仕事の事情であるPSDファイルにある画像の座標の情報が必要になって調べました。詳しく説明すると例えば背景が100x100のサイズで、その上に張り付いた違うレイヤーの画像の座標のことです。
ショットカットキーはCTRL+Tです。
メニューで「編集」->「自由変形」にすれば、レイヤーの4隅と中心座標の取得、数値入力による座標移動等ができます。
こんな感じです。メニューバーに表示してます。
仕事の事情であるPSDファイルにある画像の座標の情報が必要になって調べました。詳しく説明すると例えば背景が100x100のサイズで、その上に張り付いた違うレイヤーの画像の座標のことです。
ショットカットキーはCTRL+Tです。
メニューで「編集」->「自由変形」にすれば、レイヤーの4隅と中心座標の取得、数値入力による座標移動等ができます。
こんな感じです。メニューバーに表示してます。
// 数値を日本円表現にフォーマット。
// 例:12345 -> 12,345
num2Currency = function(obj) {
// 画面項目の値
var str = obj.value;
var num = new String(str).replace(/,/g/"");
while(num != (num =num.replace(/^(-?\d+)(\d{3})/,"$1,$2")));
obj.value = num;
}
// 日本円表現を数値にフォーマット。
// 例:123,45 -> 12345
currency2Num = function(obj) {
var str = obj.value;
var num = str.replace(/,/g,"");
obj.value = num;
}
環境構築の記事でよく目にすると思いますが
このsudoコマンド。
気になってて調べてみたんです。
sudo is a Terminal command used to execute a command as another user, by default, the root user.
あるコマンドを別のユーザとして実行する、デフォルトではルートユーザ、だそうです。
例えばルートユーザとしてあるアプリを実行したい時は:
sudo open ....
Webページの画像を右クリックで簡単にFlickrにアップロードできるChromeエクステンションです。
もしタイトルやタグなども編集できればもっどいいですけどね。
Flickr Upload Extensionをダウンロード
ターミナルはApplication/Utilitiesフォルダにあります。
CTRL+Spaceで直接Terminalを叩いても直接開けますので、
とても便利でずっとこれを使ってます。
pwd
今のディレクトリのパスを返します。"/Users/(yourusername)"のような
open
Finderでダブルクリックと同じ効果です。アプリを開くに使います。
~
波記号はHomeディレクトリのショートカットです。
例えばcd ~で叩くとデフォルトで"/Users/(yourusername)"ディレクトリに行きます。
ps -ax | grep http
ps -ax | grep mysql
kill xxx
上記の"xxx"はプロセスのIDです。
またアプリの名前がわかった場合はkillallコマンドが使えます。
killall Dock
大文字小文字は区別しますので、気おつけてください。
Springのコンテキストファイルにjdbc:embedded-databaseタグで
type="H2"でbeanを登録します。
jdbc:scriptタグで初期化時に実行したいSQLファイルを指定できます。
Sprintって、本当に便利ですね。
<jdbc:embedded-database id="dataSource" type="H2">
<jdbc:script location="classpath:schema.sql"/>
<jdbc:script location="classpath:test-data.sql"/>
</jdbc:embedded-database>
ちなみにjdbcのnamespaceの登録も忘れずに。
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
H2以外でもHSQL、Derbyがサポートされています。
MacにはデフォルトでRubyが入ってそうです。
ターミナルを開いてrails -vを叩いたらバージョン情報が出てきました。
ruby 1.8.7 (2009-06-08 patchlevel 173) *universal-darwin10.0*
そしてRubyだけじゃなくRailsも入ってましてびっくりしました。
すごいですねMacは。。。
て、railsのバージョンもrails -vで確認できますが、
デフォルトのバージョンは古いそうで下記のコマンドでアップグレードできます。
sudo gem update rails
するとこんなログ情報が出ます。
Updating installed gems
Updating rails
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/zolo/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
Successfully installed activesupport-2.3.8
Successfully installed activerecord-2.3.8
Successfully installed rack-1.1.0
Successfully installed actionpack-2.3.8
Successfully installed actionmailer-2.3.8
Successfully installed activeresource-2.3.8
Successfully installed rails-2.3.8
Gems updated: activesupport, activerecord, rack, actionpack, actionmailer, activeresource, rails
Installing ri documentation for activesupport-2.3.8...
Installing ri documentation for activerecord-2.3.8...
Installing ri documentation for rack-1.1.0...
Installing ri documentation for actionpack-2.3.8...
Installing ri documentation for actionmailer-2.3.8...
Installing ri documentation for activeresource-2.3.8...
Installing ri documentation for rails-2.3.8...
Installing RDoc documentation for activesupport-2.3.8...
Installing RDoc documentation for activerecord-2.3.8...
Installing RDoc documentation for rack-1.1.0...
Installing RDoc documentation for actionpack-2.3.8...
Installing RDoc documentation for actionmailer-2.3.8...
Installing RDoc documentation for activeresource-2.3.8...
Installing RDoc documentation for rails-2.3.8...
多少時間がかかります。
これでMacでのRuby開発の準備は完了です。
gem update railsにsudoを付けないとこんなエラーが出るかも
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/paku-k/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
ERROR: Error installing rails:
bundler requires RubyGems version >= 1.3.6
XAMPP1.7.3 + WinXP
ダウンロードはこちら
c:\memcached.exe -d install
コマンドプロンプト
c:\memcached\memcached.exe -d start
XAMPPのパス/php/php.iniを編集:下記コードを追加
extension = php_memcache.dll
ここはLinux環境と違い拡張子が.soではなく.dll。
http://downloads.php.net/pierre/から'memcache'を検索して正しいバージョンのファイルをダウンロード。
そしてxampp/php/extに入れる。
ここで問題!正しいバージョンはなんなのか?間違ってダウンロードすると後でApacheサーバを立ち上がるときエラーが出るよ。私の環境だとphp_memcache-cvs-20090703-5.3-VC6-x86.zipのファイルが正しいけど、今時点で上記URLには載せていない。結構ググって見ても結局古い結果で、しょうがなく友人からそのファイル貰った。。。ここにアップしたので、必要な方はダウンロードしてください。ウイルススキャンしてね。。
. $memcache->getVersion() . "<br />\n";
// we will create an array which will be stored in cache serialized
$testArray = array('horse', 'cow', 'pig');
$tmp = serialize($testArray);
$memcache->add("key", $tmp, 30);
echo "Data from the cache:<br />\n";
print_r(unserialize($memcache->get("key")));
?>
Memcached, by default, loads with 64mb of memory for it’s use which is low for most applications. To change this to something else, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server in your registry, find the ImagePath entry and change it to look something like this:
“C:\memcached\memcached.exe” -d runservice -m 512
http://www.codeforest.net/how-to-install-memcached-on-windows-machine
http://pureform.wordpress.com/2008/01/10/installing-memcache-on-windows-for-php/
A Sass-based CSS Meta-Framework that allows you to mix and match any of the following CSS frameworks:
Compass Core
Blueprint
960
Susy
YUINew frameworks and extensions are tracked on the wiki as they are created.
Other frameworks can be added relatively easily. Create your own!
http://github.com/chriseppstein/compass/tree#readme
http://compass-style.org/docs/
The Rails Rumble is an annual 48 hour web application development competition in which teams of skilled web application developers get one weekend to design, develop, and deploy the best web property that they can, using the power of Ruby and Rails.
A monospaced font, also called a fixed-pitch or non-proportional font, is a font whose letters and characters each occupy the same amount of horizontal space.1 This contrasts to variable-width fonts, where the letters differ in size to one another.
The first monospaced typefaces were designed for typewriters, which could only move the same distance forward with each letter typed. This also meant that monospaced fonts need not be typeset like variable width fonts and were, arguably, easier to deal with.
いつもYahooで終電を検索するんですが、それがアテにならないことが分かりました。
終電検索で深夜1時とか出発でただ乗換が多かったのを見てとりあえず帰れるって安心したんですが、あとで見ると実は二日目の朝4~5時の電車となってしまいました。時間を全部チェックしてなかったのが自分のミスでしたが、、、検索アルゴリズムを改善する必要があると思います。
ブレインストーミングのこと。
ブレインストーミング(Brainstorming)とはアレックス・F・オズボーンによって考案された会議方式のひとつ。集団思考とも訳される。集団発想法、ブレインストーミング法(BS法)、ブレスト、課題抽出ともいう。1941年に良いアイデアを生み出す状態の解析が行われた後、1953年に発行した著書「Applied Imagination」の中で会議方式の名称として使用された。
rsync is a file transfer program for Unix systems. rsync uses the "rsync algorithm" which provides a very fast method for bringing remote files into sync. It does this by sending just the differences in the files across the link, without requiring that both sets of files are present at one of the ends of the link beforehand.
Some features of rsync include
Cron is a time-based job scheduler in Unix-like computer operating systems. The name cron comes from the word "chronos", Greek for "time". Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.
http://en.wikipedia.org/wiki/Cron
結構使えそう。