<?xml version="1.0" encoding="iso-8859-1"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
	<channel>
		<title>Joomla! powered Site</title>
		<description>Joomla! site syndication</description>
		<link>http://www.phamngochai.net</link>
		<lastBuildDate>Wed, 08 Feb 2012 22:25:16 +0100</lastBuildDate>
		<generator>FeedCreator 1.7.2</generator>
		<image>
			<url>http://www.phamngochai.net/images/M_images/joomla_rss.png</url>
			<title>Powered by Joomla!</title>
			<link>http://www.phamngochai.net</link>
			<description>Joomla! site syndication</description>
		</image>
		<item>
			<title>ASP.NET MVC3 jQuery form POST and Redirect</title>
			<link>http://www.phamngochai.net/programming/asp.net-mvc3-jquery-form-post-and-redirect.html</link>
			<description>
It has been some time since I touched ASP and M$ stuff. Today while working with ASP.NET and jQueryMobile, I discovered that my redirection no longer worked.


If you have a form POST to an action that return a Redirect like:


[code]


[HttpPost]


public ActionResult Reserve(ReserveViewModel reserveViewModel)


{


	....


	return Redirect(redirectUrl);


} 


[/code]


 


ISS will return an HTTP 302 redirection, in order for jQuery to redirect to that URL instead of using AJAX to handle. Your form must have an data-ajax= false , like:


[code]


&amp;lt;form action= /Ticket/Reserve  data-ajax= false  method= post &amp;gt;


....


&amp;lt;/form&amp;gt; 


[/code]


That will disable AJAX handling on that form and your browser will happily redirect to the new address. 

</description>
			<category>Computer stuff - Programming</category>
			<pubDate>Sat, 26 Nov 2011 02:18:20 +0100</pubDate>
		</item>
		<item>
			<title>Java and Program terminated with signal 11, Segmentation fault.</title>
			<link>http://www.phamngochai.net/softwares/java-and-program-terminated-with-signal-11-segmentation-fault..html</link>
			<description>
Recently we have encoutered several jvm crashes on our test server which is on Amazon cloud. This server is running on CentOS 5.5 x86_64 with Oracle JRE 1.6.0_22. We have Fusesource ServiceMix 4.2.0-fuse-02-00, PostgreSQL 8.4 on this server. This system has been running for more than a year without any problem but last week, ServiceMix just crashed a few times a day without showing anything in the log. I tried to upgrade to Oracle JDK 1.6.0_27 but the problem persisted. I found out that the ulimit for  core file size  for the user that we use to run servicemix is 0


[code] 


core file size          (blocks, -c) 0


data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 122944
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 122944
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[/code] 


 


I changed that to unlimited


 


[code] 


ulimit -c unlimited 


[/code] 


 


and core dump files were produced whenever ServiceMix (or JVM actually) crashes.


I have two core dump files, one from JRE 1.6.0_22 the other from JDK 1.6.0_27.


With the help of gdb, I was able to find the problem:


[code]


gdb /usr/java/jre1.6.0_22/bin/java /usr/local/apache-servicemix-4.2.0-fuse-02-00/core.3595 
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5_7.1)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type  show copying 
and  show warranty  for details.
This GDB was configured as  x86_64-redhat-linux-gnu .
For bug reporting instructions, please see:
&amp;lt;http://www.gnu.org/software/gdb/bugs/&amp;gt;...
Reading symbols from /usr/java/jre1.6.0_22/bin/java...(no debugging symbols found)...done.
[New Thread 4249]
[New Thread 13326]
[New Thread 13302]
....


[New Thread 3595]
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /usr/java/jdk1.6.0_27/bin/../jre/lib/amd64/jli/libjli.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/bin/../jre/lib/amd64/jli/libjli.so
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/server/libjvm.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/server/libjvm.so
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/libverify.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/libverify.so
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/libjava.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/libjava.so
Reading symbols from /lib64/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_files.so.2
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/libzip.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/libzip.so
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/libnet.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/libnet.so
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/libmanagement.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/libmanagement.so
Reading symbols from /lib64/libnss_dns.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_dns.so.2
Reading symbols from /lib64/libresolv.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libresolv.so.2
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/libnio.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/libnio.so
Reading symbols from /usr/java/jdk1.6.0_27/jre/lib/amd64/librmi.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jdk1.6.0_27/jre/lib/amd64/librmi.so
Core was generated by `/usr/java/latest/bin/java -server -Xms1024M -Xmx4096M -XX:MaxPermSize=256m -XX:'.
Program terminated with signal 11, Segmentation fault.
#0  0x00002aaaaf640360 in Java_java_net_SocketInputStream_socketRead0 () from /usr/java/jdk1.6.0_27/jre/lib/amd64/libnet.so
[/code] 


 


The other core dumpl file also showed me that the JVM crashed at .../amd64/libnet.so 


Google brought me to JVM bug 7059899


http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7059899


Follow the workaround mentioned there, I change the DEFAULT_JAVA_OPTS in [SMX_HOME]/bin/servicemix to:


[code]

DEFAULT_JAVA_OPTS= -Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM -XX:MaxPermSize=256m -XX:PermSize=256m -XX:StackShadowPages=20 
[/code]

After restarting, my ServiceMix has been running fine since.

</description>
			<category>Computer stuff - Softwares</category>
			<pubDate>Thu, 20 Oct 2011 23:52:45 +0100</pubDate>
		</item>
		<item>
			<title>MP4 video encoding for Motorola Xoom</title>
			<link>http://www.phamngochai.net/misc/mp4-video-encoding-for-motorola-xoom.html</link>
			<description>
If you try to play those 1080p, 720p mkv files directly in your Xoom, you'll find it very jerky and seeking/skipping takes forever. That's because Xoom only supports base line profile of H264, in order to play those files smoothly, you need to reencode them.


I dont want to install handbrake so what I use is:


[code]


ffmpeg -i /path/to/file.mkv -threads 4 -vcodec libx264 -x264opts ref=3:bframes=0:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0:cabac=0:weightp=0 -acodec libfaac -ab 128k -ac 2 -ar 48000 -crf 24 -f mp4 outfile.mp4 


[/code] 

</description>
			<category>Computer stuff - Misc</category>
			<pubDate>Mon, 01 Aug 2011 23:01:36 +0100</pubDate>
		</item>
		<item>
			<title>Motorola Xoom and Adobe Reader</title>
			<link>http://www.phamngochai.net/misc/motorola-xoom-and-adobe-reader.html</link>
			<description>
I just got my Motorola Xoom Wifi only a few days ago, one of the reasons that I bought it is because I want to read ebooks (pdf, chm...) on it so I spent a huge amount of time getting Adobe Reader on it. Obviously it's not on the Android market since this is a Honeycomb device, so I tried appbrain, now I can see Adobe Reader but Xoom still refuses to install it. I also tried to install a few free pdf readers but none of them actually shows the pdf nicely. When I almost gave up, I saw that Adobe actully put the Adobe Reader for Android on their FTP server, et voila...


ftp://ftp.adobe.com/pub/adobe/reader/android/10.x/10.0.1/


I downloaded the apk file, do a  adb install AdobeReader.apk (ftp://ftp.adobe.com/pub/adobe/reader/android/10.x/10.0.1/AdobeReader.apk)   the next moment I can see my pdfs are nicely displayed on my Xoom :)

</description>
			<category>Computer stuff - Misc</category>
			<pubDate>Mon, 25 Apr 2011 23:33:47 +0100</pubDate>
		</item>
		<item>
			<title>Vinaphone MF 190(ZTE) 3G USB device in linux</title>
			<link>http://www.phamngochai.net/misc/vinaphone-mf-190zte-3g-usb-device-in-linux.html</link>
			<description>
I was back in Vietnam for the last 3 weeks for my Tet holiday. Back there, my house does not have internet connection, luckily I've got a 3G USB device from my friend, which is  MF 190(ZTE). This device comes from Vinaphone - one of the Mobile phone service providers in Vietnam. As usual, this device does not come with linux driver, but after fighting with it for more than half a day, I was able to get it to work on my Archlinux x86_64 laptop. The reason why it took so long was that the signal at the place (my friend's cafe) was too low, I did not know that until I brought it outside.


All that is needed for the 3G USB  to works under Archlinux is usb_modeswitch (from community repo) and wvdial (from extra repo). After installing them, when you plug it in, you should see a GSM modem in dmesg. The rests are just wvdial configurarion. 

</description>
			<category>Computer stuff - Misc</category>
			<pubDate>Thu, 17 Feb 2011 09:59:26 +0100</pubDate>
		</item>
	</channel>
</rss>

