ラベル Javascript の投稿を表示しています。 すべての投稿を表示
ラベル Javascript の投稿を表示しています。 すべての投稿を表示

金曜日, 12月 30, 2011

Javascriptの多次元配列

やられましたね。これ。Javascriptの多次元配列。

var array=new Array();
array[0,0]=0;
array[1,0]=1;

alert(array[0,0]);
alert(array[1,0]);

結論的には、双方ともに1を表示します。

皆さんも気をつけましょう。

謹賀新年

木曜日, 12月 17, 2009

Chrome Extensions

Google Chrome browser seem to get the momentum now that many extensions are available.

Chrome Extensions

Sensible enough, it runs Javascript. The objects are custom made, though, and it will take time to get them all.

Google Chrome Extensions (Labs)

A code like this will set a listener. The specified callback function will be invoked when the icon is clicked.



chrome.browserAction.onClicked.addListener(function(tab) {

alert(tab.url);

});



When the extension is invoked, it creates popup window. It could create empty background window. The current selected window is called contents window and scripts and css's etc for the window can be specified in .json file.

Overview

Google Chrome 拡張機能では、それぞれ任意のページ(background), サイトを開いたときに起動する(contents), アイコンをクリックすると表示される(popup)などで指定するコードを起動できる。

金曜日, 11月 28, 2008

雑感

妙に気張ったサイトがあるが、必要もないのにリフレクションの類を使うのは意味がないだけでなく、コンセプトをあいまいにするという欠点がある。

「あ、IEがサポートした!」など一喜一憂したくない。さらに悪いのは、「あ、IEがサポートしてない!」である。この対処法はいくらもあるが、基本線に徹するのもひとつの生き方である。ところが、基本中の基本と考えているようなことがサポートされていない場合などあり、その解決だけで時間がかかる。

最初から汎用性のない機能を説明するなどまったくテキストとして方針がなっていない。その辺の配慮が、教育的配慮というものである。他人の造ったプログラム言語を説明するには、それなりの配慮がいる。もっともよく使う演算子、関数に、決まった形式がなかったり指定されていなかったり冗長であったりすると、汚いプログラムになる。

Firefoxで対応していない機能もある。ブラウザでルビに対応しないのがあり、不便である。括弧書きはいかにもよくない。日本語に特有な機能であり、ブラウザの開発にも開発者およびサポーターの使う言語に依存する部分がある。

日曜日, 2月 03, 2008

Unicode Hex Representation

I just happened to have had some needs to know the unicode hex for certain unicode characters. Here are the javascript that does the conversion from the given unicode string to its hex representation. Please feel to take it from here.

Unicode Hex Representations

Flask の Blueprint のテンプレート問題

  Flask の Blueprint は、ルート、静的ファイル、テンプレートをまとめて管理できます。しかし、テンプレートが指定できません。 ここでは、Blueprint の template_folder の問題点と回避策を説明します。 Blueprint のテンプレート問題...