This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright Kazuo KASHIMA 2011 | |
* k4200 [at] kazu [dot] tv | |
* Licensed under the same license as Lift framework (Apache 2.0) | |
*/ | |
package code.model | |
import net.liftweb._ | |
import mapper._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* コンパイル通りません。 | |
* | |
* やりたい事: | |
* 1. ProtoUserクラスを継承した任意のクラス(仮にUser)と、モデルクラス(Foo)の2つが存在。 | |
* 2. Fooには、どのユーザーがレコードを作成したかを表すフィールドがあり、Userテーブルへの外部キーとなっている。 | |
* 3. レコードの所有者のみがCRUDの機能を使えるよう。 | |
* 4. 2, 3の機能はtraitにして、Foo以外のクラスでも同様の機能を使えるようにしたい。 | |
* | |
* Liftのソースをにらめっこしながら頑張ったんだけど・・・ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright Kazuo KASHIMA 2011 | |
* k4200 [at] kazu [dot] tv | |
* Licensed under the same license as Lift framework (Apache 2.0) | |
*/ | |
// Some methods used here are private[mapper], so I need to put these traits | |
// under net.liftweb.mapper. | |
package net.liftweb { | |
package mapper { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):002:0> "1234567890".crypt("AA") | |
=> "AAOytELTtvgVU" | |
irb(main):003:0> "1234567809".crypt("AA") | |
=> "AAOytELTtvgVU" | |
irb(main):004:0> "1234567809".crypt("$1$AA") | |
=> "$1$AA$FGGqw9MVpWh4jOox/NNHk0" | |
irb(main):005:0> "1234567890".crypt("$1$AA") | |
=> "$1$AA$GpKPiWMTtFX2jcBN5zP7v1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There's a class called MappedPassword in Lift. I wanted to create a class that | |
// holds the plain text when a password is set. | |
//------------------------------- | |
// This works, but I didn't like the idea for two reasons. | |
// 1. The class name is long. | |
// 2. Seems kinda ugly to me. | |
abstract class MappedPasswordWithPlainWhenSet[A<:Mapper[A]](override val fieldOwner: A) | |
extends MappedPassword[A](fieldOwner) { | |
var plain: String = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form name="aa" action="foo.php" method="POST"> | |
<input type='text' name='important_info' /> | |
<input type='hidden' name='token' value='<?php echo session_id(); ?>' /> | |
<input type='submit' name='submit' value='send it' /> | |
</form> | |
----- | |
<!-- 次のページ foo.php --> | |
<?php | |
session_start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<script src="jquery-1.6.1.js"></script> | |
<script type="text/javascript"> | |
function test() { | |
//FF4で確認。他のブラウザも要チェック | |
console.log($("#div1")); | |
console.log($("#div1").prop("val")); //NG | |
console.log($("#div1").attr("val")); //OK | |
console.log($("#div1")[0].getAttribute("val")); //OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://akka.io/docs/akka/1.1.2/scala/futures.html | |
// にあるサンプルコードの説明をコメントとして記入しました。 | |
// 間違い等があれば指摘してもらえればと思います。 | |
// 以下の2行はnon-blockingな処理 | |
val f1 = actor1 !!! msg1 // actor1 に msg1 を投げ、Futureを得る | |
val f2 = actor2 !!! msg2 // actor2 に msg2 を投げ、Futureを得る | |
// この時点では actor1, actor2 の処理は終わっていない |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# This is my first python script. Whoo hoo! | |
# I needed to create a csv, each line of which consists of | |
# key, Japanese text, and English text, out of Java language | |
# resource files. | |
import sys | |
import glob | |
import re | |
import csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is distributed under the same license as that of Lift. | |
// | |
package com.example { | |
package lib { | |
import net.liftweb._ | |
import common._; | |
import http._; | |
import mapper._ | |
import sitemap._; |
OlderNewer