Entries from 2012-01-01 to 1 year

Yahoo Japan エンコード mechanize/open-uri

YJのページのヘッダーによるとエンコードはEUC-JPと言うことなのでrequire 'mechanize' eucBody=a.get(uri){|page| page.encoding="EUC-JP"}.body page = Nokogiri::HTML( NKF.nkf('--utf8 --euc-input', eucBody) )としていたが、上手く行かない(上記pageが…

文字エンコーディング

またぞろきたももんがさん師匠の受け売りです。http://d.hatena.ne.jp/kitamomonga/20081209/kaisetsu_for_ver_0_9_ruby_www_mechanize http://jp.rubyist.net/magazine/?0009-BundledLibraries#l15Mechanize は meta charset やレスポンス HTTP ヘッダの Co…

jQuery クリックされた自分or親elementを探す

$(document).ready(function() { $("#example div").click(function() { var index = $(this).index(); $("#example_index").html("Index " + index + " was clicked"); }); });ーーーーーーーーーーーーーーーーーー$("*", document.body).each(function ()…

jQuery 小技 Toggle セレクタ

$(elem).prop("disabled",!$(elem).prop("disabled"))if($(this).prop('value')=='変更'){$(this).prop('value','確定')}else{$(this).prop('value','変更')}$('#play_button_id').toggle(play,play_pause)http://allabout.co.jp/gm/gc/24187/2/ http://alla…

Sinatraのapp_root

http://d.hatena.ne.jp/foosin/20090613/1244917528start.rbにMVCの全てを詰め込む事もできるが、やはりMVCのそれぞれでファイルを分けたい。sinatraではMVC的なファイルの配置は、ビュー以外は用意されていない。アプリケーションルート(以後 $APP_ROOTと…

Sinatra Haml jQuery example

http://shokai.org/blog/archives/5610 http://shokai.org/blog/archives/6029 http://youichi-kato.cocolog-nifty.com/blog/2009/08/sinatra-haml-sa.html http://youichi-kato.cocolog-nifty.com/blog/2009/08/sinatra-haml--1.htmlSinatraでちょいTwitter…

Cappuccino and Cocoa

web applications that look and feel like desktop applicationshttp://cappuccino.org/ http://www.exampler.com/blog/2011/12/17/tdd-workflow-sinatra-haml-jquery-part-1/ The Cocoa and Cocoa Touch frameworks that power Mac OS X and iOS are tight…

Serialport-server USB

毎度橋本商会さんすごいです。http://shokai.github.com/serialport-server/ http://shokai.org/blog/archives/6009

Ubuntu LAN上の使用中IPアドレスを一斉調査する

sudo arp-scan --interface=eth1 192.168.2.0/24

Ubuntu 12.04 Gnome3 System tray missing!

Alt-RightClickで"Add to Panel"更にNotificationAreaでskype,HPLIP,InputMethodが戻ってきます。またはsudo apt-get install sni-qt:i386

Wake on LAN wol設定

http://d.hatena.ne.jp/pochio_pochiyama/20110620/p2 http://d.hatena.ne.jp/ichiro_tanaka/20090505/1241530936 https://help.ubuntu.com/community/WakeOnLan http://www.intel.com/jp/support/motherboards/desktop/sb/CS-022309.htmWOLで起動したいマシ…

Ubuntu 12.04 ruby1.9.3p0 mechanize 2.5.1 Yahoo文字化け

特に最新の組み合わせを指向した分けではないが、新規のubuntuサーバーを建てるために12.04を採用したために全て: ubuntu11.04 ->12.04 ruby1.9.2p180 ->1.9.3p0 mechanize2.1 ->2.5.1 になった。その途端にmechanizeで今まで正常に動いていたYahooJapanへ…

Building Backbone.js Apps With Sinatra, MongoDB and Haml

http://addyosmani.com/blog/building-backbone-js-apps-with-ruby-sinatra-mongodb-and-haml/

Using Yan:captcha in Ruby Web Application

http://sunng.info/blog/2009/12/use-yan-in-ruby-web-application/

An Introduction to Haml

http://rubysource.com/an-introduction-to-haml/

Sinatra 画像

Sinatraで画像ファイルやcssファイル等、静的ファイルはpublicフォルダに入れてる。そのファイルを指定するときは、public/hoge.png、ではなく /hoge.png で指定できる。上策:Rackに任せる http://blog.s21g.com/articles/1565 Sinatra で画像をダイナミッ…

sinatra + html5_canvas + jquery 画像ドラッグドロップでファイル保存//File upload with Sinatra

http://d.hatena.ne.jp/noodles_mtb/20110903/1315036154 http://www.wooptoot.com/file-upload-with-sinatra

Sequel::Model Example チュートリアル

http://route477.net/ramaze/?Sequel http://route477.net/ramaze/?Tutorialhttp://d.hatena.ne.jp/uzuki05/20081101/1225535468 http://d.hatena.ne.jp/shibason/20100304/1267697379http://pastebin.com/uriGCi3D class Questionnary set_schema do #syste…

sqlite3 forigen key について

現時点で私個人はRuby Sequelを通してforigen_keyをONにする方法を知りません。http://d.hatena.ne.jp/yatt/20110103/1294064413 http://d.hatena.ne.jp/naga_sawa/20101219/1292774083 http://www.k-brand.gr.jp/log/002036http://sqlite.org/foreignkeys.h…

Sinatra Tips チュートリアル

http://labs.unoh.net/2009/05/sinatra.htmlhttp://www.machu.jp/diary/20111002.html#p01http://net.tutsplus.com/tutorials/ruby/singing-with-sinatra/ http://net.tutsplus.com/tutorials/ruby/singing-with-sinatra-the-recall-app-2/ http://net.tutsp…

git チュートリアル

http://www8.atwiki.jp/git_jp/pub/git-manual-jp/Documentation/gittutorial.html

Ruby 文字列シンボル

文字列をシンボル "str".to_sym か "str".internシンボルを文字列 :symbol.to_s

sqlite3 日付 ユリウス日

http://www.dbonline.jp/sqlite/特にデータ型についてはhttp://www.dbonline.jp/sqlite/type/index1.html日付・julian day,ユリウス日、ソート http://d.hatena.ne.jp/Kishi/20080108/1199785354

mechanizeに必要なライブラリ

sudo apt-get install libxslt-dev libxml2-dev

githubから直接GIT

例えば http://gihyo.jp/dev/serial/01/ruby/0009 のサンプルアプリをコピーするには上部の[Git Read-Only]フィールドからgit://github.com/yhara/sinatbbs.gitをコピーしてgit clone git://github.com/yhara/sinatbbs.gitsinatbbsフォルダーとコードをクロ…

SSHアタックを回避

http://www.ubuntugeek.com/howto-pptp-vpn-server-with-ubuntu-10-04-lucid-lynx.htmlWe need to set up ip-masquerading: ‘sudo nano /etc/rc.local‘Add the following lines above the line that says ‘exit 0‘ # PPTP IP forwarding iptables -t nat -A …

nautilusユーティリティインストール

http://iloveubuntu.net/handy-nautilus-actions-suite-enriched-new-scripts-and-separate-packages sudo add-apt-repository ppa:nae-team/ppa sudo apt-get updateThen, install the desired packages Nautilus Advanced Menu sudo apt-get install nauti…

nautilus-open-terminal

Google で 「ubuntu apt-get install nautilus-open-terminal」検索 このコマンド危険->ibus,Anthyをremoveしてしまう sudo aptitude install nautilus-open-terminal

Geditのリサイズが面倒

Workaround: Edit /usr/share/themes/Ambiance/metacity-1/metacity-theme-1.xml. Set the following values in frame_geometry_normal as desired: Radianceを使っているひとは/usr/share/themes/Radiance/metacity-1/metacity-theme-1.xmlでもこれはあまり…

ubuntu 12.04 server gnome enable file share

Nautilus extension to share folder using Sambaソフトウェアセンターからインストール