2009年12月27日日曜日

OmniFocus を軽く快適に使えるようにメンテする技

GTDOmniFocus便iPhone3GOmniFocus






iPhone10
mobilemeFinder
OmniFocusOmniFocus


http://forums.omnigroup.com/showthread.php?t=14631&highlight=compact
http://forums.omnigroup.com/showpost.php?p=70253&postcount=3


OmniFocus
OmniFocus.ofocusOmniFocusMac BundleZIP
0000000000-日付.zip
ランダムな文字列-日付.zip
ランダムな文字列-日付.zip
ランダムな文字列-日付.zip
以下たくさん・・・
ZIPcontent.xmlXML
content.xmlOmniFocus
content.xmlZIP
このデータベースにはタスクが10個入ってるよ - 2009/11/10.zip
タスクBを完了したよ - 2009/11/10.zip
タスクXYZを新規作成したよ - 2009/11/10.zip
タスクDを削除したよ、あとコンテキストXXXを作成したよ - 2009/11/12.zip
ZIP



"Move Old Data to Archive"



タスクABCはArchiveしたからもう二度と表示しなくていいよ.zip





"Compact DataBase"
ZIPZIP11.5MB25KB
FAQ
iPhoneOFF"Compact DataBase"


3

2009年12月19日土曜日

Java 使いの人向け ActionScript3 のクラス仕様まとめ

JavaActionScript3FlexFlash 10



http://www.tom.sfc.keio.ac.jp/~fjedi/wiki/index.php?%A5%AF%A5%E9%A5%B9%BC%FE%A4%EA%A4%CE%BB%C5%CD%CD%28ActionScript3%29
WikiWiki



Java
JavaJavainterface


Java


(一)package.NETC++{}{}Javapublic
package {
    //以下javaと同じ
    import flash.text.TextField;
    public class Hogehoge extends TextField { /*...*/ }
}


(二)package{}package{}使
package {
    import flash.text.TextField;
    public class Hogehoge extends TextField { /*...*/ }
}
// 別途インポートが必要
import flash.text.TextField;
var abesi:TextField = new TextField();


(三)dynamic

(四)abstractabstract

(五)native, synchronized, transient

(六)namespace使

(七)enum

(八)function

(九)publicpublic

(十)使

(11)override

(12)getter/setterget, set





(一)String

(二)使
function abesi(a:String="abesi", b:String="hidebu") { /*...*/ }
abesi(); //自動的にデフォルト引数が使用されるのでこういう呼び出しが可能


(三)
//Javaでは
public void abesi(String... args) { /*...*/ }
//AS3では
public function abesi(...args) { /*...*/ }







PlaceholderTextField - wonderfl build flash online

JavaAS3textColorsetterthis.textColor = 0x999999defaultTextColorsuper.textColorsettergetter/setter使

iMovie 08 でニコニコ動画にアップロードするための動画をエンコードする設定まとめ

WindowsMac


http://d.hatena.ne.jp/KZE/20091106/p1
http://www.smilevideo.jp/static/www/help/#000562
http://nicowiki.com/encode.html



Mac OS X 10.6.2 Snow Leopard
iMovie 08
QuickTime Player X (Snow Leopard)

iMovie08使iMovie HDflviMovie 09ksk

QuickTimeQuickTimeLeopardQuickTime Player 9



1000Kbps100MB

http://d.hatena.ne.jp/KZE/20091106/p1iMovie 08flvmpeg-4 H.264


(一)QuickTime 使
Cmd+E

(二)MPEG-4
QuickTimeMPEG-4

(三)
MP4(ISMA)MP4H.264
300600Wiki

(四)使










FLV
FLVffmpegX使
iMovieFLVH.264FLV

2009年12月16日水曜日

bulkloader.py を使って Google App Engine の本番サーバーから開発サーバーにデータを移す

Google App Engine SDKtmp調bulkloader.py使

http://code.google.com/intl/en/appengine/docs/python/tools/uploadingdata.html

2010/01/31--db_filename使 



app.yamlappcfg.py update
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
app-engine-patch使app.yaml


使
bulkloader.py --dump --kind=<kind> --url=http://<appname>.appspot.com/remote_api --filename=<data-filename>
hon_hero
Model
bulkloader.py --dump --kind=hon_hero --url=http://akisutesama.appspot.com/remote_api --filename=hon_hero.dump


bulkloader.py --restore --kind=<kind> --url=http://<appname>.appspot.com/remote_api --filename=<data-filename>
--dump--restore


bulkloader.py --restore --kind=<kind> --url=http://localhost:8080/remote_api --filename=<data-filename> --app_id=<appname>

dev_appserver.py
--url
--app_idapp_id


使


log, progress, result使
bulkloader.py
bulkloader-log-20091211_145622.log
bulkloader-progress-20091211_145622.sql3
bulkloader-result-20091211_145622.sql3
使2

--log_file--db_filename--result_db_filename便
#!/bin/sh

# 前回の実行結果が残っているとエラーになる(上書きしてくれない)ので、まずいったん消す
if [ -e hon_hero.dump ]; then
rm hon_hero.dump
fi
# bulkloader.pyを実行する
# db_filenameとresult_db_filenameは一緒のファイルを指定してもかまいません。
# (その場合は、一つのsqlite3データベースに一緒に格納されます)
# db_filenameとresult_db_filenameは、db_fileやresult_db_fileのように短縮して書いても動作するみたいです
bulkloader.py --dump \
--url=http://akisutesama.appspot.com/remote_api \
--kind=hon_hero \
--filename=hon_hero.dump \
--log_file=bulkloader-log-hon_hero.log \
--db_file=bulkloader-progress-hon_hero.sql3 \
--result_db_file=bulkloader-progress-hon_hero.sql3
2bulkloader-progress-hon_hero.sql3datastore
[INFO    ] Connecting to akisutesama.appspot.com/remote_api

[INFO ] Have 2610 entities, 2610 previously transferred
[INFO ] 2610 entities (974 bytes) transferred in 0.4 seconds
1130
2使0.4

使
#!/bin/sh

# --db_fileと--result_db_fileには先ほどのダンプ時に指定したものとは別のファイルが必要になります
# (先ほどのデータベースはappspot.com用として設定されるので、localhostで使用するとエラーになってしまいます)
# --db_fileと--result_db_fileには特別な名前としてskipを指定することができます
# この名前を使用するとデータベースへの書き込み/読み込みを行いません
bulkloader.py --restore \
--url=http://localhost:8000/remote_api \
--app_id=akisutesama \
--kind=hon_hero \
--filename=hon_hero.dump \
--log_file=bulkloader-log-restore.log \
--db_file=skip \
--result_db_file=skip



appspot.comlocalhostdumprestore--app_id

Pythonappcfg.py download_data使

2009年12月13日日曜日

Highcharts.js を使ってみた

IDEA*IDEAHighcharts.js



http://www.highcharts.com/

1$80$360



http://www.highcharts.com/ref/
JS



1.0.22009/12/09

CSSstyle
CSS使
<style>#chart_area {width:800px; height:400px;}</style>
<div id="chart_area" ></div>
0style
<div id="chart_area" style="width:800px; height:400px;"></div>


Zoom使
Mac OS X 10.6Firefox3.5.6Safari4.0.4Y

seriesX
xAxisdatetimeNG
series: [{
name: 'Plague Rider',
data: [[Date.UTC(2009, 12, 4), 57.4],
[Date.UTC(2009, 12, 3), 57.6],
[Date.UTC(2009, 12, 2), 59.1]]
}]
series: [{
name: 'Plague Rider',
data: [[Date.UTC(2009, 12, 2), 59.1],
[Date.UTC(2009, 12, 3), 57.6],
[Date.UTC(2009, 12, 4), 57.4]]
}]


seriesnull0
121100122110123null1230xAxistypedatetimeyAxismin

xAxistypedatetimespline使line使
xAxistypedatetimesplineline使


BuggyJSPrototypejQuery$80


Google Charts API
Google Charts API使調Google Charts API

Highcharts.js

UI
JS
Ajax

Google Charts API


2009年12月11日金曜日

Django の Template Filter には任意の変数を使用することができる



Django
{{ some_value|floatformat:1 }}
view
{{ some_value|floatformat:floatpoint }}
{{ now "%Y %m %d" }}
{{ now date_format }}

Heroes of Newerth の統計情報を集めるサイトにグラフを付けてみた



HoN



3
Usage Percent使
Winning Percent
K/D ratioKill/DeathTuee

1011



2009年12月1日火曜日

Heroes of Newerth の統計情報を集めるサイトをつくってみた




Heroes of Newerth
http://wikiwiki.jp/hon/
βTwitter D



http://www.heroesofnewerth.com/heroes.php使

Usage %使12

11西91

span



Ophelia使



Scout使Maliken

Processingはじめました

akisute
Processing

4873113784ビジュアライジング・データ ―Processingによる情報視覚化手法
増井 俊之 (監訳)
オライリージャパン 2008-12-01

by G-Tools


Java




http://gist.github.com/246029

Processing

Google App Engine SDK の dev_appserver.py が自動的に index.yaml を更新してくれない時の対処法

Google App Engine SDKdev_appserver.pyindex.yaml調







index.yaml
indexes:

- kind: django_admin_log #手動で定義したインデックス
properties:
- name: content_type
- name: object_id
- name: action_time

# AUTOGENERATED

# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED"). If you want to manage some indexes
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.

- kind: hon_herostatistics #ここから下は、自動的にdev_appserver.pyが追加してくれるindex
properties:
- name: fetchCompleted
- name: hid
- name: datetimeCreate
direction: desc
# AUTOGENERATEDindex



index.yamldev_appserver.pyindex
indexes:

# AUTOGENERATED




調vimindex.yamlCRLF(dos)MacLF(unix)dev_appserver.pyindexvim
:set fileformat=unix

2009年11月23日月曜日

maven2を使ってScalaのHello Worldを書いてみた

@yuroyoroScala Hackathon #1ScalaHello World
使
Eclipse使
NetBeans使
IntelliJ IDEA使
Mavenmaven-scala-tools使
sbt(Simple build Tool)使
Maven2使ScalaHello World


http://dl.dropbox.com/u/261418/scala-hackathon/setup.html#maven2

http://scala-tools.org/mvnsites/maven-scala-plugin/plugin-info.html
http://scala-tools.org/mvnsites/maven-scala-plugin/usage_run.html


mvn
mvn
mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \
-DarchetypeGroupId=org.scala-tools.archetypes \
-DarchetypeArtifactId=scala-archetype-simple \
-DarchetypeVersion=1.2 \
-DremoteRepositories=http://scala-tools.org/repo-releases \
-DgroupId=scalahackathon.helloworld -DartifactId=scalahackathon.helloworld
Scala


App
ScalaAppAppJavamain
akisute scalahackathon.helloworld$ cd src/main/scala/scalahackathon/helloworld 
akisute helloworld$ vim App.scala
package scalahackathon.helloworld

/**
* Hello world!
*
*/
object App extends Application {
println("Hello World!");
val l = List(1, 2, 3, 4, 5, 6);
l.foreach(println(_));
}
Appl
icationAppmainAppmain



mvn scala:run
pom.xml
mvn scala:run -DmainClass=scalahackathon.helloworld.App
pom.xmlpom.xml
<!-- reportingの中を直す、build要素はそのままでよい -->
<reporting>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<!-- このlaunchers要素を新規に作る。idとmainClassは必須。 -->
<launchers>
<launcher>
<id>app</id>
<mainClass>scalahackathon.helloworld.App</mainClass>
<!-- 以下、任意要素。 args と jvmArgs を指定できます。 -->
<!--
<args>
<arg>arg1</arg>
</args>
<jvmArgs>
<jvmArg>-Xmx128m</jvmArg>
<jvmArg>-Djava.library.path=...</jvmArg>
</jvmArgs>
-->
</launcher>
</launchers>
</configuration>
</plugin>
</plugins>
</reporting>
mvn scala:run
jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'scala'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - scalahackathon.helloworld:scalahackathon.helloworld:jar:1.0-SNAPSHOT
[INFO] task-segment: [scala:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing scala:run
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [scala:compile {execution: default}]
[INFO] Checking for multiple versions of scala
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [scala:testCompile {execution: default}]
[INFO] Checking for multiple versions of scala
[INFO] Nothing to compile - all classes are up to date
[INFO] [scala:run]
[INFO] Checking for multiple versions of scala
[INFO] launcher 'app' selected => scalahackathon.helloworld.App
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
Hello World!
1
2
3
4
5
6
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Mon Nov 23 20:59:51 JST 2009
[INFO] Final Memory: 18M/79M
[INFO] ------------------------------------------------------------------------

Mac OS Xには最初から/usr/share以下にmaven2やantが付いてくる

Scala Hackathon #1Mac OS XJava
akisute ~$ mvn --version
Maven version: 2.0.9
Java version: 1.6.0_15
OS name: "mac os x" version: "10.6.2" arch: "x86_64" Family: "mac"
akisute ~$ ant -version
Apache Ant version 1.7.0 compiled on July 20 2009
akisute ~$ which mvn
/usr/bin/mvn
akisute ~$ which ant
/usr/bin/ant
maven2
使/usr/share
akisute ~$ cd /usr/share
akisute share$ ls
NotificationServer/ distcc_compilers info/ sandbox/
Ssh.bin doc/ java/ screen/
TargetConfigs/ emacs/ junit/ sdef/
aclocal/ enscript/ langid/ servermgrd/
aclocal-1.10/ examples/ libiodbc/ skel/
ant/ file/ libtool/ snmp/
apr-1/ ftpd/ locale/ statsCollector/
autoconf/ gdb/ man/ swig/
automake-1.10/ germantok/ maven@ tabset/
bakefile/ gprof.callg mecab/ tcsh/
bison/ gprof.flat misc/ terminfo/
caldavd/ groff/ mk/ texi2html/
calendar/ gtk-doc/ openmpi/ texinfo/
cracklib/ gutenprint/ openmpi-default-hostfile uucp/
cups/ heapdiff/ openmpi-mca-params.conf vim/
cvs/ hiutil/ openmpi-totalview.tcl xcode-select/
derby/ httpd/ podcastproducer/ zoneinfo/
dict/ icu/ ri@ zsh/
de
rbyTomcatJettyWeb

 

2009年11月8日日曜日

表示専用のカレンダーJSが欲しい

日付を選択するためのカレンダーJSはよく見るのですが、表示に特化したものは余り見ないので。たとえばこんな感じでjQueryのプラグインみたいに使えるカレンダーが欲しいのです。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Calendar object test</title>
<script type="text/javascript" src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script type="text/javascript" >
$(function(){
// add a new text and set its style
$("calendar")
.from(2009, 10, 30)
.to(2009, 10, 31)
.text("Halloween")
.color("#ffcccc")
.style("bold")
.backgroundcolor("#ffddcc");
});

// calendar event handling
// use customized Event object which has "day" and "from, to" attr
$("calendar").click(function(e){
day = e.day
this.day(day).text("clicked")
});
$("calendar").select(function(e){
from = e.from
to = e.to
this.from(from).to(to).text("selected")
});
</script>
</head>
<body>
<div id="calendar">Calendar will be shown here</div>
</body>
</html>
どうでしょ?探せばあると思うのですが・・・

2009年11月1日日曜日

PDFをiPhoneから生成するサンプルプロジェクトを公開いたしました




githubXcodePDF
http://github.com/akisute/iPhonePDF

libHaruZLIB/LIBPNG License


2009年10月31日土曜日

libHaru on iPhone: Objective-Cでエラーハンドリング





libHaru
http://libharu.org/wiki/Documentation/Error_handlingPDF
// まずはヘッダファイルの中で
// ユーザーデータ用の構造体の宣言と、エラーハンドラ関数のプロトタイプ宣言をしておく

typedef struct _PDFService_userData {
HPDF_Doc pdf;
PDFService *service;
NSString *filePath;
} PDFService_userData;

// エラーハンドラ関数のシグネチャは常にこうでなければならない
// 関数名は自由に決めて良いが、引数と返り値は決められている
void PDFService_errorHandler(HPDF_STATUS error_no,
HPDF_STATUS detail_no,
void *user_data);
// 注意点として、エラーハンドラ関数はHPDF_Newより前の行で実装しておかなければならない
// (プロトタイプ宣言しておいてもだめみたいです)
void PDFService_errorHandler(HPDF_STATUS error_no,
HPDF_STATUS detail_no,
void *user_data) {
// ユーザーデータを取得する
// C言語の構造体からでもObjective-Cのクラスが取り出せますよ
PDFService_userData *userData = (PDFService_userData *)user_data;
HPDF_Doc pdf = userData->pdf;
PDFService *service = userData->service;
NSString *filePath = userData->filePath;

// エラーハンドリング後、PDF関連の処理を続行したい場合は
// このHPDF_ResetError関数を呼び出す必要がある。
// これを呼び出さないと後続の処理がうまくいかない。
HPDF_ResetError(pdf);

// 逆にエラーハンドリング後、PDF関連の処理をすべて中断したい場合には
// HPDF_Free関数を使ってpdfオブジェクトを解放するとよい。こうすると、以後の
// HPDF関連の関数はすべて何もしないで終了してくれる。ただし、同じpdfオブジェクトを
// 2回HPDF_Freeしてしまうとエラーになるため、HPDF_HasDocを使って制御すること
HPDF_Free(pdf);
}

// あとはPDFドキュメント生成時に関数とユーザーデータを引数として渡す
int main(int argc, char** args) {
PDFService_userData userData;
HPDF_Doc pdf = HPDF_New(PDFService_defaultErrorHandler, &userData);
userData.pdf = pdf;
userData.filePath = @"/var/tmp/hogehoge.pdf";
// 以下省略
}


CObjective-C
CObjective-CCocoa Touchdelegate便PDFObjective-CPDFServicePDFServiceDelegatelibHaru
void PDFService_defaultErrorHandler(HPDF_STATUS   error_no,
HPDF_STATUS detail_no,
void *user_data)
{
// ユーザーデータを展開
PDFService_userData *userData = (PDFService_userData *)user_data;
HPDF_Doc pdf = userData->pdf;
PDFService *service = userData->service;
NSString *filePath = userData->filePath;

// 以後のPDF作成処理をすべてストップする
HPDF_Free(pdf);

// Delegate呼び出し
if (service.delegate) {
[service.delegate service:service
didFailedCreatingPDFFile:filePath
errorNo:error_no
detailNo:detail_no];
}
}
DelegateViewControl
ler
#pragma mark -
#pragma mark delegate method
- (void)service:(PDFService *)service
didFailedCreatingPDFFile:(NSString *)filePath
errorNo:(HPDF_STATUS)errorNo
detailNo:(HPDF_STATUS)detailNo
{
NSString *message = [NSString stringWithFormat:@"Couldn't create a PDF file at %@\n errorNo:0x%04x detalNo:0x%04x",
filePath,
errorNo,
detailNo];
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"PDF creation error"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[alert show];
}

2009年10月24日土曜日

libHaruを使ってiPhoneアプリからPDFを作成する

iPhonePDF調


PDF
PDF調

jspdfhttp://code.google.com/p/jspdf/PDFhttp://www.adobe.com/devnet/pdf/Adobe31MB, 500
Adobe PDF Libraryhttp://www.adobe.com/devnet/pdf/library/ http://www.est.co.jp/pdfl/index.html

libHaruhttp://libharu.org/wiki/Main_Page
PDFCiPhone
libHaru使


libHaruXcode
1libHaruXcode
http://libharu.org/wiki/DownloadsMac使. configuremakemake installiPhone
includesrcCXcode


2libpngXcode
libHaruPDFlibpnglibpnglibpnghttp://www.libpng.org/pub/png/libpng.htmlXcodelibpng使iPhone
cocos2d for iPhone0.8.1http://code.google.com/p/cocos2d-iphone/source/browse/#svn/trunklibpng使cocos2d for iPhoneXcodeSupport/external/libpng


3libHaruconfigure
. configure. configureMacConfigureiPhoneconfigureincludehpdf_config.h.in
/* include/hpdf_config.h.in.  Generated from configure.in by autoheader.  */

/* Define to 1 if you have the header file. */
#undef HAVE_DLFCN_H
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the `png' library (-lpng). */
#undef HAVE_LIBPNG
#define HAVE_LIBPNG 1

/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
#define HAVE_LIBZ 1

/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_STDINT_H
#define HAVE_STDINT_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_STDLIB_H
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_STRINGS_H
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_STRING_H
#define HAVE_STRING_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_SYS_STAT_H
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_SYS_TYPES_H
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the header file. */
#undef HAVE_UNISTD_H
#define HAVE_UNISTD_H 1

/* debug build */
#undef HPDF_DEBUG
#ifdef DEBUG
#define HPDF_DEBUG 1
#endif

/* debug trace enabled */
#undef HPDF_DEBUG_TRACE
#ifdef DEBUG
#define HPDF_DEBUG_TRACE 1
#endif

/* libpng is not available */
#undef HPDF_NOPNGLIB

/* zlib is not available */
#undef HPDF_NOZLIB

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
#define STDC_HEADERS 1

/* Define to `unsigned int' if does not define. */
/* #undef size_t */
hpdf_config.h


4Xcode
libharu.alibpng.a使便


libpnglibpng2cocos2d for iPhoneXcodelibpngzlib.dylibzlib.dylibiPhone SDK


libHaru


libharu.aiPhone


5

Cmd+B





Hello, libHaru!
PDF
// TEST CODE: testing libharu
NSString *path = nil;
const char *pathCString = NULL;
NSLog(@"[libharu] PDF Creation START");
HPDF_Doc pdf = HPDF_New(NULL, NULL);
NSLog(@"[libharu] Adding page 1");
HPDF_Page page1 = HPDF_AddPage(pdf);
NSLog(@"[libharu] SetSize page 1");
HPDF_Page_SetSize(page1, HPDF_PAGE_SIZE_A4, HPDF_PAGE_LANDSCAPE);
NSLog(@"[libharu] TextOut page 1");
HPDF_Page_BeginText(page1);
HPDF_UseJPFonts (pdf);
HPDF_UseJPEncodings (pdf);
HPDF_Font fontEn = HPDF_GetFont(pdf, "Helvetica", "StandardEncoding");
HPDF_Font fontJp = HPDF_GetFont(pdf, "MS-Mincyo", "90ms-RKSJ-H");
HPDF_Page_SetFontAndSize(page1, fontEn, 16.0);
HPDF_Page_TextOut(page1, 100.00, 100.00, "Hello libHaru!");
HPDF_Page_SetFontAndSize(page1, fontJp, 16.0);
HPDF_Page_TextOut(page1, 100.00, 60.00, [@"はろー日本語" cStringUsingEncoding:NSShiftJISStringEncoding]);
HPDF_Page_EndText(page1);
NSLog(@"[libharu] Path drawing page 1");
HPDF_Page_SetLineWidth(page1, 4.0);
HPDF_Page_SetRGBStroke(page1, 1.0, 0, 0);
HPDF_Page_Rectangle(page1, 200, 200, 40, 150);
HPDF_Page_Stroke(page1);
NSLog(@"[libharu] PNG image drawing page 1");
path = [[NSBundle mainBundle] pathForResource:@"portrait2"
ofType:@"png"];
pathCString = [path cStringUsingEncoding:NSASCIIStringEncoding];
NSLog(@"[libharu] LoadPngImageFromFile path:%@\n pathCString:%s", path, pathCString);
HPDF_Image image = HPDF_LoadPngImageFromFile(pdf, pathCString);
HPDF_Page_DrawImage(page1, image, 300, 50, 245, 319);

// Get documents directory
NSArray *arrayPaths =
NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory,
NSUserDomainMask,
YES);
path = [arrayPaths objectAtIndex:0];
path = [path stringByAppendingPathComponent:@"test.pdf"];
pathCString = [path cStringUsingEncoding:1];
NSLog(@"[libharu] SaveToFile path:%@\n pathCString:%s", path, pathCString);
HPDF_SaveToFile(pdf, pathCString);
NSLog(@"[libharu] Freeing PDF object ");
HPDF_Free(pdf);
NSLog(@"[libharu] PDF Creation END");

Documenttest.pdf



PDFUIWebView


Hooray!!



UIViewPDF

2009年10月23日金曜日

iPhone向けに最適化されたPNGをlibpngで扱う方法


iPhonePNGlibpngiPhonePNGlibpng


1

http://d.hatena.ne.jp/wasabi-arts/20090301/1235856525

IPHONE_OPTIMIZE_OPTIONS=-skip-PNGs




2UIImagePNG
UIImage使png
@nakamura001

[2009/10/24 22:20]
@nakamura001
http://d.hatena.ne.jp/nakamura001/20091024/1256371800

UIButtonPNGUIButtonPNG使PNG

2009年10月17日土曜日

PythonのEvernote APIをProxyに対応させることに成功しました

ThriftTHttpClientPythonProxy


PythonEvernote APIProxy
Evernote API使thrift.transport.THttpClient
THttpClient.py

http://gist.github.com/204501

API
# これを・・・
# import thrift.transport.THttpClient as THttpClient
# こうする
import thrift.transport.MyTHttpClient as THttpClient
import evernote.edam.userstore.UserStore as UserStore
import evernote.edam.userstore.constants as UserStoreConstants
import evernote.edam.notestore.NoteStore as NoteStore
import evernote.edam.type.ttypes as Types

##########
# 中略
##########

# プロキシを使わなくて良いときはproxy引数を無視すればよい
# userStoreHttpClient = THttpClient.THttpClient(userStoreUri)
# プロキシを使いたいときはこうする
userStoreHttpClient = THttpClient.THttpClient(userStoreUri, proxy="myproxy.example.com:8080")
userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient)
userStore = UserStore.Client(userStoreProtocol)

versionOK = userStore.checkVersion(applicationClientNameString,
                                   UserStoreConstants.EDAM_VERSION_MAJOR,
                                   UserStoreConstants.EDAM_VERSION_MINOR)




ThriftTHttpClient使使C#http://issues.apache.org/jira/secure/attachment/12391517/THttpClient.cs使connection.Proxy = null;

THttpClient使



httplib.HTTP使httplib.HTTPConnection使httplib.HTTPhttplib.HTTPConnection使orz
self.__http = httplib.HTTP(self.host, self.port)
self.__http._conn #これでhttplib.HTTPConnectionが取得できる
read()
closehttplib.HTTPClose
THttpClienthttplib.HTTP使

httplib.HTTPResponse
response = conn.getresponse()
response.fp # これがファイルポインタ。httplib.HTTP.read()でも使われている
httplib

2009年10月11日日曜日

UIViewControllerのtouchesBeganとかtouchesEndedが上手く機能しなかったと思ったら・・・

UIKit使iPhone
@implementation AbesiViewController

- (void)viewDidLoad
{
[super viewDidLoad];
self.wantsFullScreenLayout = YES;
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}

- (void)dealloc
{
[super dealloc];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// なぜか出力されない
NSLog(@"touchesBegan");
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
// なぜか出力されない
NSLog(@"touchesMoved");
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
// なぜか出力されない
NSLog(@"touchesEnded");
}

@end
UIViewCon
troller

Interface BuilderInteraction EnabledViewControllerView調

UIViewControllerUIViewtouchesBeganOS 3.1.2

http://stackoverflow.com/questions/1025574/uiviewcontroller-not-receiving-touchesbegan-message
OK, I'm a dummy. It works fine. The problem was, I didn't realize I was sending a release message to the UIViewController without having retained it elsewhere first. So that was causing the problem.
UIViewControllerretainorz

retain

2009年10月8日木曜日

PythonのEvernote APIをプロキシに対応させようとして挫折した

Evernote API使ThriftTHttpClientEvernote API
調

ThriftTHttpClientPython

http://gist.github.com/204501

httplib.HTTPhttplib.HTTPConnection/edam/user/CheckVersion500500

send: 'POST /edam/user HTTP/1.1\r\nHost: sandbox.evernote.com:443\r\nAccept-Encoding: identity\r\nHost: sandbox.evernote.com\r\nContent-Type: application/x-thrift\r\nContent-Length: 82\r\n\r\n'
send: '\x80\x01\x00\x01\x00\x00\x00\x0ccheckVersion\x00\x00\x00\x00\x0b\x00\x01\x00\x00\x00(Python URL to Evernote/0.1; Python/2.5.2\x06\x00\x02\x00\x01\x06\x00\x03\x00\r\x00'
debug: HTTPConnection
Request-sent None
reply: 'HTTP/1.1 200 OK\r\n'
header: Server: Apache-Coyote/1.1
header: Content-Type: application/x-thrift
header: Content-Length: 29
header: Date: Wed, 07 Oct 2009 09:04:29 GMT
read start
read POST request
send: 'POST /edam/user HTTP/1.1\r\nHost: sandbox.evernote.com:443\r\nAccept-Encoding: identity\r\n\r\n'
read getresponse
debug: HTTPConnection
Request-sent None
reply: 'HTTP/1.1 500 \r\n'
header: Server: Apache-Coyote/1.1
header: ETag: W/"3401-1254794526000"
header: Last-Modified: Tue, 06 Oct 2009 02:02:06 GMT
header: Content-Type: text/html
header: Content-Length: 3401
header: Date: Wed, 07 Oct 2009 09:04:29 GMT
header: Connection: close
read start
read POST request
HTTPS
12調



2readHTTP

2009年10月5日月曜日

Evernote APIためしてみた

API KeyEvernote API





http://www.evernote.com/about/contact/support/?application=EvernoteAPI&summary=API+Key+Request#inquiryAPI

http://www.evernote.com/about/developer/api/SDK

http://blog.lilyx.net/2008/11/03/evernote-api/1


Hello World
sandboxhttp://sandbox.evernote.com/login.jsp
SDKPython
cd sample/python
cp * ../../lib/python
cd ../../lib/python
python EDAMTest.py username password


ENML
URLEvernoteHTML調EvernoteENMLHTML
http://www.evernote.com/about/developer/api/evernote-api.htm#_Toc200272588
htmlbodyidclass
p

br

XMLHTML
HTMLENML

ENML

2009年10月4日日曜日

cocos2dでParticleSystemを使うときのメモ

cocos2dParticleSystem


ParticleSystemParticle
http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_particle_system.html
2009/10/02startSpin, startSpinVar, endSpin, endSpinVar調Particle
        // angle of particles
startSpin = 90;
startSpinVar = 0;
endSpin = 1800;
endSpinVar = 3600;
PointParticleSystemP
articleSystemspinQuadParticleSystem

ParticleSystemParticle



Particle
endSizekParticleStartSizeEqualToEndSizeParticle
        // size, in pixels
startSize = 90.0f;
startSizeVar = 30.0f;
endSize = kParticleStartSizeEqualToEndSize;
endSizeVar = 30.0f;


Particle
cocos2dParticleSystem.m180
 // angle
float startA = startSpin + startSpinVar * CCRANDOM_MINUS1_1();
particle->angle = startA;
if (endSpin == kParticleStartSpinEqualToEndSpin )
particle->deltaAngle = 0;
else {
float endA = endSpin + endSpinVar * CCRANDOM_MINUS1_1();
particle->deltaAngle = (endA - startA) / particle->life;
}
Part
icle使
 // angle
float startA = startSpin + startSpinVar * CCRANDOM_MINUS1_1();
particle->angle = startA;
if (spinFixed)
particle->deltaAngle = 0;
else {
float endA = endSpin + endSpinVar * CCRANDOM_MINUS1_1();
particle->deltaAngle = (endA - startA) / particle->life;
}

各種WebサービスのAPI認証方法を調べてみた

Web APIWeb API調


Google

http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI




IDCookie

API

HTTPS POST

URL

https://www.google.com/accounts/ClientLogin

API

HTTP GET/POST, HTTPS GET/POST



HTTPCookieSID
Cookie使WebWebURLSIDHTTPCookieSID


Remember the Milk(RTM)

http://www.rememberthemilk.com/services/api/authentication.rtm
http://www.rememberthemilk.com/services/api/methods/rtm.auth.getFrob.rtm




API使3ID

API

HTTP GET

URL1使

http://api.rememberthemilk.com/services/rest/?method=rtm.auth.getFrob&api_key=abc123

URL2

http://www.rememberthemilk.com/services/auth/?api_key=abc123&perms=delete&frob=123456&api_sig=zxy987

URL2ID

http://api.rememberthemilk.com/services/rest/?method=rtm.auth.getToken&api_key=abc123&frob=123456


API

HTTP GET



HTTPauth_token
WebGoogleAPIHTTPS POSTHTTP GETREST


1API2
api_key
shared secret

2api_key使
frob使
frobhttp://en.wikipedia.org/wiki/Frob

3shared secretURLapi_sig
URL3
api_key=abc123&perms=delete&frob=123456

api_keyabc123permsdeletefrob123456

shared secret
BANANASapi_keyabc123permsdeletefrob123456

md5 hashapi_sig
md5('BANANASapi_keyabc123permsdeletefrob123456')

4api_key, frob, api_sigID
URL2ID

5ID
auth_tokenIDauth_tokenHTTP


Evernote

http://www.evernote.com/about/developer/api/evernote-api.htm#_Toc200272584




consumerKey, consumerSecretID

API

Thrift TBinaryProtocol wrapping a THttpClient transport

URL

https://www.evernote.com/edam/user

API

Thrift



UserStore Authentication Token
Thrift使ThriftC, Java, PHP, Python, Perl, RubyAPI KeyRTM
WebOAuth使OAuth調


Twitter

http://usy.jp/twitter/index.php?Twitter%20API
http://twitter.pbworks.com/API%20Docs#Authorization
http://watcher.moe-nifty.com/memo/2007/04/twitter_api.html


1

IDBasic

API



URL



API

HTTP GET



http://username:password@twitter.com/ID


2

IDCookie

API

HTTP POSTHTTPS

URL

http://twitter.com/login

API

HTTP GET



HTTPCookie_twitter_session


3

OAuth

http://watcher.moe-nifty.com/memo/2007/04/twitter_api.html

public_timeline  API  API 使 protected  API 
OAuthBASIC使

 OAuth OAuth 
BASIC使

Web Twitter  cookie 使 BASIC  cookie 使 API 
(: API  cookie 使 BASIC BASIC API  cookie  API  API protected 
OAuth  API  cookie  API  cookie )

2009年9月25日金曜日

スティーブ・ジョブズが目の前なう



2009/09/25: 
2009/09/28: 


1
23


Google
CaltrainGoogleApple

Caltrain2姿

San AntonioVTA40Google


Google
Palo Alto

VisitorClosed Campus退

"There are no public visitor center or a shop"Google

"public"Google


Apple
CaltrainSunnyvale

VTA55AppleGoogle

GoogleInfinity Loop6 Infinity LoopMac Pro

Infinity Loop6, 5, 4, 3, ....1 Infinity Loop, 









http://twitter.com/akisutesama/status/4354424273
http://twitter.com/akisutesama/status/4354453168
http://twitter.com/akisutesama/status/4354498099



3

"then it might have been""He usually doesn't answer because he's so busy"





Sunnyvalesushi寿4

Palo AltoMacBookAdobe AirFlashMac19

2009年9月24日木曜日

アルカトラズなう

123


2
Whole Food MarketWalgreens

退

MUNI





Apple StoreWifiFallout 3Power SuitDSWii

Walgreens$1.69



Pier39

Pier33










使

21918

Whole Food Market


3
9

14100


1030

Whole Food Market




GoogleAppleStanford

2009年9月22日火曜日

サンフランシスコなう


910

10

TOEIC
SUBWAY
2324Google

2009年9月13日日曜日

iMacもSnow Leopardにしてみた


MacBook AiriMacSnow Leopard




USB Overdrive

Shades
Snow Leopard
ShadesOK
MenuMeters



iMac


2.2Apple

Macintosh USB Overdrive
ExposeSpaces
SpacesSpacesSpaceSpaceSpacesSpaceExpose

2009年9月8日火曜日

Mac OS X 10.6 Snow Leopardのeasy_installでPILをビルドするときに気をつけることなど

Snow LeopardPIL(Python Imaging Library)


調

Snow LeopardPython使Python 2.6.1使
Snow LeopardPython 2.5.4使
Snow LeopardPython 2.5.4distutilUnixCCompilerC64bitSnow Leopard
C使PILSnow LeopardPython 2.5.4使
2.5.4使ARCHFLAGS "-arch x86_64"PIL
MacPortMacPython

 200998MacPortPythonMacPythonSnow LeopardPython 2.5.4



LeopardGoogle App Engine SDKSnow LeopardPIL/Library/Python/Python2.5/site-packages/Python使Python 2.5http://www.pythonware.com/products/pil/1.1.6
sudo python setup.py install
python selftest.py
ImagingMathPILPythonimport
akisute PIL$ python2.5
Python 2.5.4 (r254:67916, Jul 7 2009, 23:51:24)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Imaging
>>> # 問題なくインポートできました
>>> import _imaging
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen(./_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
Referenced from: /Library/Python/2.5/site-packages/PIL/_imaging.so
Expected in: flat namespace
in /Library/Python/2.5/site-packages/PIL/_imaging.so
>>>
_imaging.so
@tokibitosoCPythonpython.hPythonCimportPython

PIL_jpeg_resync_to_restart使libjpegMacPort

PIL調warning調
gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc build/temp.macosx-10.6-i386-2.5/_imaging.o build/
temp.macosx-10.6-i386-2.5/decode.o build/temp.macosx-10.6-i386-2.5/encode.o build/temp.macosx-10.6-i386-2.5/map.o build/
----
中略
----
-L/o
pt/local/lib -L/System/Library/Frameworks/Python.framework/Versions/2.5/lib -L/usr/lib -ljpeg -lz -o build/lib.macosx-10
.6-i386-2.5/_imaging.so
-arch i386 -arch ppcSnow Leopard64bit-arch x86_64

Python 2.6.1_imaging.so
akisute PIL$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import _imaging
Traceback (most recent call last):
File "", line 1, in
ImportError: ./_imaging.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)
>>>
64bit調


distutil
python setup.py installgccsetup.pydistutils.command.build_extimport使Python2.5

475         objects = self.compiler.compile(sources,
476 output_dir=self.build_temp,
477 macros=macros,
478 include_dirs=ext.include_dirs,
479 debug=self.debug,
480 extra_postargs=extra_args,
481 depends=ext.depends)
self.
compiler.compileunixccompiler.py-archi386ppc
def _darwin_compiler_fixup(compiler_so, cc_args):
"""
This function will strip '-isysroot PATH' and '-arch ARCH' from the
compile flags if the user has specified one them in extra_compile_flags.

This is needed because '-arch ARCH' adds another architecture to the
build, without a way to remove an architecture. Furthermore GCC will
barf if multiple '-isysroot' arguments are present.
"""
----
中略
----
if stripArch or 'ARCHFLAGS' in os.environ:
while 1:
try:
index = compiler_so.index('-arch')
# Strip this argument and the next one:
del compiler_so[index:index+2]
except ValueError:
break

if 'ARCHFLAGS' in os.environ and not stripArch:
# User specified different -arch flags in the environ,
# see also distutils.sysconfig
compiler_so = compiler_so + os.environ['ARCHFLAGS'].split()
----
後略
----
ARCHFLAGS"-arch x86_64"64bit



調

Python 2.6

Python2.6PIL

-arch x86_64

python selftest.py

Google App Engine SDKPIL







Google App Engine10

2009年9月3日木曜日

.tmux.confをいじってtmuxのエスケープキー(prefix)を変える

~/.tmux.conftmuxscreen~/.screenrc
screenescape
set-option -g prefix C-t
unbind-key C-b
bind-key C-t send-prefix
C-Control
.screenrc
escape ^Tt
OK


http://ktjx.blogspot.com/2009/08/tmux.html



.tmux.conf
set-option -g prefix t
T
prefixexitquittmuxControl-CMacTerminal.apptmuxTerminaltmuxTerminaltmuxtmux

tmuxkilltmux

Python 2.5系列では__repr__()でunicodeを返すといろいろトラブルが起きる

Djangoapp engine patchmanage.py shellUnicodeEncodeError
>>> from game.models import *
>>> hts = HeroTemplate.all()
>>> ht = hts.fetch(1)[0]
>>> ht.template_name #問題なし
>>> ht.name          #問題なし
>>> hero = Hero(
... name=ht.name,
... symbol=ht.symbol,
... max_life=ht.max_life,
... life=ht.max_life,
... max_move=ht.max_move,
... move=ht.max_move,
... weapon=None,
... item=None,
... )
>>> hero             #ここでUnicodeEncodeError
>>> ht.createHero()  #上記と同じ処理をやるメソッド、これもUnicodeEncodeError
調Python 2.5_
_repr__()unicode

http://d.hatena.ne.jp/alisue/20090402/1238690818


>>> class Abesi:
...   def __repr__(self):
...     return u'¥u3059¥u305a¥u304d¥u3044¥u3061¥u308d¥u30fc'
... 
>>> abesi = Abesi()
>>> abesi #UnicodeEncodeError
abesi
WindowsXPCygwin 1.7 + Python 2.5.4shift_jis使utf-8__repr__()unicode



__str__()__repr__()str

__unicode__()unicode

Python 2.5Python 3.0unicodePython 3.0



Djangodjango.db.models.Model__repr__()__repr__()使

2009年9月1日火曜日

多少マシになったかな








Way

STG

github
http://github.com/akisute/MyShooting/tree/338e164b4716ec27a6a9b8d384f7714243f53d2e


http://github.com/akisute/MyShooting/tree/master



cocos2d20022

ActionActionActionvx, vy使

2009年8月29日土曜日

どのクラスのインスタンスを作っているかに注意しましょう・・・


http://github.com/akisute/MyShooting/blob/4570825e7384157d3572b689cc23f9bb3acc0b82/Classes/MSTGObjectFactory.m







+ (MSTGObject *)cannon
{
// ここが間違い。MSTGObjectではなくてMSTGCannonのインスタンスを生成する必要がある
MSTGObject *object = [MSTGObject spriteWithFile:@"cannon.png"];
return object;
}
MSTGObject
退Java