lin.bin
lin.binをlin.bin.exeにして
ipアドレスの10進数表示で実行するとエミュ鯖に接続できた
javaソース的には
String ip = "192.168.1.7"; String sp[] = ip.split("\\."); long ip0 = Integer.parseInt(sp[0]); long ip1 = Integer.parseInt(sp[1]); long ip2 = Integer.parseInt(sp[2]); long ip3 = Integer.parseInt(sp[3]); long newip = (ip0 << 24) + (ip1 << 16) + (ip2 << 8) + (ip3); System.out.println("newip="+newip);
たとえば、127.0.0.1なら
Lin.bin.exe 2130706433
192.168.1.7なら
Lin.bin.exe 3232235783
アセンブラ
jz
ZFフラグがセットされている場合にジャンプ
jnz
ZFフラグがセットされていない場合にジャンプ
jmp
無条件ジャンプ
rpmでproxy越え
rpm --httpproxy proxy.hogehoge --httpport 8080 -Uvh http://ほげほげ
Linux ネットワークインストールする際にproxy越えしたい
超えたいproxyより手前にapacheを入れる必要がある。
自分の場合、CentOSのネットワークisoをVMWarePlayerでインストールし、ホストマシンの
apache(既に導入済み)に設定変更で対応
# local proxyを立てる設定
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_module modules/mod_proxy.so
ProxyRequests Off
Order deny,allow
Allow from all
ProxyPass /Linux/centos http://ftp.riken.jp/Linux/centos
ProxyPassReverse /Linux/centos http://ftp.riken.jp/Linux/centos
ProxyRemote * http://proxy.ほげほげ:8080
# local proxy
proxy.ほげほげ:8080は超えたいproxyです。
インストール時には、FTPサイト名をapacheをインストールしたマシンのipadoress(例192.168.1.1)
CentOSディレクトリ:/Linux/centos/5.5/os/i386
とするとうまく行った
CentOS yumでproxy越え
/etc/yum.conf に以下のように記述する
proxy=http://プロキシサーバ名:プロキシポートNo
proxy_username=プロキシ認証ユーザ
proxy_password=プロキシ認証パスワード
認証が必要なければ、proxy_usernameとproxy_passwordは必要なし
0.8.2からのSAStrutsの設定
app.diconにmobylet.diconを記述する。
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.4//EN" "http://www.seasar.org/dtd/components24.dtd"> <components> <include path="convention.dicon"/> <include path="aop.dicon"/> <include path="j2ee.dicon"/> <include path="s2jdbc.dicon"/> <include path="mobylet.dicon"/> <component name="actionMessagesThrowsInterceptor" class="org.seasar.struts.interceptor.ActionMessagesThrowsInterceptor"/> </components>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <context-param> <param-name>sastruts.VIEW_PREFIX</param-name> <param-value>/WEB-INF/view</param-value> </context-param> (中略) <!-- MobyletFilter Start --> <filter> <filter-name>mobyletfilter</filter-name> <filter-class>org.seasar.mobylet.http.S2MobyletFilter</filter-class> </filter> <filter-mapping> <filter-name>mobyletfilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <!-- MobyletFilter End --> <filter-mapping> <filter-name>encodingfilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 以下省略
これで以下のようにするとDIされる。
@Resource protected Mobylet mobylet; @Execute(validator = false) public String index() { mobylet.getUid() }
DIされてなくても
MobyletFactory.getInstance().getUid();
も可能なようです。
Diffライブラリを使って文字単位での差分
http://sweetbat.ddo.jp/miraque/で、投稿内容の異なる部分を色分けするようにしたいと思い文字単位でのDiff(差分)を抽出できるライブラリを探していました。
例)
元:あいうえおう
先:あいかえおう
ネットでいろいろ調べていると行単位や配列の差分抽出できるライブラリしかなくどうしようかと思ったんだけど、ものは考えようでした。
自分が考えたのは文字列を1文字づつ分割して配列にしてDiffライブラリをかまして、またくっつけるということです。
スマートなやり方かどうかはわからないけどそれで一応実現した。
自分のサイトは携帯サイトなので半角カナも考慮したソースになっていますが以下のようにしました。
package miraque.utils; import java.util.ArrayList; import java.util.List; public class DiffUtil { private String _moto; private String _saki; /** * コンストラクタ */ public DiffUtil() { _moto = ""; _saki = ""; } /** * コンストラクタ * * @param moto * @param saki */ public DiffUtil(String moto, String saki) { _moto = moto; _saki = saki; } /** * 差分を計算する */ public void exec() { String[] motosp = split(_moto); String[] sakisp = split(_saki); _moto = ""; _saki = ""; @SuppressWarnings("unchecked") List<Difference> differenceList = new Diff( motosp, sakisp ).diff(); for ( Difference o : differenceList ) { setcolor(o.getDeletedStart(), o.getDeletedEnd(), motosp); setcolor(o.getAddedStart(), o.getAddedEnd(), sakisp); } for (String s : motosp) { _moto += s; } for (String s : sakisp) { _saki += s; } } /** * 半角カタカナの濁点、半濁点を1文字として分割 * * @param str * @return */ private String[] split(String str) { List<String> arr = new ArrayList<String>(); for (int i=0; i < str.length(); i++) { String s = str.substring(i, i+1); String t=""; try { t = str.substring(i+1, i+2); } catch (Exception e) { ; } if ("゙".equals(t) || "゚".equals(t)) { s = str.substring(i, i+2); i++; } arr.add(s); } return arr.toArray(new String[0]); } /** * 差分部分を赤色に変更 * * @param start * @param end * @param sp */ private void setcolor(int start, int end, String[] sp) { if (sp.length > start && end != -1) { sp[start] = "<font color=\"RED\">" + sp[start]; sp[end] = sp[end] + "</font>"; } } /** * @return _moto */ public String getMoto() { return _moto; } /** * @return _saki */ public String getSaki() { return _saki; } }
参考ページ
http://d.hatena.ne.jp/reiro/20080225/javadiff
id:reiro:20080225#javadiff