AWSアドバンスドコンサルティングパートナーの一員として活動する株式会社スタイルズが、AWS導入、移行、開発、セキュリティ、運用保守など、すべてのご相談に乗らせていただきます。 AWSを導入したいが何から始めたらいいかわからない 既存のベンダーが新技術に弱く、良い提案がもらえない クラウドの導入にセキュリティの不安がある AWSをとりあえず導入したが、さらに活用していきたい 社内にAWSの知見を持っている人がいない AWSならではのシステム開発を詳しく知りたい
最近になってようやくJavaScript関係、動的ロードを使ったテクニック等について 話せる相手ができまして、、なかなか充実しています。 Gmail、GoogleMapsのような画面遷移なしの高速なナビゲーションが注目されています。 サイトが特定のタスクに対して特化している場合、JavaScriptを使ったインターフェースの最適化が非常に有用であるのは間違いありません。 ブラウザ上で動作するリッチクライアントとしてはFlashが圧倒的に有名ですが、Flashは、ブックマーク、ブラウザの戻る進む機能、文字の拡大縮小、などのブラウザが本来備えている機能が使えないため、ユーザビリティ研究者の間では嫌われ者です。 http://d.hatena.ne.jp/nazoking/20050226 というわけで、AjaxがFlashのような使い方をされないような実装例を考えてみたいと思います。 一つは、
Arrayのuniq()を作る - 素人がプログラミングを勉強するブログのやつと、下のやつのどっちがいいかな。 Array.prototype.uniq=function() this.sort().reduceRight( function(a,b){ a[0]===b||a.unshift(b); return a; } ,[]) var array=[1,1,2,3,4,1,null,null,undefined,HTMLElement,'a','b',HTMLElement,'b']; array.uniq();//[1, 2, 3, 4, HTMLElement, "a", "b", null] 一度ソートすれば隣と比較するだけでよくなる。ただし、順番はソートされたものになる。
Opera で DOM Mutation Event を使用するコードを追記しました。 まとめを追加しました。 Opera パート2に取得できないケースが見つかったため、パート3 を追加しました。 rhino.jpg(幅:300px, 高さ:227px) を、 <img id="rhino" src="rhino.jpg" width="100" height="75" /> と、100 x 75 で表示している場合を例に、画像本来のサイズを取得する方法をご紹介します。 Firefox, Safari, Google Chrome なら image.naturalWidth と image.naturalHeight を利用します。 image.naturalWidth と image.naturalHeight の初期値は 0 です。画像の読み込みが完了した時点で適切な値に更新されます。
Hacking the Hack #92: iTunes COM API で今聞いている曲を Blog エントリに掲載 Blog Hacks Hack #92 では、Winamp とそのプラグイン amip を使用して、今聞いている曲をエントリに追記する方法を紹介していますが、iTunes の場合は COM を利用してもっとスマートにできます。 以下のコードを nowPlaying-iTunes.js として保存します。 // Configurtaion: path to your MT script and blogID var mtUrl = "http://blog.bulknews.net/mt/mt.cgi"; var blogID = 6; // Get Trackname from iTunes using COM var iTunes = WScript.CreateObj
JSON文字列をevalして値を取りたいときに挙動が妙ではまった、という話を聞いたので、Firefox1.5上のFireBugのコンソールで何パターンか試してみた。 {"key":"value"}というJSONデータが文字列で渡ってきて、それをevalしてJavaScriptの値として使いたい、という想定。 間違ったJSON文字列をevalした場合 >>> jsonstr = "{key:\"value\"}" "{key:"value"}" >>> var obj = eval(jsonstr) >>> obj "value" >>> typeof(obj) "string"JSONのオブジェクトでは、ラベルも""でくくって文字列にしないといけないのだが、まずはそれを忘れた場合を試してみた。結果として返ってくるのは、なんとJSONのハッシュの要素にしたつもりの文字列のみ。 正しいJSON
Reply to はてなブックマークのコンテンツの JavaScript を高速化する - IT戦記 「重い箇所2:HatenaStar.js 1738 行目」で取り上げられていた Hatena.Star.Button.reateButton ですが、Flyweight パターンのアイデアと Element.cloneNode() を利用したところ、手元の環境(WinXP,Fx3.0)で7.7倍速くなったのでお伝えしておきます。 修正コード /* Hatena.Star.Button */ Hatena.Star.Button = new Ten.Class({ createdButton: {}, createButton: function(args) { var src = args["src"]; if (!this.createdButton[src]) { var newimg
はじめに 「新はてなブックマーク」になったということで、とっても便利になったのですが、ブックマーク一覧ページ*1が若干 JavaScript に時間が掛かっているみたいです。 というわけで 調査してみたいと思います。調査して、改善できそうなところは後で纏めて「はてなアイデア」にでも登録しようと思います。 この日記は調査しながら、過程を書いていくつもりです。 準備 まずは、人のサイトの JavaScript を書き換えて試してみるための環境を作ります。 作業用ディレクトリを作る とりあえず、ホームに HatenaJS というディレクトリを作ります。 $ mkdir HatenaJS $ cd HatenaJS CocProxy をダウンロードしてくる 以下から CocProxy というツールをダウンロードしてきます。 http://coderepos.org/share/wiki/CocPr
プロトタイプ function Animal(){}; Animal.prototype = { sleep : function(){}, walk : function(){ alert('noshi, noshi') } }; function Human(){}; Human.prototype = new Animal(); new Human().walk(); // noshi, noshi もっともポピュラだと思われる。 変型プロトタイプ Human.prototype.__proto__ = Animal.prototype; new Human().walk(); // noshi, noshi ほとんどのIEを除くJavaScript処理系で実行可能。裏ワザちっく。 エクステンド /** * extend function * @param {Object} s su
20080406 21:50 キーコードについての説明を追記しました。 Greasemonkeyを使ってる人ならたいていの人が知ってるMinibufferとLDRize(偏見?) ただ、なんというかMinibufferについての説明がMinibuffer 2007.11.15 の変更点 | 3.14とsilog - script/LDRizeの記事くらいしかなく、半ばソース読んで書け状態になってるので結構ハードルが高いのではないかと。 そこで、自分でもDeleteCommand for GreasemonkeyっていうMinibuffer上で動くGreasemonkeyを書いたんだけれど、そのときにわかったこととか、後でMinibuffer用Scriptを書くときの備忘録みたいなのをまとめておく。 これよんでちょっとでもGreasemonkey、またMinibufferに興味持つ人が増えな
さいきんFirebugでコードを書いている。書いてCtrl-Enterを押した瞬間に結果が確認できるので気持ちがいい。Canvasを使えばグラフィックも扱える。BASICでコードを書く感覚を思い出した。 Firebug上では、あんまり長いコードを書くのはつらいところが難点だった。自分で拡張してincludeできるようにしたらこれがすごくいい。Firebug上で実行して動作を確認しながら関数を書いていって、うまく動くようになった時点でincludeしているファイルのほうに移動してFirebugのコマンドラインを空にする。vim上でコードを書いてブラウザに戻ってきてreloadするのにくらべてストレスが少ない。 vim上でコードを書き換えたときもCtrl-Enterでもう一度includeされて実行されるので、リロードは発生しないし、Firefoxとvimとをいったりきたりしなくてもいい。
2年前の夏に書かれたFirebugの便利な組み込み関数 - 技術メモ帳を読んで、いまさらdebuggerと書くとそこからデバッガでステップ実行できるのを知ってショックでした.... lurkerさんのブログで紹介されている$0, $1 で直前にinspectしたものを参照できることも、なぜか公式のドキュメントっぽいFirebug Documentationには載っていなくて、FireBug Documentation - JoeHewitt.comには載っています。 で、もうひとつ、ソースコードにしか書かれてなさそうなやつを発見しました。$$1と$$2です。 自分はFirebugを使っていて、ときどきconsole.logで出したオブジェクトのプロパティを引数にして関数を呼んだりしたい、ということがあったけどできなくて困ってたんですが$$1でそういうことができるようになりました。 たとえば
9割ぐらいはハッシュ何がハッシュなのかjavascriptで存在するほとんどのオブジェクトの実体はハッシュだよ。 var arr = [0,1,2,3]; とかをみると配列(人によってはリスト)に見えると思う。でも実際は違うんだ。 これは var has = {0:0,1:1,2:2,3:3}; と基本的には等価なんだ。ただちょっと束縛されているメソッド(インターフェイス)が違うだけ。 ためしに arr[4] = 4; arr['x'] = 'string'; arr[-1] = -1; としてみよう。 Firebugで確認してみると[0, 1, 2, undefined, 4]というような値がかえってくるよ。 でもarr[-1]やarr['x']の値は保存されてないのかな?そんなことはないちゃんとアクセスできるんだ。 それどころかarr.xで'string'がかえってくるんだ。 別の例を
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く