Showing posts with label Free-Libre-OpenSource. Show all posts
Showing posts with label Free-Libre-OpenSource. Show all posts

Monday, September 13, 2010

Vietnamese typing on Linux

For the list of other platforms, please see my old post: Vietnamese typing.

This entry is mostly for Ubuntu Linux, yet it can be applied on other Debian-based distributions, and probably some RedHat-based distro too.

X-unikey : (Phạm Kim Long)
Download:
https://sites.google.com/site/quoc383011/x-unikey_1.0.4-5_i386.deb

References:
http://sites.google.com/site/wangjihoan/xvnkb-scim-unikey


Xvnkb : (Đào Hải Lâm)
Download:
https://sites.google.com/site/quoc383011/xvnkb-0.2.9a-utf_i386.deb
https://sites.google.com/site/quoc383011/xvnkb_0.3-4ubuntu810_i386.deb

References:
http://wangji.hoan.googlepages.com/xvnkb-revisited


SCIM
Download:

References:
http://code.google.com/p/scim-unikey/


IBus
Download:

References:
http://code.google.com/p/ibus-unikey/


That's all (^o^) ,

Sunday, May 30, 2010

Ubuntu Lucid Lynx

My upgrade from Hardy Heron (8.04) to Lucid Lynx (10.04) went smoothly on desktop PC, but on laptop there were some small issues.

Here are 2 major issues then and how I solved them:

1/ Grub error: boot into text mode only, could not get GUI by startx or xstart command
==> SOLUTION STEPS: fix the old grub (not grub2) menu.lst (or edit boot menu directly)
* Change root partition from by-uuid ("root=UUID=asdf...") to by-path ("root=/dev/sda7")
* Change kernel version from old Hardy (2.6.14-19-generic) to new Lucid (2.6.32-22-generic)


2/ Sound error: could not hear sound, conflict sound system of YouTube/StarDict/VLC/MPlayer
==> SOLUTION STEPS: a little painful
* Run gnome-volume-control to uncheck "Mute" options, try changing sound theme (Ubuntu/NoSound/...)
* Install gnome-alsamixer or pavu, adjust the options and volume
* Resolve the libflashplayer.so location for Flash and libnpjp2.so location for Java RE.
* For StarDict, use aplay as command for playing sound files (usually in /usr/share/WyabdcRealPeopleTTS/ )


Some minor issues may be possible:
- (Gnome) combination (Alt+F2) does not work ==> SOLUTION: enable the "Gnome compatibility" plugin in CompizConfig S Manager (ccsm)
- Postgresql 8.3 startup failed due to memory segmentation ==> SOLUTION: open file postgresql.conf in /etc/postgresql/8.3/main/ and reduce value of the variable shared_buffers (for example 32M -> 16M)
- Some custom launchers' icons are changed ==> SOLUTION: find alternatives in /usr/share/pixmaps/


Hope this helps,

Monday, September 07, 2009

Eclipse WTP Hotswap

One of the reason why JavaEE does not have many succesful projects is that its development time is usually longer than other competitors' time (PHP, Ruby, Python, ASP.NET, ...) . Ok, we all know the burden of overly complicated design and over-engineered implementations from Sun, so let's skip them and go to the one to be resolved: the Hot-Deploy time. In other words, the time for developers to see the web-page refreshed with their changes applied.

The word "hot deploy" used above may not reflect its original meaning, not only because my poor English, but also because (Vietnamese) developers have different concepts of it: "automatic hot swap", "automatic redeploy webapp", "automatic restart container" .

This is how I understand the differences:
1/ Hot deploy container: automatic restart whole servlet container (Tomcat)
2/ Hot deploy webapp: automatic reload context root and all classes of respective webapp.
3/ Hot deploy classes: hot-swap only the re-compiled classes (runtime)
It is obvious that #1 is slower than #2 and #2 is slower than #3: Hot-swap or hot-code replacing .


Ok, now what? Let's try to reduce the hot-deploy time in Java developement in the well-known combination: Eclipse + WTP plugins + Tomcat. Assumed that you already have an Eclipse with WTP/WST plugins installed (e.g. Eclipse JavaEE version).

Create a New Server WTP for your web application
From the New menu, select Other… -> Server -> Server. For your server type (probably "Apache Tomcat 6"), specify the path to your Tomcat installation directory, e.g. "/opt/apache-tomcat-6.0.18" or "D:\USR\apache-tomcat-6.0.18" . Add your web project as a 'Resource' to this server (you may modify the context root first).

Adjust the server's settings
Double click on the Server in your Server view (its name is something like "Tomcat v6.0 Server at localhost-config"), it will display the "Overview" tab:
- Server location: Use Tomcat installation (actually, either "workspace metadata" or "custom location" can work as well, but let's use the most simple for beginners)
- Port: modify the HTTP port from 8080 to the one you desire. You may also modify the remaining 2 ports respectively to avoid port conflicts between Tomcat instances.
- Timeout: better increase them 100 or 200 seconds more.
- Server options: not necessary to check any options.

Enable classes hot-swap
Ok, the main settings for hot-deploy here:
- Publishing: Auto publish when resources changes (to hot-deploy text resources like .properties, .html, .jsp, ... and packaged resources like .jar, .zip ) , the interval should be small (1 or 0 sec).
- Switch to "Modules" tab, since you already added the web app to the server, there should be at least a "module" with the specified context root (path URL). Select that module, then click "Edit" button, uncheck the "Auto reloading enabled" checkbox, click OK. Now your module should have "Auto Reload" setting as disabled (equivalence to <Context reloadable="false" ... /> in server.xml/context.xml of Tomcat)
- Save the changes (at least make sure the two above has been applied already).

Start the server in Debug mode
Once you started the web-app in Debug (right click -> choose "Debug..."), Changes you make to your JSPs or inside Java methods will be instantly hotswapped into your running webapp, therefore reduce the development time (at least the wasted time looking at console when reloading web-app).

Why?
Since Java 1.4.2 , the JPDA supports hot-swap classes on debug mode, by manipulateing class loaders at runtime. Eclipse makes use of it via WTP under the name Hot Code Replace . Setting auto-publish helps replacing text files and recompiled jar, but not for classes. By default, Tomcat's context reloading will reload all classes using its class loaders and therefore does not take advantage of hot-deployed classes.
Note that JPDA is not the best for hot code replacing, the number one here must be JRebel. Some web frameworks (Tapestry, Stripes, Wicket, Grails, Roo) also has their own classloader handlings to support quick reload. They're all inspired by some standalone JAR files around which I don't remember (probably the pioneers for JRebel). And FYI, Tomcat Sysdeo plugin and Jetty can also support HCR , in case you don't want to use Tomcat WTP.

Some more recommended settings
Running Tomcat in Eclipse (via WTP plugin) is a bit slower than via external command, and running in Debug mode is somehow resource-hogging, which may result in errors like hot-swap failure or OutOfMemoryError . To avoid those issues, you may try some JVM options via Tomcat JRE params: Double-click on your server in the "Servers" view, switch to the "Overview" tab, click on the "Open launch configuration" link, switch to the Arguments tab; there you can add relevant memory settings to the "VM Arguments" section
-client -Djava.awt.headless=true
-Xmx1024m
-Xms512m
-XX:MaxPermSize=1024m
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC


Limitations
JPDA HCR not applied: to change the signature of a class (add/remove methods or fields) or to add new classes on the fly. Additionally, some method calls (“stack frames”) can’t be modified, including the main method or any method invoked via reflection, that is, by using java.lang.reflect.Method.invoke().
(JRebel can overcome those limitations)


Good luck & have fun :-) ,



./.

Monday, June 15, 2009

VN opensource sites

Some Vietnamese websites for OSS and Linux/Unix fan:

http://forum.ubuntu-vn.org
http://diendanlinux.org
http://forum.vnoss.org
http://viettug.org
http://vnlinux.org
http://opensource.com.vn
http://ubuntut.com
http://tapchilinux.com
http://tapchifc.pbworks.com
http://saigonlinux.org
http://saigonlug.org
http://hanoilug.org
http://hanoi.centre-linux.org
http://foss.vn
http://vi.openoffice.org (http://openoffice.vn)
http://asianuxvietnam.vn
http://hacao.com
. . .

Also some well-known blogs:

http://saylinux.wordpress.com
http://zxc232.wordpress.com (http://zxc232.blogspot.com/)
http://blog.iwayvietnam.com/tuanta
http://linuxwhoami.blogspot.com
http://projektantos.wordpress.com
http://kythuatmaytinh.wordpress.com
http://vnfoss.blogspot.com
http://tutroc77.blogspot.com/
http://nguyentieuhau.com
http://my.opera.com/otaku_2r
http://my.opera.com/buiquanghuylinux
http://my.opera.com/trangtinh
. . .

More personal sites: (less known than above)

http://mediocre-ninja.blogspot.com
http://silverhat.wordpress.com/
http://vinux.sourceforge.net/

http://tuyetkiem.wordpress.com/
http://xelnaga.wordpress.com/
http://hoangtran.wordpress.com/
http://moriator.wordpress.com/
http://my.opera.com/chuyenmt/
http://www.openandfree.org/blog/
http://hapm.info/
http://ngohaibac.net/
http://viet94.wordpress.com/
http://binkun-linux.blogspot.com/
http://nguyendinhtrung.wordpress.com/
http://my.opera.com/hautp/
http://phamkhoa.wordpress.com/
http://www.manguonmo.vn/
http://www.saigonnezumi.com/
More . . .


Extras:
http://www.quantrimang.com.vn/hedieuhanh/linux/index.aspx
http://vinasupport.com/blog/index.php/category/os/linux/
http://thegioimang.org/linux/
http://www.vn-zoom.com/f316/
http://www.manguonmo.vn/
http://baiviet.phanvien.com/subcat/1/he-dieu-hanh-khac.html
http://www.eda.vn/forum/viewforum.php?f=3
. . .


If you want to enlist your OSS website/blog here, feel free to tell me (via comments or email/Twitter/Facebook/etc)

Cheers :-)

Tuesday, January 13, 2009

ThunderBird duplicate mails

To make ThunderBird automatically handle possible duplicate emails, you can edit the value of "mail.server.default.dup_action" in its prefs.js (or use its Config Editor) :

* 0 - (default value) retrieves duplicate mails like normal mails.
* 1 - duplicate mails will be deleted automatically once retrieved
* 2 - duplicated mails will be moved right into the trash
* 3 - finally marks duplicate mails as read




To remove those duplicate ones which has already been retrieved, you should install the "Remove Duplicate Messages" add-on.


:-)

Sunday, December 07, 2008

VIM vs Notepad++

Ngoài 1 số điểm mà notepad-plus plus kết hợp plugins đuổi kịp VIM, vẫn còn một số ưu điểm không thể không nhắc đến của vim :


1/ Mở file lớn. (bạn thử mở 1 file > 100 MB bằng vim với Notepad++ coi sao)


2/ Xử lý nhiều cụm từ trong 1 file lớn (VD: thay thế vài ngàn từ bằng vim và Notepad++)


3/ Hỗ trợ highlight nhiều hơn (syntax on hoặc syntax enable), hiện nay Notepad++ đã được tăng nhiều nhưng vẫn chưa bằng vim (thử mở các file text như .conf, .cnf, .lst , .cnt , .*rc , ... )


4/ Customize màu sắc dễ hơn, adapt không chỉ 1 ngôn ngữ lập trình (colorscheme, set background, set foreground, set guifont, tự chỉnh các file .vim , ... )


5/ Customized macro: recording các thao tác , chẳng hạn bạn đang viết blog đến từ "CSS", muốn link Wiki chỉ bấm 1, hoặc 2 phím đã recorded thành macro thì chữ CSS đó đã trở thành <a href="http://en.wikipedia.org/wiki/CSS">CSS</a> ,


6/ Customized hotkey: nếu macro không quá phức tạp mà lại hay dùng thì thường người ta ánh xạ hotkey, hầu như không có giới hạn nào cả. Chẳng hạn nếu muốn thì Ctrl+B có thể là cặp thẻ (cho HTML) , Ctrl+W rồi phím b là cặp thẻ [b] (cho forum BBcode) .


7/ Thao tác trên từng word, dòng, ..., di chuyển... bằng các phím cực nhanh. Chẳng hạn file có 1234 dòng, bạn muốn cut 543 dòng đầu tiên đem xuống cuối file rồi paste lại thì chỉ cần chuyển qua Normal mode rồi bấm (nhắm mắt luôn) :
gg543ddGp
hoặc gõ tương ứng các lệnh đó rồi Enter cũng được


8/ Viết script: vim có hỗ trợ cả các cú pháp if, else, func... Chẳng hạn có thể viết 1 function rồi map cho "Ctrl+/" : khi gặp file java, C, C++,... thì comment out cả đoạn bằng " // " , khi gặp file Perl, Shell,... thì comment out bằng " # " , gặp hợp ngữ thì comment bằng " ; " khi gặp file VIM thì comment out bằng " " " , ...


9/ Kích hoạt shell command: bằng dấu "!" ngay sau dấu ":" , chẳng hạn
:!ps
Một ví dụ tổng hợp: chẳng hạn dùng để map hotkey (kết hợp shellscript & perl) để mở Xterm tra dữ liệu từ điển Hồ Ngọc Đức trong vim console bằng phím F9 (gần giống kiểu click & see)


10/ "DIFF" 2 hoặc 3 file cùng lúc bằng lệnh
$ vimdiff copyBTL1.txt copyBTL2.txt
hoặc
$ vim -d copyBTL2.txt copyBTL1.txt copyBTL3.txt


... more to come (vimrc, multiple buffer, multiple session, multiple split, vimshell, external edit ... ), làm biếng nghĩ tiếp quá



have fun geeks !

Monday, October 13, 2008

Best text editors

Developers still spend a lot of time with plain text. No matter how many wizards and other sorcerers we develop, most coding is still in plain text. Most of the information you keep should also reside in plain text because you never know if the tool you are using will be around in five years. It’s a good bet that you’ll be able to read plain ASCII (and probably Unicode) for the next century or so.
(As The Pragmatic Programmer [Addison-Wesley] admonishes: "Keep knowledge in plain text.")

Because so much of what we do revolves around text, it makes sense to find your perfect text editor.

This isn’t about IDEs; company policy and the language you use generally dictate that. IDEs are great at producing source code. But they are lacking in some of the best tools for plain old text.

And IDE is usually "heavy" (i.e. resource-consuming) for the student computer, whereas the developer often just want a quick edit. Why would we need to wait 8 seconds for IDE booting, just for a 5 second copy & paste & modify? Therefore it's essential to get a general source code editor (or lightweight IDE), beside the primary IDE .



Hence, which text editor to pick ?


Usually, the criteria for a good text editor are :

+ Syntax highlighting (i.e colorful)

+ Line number, column number, num of chars, ...

+ Braces matching and block folding

+ Smart indent , bracing, shortcut keys

+ Multi programming languages support

+ Customizable syntax/font/theme/hotkey...

+ Auto completion (keywords, APIs, ... )

+ Lightweight, small footprint

+ Macro recording

+ Supports multi types of line-breaking, character encoding, collation

+ Regular Expression search/replace

+ Multiple documents (tab/panel/... ) in a window

+ Multiple views in a document window

+ Some advanced features (convert charset, file explorer, function list, link compiler, plugins, ... )


Now, let's have a look at the candidates:


1/ Notepad++ (screenShot) : currently it is the most favourite one. It has enough good features, and does the job well. Despite being written in C++ and WinAPI (based on Scintilla lib), it can run smoothly on *nix via Wine. Notepad++'s biggest drawback is the slowness when processing large file ( > 100 MB) , you can begin to see this downfall if you have to open an XML or SQL file which is more than 80 MB.
( thôi viết tiếng Việt cho khỏe :D )


2/ jEdit (screenShot) :


3/ SciTE (screenShot) : cũng là phần mềm mã nguồn mở và dùng thư viện Scintilla như Notepad++ , do chính tác giả của Scintilla phát triển (ban đầu nhằm minh họa thư viện trên). SciTE có phiên bản chạy tốt trên cả Win lẫn Linux, có dung lượng nhỏ nhưng đầy đủ tính năng của 1 editor mạnh, và đã được AutoIT developer xem là editor chính cho AutoIT .


4/ Emerald (screenShot) : trước đây là Crimson Editor, từng được coi là text editor miễn phí tốt nhất trên Windows (như Notepad++ bây giờ) , sau đó ngưng phát triển 1 thời gian nên bị các tool kia vượt qua, và bây giờ come back với tên mới là Emerald :D


5/ PSPad (screenShot) :
cũng là phần mềm miễn phí nhưng không open source, hỗ trợ rất nhiều ngôn ngữ lập trình (nhất là các loại về Web) . Nói chung nếu bạn chỉ code trên Windows thì cái này cũng là ứng cử viên nặng ký.


6/ kate (screenShot) : cá nhân tớ đánh giá kate khá cao , nếu chỉ xét các text editor dạng GUI trên Linux thì xem như nó đỉnh nhất, hơn gedit hay kedit, kwrite nhiều. Các chức năng IDE cũng có thể cạnh tranh với XEmacs, Geany, BlueFish, ... nói chung nếu bạn xài KDE thì nên dùng kate làm text editor chính.


7/ Emacs derivation (XEmacs, Aquamacs, nano, pico, ...) :
(to be updated)


8/ vi derivation (VIM, elvis, nvi, vile, ... ) :
VI/vim is a very good powerful and lightweight editor. It can run on console, i.e. command-line, of ALL the modern Operating Systems. VI/vim is incredibly hard to learn; it has a virtual cliff-face learning curve. But, once you’ve mastered it, you are the most effective manipulator of text possible. Watching experienced VIM coders typing prolly make you impressed, people say that the cursor just follows their eyes !
Despite small footprint, VIM can open big ( > 100 MB ) files, replace many ( > 1000 ) words much faster than such as Notepad++ , jEdit, ... Not only able to invoke shell commands, VI/vim also supports hundreds of language syntax highlightings, macro recording, and scripting, mapping hotkeys as many as you want, and lot of more cool features !


9/ Another freeware (Notepad2, Smultron, ConTEXT, ... ) : Trong số này thì cũng có vài cái xài được, nhưng có vẻ chưa mature đủ để vượt qua danh tiếng những cái trên. Time will tell, though.


10/ proprietary ones (TextMate, e, SlickEdit, UltraEdit, ... ) :
thường phải trả phí từ 20-60$ . Nổi bật nhất có lẽ là TextMate , rất được hâm mộ trên máy Mac, không chỉ ở giao diện elegant, nhiều theme đẹp mắt mà còn đủ các tính năng đáng kể như đã nêu ở trên .
Có một bản port sang Windows là "e" , hay còn gọi là "E" , hoặc "eText editor" hoặc "eEditor" , cũng đang được đánh giá cao, vượt hơn những đối thủ cạnh tranh trước đó như UltraEdit, EditPlus, SlickEdit, TextPad, EmEditor ...



have fun,