船のサイズ
2007年11月28日(水) 05:11
船のサイズ表記とどこからどこまでなのかの図解
Visit SITE: https://wrc.navair-rdte.navy.mil/warfighter_enc/SHIPS/shipeng/stabilty/trimdrft/trimdrft.htm
Do You PHP? - PHP+Oracle Instant Clientのインストール
2007年11月27日(火) 09:01
スクリプト言語であるPHPとOracleの連携
Visit SITE: http://www.doyouphp.jp/inst/inst_unix_dso_430_ic.shtml
空間分割による経路探索
2007年11月27日(火) 02:58
経路探索アルゴリズム (DELPHI)
Visit SITE: http://www.o440.info/developing/findpath/
A*(A-star:エースター)探索アルゴリズム
2007年11月27日(火) 02:56
経路探索アルゴリズム
Visit SITE: http://homepage.mac.com/piyajk/text/2007/0707.html
経路探索アルゴリズムA* - gan2 の Ruby 勉強日記
2007年11月27日(火) 02:56
経路探索アルゴリズム
Visit SITE: http://d.hatena.ne.jp/gan2/20071124/1195901105
Speedtest - how fast are you?
2007年11月26日(月) 06:11
英文のタイピング遊び。 9000位くらい。
Visit SITE: http://speedtest.10-fast-fingers.com/
Apple Developer Documentation
2007年11月26日(月) 01:59
Cocoaプログラミングの資料
Visit SITE: http://developer.apple.com/jp/documentation/japanese.html#CocoaSeminar1
WebAlchemy accelerates Django in 100 times | My Soft Parade
2007年11月20日(火) 04:22
.htaccessと組み合わせて動作を速くする。更新があった時に.htaccessをいじるのがポイント。
Visit SITE: http://www.mysoftparade.com/blog/webalchemy-django-apache/
mini-pythonを作る2007
2007年11月13日(火) 14:58
mini-pythonを作る2006
2007年11月13日(火) 14:58
Numata Designed Factory - Cocoa Sweets
2007年11月13日(火) 04:16
Cocoa プログラミングの解説記事
Visit SITE: http://numata.designed.jp/?Cocoa%20Sweets
Processing 1.0 (BETA)
2007年11月12日(月) 16:18
From the homepage:
"Processing is an open source programming language and environment for people who want to program images, animation, and sound. It is used by students, artists, designers, architects, researchers, and hobbyists for learning, prototyping, and production. It is created to teach fundamentals of computer programming within a visual context and to serve as a software sketchbook and professional production tool. Processing is developed by artists and designers as an alternative to proprietary software tools in the same domain."
It is also great for scientific visualization.
Visit SITE: http://processing.org/
Font Management - Simple, Smart, Free - Linotype FontExplorer X
2007年11月12日(月) 16:17
Linotype FontExplorer X sets a new standard for font management software. Linotype is pleased to announce the missing link to your font collection. With the new Linotype FontExplorer X, font management, font sorting, font shopping and font discovery are simple and fun!
Visit SITE: http://www.linotype.com/fontexplorerX
Titanium Software
2007年11月12日(月) 16:17
Deeper allows you to enable and disable the hidden functions of Finder, Dock, Dashboard, Exposé, Safari, Login window and many Apple's applications...
Deeper is an Universal Binary application and works with all Macintosh PowerPC and Intel computers running Mac OS X version 10.4.x (Tiger).
Visit SITE: http://www.titanium.free.fr/pgs2/english/deeper.html
Audion 3 - The ultimate Macintosh MP3 player / encoder
2007年11月12日(月) 16:16
Record, play, encode, edit, mix, manage, and visualize audio files. This was once a pay application, but they offer for free now.
Visit SITE: http://www.panic.com/audion/
Reggie Ashworth - AppDelete
2007年11月12日(月) 16:16
AppDelete is an application for Macs that will delete the application you choose and any associated items (files and folders) that belong to that application. Now you will no longer have to hunt through your system to find these items and delete them manually. Or worse, just let them sit on your Mac forever even though the application is long gone!
Visit SITE: http://reggie.ashworth.googlepages.com/appdelete
KaBlog
2007年11月12日(月) 16:15
Actiontastic aims to be a Lean Mean Action Contextifying Machine.
It is a GTD (Getting Things Done) application that allows Inbox collection (including a Quicksilver plugin), Processing into Actions, Projects, and Contexts, and acting on these items in their Context views. All of this is aided by filtering to show only the very next action for each Project if desired.
The latest version supports iCal syncing via Sync Services, allowing iCal-friendly PDA support as well as iPod export.
Visit SITE: http://www.kaboomerang.com/blog/
Afloat. by ∞labs
2007年11月12日(月) 16:15
Afloat is a Cocoa plug-in that adds "Keep Floating" (always-on-top) and "Make Transparent" commands for all windows in all Cocoa applications.
Visit SITE: http://millenomi.altervista.org/Afloat/
郵便番号データ突っ込んでみたよ
2007年11月11日(日) 00:01
ちかぢか大量のデータを扱うことになりそうなのと、ちょいと郵便番号データを使ったものをプライベートで作る必要があるのとで、データベースにレコードをインサートするのにかかる時間をはかってみた。
郵便番号データはたかだか12万件程度しかないので、実際にはどうなるかわからないけど楽しいからやってみただけ。
実際は位置データを使いたいからPostgreSQLになると思うんだけど、速度を考えるとメモリという選択肢もあるので、SQLiteってどうなのよという気もあってSQLiteも試してみた。
MySQL?キライ:)
郵便番号をしまうためのモデルはこんな感じ。郵便番号はユニークにした方がいいんだけど…。
from django.db import models
class ZipCode(models.Model):
zipcode = models.CharField('Zip Code', max_length=7, db_index=True)
prefecture_kana = models.CharField('Prefecture Kana', max_length=20)
city_kana = models.CharField('City Kana', max_length=100)
town_kana = models.CharField('Town Kana', max_length=100)
prefecture = models.CharField('Prefecture', max_length=20)
city = models.CharField('City', max_length=100)
town = models.CharField('Town', max_length=100)
def __unicode__(self):
return '%s: %s %s %s' % (self.zipcode, self.prefecture, self.city, self.town)
郵便番号データは、例によって日本郵便の全件なので、半角カナが入ってます。
なので、setomitsさんの全角半角コンバートモジュールを使ってます。
import sys, os, csv, time
from django.conf import settings
from django.db import IntegrityError
from greetings.zipcode.models import ZipCode
try:
import zenhan
except ImportError:
print '''You need zenhan.py .
Download zenhan.py and install it.
http://matatabi.homeip.net/blog/setomits/877
'''
sys.exit()
#
#from django.db import connection
#cursor = connection.cursor()
#cursor.execute('PRAGMA temp_store = MEMORY;')
#cursor.execute('PRAGMA synchronous=OFF')
from django.core.management import call_command
call_command('syncdb')
reader = csv.reader(open(os.path.join(settings.DATA_DIR, 'KEN_ALL.CSV'), 'rb'))
counter = 0
start = time.clock()
for data in reader:
try:
zipcode = ZipCode(zipcode=data[2],
prefecture_kana=zenhan.h2z(unicode(data[3], 'shift_jis'), zenhan.KANA),
city_kana=zenhan.h2z(unicode(data[4], 'shift_jis'), zenhan.KANA),
town_kana=zenhan.h2z(unicode(data[5], 'shift_jis'), zenhan.KANA),
prefecture=unicode(data[6], 'shift_jis'),
city=unicode(data[7], 'shift_jis'),
town=unicode(data[8], 'shift_jis'))
zipcode.save()
except IntegrityError: pass
counter += 1
if counter%1000 == 0:
print '%d: %.2f' % (counter, time.clock() - start)
print 'end: %.2f' % (time.clock() - start)
試したのは、PostgreSQL(PostgreX8.2.5)とSQLite(3.4.0)。それからデータベースに入れなかった場合とかも試してる。
実行環境はCoreDuo1.83Ghz/2GB上のleopard+Python2.5.1。
結果は、以下の通り。
SQLiteは書き込みが遅いらしく、ファイルシステムを使った場合にはPostgreSQLの2.5倍遅い。
とりあえず非同期書き込みにしてみたら1.7倍遅いところまで改善。メモリにしたら2倍速くなった :)
ちなみに、データベースにインサートを行わずに「Djangoのモデルを作るだけ」と「単に変数に入れるだけ」の場合では、 12万件で2秒程度しか違いがないようなので、生成コストは無視してよさそう。O/Rを使うこと自体はメリット の方が大きい模様。
Shift_jisのデータを読み込んでunicodeに変換して半角カナを全角にするってのを省いて、「本当に単に変数に入れるだけ」の場合は12万件で1.09秒だった。マルチバイトうぜー。
--------
2007/11/16 追記
コメントいただいたので、追試を行いました。
ワントランザクションにしたところ、SQLiteはほぼメモリと同等のパフォーマンス(+1秒)になり、PostgreSQLについてもSQLiteの1.2倍遅い(+10秒)だけの状態になりました。
Friio - 地上デジタルハイビジョンテレビアダプター 「フリーオ」
2007年11月10日(土) 15:42
当然対応はWindowsのみか。
Visit SITE: http://www.friio.com/
The B-List: Moving into production
2007年11月10日(土) 15:30
プロダクションに移行するさいの注意点。 djangoproject.comのモードきりかえ(コメント欄)が格好いい。 訳すべき
Visit SITE: http://www.b-list.org/weblog/2007/nov/08/production/
機械学習序曲(仮) > 数値計算の実行速度 - Python, C, Rの比較
2007年11月10日(土) 07:32
PythonはCより速い場合がある。らしい。 NumericPython使えば、いろいろ良さそうだな。計算させる場合にも(裏がCやらなにやらで実装されてるから速いんだが)。
Visit SITE: http://hawaii.naist.jp/~kohei-h/my/python-numeric-comp.html
Differences between IronPython 1.0 and CPython 2.4.3
2007年11月09日(金) 02:31
IronPython1.0とCPython2.4.3の違い
Visit SITE: http://www.codeplex.com/IronPython/Wiki/View.aspx?title=Differences
Javaの特定パッケージに入ってるClassをとる
2007年11月08日(木) 19:10
Python温泉とかCross Community Conferenceとかのイベント参加した><
Teeda(S2)記事のムック頂いた><
とかいろいろ書かなきゃいけない事がスタックしてるんだけど、勢いで書いちゃえ。
ちょいと仕事でJava縛りになったりする(というかほとんどがそう)ので、JavaでもDjangoとかrhacoとかの気分で書きたいんですわ。
S2も相当楽にしてくれるんだけど、我々は大したものを作っていないので不要な抽象化とか、Javaの仕様に従ってるがための制限とかが我々を苦しめてくれます :(
なので、いずれはオレオレっちゃいたいと思ってるんだけど、それについてもいろいろな制限に苦しんじゃってたりします。
「パッケージ名なんて自由に決めさせる必要ないよねー。」と思って特定パッケージに属しているクラス一覧をとろうと思ったら、パッケージクラスにそんなメソッドが無くって慌てた。
java-jaで聞いたら、「クラスがあって初めてパッケージになるからねぇ」ということを教えてもらえた。
java-jaは暖かい :)
で、指定したパッケージ直下のクラス一覧をとるクラスを書いたよ。世の中に数人困っている人がいたので、汚いコードを晒すよ。単にデフォルトのクラスパスとJarの中からパッケージ名がマッチするクラスの名前を返すだけ。
汎用性とか阿呆らしいと思っているので目的に対してハードコードですが、おおよそのやり方として見れば全く役に立たない事も無いんじゃないかと…。ノーテスト!インナークラスとか知らない><
package org.jarts.core;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarInputStream;
import java.util.jar.JarEntry;
public class AppClassLoader extends ClassLoader {
static String DIR_SEPARATOR = File.separator;
static String PATH_SEPARATOR = System.getProperty("path.separator");
static String PACKAGE_SEPARATOR = "\\.";
static String MODELS_PACKAGE = "models";
static String VIEWS_PACKAGE = "views";
@SuppressWarnings("unchecked")
public Map<String, List<Class>> getAppModels(String[] applications) throws IOException, ClassNotFoundException {
return getAppClass(applications, MODELS_PACKAGE);
}
@SuppressWarnings("unchecked")
public Map<String, List<Class>> getAppViews(String[] applications) throws IOException, ClassNotFoundException {
return getAppClass(applications, VIEWS_PACKAGE);
}
@SuppressWarnings("unchecked")
public Map<String, List<Class>> getAppClass(String[] applications, String packageSuffix) throws IOException, ClassNotFoundException {
Map<String, List<Class>> map = new LinkedHashMap<String, List<Class>>();
for(String app: applications) {
map.put(app, new ArrayList<Class>());
}
String pathes = System.getProperty("java.class.path");
String[] pathList = pathes.split(PATH_SEPARATOR);
for(String path: pathList) {
if(path.endsWith(".jar") || path.endsWith(".zip")) {
JarInputStream jis = null;
try {
jis = new JarInputStream(new BufferedInputStream(new FileInputStream(path)));
JarEntry entry;
while((entry = jis.getNextJarEntry()) != null) {
String name = entry.getName();
for(String app: applications) {
String appmodeldir = app.replaceAll(PACKAGE_SEPARATOR, DIR_SEPARATOR) + DIR_SEPARATOR + packageSuffix;
if(name.indexOf(appmodeldir) == 0) {
map.get(app).add(Class.forName(
name
.replaceAll(DIR_SEPARATOR, PACKAGE_SEPARATOR)
.replaceAll(".class", "")
)
);
}
}
}
} finally {
if(jis != null) jis.close();
}
} else {
for(String app: applications) {
String dir = path + DIR_SEPARATOR + app.replaceAll(PACKAGE_SEPARATOR, DIR_SEPARATOR) + File.separator + packageSuffix;
try {
File directory = new File(dir);
File[] files = directory.listFiles(new ClassFilter(null));
if(files != null) {
for(File f: files) {
map.get(app).add(Class.forName(
f.getPath()
.replaceAll(path + DIR_SEPARATOR, "")
.replaceAll(DIR_SEPARATOR, PACKAGE_SEPARATOR)
.replaceAll(".class", "")
));
System.out.println("found:" + app + "->" + f.getPath()
.replaceAll(path + DIR_SEPARATOR, "")
.replaceAll(DIR_SEPARATOR, PACKAGE_SEPARATOR)
.replaceAll(".class", ""));
}
}
} catch(Exception e) {}
}
}
}
return map;
}
@SuppressWarnings("unchecked")
public static void main(String[] args) throws IOException, ClassNotFoundException {
AppClassLoader l = new AppClassLoader();
Map<String, List<Class>> modelMap = l.getAppModels(new String[]{"org.jarts.app.sample"});
Set<String> appset = modelMap.keySet();
for(String app: appset) {
List<Class> app_class = modelMap.get(app);
for(Class k: app_class) {
System.out.println(app);
System.out.println(" :" + k);
}
}
}
}
class ClassFilter implements FilenameFilter {
String extension = ".class";
public ClassFilter(String extension) {
if(extension != null) this.extension = extension;
}
public boolean accept(File dir, String name){
return name.toLowerCase().endsWith(extension);
}
}
A Little Head Trauma...: Customizing filenames without patching Django
2007年11月08日(木) 09:40
Djangoにパッチをあてずに、保存されるファイル名を変更する方法。これは重要。
Visit SITE: http://gulopine.gamemusic.org/2007/11/customizing-filenames-without-patching.html
例のあれ(仮題)・“Quick Look”を更に便利にする三つのプラグイン。
2007年11月05日(月) 03:27
Cover Flowを組み込みたいなぁ
Visit SITE: http://reiare.net/blog/2007/11/05/quick-look-plug-in/
(Video) How to create a Domain Specific Language ?
2007年11月01日(木) 06:42
DSLを作る方法。Rubyだけど、気になる。
Visit SITE: http://www.xaop.com/articles/2007/10/07/metaprogramming

