参考ページ
日本語化
$sudo apt-get install chromium-browser-l10n
※文字フォントがおかしくなるため、インストール後手動で設定する必要があった。また、日本語化しきれていない部分が随所にある。
Developer Toolsのインストール
$sudo apt-get install chromium-browser-inspector
※FirefoxでいうところのFirebugみたいなもの。比較対象がないため、良いのか悪いのか分からない。
2009年9月30日水曜日
2009年9月28日月曜日
Chrome OSをUSBメモリにインストールする
インストールの作業はUbuntuに似ており、Ubuntuをインストールしたことがあるなら難なく行える。ただし、どんな不具合があるか分からないのでHDDは外しておいた方が無難な感じ。
時間を計測していないが、インストール作業自体は30~40分くらい。
使ってみた印象としては、まだまだ使い物にはならないという感じ。期待して使うとかなりガッカリする。っていうかこれホントにChrome OSなのかな?何か騙されている気がする。
参考ページによるとFakeだそうです。確信は無いけど、そっちの方が確率高い気がする。
Google Chrome OS Betaがダウンロード可能になったので試してみる。
手順は大まかに
1.isoイメージのダウンロード
2.LiveCDの作成
3.HDDを抜いておく
4.LiveCDの起動
5.USB(4GB)にインストール
で順調に進んでくれればいいなと思っている。特に工程の5が。
2009年9月25日金曜日
boost c++のインストール(UNRでの場合)
boost c++のダウンロード
解凍してディレクトリに入る
$ ./bootstrap.sh --prefix=/usr/ --with-libraries=all
$ sudo ./bjam install
/usr/includeにboostというディレクトリが作成され、/usr/libにlibboost_regex.aのようなboost関係の静的ライブラリが作られる。
環境変数に
CPLUS_INCLUDE_PATH=/usr/include
LD_LIBRARY_PATH=/usr/lib
を追加
解凍してディレクトリに入る
$ ./bootstrap.sh --prefix=/usr/ --with-libraries=all
$ sudo ./bjam install
/usr/includeにboostというディレクトリが作成され、/usr/libにlibboost_regex.aのようなboost関係の静的ライブラリが作られる。
環境変数に
CPLUS_INCLUDE_PATH=/usr/include
LD_LIBRARY_PATH=/usr/lib
を追加
2009年9月10日木曜日
Chromiumの拡張機能について
参考ページ
9月10日。どうやら拡張機能のAPIの準備が整ったようだ。ただし、冒頭にこんな文がある。
原文:This tutorial requires Windows. You can try it on Linux and OS X, and it might work, but the extensions support is less stable on those platforms. We're working hard to bring them up to speed.
訳:このチュートリアルはWindows向けです。Linux,Macでは、もしかしたら何とかできるかもしれませんが、基本まだ無理です。できるようになるように頑張ってます。
頑張ってください。期待して待ってます。
9月10日。どうやら拡張機能のAPIの準備が整ったようだ。ただし、冒頭にこんな文がある。
原文:This tutorial requires Windows. You can try it on Linux and OS X, and it might work, but the extensions support is less stable on those platforms. We're working hard to bring them up to speed.
訳:このチュートリアルはWindows向けです。Linux,Macでは、もしかしたら何とかできるかもしれませんが、基本まだ無理です。できるようになるように頑張ってます。
頑張ってください。期待して待ってます。
2009年9月9日水曜日
GAE/Jでのformについて
<form action="/write" method="post" enctype="multipart/form-data">
<input type="text" name="userid" />
<input type="submit" value="push" />
</form>
enctypeでスラッシュを使うとなぜかrequest.getParameter("○○○");でデータの取得が出来ない。
<form action="/write" method="post" enctype="multipart-form-data">
<input type="text" name="userid" />
<input type="submit" value="push" />
</form>
enctypeでハイフンを使うとrequest.getParameter("○○○");でデータの取得ができる。
何でなんだろうか?
2009年8月23日日曜日
GAE/Jでアップロードした画像をデータストアに保存し、imgタグに出力する
upload.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"UploadTest.javaにアップロードしたファイルをPostリクエストで送信
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TEMPLATE</title>
</head>
<body>
<form action="/upload" method="post" enctype="multipart/form-data">
アップロードするファイル : <input type="file" name="imgfile" /><br>
<input type="submit" value="upload" />
</form>
<img src="/indication" alt="imgfile" />
</body>
</html>
package org.test;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import java.util.logging.Logger;
import javax.jdo.PersistenceManager;
import org.test.DataStImg;
import org.test.PMF;
public class UploadTest extends HttpServlet {
private static final Logger log =
Logger.getLogger(UploadTest.class.getName());
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
PersistenceManager pm = PMF.get().getPersistenceManager();
final int size = 50000;
try{
ServletFileUpload upload = new ServletFileUpload();
upload.setSizeMax(size);//50KBの制限
FileItemIterator iterator = upload.getItemIterator(req);
while (iterator.hasNext()) {
FileItemStream item = iterator.next();
InputStream stream = item.openStream();
if(item.isFormField()){
log.warning("Got a form field: " + item.getFieldName());
} else {
log.warning("Got an uploaded file: " + item.getFieldName() +
", name = " + item.getName());
//ここからが大変だった。
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
int i = 0;
byte[] buffer = new byte[1024];
while( (len = stream.read(buffer, 0, buffer.length)) != -1){
out.write(buffer, 0, len);
}
byte[] b = out.toByteArray();
//直す気力ないけどファイル名を取得して
//contentに入れればファイル名をキーに画像を呼び出せる。
String content = "content";
DataStImg ds = new DataStImg(content, b);
pm.makePersistent(ds);
pm.close();
resp.sendRedirect("/html/upload.html");
}
}
}
catch(Exception ex){
throw new ServletException(ex);
}
}
}
package org.test;Google app engineのFAQのところにあったコードを参考に作成。DataStImg.javaに画像データを保存し、再びupload.htmlにリダイレクト。imgタグsrc属性にservletを呼び出すためのURLを指定しておく。IndicationImg.javaにGETリクエストが送信される。
import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.datastore.Blob;
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class DataStImg {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private Blob blob;
@Persistent
private String content;
public DataStImg(String content, byte[] buffer) {
blob = new Blob(buffer);
this.content = content;
System.out.println("In DataStImg");
}
public Long getId() {
return id;
}
public byte[] getImg() {
return blob.getBytes();
}
public String getContent() {
return content;
}
public void setImg(byte[] buffer) {
this.blob = blob;
}
public void setContent(String content) {
this.content = content;
}
}
package org.test;これで画像が表示される。
import java.util.List;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;
import javax.jdo.PersistenceManager;
import org.test.DataStImg;
import org.test.PMF;
public class IndicationImg extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException, ServletException {
resp.setContentType("image/png");
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
String query = "select from " + DataStImg.class.getName();
Listdss = (List ) pm.newQuery(query).execute();
if (dss.isEmpty()) {
resp.sendRedirect("/html/upload.html");
} else {
for (DataStImg ds : dss) {
byte[] b = ds.getImg();
BufferedInputStream in = new BufferedInputStream(
new ByteArrayInputStream(b));
ServletOutputStream out = resp.getOutputStream();
int len;
while( (len = in.read(b, 0, b.length)) != -1) {
out.write(b, 0, len);
}
out.close();
in.close();
//まずは何番目の画像とか細かいこと考えず、
//とにかく最初に入れた画像を表示する
break;
}
}
}
catch(Exception e){
e.printStackTrace();
}
finally{
pm.close();
}
}
}
登録:
投稿 (Atom)