This file contains hidden or 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
import java.awt.*; | |
import javax.swing.*; | |
import wiiremotej.*; | |
import wiiremotej.event.*; | |
/** | |
* WiiRemoteJ Nunchuk Excample. | |
* this source base WiiRemoteJExample(WRLmpl.java) | |
*/ |
This file contains hidden or 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
package components { | |
import flash.utils.describeType; | |
import flash.utils.getDefinitionByName; | |
import mx.core.IFactory; | |
import mx.core.UIComponent; | |
import mx.events.FlexEvent; | |
import mx.utils.ObjectUtil; | |
public class CloneFactory implements IFactory{ |
This file contains hidden or 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
var document = FireGestures.sourceNode.ownerDocument; | |
var window = document.defaultView; | |
var x,a,u,q,qq,qg,g='',w=window,d=document,l=d.location,e=encodeURIComponent; | |
var h=l.href,hs=h.split('?'),i,b,o=new Image,m=d.images; | |
if(/[^\w\-\.\!\~\*\'\(\)\;\/\?\:\@\&\=\+\$\,\%\#]/.test(hs[0])){ | |
h=encodeURI(hs[0])+(hs[1]?hs[1]:''); | |
} | |
b=h.match(/(.*)\/.*$/)[1]; | |
if(m){ |
This file contains hidden or 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
package cn.orz.pascal.persistance | |
import com.db4o.{Db4o, ObjectContainer} | |
import com.db4o.query.Predicate | |
import scala.collection.jcl.Conversions.convertList | |
object Db4oDao { | |
implicit def toPredicate[E](predicate:(E) => Boolean) = new Predicate[E](){ def `match`(x:E) = predicate(x) } | |
This file contains hidden or 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
import scala.util.parsing.json._ | |
object JsonSample { | |
def main(args : Array[String]) { | |
//デフォルトは数字は浮動小数 | |
JSON.parse("""[{"test": "hello"},{"test2": {"hoge":3}}]""") match{ | |
case Some(json) => println(json) | |
} | |
//perThreadNumberParserでここから数字をBigDesimalに変換するように明示 | |
JSON.perThreadNumberParser = {input : String => BigDecimal(input)} |
This file contains hidden or 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
import java.io._ | |
import java.net._ | |
import scala.io._ | |
import scala.xml._ | |
object Shell { | |
val sjis = "Shift_JIS" | |
val utf8 = "UTF8" | |
val jis = "jis" |
This file contains hidden or 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
object NQueen { | |
def nq1(n:Int) = { | |
def _nq(n:Int, x:Int, xs:Set[Int], ys:Set[Int], us:Set[Int], ls:Set[Int]):Int = { | |
def collision(x:Int, y:Int) = xs(x) || ys(y) || us(y + x) || ls(y - x) | |
if (n == x) 1 | |
else { | |
var cnt = 0 | |
for(y <- 0 to n - 1) { | |
if ( !collision(x, y) ) { | |
cnt += _nq(n, x+1, xs + x, ys + y, us + (y + x), ls + (y - x)) |
This file contains hidden or 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
REM ***** BASIC ***** | |
Sub delete_prev_char | |
rem ---------------------------------------------------------------------- | |
rem define variables | |
dim document as object | |
dim dispatcher as object | |
rem ---------------------------------------------------------------------- | |
rem get access to the document | |
document = ThisComponent.CurrentController.Frame |
This file contains hidden or 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
Expr ::= Expr + Term | Expr - Term | Term | |
Term ::= Term * Fact | Term / Fact | Term % Fact| Fact | |
Fact ::= ( Expr ) | number | +number | -number| |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
int fib(int n){ | |
// if (n > 100 ) return 1; | |
return | |
(n == 0) ? 0 | |
:(n == 1) ? 1 | |
: fib(n-1) + fib(n-2); | |
} |