Archive for the ‘Software’ Category.

osx / mac : use ssh tunnel / ssh proxy 說明

先找 osx 這個軟體 ssh secret socks , download : http://nihilex.com/secret-socks

 

螢幕快照 2011 12 31 上午8 53 07

 

如這頁說明裝好 ssh secret socks 
http://www.pairsdoll.com/secret-socks.html/

 

在 OSX 的 網路 setting 那邊應該 這軟體會幫忙設好, 若沒有就照下面畫面設定

螢幕快照 2011 12 31 上午10 42 36

 

 

那頁假設是用 local 的 SOCKS PORT 是 9999 那麼 Firefox 的 設定就這樣設定

螢幕快照 2011 12 31 上午9 15 13

 

 

Protected: [memo] 標準前台安裝 , SOP , steps

This post is password protected. To view it please enter your password below:


HTML5 畫統計圖的 library RGraph

Apache 是 Internet 世界最偉大的 project

以前 打 www.apache.org 可能就是看到 apache web server 的 download , document ….等等, 但隨著越來越多開發者把他們的 project 標記成 apache license , apache 於是變成一個巨大的 project 集中地 – The Apache Software Foundation ….

apache web server 是排名第一的 web server 這不用說, 今天認識了 Lucene , Solr 這個應該算是 apache 第二大

Apache Lucene Java 分類是 database
http://projects.apache.org/projects/lucene_java.html

Apache Solr 是被分類在 web-framework, network-server
http://projects.apache.org/projects/solr.html

 

很強的 Message Broker : ActiveMQ

Supports a variety of Cross Language Clients and Protocols from Java, C, C++, C#, Ruby, Perl, Python, PHP

Features : http://activemq.apache.org/features-overview.html

Use subversion on Dropbox steps

這麼一來, 可以用 Dropbox 的地方就可以輕鬆的 check out code 了 (y)

Continue reading ‘Use subversion on Dropbox steps’ »

Subversion Server Notes

kvm / qemu simple command

建立一個新的  image : qemu-img create winxp.raw 8GB

啟動一個 guest os 用 VNC 連接 : kvm –hda winxp.raw –cdrom /dev/cdrom –vnc :2

[下午 02:21:04] _RTN gillight: 如果有 適合的 CPU 的話
[下午 02:21:11] _RTN gillight: KVM 會有些優勢
[下午 02:21:26] _RTN gillight: 1. 近似 native 的 CPU 利用
[下午 02:22:03] _RTN gillight: 2. 近似 native 的網路利用 (KVM的半虛擬化驅動程式)
[下午 02:22:23] _RTN gillight: 3. 近似 native 的硬碟利用 (也是KVM的半虛擬化驅動程式)
[下午 02:22:50] _RTN gillight: 4. 動態縮放guest主機的實體記憶體大小
[下午 02:23:56] _RTN gillight: 然後剛剛說的那個 library 叫做 libvirt
[下午 02:26:05] _RTN gillight: 剛剛應該可以參考這個網頁
[下午 02:26:06] _RTN gillight: https://help.ubuntu.com/10.04/serverguide/C/libvirt.html

[下午 02:26:58] _RTN gillight: virt-viewer  是官方推薦的 GUI
[下午 02:27:02] _RTN gillight: 但我沒用過
[下午 02:27:42] _RTN gillight: 我還是覺得要管一堆虛擬機器的話 webUI 還是最方便的
[下午 02:27:51] Rimmon 2.0: (y)
[下午 02:27:59] Rimmon 2.0: 有喵到
[下午 02:28:51] _RTN gillight: 我自己現在適用 VirtualBox
[下午 02:28:57] _RTN gillight: 本來是昇陽的產品
[下午 02:29:11] _RTN gillight: 現在變成萬惡甲骨文的了
[下午 02:37:52] Rimmon 2.0: 對呀, 一開 virtualbox 就看到 oracle ….
[下午 02:38:20] _RTN gillight: 更囧的事
[下午 02:38:29] _RTN gillight: 開 java 也會看到 oracle
[下午 02:38:38] Rimmon 2.0: 有點嚇一跳
[下午 02:39:03] Rimmon 2.0: 不是,  還有更囧的事
開 mysql 也會看到 oracle Orz
[下午 02:39:05] _RTN gillight: 還導致 Eclipse 死當
[下午 02:39:53] _RTN gillight: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6969236
[下午 02:40:44] _RTN gillight: 因為急著改名導致程式死當的案例…..
[下午 02:40:56] Rimmon 2.0: 這就是 hardcode 的結果呀
[下午 02:41:22] _RTN gillight: :P 的確是

把 wordpress blog 立即變成 mobile friendly 的套件

阿毛介紹的: http://mobilepress.co.za/

裝好後它會偵測 user 的 user agent 若是 mobile 就會把頁面換成 ‘手機’ 版.

Online 畫草圖工具 / Online draft editing tools

我的第一隻 iPhone 程式 – HelloMap !

hellomap2

這隻程式會展現一個地圖, 並以目前定位的座標為中心點, 及一個按鈕,按下按鈕會把座標及UDID傳送到 server , 由 server 端的程式記錄下來, 並且 server 端亂數送出一個水果名回傳給 iPhone client 端, iPhone client 端再把這水果名 show 在 iPhone screen上.

底下是片斷程式碼:

FirstViewController.h :

#import 
#import

#import 

@interface FirstViewController : UIViewController  {
  IBOutlet MKMapView *mapView;
  CLLocationManager *locationManager;
  CLLocation *currentLocation;

}

- (IBAction) updateLocation;

@end

 

FirstViewController.m :

- (void)viewDidLoad {
  [super viewDidLoad];

  if (locationManager==nil) {
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
  }

  [locationManager startUpdatingLocation];

  [mapView setMapType:MKMapTypeStandard];
}

- (void)locationManager:(CLLocationManager *)manager
  didUpdateToLocation:(CLLocation *)newLocation
       fromLocation:(CLLocation *)oldLocation {

  NSLog(@"Location : %.6f , %.6f", newLocation.coordinate.latitude , newLocation.coordinate.longitude );

  MKCoordinateRegion region = [mapView region];

  region.center = newLocation.coordinate;

  MKCoordinateSpan span;
  span.latitudeDelta = 0.01;
  span.longitudeDelta = 0.01;
  region.span = span;
  [mapView setRegion:region animated:TRUE];

  //
  if ( currentLocation != nil) {
    [currentLocation release];
    currentLocation = nil;
  }
  currentLocation = [newLocation copy];

}
- (IBAction) updateLocation {

  if(currentLocation==nil)
    return;

  UIDevice *device=[[UIDevice alloc] init];

  NSString *URLString=[[NSString alloc] initWithFormat:@"http://z.monster.tw/save_location.php?lat=%.6f&lng=%.6f&id=%@"
             ,currentLocation.coordinate.latitude
             ,currentLocation.coordinate.longitude
             ,device.uniqueIdentifier];

  [device release];

  NSLog(@"%@",URLString);

  // Send Request
  NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:[URLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]
                       cachePolicy:NSURLRequestReloadIgnoringCacheData
                     timeoutInterval:20.0]; 

  NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
  NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];

  NSLog(@"%@",returnString);  

  // Display AlertView
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:returnString message:@"Thanks!"
                           delegate:self cancelButtonTitle:@"Close" otherButtonTitles: nil];
  [alert show];
  [alert release];  

  [returnString release];
}

Protected: Web Design Blog, Tutorials and Inspiration

This post is password protected. To view it please enter your password below:


Maximum Availability Architecture – Oracle Streams Configuration Best Practices

Oracle doc PDF URL : http://dn.monster.tw/my/docs/oracle/MAA_10gR2_Streams_Configuration.pdf

Oracle® Streams Advanced Queuing User’s Guide and Reference
10g Release 2 (10.2) –
http://download.oracle.com/docs/cd/B19306_01/server.102/b14257/toc.htm

sample memo: http://www.monster.com.tw/archives/2565

Oracle Maximum Availability Architecture – Overview – http://www.oracle.com/technology/deploy/availability/htdocs/maaoverview.html

[設定/memo] PL/SQL Developer , plsql 免設 tnsname 檔的方法

在 Database 那格用這種格式: IP_ADDRESS/SERVICE_NAME

擷取PLSQL

key / value database’ performance compare – 查詢 對照表效能 PK 賽

 

From URL : http://anyall.org/blog/2009/04/performance-comparison-keyvalue-stores-for-language-model-counts/

 

architecture name speed (tweets/sec)
in-memory, within-process python dictionary 2700
on-disk, within-process tokyo cabinet hashtable 1400
on-disk, within-process berkeleydb hashtable 340
on-disk, over socket tokyo tyrant, binary protocol 225
in-memory, over socket memcached 120
in-memory, over socket tokyo tyrant, memcached protocol 85
on-disk, over socket tokyo tyrant, memcached protocol 85
on-disk, over socket memcachedb 0.5

memcache 的測試值跟我測得的數據接近(我用 100K 的 data測)

為了避免該資料不見, 搜藏/節錄一下重點:

More details on the options:

  • Python dictionary: defaultdict(int) is the simplest and most obvious implementation. It’s the baseline and the fastest. This is the best option for many types of experimental NLP code, since it can just be serialized to disk for use later. Only if you want many processes to build it concurrently and incrementally, or want many processes to access the model but not have to hold it in their own process space, do the other options start becoming relevant.
  • BerkeleyDB: a well-known key/value store that I’ve used for a while. Unfortunately it’s been removed from the Python distribution, and there are often version hell issues every time I see people try to use it. (Every Linux/Unix seems to carry a different version, and they’re all not compatible with each other.)
  • Tokyo Cabinet is a newish key/value store that has some impressive benchmarks. I just learned about it from Leonard’s post, and I also found it to be excellent. If Cabinet keeps being so awesome, I might never use BerkeleyDB again. (Though installation issues are worse than BerkeleyDB since it’s new enough to not be a common package; e.g. I found it on MacPorts but not Debian.)
  • Memcached: The most standard in-memory key/value for use over sockets. Usually used for caching results from database queries for web applications — because in-memory caching is way faster than hitting disk on a database query. All data in a Memcached disappears if you turn it off. Clients talk to it via a plaintext protocol over sockets.
    • The fact it was slower than the dictionary or BDB or Cabinet means that the communication overhead was high. The nice thing about Memcached for keeping running counts like this is that it should distribute well: have lots of different processes/machines processing data and asking a central Memcached cluster to increment counters. It might be a little unfair to compare Memcached performance to BerkeleyDB or Cabinet, since it’s designed for the situation of communicating with many clients at once. It’s usually considered a win if Memcached is faster than a parallel-ly accessed RDBMS, which is very much the case.
    • I wonder how this architecture would compare to a Hadoop/HDFS/MapReduce for batch-job term counting performance. Jimmy Lin & other Maryland folks wrote an interesting report (2009) about using Memcached during a Hadoop job in a similar way for, among other things, this same language model use case. In general, lots of machine learning algorithms really don’t parallelize very well in the MapReduce architecture; parameter updates in Gibbs sampling, EM, and any online algorithm (e.g. SGD) are other examples. (An earlier paper on a better-than-mapreduce approach for EM parameters: Jason Wolfe et al. 2008; slides, paper.) A Memcached-like system could be a component of more client-server-ish parallel processing models for these use cases.
    • Note of warning: there are actually 3 different Python libraries to talk to Memcached: (1) memcache.py aka python-memcached; (2) cmemcache which wraps the C library libmemcache, and (3) cmemcached.pyx aka python-libmemcached write wraps a different C library, libmemcached. For each one, the X in import X correlates quite poorly to the project’s name. Bleah. Option #3 seems newest, or at least has the best-maintained websites, so I used that.
  • MemcacheDB is a BerkeleyDB-backed, Memcached-protocol server. Initially I had hoped it was just Memcached over BDB. Unfortunately this is clearly not the case. Its name is so similar yet its effectiveness is so different than Memcached! As Leonard points out, there are lots of half-assed solutions out there. It’s easy for anyone to create a system that works well for their needs, but it’s harder to make something more general.
  • Tokyo Tyrant is a server implemented on top of Cabinet that implements a similar key/value API except over sockets. It’s incredibly flexible; it was very easy to run it in several different configurations. The first one is to use an in-memory data store, and communicate using the memcached protocol. This is, of course, *exactly* comparable to Memcached — behaviorally indistinguishable! — and it does worse. The second option is to do that, except switch to an on-disk data store. It’s pretty ridiculous that that’s still the same speed — communication overhead is completely dominating the time. Fortunately, Tyrant comes with a binary protocol. Using that substantially improves performance past Memcached levels, though less than a direct in-process database. Yes, communication across processes incurs overhead. No news here, I guess.

I can’t say this evaluation tells us too much about the server systems, since it’s all for a single process, which really isn’t their use case. It is interesting, however, to see that memcached’s plaintext protocol causing a big performance hit compared to a binary one. There’s a lot of talk and perhaps code for a binary memcached protocol, but I couldn’t find any docs suggesting whether it currently works. Tyrant seems to work great.

The biggest takeaway is that Tokyo Cabinet is awesome. It has very complete English language documentation — something sadly lacking in many otherwise fine Japanese open-source projects — and appears to be highly performant and very flexible. This presentation by its author (Mikio Hirabayashi) shows a pretty impressive array of different things the suite of packages can do. At the very least, I’ll probably abandon BerkeleyDB if Cabinet keeps working so well; and hopefully, distribution and remote access will be easy to add via Tyrant.

Final note: it’s interesting how many of these new low-latency datastore systems come out of open-sourced projects from social network companies. Tokyo Cabinet/Tyrant is from Mixi, a large Japanese social networking site; Cassandra is from Facebook; and Voldemort is from LinkedIn. (Hadoop HDFS, approximately from Yahoo, is another open-source non-rdbms distributed datastore, though it’s not really low-latency enough to be comparable.) Then there are lots of commercial low-latency and distributed systems for data warehousing (oracle greenplum vertica aster…) but all these large web companies seem happy open-sourcing their infrastructure. This is great for me, but sucks to be a database company.

裝好 oracle 後 啟用 Enterprise Manager 後的 license 訊息畫面

用 VMware Infrastructure Client 遇到

Protected: amazon ec2 實作參考資料

This post is password protected. To view it please enter your password below:


不錯的配色網站 – design your own palette / pattern / color

[monster] monster.tw 記錄 / memo / ubuntu / 裝 圖形介面 / GUI / gnome desktop / ip address / setting

昨天晚上去一位朋友公司幫忙用他們的 server , 回來就想要做幾件事:

1. 記錄一下自己的 server 某些重要檔案, 也可供其他人參考

2. 備份重要 file

3. 隨時準備好最新版的救援CD/Live CD/Live USB , 最新版的 Monster LAMP pack 也要燒好收著.

4. 準備一個 “萬用” 含各類 driver 的 linux kernel , 以供救援使用.

5. 搞懂 booting steps / GRUB setting


a93c35eaf5a0019c7f7a42f461dae3de

root@park:~# cat /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#              

proc            /proc           proc    defaults        0       0
# / was on /dev/sda1 during installation
UUID=46312252-8925-4e60-ab5f-af240b4b440f /               ext3    relatime,errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=bf9a64f1-3eb8-433c-8311-8d971be82dc2 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

service / daemon 管理工具

sysv-rc-conf text based utility :

sudo apt-get install sysv-rc-conf

另一套 GUI

sudo apt-get install gnome-system-tools

monster.tw 是裝這個 apt-get install rcconf

列出 runlevels 的 program : chkconfig

裝 圖形介面 / GUI / gnome desktop

sudo apt-get install ubuntu-desktop --no-install-recommends

啟動 desktop manager :

/etc/init.d/gdm start

stop x server / 關掉 x window: /etc/init.d/gdm stop

改 IP address

cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 172.30.0.42
        netmask 255.255.255.0
        network 172.30.0.0
        broadcast 172.30.0.255
        gateway 172.30.0.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 8.8.8.8
        dns-search monster.tw

重新啟動 networking
/etc/init.d/networking restart

若要使用 DHCP 的話

auto eth0
iface eth0 inet dhcp

加上 default route

gateway 1.2.3.4

或另一個 static route

up route add -net 1.2.3.0 netmask 255.255.255.0 gw 1.2.3.4

change host name:

改 /etc/hostname
改 /etc/hosts

若是用 vmware 之類的軟體導致 clone 出來的 ubuntu 網路 interface 跑掉, 可以砍掉
/etc/udev/rules.d/70-persistent-net.rules
後 reboot , 就可以解決了.