What this administration did was to distort opinions so that the targets will be directed to somewhere that is irrelevant to thier teams. But what we say is true and will be true for the foreseeable future, and the situation will exactly be the same if they do not take actions. Their stores won't motivate the people here to do better
jobs nor to get better skills. They do not have pride in their works. It will take forever to get their job done.
Java is the nicest thing to have.
Here is the Grep.java program I've just written.
→ Java JDK
木曜日, 2月 14, 2008
日曜日, 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
→ Unicode Hex Representations
土曜日, 2月 02, 2008
ソニー、デジタル一眼「α」初のライブビュー搭載の「α350」など発表
ソニーは、デジタル一眼レフ「α100」の後継機種の「α200」を2月に、ライブビュー付の「α350」を3月に発売すると発表したらしい。
→ ソニー、デジタル一眼「α」初のライブビュー搭載の「α350」など2機種 (2008-2-1)
フォーカスが早くなり、高感度になる、α350では画素数が1420万画素ということらしい。
→ ソニー、デジタル一眼「α」初のライブビュー搭載の「α350」など2機種 (2008-2-1)
フォーカスが早くなり、高感度になる、α350では画素数が1420万画素ということらしい。
土曜日, 1月 26, 2008
To implement Emacs styled "kill-line"
What I found out today is that emacs styled "kill-line" is really a thing that makes you feel you're in fact using the program like a part of you. Just because it will get you to a part of the program, it indeed is going to make you feel better using the software. That kind of application is something that all of us would have to want to program.
To look at what "kill-line" is, try the Java applet editor in my Zhuyin page. The popup menu of the Java applet editor shows the "Cut Line" that is much like "kill-line" and delete the text from where the caret is to the end of the line. "Copy Line" does just as you assume, it selects the portion of line to the end and that part is copied to the system clipboard.
In case you want to know the beautiful Java lines that can accomplish these tasks, here are the codes.
To look at what "kill-line" is, try the Java applet editor in my Zhuyin page. The popup menu of the Java applet editor shows the "Cut Line" that is much like "kill-line" and delete the text from where the caret is to the end of the line. "Copy Line" does just as you assume, it selects the portion of line to the end and that part is copied to the system clipboard.
In case you want to know the beautiful Java lines that can accomplish these tasks, here are the codes.
boolean isLineEnd(char ch)
{
return (ch=='\u2029'||ch=='\u2028'||ch=='\u0085'||ch=='\n'||ch=='\r');
}
public int getLineEndPosition()
{
int index=-1;
String text=textArea.getText();
if(!text.isEmpty())
{
int pos=textArea.getCaretPosition();
index=pos;
int len=text.length();
while(!isLineEnd(text.charAt(index)) && ++index<len);
}
return index;
}
void cutLine()
{
int start=textArea.getCaretPosition();
int end=getLineEndPosition();
textArea.setSelectionEnd(end);
textArea.replaceSelection("");
}
void copyLine()
{
int start=textArea.getCaretPosition();
int end=getLineEndPosition();
textArea.setSelectionEnd(end);
textArea.copy();
}
Java is wonderful. >> C/C++ only programmers
Java is wonderful. If anything, I could complain just a few things, like sometimes, they use English that is not entirely correct in the sense that makes me feel that some English speaker is making fun of Japanese. Maybe it is too much of programming on my part (^^;) but anything that is uncertain about the language is just painful. Here is this Java compiler error message. The error message must convey the precise meaning of what is going on in the program -- and not in other part of the world. ^^
Please remove or make sure it appears in the correct subdirectory of the classpath.
木曜日, 1月 24, 2008
Javaで書いたプログラムがもっとも古びず、長持ちする
けったいな意見の持ち主がいて、プログラムを書くと「マイクロソフトに利用されている」という。しかし、プログラムを書くのはプログラマで、プログラムを使うのはユーザーである。同様に、政治的意見を持つのは国民で、政治の結果をもろにかぶるのは市民である。
Javaで書いたプログラムがもっとも古びず、長持ちする。プログラマとしては他に換えがたいメリットがある。95で書いたプログラムは、もう目にする機会もない。
こちら、自作ソフトのページ↓です
→ Java Programming
Javaで書いたプログラムがもっとも古びず、長持ちする。プログラマとしては他に換えがたいメリットがある。95で書いたプログラムは、もう目にする機会もない。
こちら、自作ソフトのページ↓です
→ Java Programming
月曜日, 1月 21, 2008
Suppose you want to use my OnScreenKeyboard class.
What is good about Java is, as they say -- write once, run anywhere. It means that the everything you write won't be wasted in a way that not only you can have it but also that you have it on your way. Java classes are extendable. Only thing that the programmer must be aware of is to set the classpath right.
In case you want to use my OnScreenKeyboard class, download (easai.jar).
The OnScreenKeyboard class is in easai.util package so import the package to use the class.
You just have to set the ActionListener to receive all the output from the OnScreenKeyboard application.
Please have a look at this application that uses the OnScreenKeyboard class if what is describe above is not entirely clear to you.
The way to set the classpath right is a bit technical. The package name of the OnScreenKeyboard class is "easai.util". As that all the Java classes are organized in the most familiar way of directories, You must store the class file in the directory named easai/util as follows.
Then compile your Java application with a proper classpath option.
Visit this site (http://easai.00freehost.com/Zhuyin/index.html) to see how it runs.
In case you want to use my OnScreenKeyboard class, download (easai.jar).
The OnScreenKeyboard class is in easai.util package so import the package to use the class.
import easai.util.*;
...
OnScreenKeyboard keyboard
=new OnScreenKeyboard("Taiwanese",this);
keyboard.init();
OnScreenKeyboard constructor takes a string argument that specifies the language and an ActionListener. This ActionListener is a wonderful thing that makes this component usable for any of the application you wish. You just have to set the ActionListener to receive all the output from the OnScreenKeyboard application.
public void actionPerformed (ActionEvent e)
{
String command=e.getActionCommand();
String ch=command.substring(0,1);
int pos=textArea.getCaretPosition();
textArea.insert(ch,pos);
}
Please have a look at this application that uses the OnScreenKeyboard class if what is describe above is not entirely clear to you.
/* TaiwaneseApplet.java -- Zhuyin on screen keyboard
*
* Copyright (C) 2008 Erica Asai
* This program is free software;
* you can redistribute it and/or
* modify it under the terms of the
* GNU General Public License
* as published by the Free Software
* Foundation; either version 2
* of the License, or (at your option)
* any later version.
*
* This program is distributed in
* the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without
* even the implied warranty of
* MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the
* GNU General Public License
* for more details.
*
* You should have received a copy
* of the GNU General Public License
* along with this program; if not,
* write to the Free Software
* Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
*
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import easai.util.*;
public class TaiwaneseApplet extends JApplet implements ActionListener
{
JTextArea textArea=new JTextArea(15,50);
JButton clear=new JButton("Clear");
JButton larger=new JButton("Font Size (+)");
JButton smaller=new JButton("Font Size (-)");
OnScreenKeyboard keyboard
=new OnScreenKeyboard("Taiwanese",this);
public void init()
{
keyboard.nButtons=10;
keyboard.init();
clear.addActionListener(this);
larger.addActionListener(this);
smaller.addActionListener(this);
JPanel control=new JPanel();
control.setLayout(new FlowLayout());
control.add(larger);
control.add(smaller);
JPanel textPanel=new JPanel();
JScrollPane textScroll=new JScrollPane(textArea);
textPanel.add(textScroll);
textPanel.add(clear);
JPanel panel=new JPanel();
BorderLayout layout=new BorderLayout();
panel.setLayout(layout);
JPanel keyboardPanel=new JPanel();
keyboardPanel.setLayout(new BorderLayout());
keyboardPanel.add(keyboard,BorderLayout.CENTER);
keyboardPanel.add(control,BorderLayout.SOUTH);
panel.add(keyboardPanel,BorderLayout.NORTH);
panel.add(textPanel,BorderLayout.CENTER);
JScrollPane scroll=new JScrollPane(panel);
add(scroll);
}
public void actionPerformed(ActionEvent e)
{
String command=e.getActionCommand();
if(0<command.length())
{
if(command.equals("Clear"))
{
textArea.setText("");
}
else if(command.equals("Font Size (+)"))
{
keyboard.resizeFont(2);
}
else if(command.equals("Font Size (-)"))
{
keyboard.resizeFont(-2);
}
else
{
String ch=command.substring(0,1);
int pos=textArea.getCaretPosition();
textArea.insert(ch,pos);
}
}
}
}
The way to set the classpath right is a bit technical. The package name of the OnScreenKeyboard class is "easai.util". As that all the Java classes are organized in the most familiar way of directories, You must store the class file in the directory named easai/util as follows.
+--easai--util
--+
+--your Java application directoryThen compile your Java application with a proper classpath option.
javac -classpath ".;.." *.javaVisit this site (http://easai.00freehost.com/Zhuyin/index.html) to see how it runs.
土曜日, 1月 19, 2008
Character.UnicodeBlock: To obtain the character set
In line with the InputContext article the other day to alter keyboard setting and the font range, I would like to present here the following code to obtain the character set and set the locale for the InputContext.
With the use of Character.UnicodeBlock.of(char), and the returned value of the UnicodeBlock information, the locale can be set -- manually. Suppose you have a JTextArea and the cursor is on the area of the text that you want to add some input.
Bopomofo (Zhuyin) is a set of alphabets that is universally used in Taiwan. In the following code, the character under the cursor is examined and the locale is set to Locale.TAIWAN if it is a Zhuyin character.
With the use of Character.UnicodeBlock.of(char), and the returned value of the UnicodeBlock information, the locale can be set -- manually. Suppose you have a JTextArea and the cursor is on the area of the text that you want to add some input.
Bopomofo (Zhuyin) is a set of alphabets that is universally used in Taiwan. In the following code, the character under the cursor is examined and the locale is set to Locale.TAIWAN if it is a Zhuyin character.
int pos=textArea.getCaretPosition();
String text=textArea.getText();
char ch=text.charAt(pos);
Character.UnicodeBlock block=Character.UnicodeBlock.of(ch);
Locale current=Locale.US;
if(block==Character.UnicodeBlock.BOPOMOFO)
current=Locale.TAIWAN;
木曜日, 1月 17, 2008
Sun Microsystems to buy MySQL
What does it mean for us, for Sun Microsystems to buy MySQL? The answer: BB+.
→ Sun Microsystems' ratings unaffected by agreed MySQL acquisition - S&P (2008-1-17)
But for MySQL users, it's a blessing. It means (probably) formal driver supports, documentation supports and package distribution under Java JDK.
I use MySQL with a jdbc driver and from Java application, DB access is as easy as ever. Just like Java. Here is how to open a database connection.
I say, Java is wonderful. How about this? To browse through the database and print out whatever satisfies the condition, the following does the job.
I say, Java is wonderful.
...
I will declear new and then they must delete it. > obsolete programmers
But it is new you know.
...any problems? ^^
→ Sun Microsystems' ratings unaffected by agreed MySQL acquisition - S&P (2008-1-17)
But for MySQL users, it's a blessing. It means (probably) formal driver supports, documentation supports and package distribution under Java JDK.
I use MySQL with a jdbc driver and from Java application, DB access is as easy as ever. Just like Java. Here is how to open a database connection.
Class.forName(driver).newInstance();
connection = DriverManager.getConnection(openDBString+database,user,password);
statement=connection.createStatement();I say, Java is wonderful. How about this? To browse through the database and print out whatever satisfies the condition, the following does the job.
ResultSet rs = statement.executeQuery("SELECT * FROM "+tableName+condition);
ResultSetMetaData meta = rs.getMetaData();
int nCol=meta.getColumnCount();
while (rs.next())
{
String buf=template;
for(int i=1;i<=nCol;i++)
{
String columnName=meta.getColumnName(i);
System.out.println(columnName,new String(rs.getBytes(i),"UTF8"));
}
} I say, Java is wonderful.
...
I will declear new and then they must delete it. > obsolete programmers
But it is new you know.
...any problems? ^^
月曜日, 1月 14, 2008
Select and set a locale for InputContext from the available locales list
Yesterday, I wrote in this blog about InputContext and how to set the language environment. Here are some more codes for listing up all the available languages, from which you can select the Locale and set it for the InputContext for your application.
A word of caution is that not all listed locales are available for InputContext -- of those, only that has both the language code and the country code can be set to use. But once you have the array of strings for the available locales, this input dialog will do the job nicely to put all locales in scrollable pane and wait for user input. Here, names is the string array that contains the list of locales.
Perhaps it gets more clearer if you look at the code so I put it right here. Here all the locales that only have either the country code or the language code are filtered out. This is what this following code does: the list of locales will be presented and then when a value is selected, the locale will be set for the InputContext.
As of 2008-1-16, the code has been modified so that the list will be sorted out in alphabetical order.
Locale locales[]=Locale.getAvailableLocales();A word of caution is that not all listed locales are available for InputContext -- of those, only that has both the language code and the country code can be set to use. But once you have the array of strings for the available locales, this input dialog will do the job nicely to put all locales in scrollable pane and wait for user input. Here, names is the string array that contains the list of locales.
Object selectedValue = JOptionPane.showInputDialog(null,
"Select a locale", "Language",
JOptionPane.INFORMATION_MESSAGE, null,
names,names[0]);Perhaps it gets more clearer if you look at the code so I put it right here. Here all the locales that only have either the country code or the language code are filtered out. This is what this following code does: the list of locales will be presented and then when a value is selected, the locale will be set for the InputContext.
As of 2008-1-16, the code has been modified so that the list will be sorted out in alphabetical order.
public void langList(JMenuItem mi)
{
int x=mi.getX();
x+=mi.getWidth();
int y=mi.getY();
Locale locales[]=Locale.getAvailableLocales();
String names[]=new String[locales.length];
String languages[]=new String[locales.length];
String countries[]=new String[locales.length];
int index=0;
for(int i=0;i<locales.length;i++)
{
languages[index]=locales[i].getLanguage();
countries[index]=locales[i].getCountry();
if(!languages[index].isEmpty() && !countries[index].isEmpty())
{
names[index]=locales[i].getDisplayName();
index++;
}
}
int nLocales=index;
int sortedIndex[]=new int[nLocales];
String sortedNames[]=new String[nLocales];
for(int i=0;i<nLocales;i++)
sortedIndex[i]=i;
for(int i=0;i<nLocales;i++)
{
for(int j=i+1;j<nLocales;j++)
{
if(0<names[sortedIndex[i]].compareTo(names[sortedIndex[j]]))
{
int t=sortedIndex[i];
sortedIndex[i]=sortedIndex[j];
sortedIndex[j]=t;
}
}
}
for(int i=0;i<nLocales;i++)
{
sortedNames[i]=names[sortedIndex[i]];
}
if(0<nLocales)
{
Object selectedValue = JOptionPane.showInputDialog(null,
"Set Language Environment", "Language",
JOptionPane.INFORMATION_MESSAGE, null,
sortedNames,sortedNames[0]);
int i=0;
if(selectedValue!=null)
{
while(!((String)selectedValue).equals(names[i]) && ++i<nLocales);
if(i<nLocales)
{
Locale newLocale=new Locale(languages[i],countries[i]);
inputContext.selectInputMethod(newLocale);
}
}
}
}
日曜日, 1月 13, 2008
InputContext and IME
I had such an unpleasant time looking through pages about IME -- as if everybody is using languages that use alphabets only. But for the most of us who use not only alphabets but also other scripts, here are some pieces of advice. Just a few lines -- but you can control IME from Java applications.
This turns on Japanese IME. If you alter the locale to Locale.TAIWAN, or instantiate the class with language and country codes as:
then you can turn on the IME of your choice from your Java application.
InputContext inputContext=null;
inputContext=frame.getInputContext();
inputContext.selectInputMethod(Locale.JAPAN);
This turns on Japanese IME. If you alter the locale to Locale.TAIWAN, or instantiate the class with language and country codes as:
Locale locale=new Locale("hi","IN");then you can turn on the IME of your choice from your Java application.
土曜日, 12月 08, 2007
「リンクしてあるテキスト」をちりばめたマップ
最近ウィキペディアを見ていて気づいたのは、メディアの種類が増えたこと。内容の充実と共に、投稿されている音声ファイルや動画が、ネットメディアのよさをフルに生かしている。もちろん、ウィキの最大のメリットは、テキストにリンクが張られていて、気になるキーワードを深く掘り下げて検索できること。
そこで発見したのは、この「高雄市」のページにある「リンクしてあるテキスト」をちりばめたマップ。地図の画像の上に、テキストが重ねてあって、リンクが張ってある。HTMLをこのように使うと、クリッカブルマップが自然にHTMLで表現できることに、いたく感動したので、さっそくアプリを作ってみました。
なにって、このアプリ。画像を読み込んで、自由な位置にテキストを置いて、リンクを張る。これを、HTMLのコードとして出力すると、クリッカブルマップをどんなページにも埋め込めるモノで、LabelMapというプログラムを起動したら、File|Open で画像を読み込む。マウスで好きな位置をクリックして、テキストを入力。右クリックでポップアップメニューの、Set Link でURLアドレスを打ち込んで...という作業を繰り返して、書きたいテキストをすべて入力。あとは、File|Export to HTML を選択すると、該当するHTMLコードが表示されます。あとは、編集するなりコピーするなり、HTMLのページに埋め込んで利用します。
ダウンロードはこちらから。
→ LabelMap
そこで発見したのは、この「高雄市」のページにある「リンクしてあるテキスト」をちりばめたマップ。地図の画像の上に、テキストが重ねてあって、リンクが張ってある。HTMLをこのように使うと、クリッカブルマップが自然にHTMLで表現できることに、いたく感動したので、さっそくアプリを作ってみました。
なにって、このアプリ。画像を読み込んで、自由な位置にテキストを置いて、リンクを張る。これを、HTMLのコードとして出力すると、クリッカブルマップをどんなページにも埋め込めるモノで、LabelMapというプログラムを起動したら、File|Open で画像を読み込む。マウスで好きな位置をクリックして、テキストを入力。右クリックでポップアップメニューの、Set Link でURLアドレスを打ち込んで...という作業を繰り返して、書きたいテキストをすべて入力。あとは、File|Export to HTML を選択すると、該当するHTMLコードが表示されます。あとは、編集するなりコピーするなり、HTMLのページに埋め込んで利用します。
ダウンロードはこちらから。
→ LabelMap
日曜日, 12月 02, 2007
IEのツールバーを作成する
IEでは、レジストリで設定すると右クリックでアプリを登録できるが、セキュリティのためかメニューにはその機能がない。右クリックを禁止するサイトでスクリプトを走らせるには、新たなメニューバーをコンパイルしないとならない。バランスの悪い対処法といえる。
とつい思ったのだが、マイクロソフト社公式サイトでは、KBBARなるサンプルコードが置いてある。それを用いると、DLLの形式で、ツールバーが作成できる。
多少つかえたのが、COM関連のクラスであるが、ここに、ページのURLを取得するコードを記述する(エラー処理は省略)。
CComBSTR url;
m_pBand->m_pIE->get_LocationURL(&url);
さらに、選択されたテキストを取得するコードを以下に示す。
IHTMLDocument2 *pDoc;
m_pBand->m_pIE->get_Document((IDispatch**)&pDoc);
IHTMLSelectionObject *pObject;
pDoc->get_selection(&pObject);
IHTMLTxtRange *pRange;
pObject->createRange((IDispatch**)&pRange);
CComBSTR selectedText;
pRange->get_text(&selectedText);
これを走らせると、メニューではなく、ツールバーからDLLを起動できる。
とつい思ったのだが、マイクロソフト社公式サイトでは、KBBARなるサンプルコードが置いてある。それを用いると、DLLの形式で、ツールバーが作成できる。
多少つかえたのが、COM関連のクラスであるが、ここに、ページのURLを取得するコードを記述する(エラー処理は省略)。
CComBSTR url;
m_pBand->m_pIE->get_LocationURL(&url);
さらに、選択されたテキストを取得するコードを以下に示す。
IHTMLDocument2 *pDoc;
m_pBand->m_pIE->get_Document((IDispatch**)&pDoc);
IHTMLSelectionObject *pObject;
pDoc->get_selection(&pObject);
IHTMLTxtRange *pRange;
pObject->createRange((IDispatch**)&pRange);
CComBSTR selectedText;
pRange->get_text(&selectedText);
これを走らせると、メニューではなく、ツールバーからDLLを起動できる。
月曜日, 11月 26, 2007
フランスで海賊行為者のウェブアクセスを禁じる新制度
フランスで、海賊ソフトを取り締まる新制度が発表されたという。独立機関が、ネットユーザーに警告し、アカウントを停止させる可能性があるという。引き換えに、デジタル著作権管理(DRM)による保護をはずし、機種間でのプロプラエタリーな規格を禁じるという、過激な制度である。
違法ソフトの摘発は、企業などで使われている海賊版を摘発することで可能といえるが、個人に対し、違法MP3ファイルのダウンロードを検出することは現在のところ不可能である。この際、違法ファイルの保持が顕著、という指摘でさえ不可能である。ごく一部の対象を取り締まることは、法の下の平等を保障しない。つまり、ある個人を違法ソフトで摘発すると、法律の恣意的な適用となる可能性が高い。
効果的なのは、個人相手ではなく、供給側に規制をかけることである。違法ファイルを置くサイトへの警告は、少なくとも日本では行われている。中国の違法DVDの販売は、中国国内での著作権をも損なうという主張がある。訪中しているサルコジ仏大統領は、中国の著作権について言及したという。中国側の反応は伝えられていないが、効果を期待したい。
→ フランスで海賊行為者のウェブアクセスを禁じる新制度 (2007-11-26)
→ フランス政府が、オンラインの海賊行為対策のため特別機関を設置へ (2007-11-26)
→ 訪中のサルコジ仏大統領、人民元上昇を促す (2007-11-26)
違法ソフトの摘発は、企業などで使われている海賊版を摘発することで可能といえるが、個人に対し、違法MP3ファイルのダウンロードを検出することは現在のところ不可能である。この際、違法ファイルの保持が顕著、という指摘でさえ不可能である。ごく一部の対象を取り締まることは、法の下の平等を保障しない。つまり、ある個人を違法ソフトで摘発すると、法律の恣意的な適用となる可能性が高い。
効果的なのは、個人相手ではなく、供給側に規制をかけることである。違法ファイルを置くサイトへの警告は、少なくとも日本では行われている。中国の違法DVDの販売は、中国国内での著作権をも損なうという主張がある。訪中しているサルコジ仏大統領は、中国の著作権について言及したという。中国側の反応は伝えられていないが、効果を期待したい。
→ フランスで海賊行為者のウェブアクセスを禁じる新制度 (2007-11-26)
→ フランス政府が、オンラインの海賊行為対策のため特別機関を設置へ (2007-11-26)
→ 訪中のサルコジ仏大統領、人民元上昇を促す (2007-11-26)
火曜日, 11月 20, 2007
米アマゾン、電子書籍参入を発表・新聞や雑誌も入手可能
アップル社の iPod の成功は、デザインや機能もさることながら、魅力的なコンテンツを手ごろな価格で便利に入手できる、という「社会的要因」によるもの――という認識が、電子機器メーカーの経営者陣にあるかどうかは知らないが、他のMP3プレーヤーと「競争にならない」市場を作り出したアップル社の目覚しい発展は、技術を持つ各社が消費者の利便性を考えて「もう少し政治的に連動することができたら」可能である市場の開拓への感慨をもたらすものである。
このたび米アマゾンは、電子書籍に参入するという。有償で電子ブック「キンドル」を販売し、コンテンツをネット配信するという。価格設定は、書籍で9.99ドル、新聞が月5.99~14.99ドル、雑誌が月1.25~3.49ドル。OEMはHon Hai Precision Ind. Co., Ltdといい、ネット回線のキャリアはSprintだという。創業者でCEOのジェフ・ベゾス氏は、「思いついたら60秒」で本を入手できるメリットを語っているという。
ここで、電子化された書籍など、素直にデスクトップで読めばいい、というナイーブな意見の持ち主には、著作権がらみのコンテンツの利用法についての考慮を要請するものである(笑)。プロの情報を、正規ルートで入手する方法というのが、現在のインターネットでは実現していない現状があるからである。そして、さらに価格設定を含め、利便性を最優先し、著作権保護をも可能にする米アマゾンのマーケティング手法と、iPod の成功を考えて欲しい。
電子ブックで先行するソニーなどは、ネットからダウンロードして「貸本」が読める、「リブリエ」を発売していた。米国では、電子ブックリーダーとして現在も販売している。性能比較しているサイトがあるが、技術屋の物悲しさを覚えるように思う。リブリエを実践で使う利用者にとっては、投資してもいいと思わせる有益な情報が、支障なくタイムリーに入手できることが、デザインや機能より優先する、最大の懸念であるからである。
トラブル・フリーな既製品をブラックボックスで販売するのは、日本企業の得意技とされている。しかし、そこには消費者の利便性という決定的な要素が軽視されているように思える。消費者の利便性の本当の意義とは、企業による人権侵害にも似たサービスの強要を言うのではなく、あくまで「社会的」なメリット、最大多数の幸福を目指したものだという面を強調したいものである。
→ アマゾン・コム、書籍用の電子端末発売 (2007-11-20)
→ 米アマゾン、電子書籍参入を発表・新聞や雑誌も入手可能 (2007-11-21)
→ Amazonの電子ブックリーダーKindle公開、399ドル (2007-11-18)
→ Front company and OEM for Amazon Kindle is… (2007-11-19)
→ Amazon Kindle vs. Sony Reader (2007-11-19)
このたび米アマゾンは、電子書籍に参入するという。有償で電子ブック「キンドル」を販売し、コンテンツをネット配信するという。価格設定は、書籍で9.99ドル、新聞が月5.99~14.99ドル、雑誌が月1.25~3.49ドル。OEMはHon Hai Precision Ind. Co., Ltdといい、ネット回線のキャリアはSprintだという。創業者でCEOのジェフ・ベゾス氏は、「思いついたら60秒」で本を入手できるメリットを語っているという。
ここで、電子化された書籍など、素直にデスクトップで読めばいい、というナイーブな意見の持ち主には、著作権がらみのコンテンツの利用法についての考慮を要請するものである(笑)。プロの情報を、正規ルートで入手する方法というのが、現在のインターネットでは実現していない現状があるからである。そして、さらに価格設定を含め、利便性を最優先し、著作権保護をも可能にする米アマゾンのマーケティング手法と、iPod の成功を考えて欲しい。
電子ブックで先行するソニーなどは、ネットからダウンロードして「貸本」が読める、「リブリエ」を発売していた。米国では、電子ブックリーダーとして現在も販売している。性能比較しているサイトがあるが、技術屋の物悲しさを覚えるように思う。リブリエを実践で使う利用者にとっては、投資してもいいと思わせる有益な情報が、支障なくタイムリーに入手できることが、デザインや機能より優先する、最大の懸念であるからである。
トラブル・フリーな既製品をブラックボックスで販売するのは、日本企業の得意技とされている。しかし、そこには消費者の利便性という決定的な要素が軽視されているように思える。消費者の利便性の本当の意義とは、企業による人権侵害にも似たサービスの強要を言うのではなく、あくまで「社会的」なメリット、最大多数の幸福を目指したものだという面を強調したいものである。
→ アマゾン・コム、書籍用の電子端末発売 (2007-11-20)
→ 米アマゾン、電子書籍参入を発表・新聞や雑誌も入手可能 (2007-11-21)
→ Amazonの電子ブックリーダーKindle公開、399ドル (2007-11-18)
→ Front company and OEM for Amazon Kindle is… (2007-11-19)
→ Amazon Kindle vs. Sony Reader (2007-11-19)
火曜日, 11月 13, 2007
中国人ジャーナリスト逮捕事件、ヤフーが和解を決定
米ヤフーは、中国当局に提供した情報によってジャーナリストが拘束された訴訟で和解を決定したと発表したという。国境なき記者団によると、ヤフーが中国当局に提供した情報により、「ネット上の体制批判者」とされる少なくとも4人が禁固刑を受けているという。
→ 中国人ジャーナリスト逮捕事件、ヤフーが和解を決定 (2007-11-14)
→ 中国人ジャーナリスト逮捕事件、ヤフーが和解を決定 (2007-11-14)
木曜日, 11月 08, 2007
中国当局への情報提供、米公聴会でヤフーCEOに批判
メロドラマのようだ、と思ったのは、ヤフーに対する米上院委員会の茶番である。ちょっと面白いので、リンクをたどって見てみると、「いやがらせ」というのは実は法的処置をしなくてすむように、米国IT企業への弁護だということが分かる。ほら、われわれも黙ってみてるわけじゃない、と有権者に訴える目的の、「金の絡まない」(=企業にとっては時間つぶし以外の意味を持たない)制裁である。
→ 中国当局への情報提供、米公聴会でヤフーCEOに批判 (2007-11-8)
→ 中国当局への情報提供、米公聴会でヤフーCEOに批判 (2007-11-8)
火曜日, 11月 06, 2007
画像を壁紙に設定する
コードを直接ネットに載せると、「恥をさらすようだ」という意見が(笑)あるが、くだらぬことに時間を割きたくないプログラマのために、画像を壁紙にするコードを載せておく。
あまり誇れるコードでもない、というのは、情報がなくてBMPの一時ファイルにする方法しか見つからなかったせいで、ある画像を画面の大きさにして壁紙に設定するだけのコードである。
なにかの役に立つかどうか分からないし、「いちおう」などと照れる必要もないだろうが、以下がそのコードである。
void CMyView::Setasdesktopbackground()
{
CImage image;
int screenWidth=::GetSystemMetrics(SM_CXSCREEN);
int screenHeight=::GetSystemMetrics(SM_CYSCREEN);
int bpp=m_pImage->GetBPP();
if(image.Create(screenWidth,screenHeight,bpp))
{
HDC hDC=image.GetDC();
SetStretchBltMode(hDC,HALFTONE);
m_pImage->Draw(hDC,0,0,screenWidth,screenHeight);
CString fileName=L"c:\\Windows\\Web\\Wallpaper\\background.bmp";
HRESULT res=image.Save(fileName);
image.ReleaseDC();
if(!FAILED(res))
SystemParametersInfo(SPI_SETDESKWALLPAPER,NULL,
(PVOID)fileName.GetBuffer(),SPIF_UPDATEINIFILE);
}
}
あまり誇れるコードでもない、というのは、情報がなくてBMPの一時ファイルにする方法しか見つからなかったせいで、ある画像を画面の大きさにして壁紙に設定するだけのコードである。
なにかの役に立つかどうか分からないし、「いちおう」などと照れる必要もないだろうが、以下がそのコードである。
void CMyView::Setasdesktopbackground()
{
CImage image;
int screenWidth=::GetSystemMetrics(SM_CXSCREEN);
int screenHeight=::GetSystemMetrics(SM_CYSCREEN);
int bpp=m_pImage->GetBPP();
if(image.Create(screenWidth,screenHeight,bpp))
{
HDC hDC=image.GetDC();
SetStretchBltMode(hDC,HALFTONE);
m_pImage->Draw(hDC,0,0,screenWidth,screenHeight);
CString fileName=L"c:\\Windows\\Web\\Wallpaper\\background.bmp";
HRESULT res=image.Save(fileName);
image.ReleaseDC();
if(!FAILED(res))
SystemParametersInfo(SPI_SETDESKWALLPAPER,NULL,
(PVOID)fileName.GetBuffer(),SPIF_UPDATEINIFILE);
}
}
日曜日, 11月 04, 2007
MFC:プリンタ印刷をカスタマイズ
先日、MFCライブラリを使ってプリンタ印刷をカスタマイズする機会があったので、気づいたことを書いておこうと思う。
MFCでは、CScrollViewなどCView派生クラスを使えば、印刷はCView::OnFilePrint()をメニューに登録し、呼び出すだけで印刷ができる。この際には、OnPreparePrinting()を再定義してDoPreparePrinting()の一行を記述する必要がある。CView::OnFilePrintPreview()を使えば何を変更することもなくプレビューができる。
縦横(Portrait/Landscape)など印刷する紙の向きなどカスタマイズする際には、CWinApp派生クラスで定義されている、m_hDevModeを変更する必要がある。m_hDevModeは外部からアクセスできないため、CWinApp派生クラスで値を変更せねばならない。つまり、このようなコードを書かねばならない。
void CMyApp::SetOrientation(short orientation)
{
CPrintDialog printDlg(FALSE);
BOOL bRet=GetPrinterDeviceDefaults(&prinDlg.m_pd);
if(bRet)
{
DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(m_hDevMode);
pDevMode->dmOrientation=orientation;
::GlobalUnlock(m_hDevMode);
}
}
CView派生クラスでは、DoPreparePrinting()を呼び出す前にCWinApp派生クラスで定義された上記のSetOrientation()を呼ぶと、紙の向きがカスタマイズできる。
BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
{
int imageWidth=m_pImage->GetWidth();
int imageHeight=m_pImage->GetHeight();
CPhotoAlbumApp* pApp=(CMyApp*)AfxGetApp();
short orientation=DMORIENT_PORTRAIT;
if(imageHeight<imageWidth)
orientation=DMORIENT_LANDSCAPE;
pApp->SetOrientation(orientation);
return DoPreparePrinting(pInfo);
}
上記のコードでは、m_pImageで指定されているCImageの縦横の長さに応じて、デフォルトでの紙の向きが指定される。
流れとしては、OnFilePrint()では、OnPreparePrinting()が呼び出され、OnPreparePrinting()を再定義してDoPreparePrinting()を呼び出すと、そこではDoPrintDialog()が呼ばれ、その際にはCWinApp派生クラスのm_hDevModeが指定されるので、OnPreparePrinting()においてDoPreparePrinting()の前にm_hDevModeを指定することになる。
MFCでは、CScrollViewなどCView派生クラスを使えば、印刷はCView::OnFilePrint()をメニューに登録し、呼び出すだけで印刷ができる。この際には、OnPreparePrinting()を再定義してDoPreparePrinting()の一行を記述する必要がある。CView::OnFilePrintPreview()を使えば何を変更することもなくプレビューができる。
縦横(Portrait/Landscape)など印刷する紙の向きなどカスタマイズする際には、CWinApp派生クラスで定義されている、m_hDevModeを変更する必要がある。m_hDevModeは外部からアクセスできないため、CWinApp派生クラスで値を変更せねばならない。つまり、このようなコードを書かねばならない。
void CMyApp::SetOrientation(short orientation)
{
CPrintDialog printDlg(FALSE);
BOOL bRet=GetPrinterDeviceDefaults(&prinDlg.m_pd);
if(bRet)
{
DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(m_hDevMode);
pDevMode->dmOrientation=orientation;
::GlobalUnlock(m_hDevMode);
}
}
CView派生クラスでは、DoPreparePrinting()を呼び出す前にCWinApp派生クラスで定義された上記のSetOrientation()を呼ぶと、紙の向きがカスタマイズできる。
BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
{
int imageWidth=m_pImage->GetWidth();
int imageHeight=m_pImage->GetHeight();
CPhotoAlbumApp* pApp=(CMyApp*)AfxGetApp();
short orientation=DMORIENT_PORTRAIT;
if(imageHeight<imageWidth)
orientation=DMORIENT_LANDSCAPE;
pApp->SetOrientation(orientation);
return DoPreparePrinting(pInfo);
}
上記のコードでは、m_pImageで指定されているCImageの縦横の長さに応じて、デフォルトでの紙の向きが指定される。
流れとしては、OnFilePrint()では、OnPreparePrinting()が呼び出され、OnPreparePrinting()を再定義してDoPreparePrinting()を呼び出すと、そこではDoPrintDialog()が呼ばれ、その際にはCWinApp派生クラスのm_hDevModeが指定されるので、OnPreparePrinting()においてDoPreparePrinting()の前にm_hDevModeを指定することになる。
火曜日, 10月 30, 2007
ヤフー検索には「アダルトフィルタ」がついている。
ヤフー検索は、グーグルの向うを張って努力しているらしい。言語指定がグーグルより正確であるのみならず、ヤフー検索には「アダルトフィルタ」がついている。高・中・低とフィルタのレベルを指定するようになっている。デフォルトでは中になっている。
言語指定がいいかげん、というのは、言葉に思い入れのある人間には重大な欠陥で、「我輩は猫である」の英訳を考えれば分かるように、翻訳で失われる情報は考えられているよりも大きい。「天下り」の英訳はgolden parachuteだという。パラシュートでは、失われる血税のにおいが伝わらない。
天下りは、恩義の貸し借りではなく、組織だった官僚と業界との癒着である。現職時代に予算を約束し、退職後に天下って団体から退職金その他で億円を稼ぐ。恩義を返す「必要」はないので結局は組織的な癒着、賄賂である。
→ 防衛省、613人天下り 山田洋行含む242社に (2007-11-6)
ところで、IE7のグーグルバーには、グーグル・サジェスト機能がデフォルトではついていない。
言語指定がいいかげん、というのは、言葉に思い入れのある人間には重大な欠陥で、「我輩は猫である」の英訳を考えれば分かるように、翻訳で失われる情報は考えられているよりも大きい。「天下り」の英訳はgolden parachuteだという。パラシュートでは、失われる血税のにおいが伝わらない。
天下りは、恩義の貸し借りではなく、組織だった官僚と業界との癒着である。現職時代に予算を約束し、退職後に天下って団体から退職金その他で億円を稼ぐ。恩義を返す「必要」はないので結局は組織的な癒着、賄賂である。
→ 防衛省、613人天下り 山田洋行含む242社に (2007-11-6)
ところで、IE7のグーグルバーには、グーグル・サジェスト機能がデフォルトではついていない。
登録:
投稿 (Atom)
Flask の Blueprint のテンプレート問題
Flask の Blueprint は、ルート、静的ファイル、テンプレートをまとめて管理できます。しかし、テンプレートが指定できません。 ここでは、Blueprint の template_folder の問題点と回避策を説明します。 Blueprint のテンプレート問題...
-
Qt はまってます。Mac でも書いたアプリがコンパイルできて、しっかり動くのを確認しました。このあいだ Chitubox が Qt 使ってるのを知ってうれしかったです。 Mac でもそのまま動くんですが、アプリのアイコンの設定はプラットフォーム依存です。 公式マニュアルでも設定...
-
コンデンサマイク 極性があります コンデンサマイクがようやく届きました。モジュールではないのでそのままでは信号が弱いので使えません。信号を増幅する必要があります。 ちょっとした手間ですが、首尾よく動いてくれました。この回路の応用で、使えるマイクが出来ます。 ...
-
今日ホール素子が届きました。 ホール素子ってのは ホール効果 を利用して磁場を感知するセンサーです。 iPad のケースとか、閉じると電源が切れてくれますよね。ケースのカバーの磁石の磁場をホール素子が感知してるわけです。 さっそくホール素子を使ってみよう!電圧...