#design #ui #photoshop

仕事の事情であるPSDファイルにある画像の座標の情報が必要になって調べました。詳しく説明すると例えば背景が100x100のサイズで、その上に張り付いた違うレイヤーの画像の座標のことです。

ショットカットキーはCTRL+Tです。

メニューで「編集」->「自由変形」にすれば、レイヤーの4隅と中心座標の取得、数値入力による座標移動等ができます。

こんな感じです。メニューバーに表示してます。

coordinate

参考サイト: http://questionbox.jp.msn.com/qa5718320.html

#apache #php #php #memcache

My環境

XAMPP1.7.3 + WinXP ダウンロードはこちら

memcache側の設定

memcacheのインストール手順

  • http://code.jellycan.com/memcached/よりmemcached 1.2.6 => win32 binaryバージョンのファイルをダウンロード +zipファイルを適当な場所(例えばc:\memcached)に解凍 +コマンドプロンプトから下記コマンドを叩く、Windowsサービスとしてインストール。これで今度Windowsが起動すると自動でmemcacheサーバが起動してくれる。
    c:\memcached.exe -d install
    

memcacheの起動(初回のみ)

コマンドプロンプト

c:\memcached\memcached.exe -d start

php側

php.iniの設定

XAMPPのパス/php/php.iniを編集:下記コードを追加

extension = php_memcache.dll

ここはLinux環境と違い拡張子が.soではなく.dll。

php_memcache.dllのダウンロード

http://downloads.php.net/pierre/から’memcache’を検索して正しいバージョンのファイルをダウンロード。 そしてxampp/php/extに入れる。

ここで問題!正しいバージョンはなんなのか?間違ってダウンロードすると後でApacheサーバを立ち上がるときエラーが出るよ。私の環境だとphp_memcache-cvs-20090703-5.3-VC6-x86.zipのファイルが正しいけど、今時点で上記URLには載せていない。結構ググって見ても結局古い結果で、しょうがなく友人からそのファイル貰った。。。ここにアップしたので、必要な方はダウンロードしてください。ウイルススキャンしてね。。 <a href=’https://images.kinopyo.com/wp-content/uploads/2010/11/php_memcache-cvs-20090703-5.3-VC6-x86.zip)>php_memcache-cvs-20090703-5.3-VC6-x86</a>

動作確認

xamppでapacheサーバを起動、下記内容をphpファイルと保存してサーバのDocumentパス(デフォルトではXAMPP/htdocs)に置く。


<?php
    $memcache = new Memcache; // instantiating memcache extension class
    $memcache->connect("localhost",11211); // try 127.0.0.1 instead of localhost
                                           // if it is not working

    echo "Server's version: " . $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")));
?>

おまけ:memcacheメモリの調整

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/

#rails #uncategorized #font #new

Compass

A Sass-based CSS Meta-Framework that allows you to mix and match any of the following CSS frameworks:

Compass Core Blueprint 960 Susy YUI

New 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/

Rails Rumble

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.

http://railsrumble.com/

Monospaced font

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.

http://en.wikipedia.org/wiki/Monospaced_font

#diary #linux #ruby #new

終電検索

いつもYahooで終電を検索するんですが、それがアテにならないことが分かりました。 終電検索で深夜1時とか出発でただ乗換が多かったのを見てとりあえず帰れるって安心したんですが、あとで見ると実は二日目の朝4~5時の電車となってしまいました。時間を全部チェックしてなかったのが自分のミスでしたが、、、検索アルゴリズムを改善する必要があると思います。

ブレスト

ブレインストーミングのこと。

ブレインストーミング(Brainstorming)とはアレックス・F・オズボーンによって考案された会議方式のひとつ。集団思考とも訳される。集団発想法、ブレインストーミング法(BS法)、ブレスト、課題抽出ともいう。1941年に良いアイデアを生み出す状態の解析が行われた後、1953年に発行した著書「Applied Imagination」の中で会議方式の名称として使用された。

rsync

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

  • can update whole directory trees and filesystems
  • optionally preserves symbolic links, hard links, file ownership, permissions, devices and times
  • requires no special privileges to install
  • internal pipelining reduces latency for multiple files
  • can use rsh, ssh or direct sockets as the transport
  • supports anonymous rsync which is ideal for mirroring

http://www.samba.org/rsync/

cron

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

redcar

結構使えそう。

  • Cross platform: OS X, Linux, Windows.
  • Syntax highlighting for many languages
  • Snippets for many languages
  • TextMate Theme support
  • Split panes
  • Block typing
  • Soft tabs
  • Optional line numbers
  • Bracket and quote matching
  • Automatic indentation for many languages
  • Directory tree pane (not yet a full project view)
  • Extend with Ruby
  • My Plugin – example plugin to start playing with editing for yourself
  • Bulk Rename files and directories
  • Source Control integration for Subversion and Git
  • Build System support via Runnables

http://redcareditor.com/

#linux #rails #ruby #sqlite

経緯

何も考えずにGemfileにsqlite3を定義してbundleを流したらこんなエラーが出ました。

$ gem install sqlite3-ruby
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
        ERROR: Failed to build gem native extension.

/home/user/.rvm/rubies/ruby-head/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel'
###  extconf.rb failed ###
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/user/.rvm/rubies/ruby-head/bin/ruby
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib


Gem files will remain installed in /home/user/.rvm/gems/ruby-head/gems/sqlite3-ruby-1.3.0 for inspection.
Results logged to /home/user/.rvm/gems/ruby-head/gems/sqlite3-ruby-1.3.0/ext/sqlite3/gem_make.out

キーのメッセージは「sqlite3.h is missing. Try ‘port install sqlite3 +universal’ or ‘yum install sqlite3-devel’」なのでそのとおりコマンドを流しましたが、portはそのコマンドがないと、yumはsqlite3-develを見つからないと返事したんです。。。

なのでsqlite本家でソースをダウンロードしビルドしてインストールする必要があります。

sqlite3のインストール

http://www.sqlite.org/download.htmlからsqlite-amalgamation-x.x.x.tar.gz(この記事を書いてる時点では3.7.3)のTarballバージョンのファイルをダウンロードします。上から二番目のリンクです。

$ wget http://www.sqlite.org/sqlite-amalgamation-3.7.3.tar.gz
$ tar vxzf sqlite-amalgamation-3.7.3.tar.gz
$ cd sqlite-amalgamation-3.7.3
$ ./configure --prefix=/usr/local
$ make
$ sudo make install

sqlite-ruby gemのインストール

後は普通にgem installでもいいしbundle installでもOKです。

$ gem install sqlite3-ruby