Hoang Tran's Blog

August 3, 2009

.astylerc

Filed under: Resources & Tools — Hoang Tran @ 2:52 pm

Astyle là một tool rất tốt để format source code. Mỗi khi có source của cái gì đó là mình cứ format source trước đã rồi đọc gì thì đọc. Có thể dùng astyle làm hook pre-commit cho các source version control. Đây là .astylerc đặt ở home directory ;-)

# Author     : Hoang Tran <tran.hoang@gmail.com>
# Version    : 1.1
# Last Change: Aug 03, 2009

# Predefined style option -A3
–style=k&r

# Indent using 4 spaces per indent. Don’t use tab -s4
–indent=spaces=4

# Break brackets from namespace, class and function definitions,
# but attach brackets to statements within a function -l
–brackets=linux

# Indent ’switch’ blocks so that the ‘case X:’ statement are
# indented in the switch block. -S
–indent-switches

# Indent multi-line preprocessor definitions ending with a backslash -w
–indent-preprocessor

# Pad empty lines around header blocks (eg. ‘if’, ‘while’ …) -f
–break-blocks

# Delete empty lines within a function or method. -x
–delete-empty-lines

# Insert space padding around operators. -p
–pad-oper

# Remove extra space padding around parenthesis on the inside and outside -U
–unpad-paren

# Converts tabs into spaces in the non-indentation part of the line -c
–convert-tabs

# Do not retain a backup of the origional file
–suffix=none

July 10, 2009

Color man pages

Filed under: Resources & Tools — Hoang Tran @ 5:59 pm

Mới biết cái tip này và giờ thì cực kỳ happy khi đọc man page :-)

screenshot

screenshot

August 18, 2008

Moc, last.fm

Filed under: Interests, Resources & Tools — Hoang Tran @ 4:48 pm

Oài mạng MediaNet cứ dùng buổi tối là chậm không thể chịu nổi. Nhưng rất tiếc do độc quyền ở tòa nhà ở quận 4 này mà chỉ dùng được một là MegaVNN, hai là MediaNet còn Viettel hay FPT thì bó tay. Đã từng ghê rợn với dịch vụ bọn VNPT mà quyết tâm chuyển sang MediaNet. Kết quả là tránh vỏ dưa gặp vỏ dừa :-(

Tiếp tục configure môi trường “vui chơi giải trí” với Gentoo, lần này là lựa chọn cho music player. Sau một hồi cân nhắc tham khảo trên mạng đã quyết định chọn cái moc (Music On Console). Đầu tiên là rebuild lại kernel để build cái alsa dưới dạng module. Sau đó là đổi lại USE trong make.conf rồi emerge cái moc. Đến lúc này chợt tỉnh người ra, không biết moc có chạy với cái last.fm ưa thích của mình không nhỉ? May thay google một phát đã có người giúp rồi :-)

Đúng là càng dùng gentoo càng thấy khoái. Tuy rằng phải đọc nhiều hơn nhưng đồng nghĩa là hiểu được nhiều hơn, kỹ hơn :-)

July 28, 2008

coLinux/Gentoo

Filed under: Resources & Tools — Hoang Tran @ 3:36 am

Hôm nay quyết định chuyển sang Gentoo ở máy công ty để “học” được nhiều hơn. Ý tưởng của Gentoo là manual configure và thường là lấy source về build hết :-) Kiểu này chắc dịch mấy cái kiểu OpenOffice chắc cỡ mất cả ngày quá. Nói một cách nào đấy Gentoo và FreeBSD có tư tưởng giống nhau chăng?

Update: Sau một hồi vật vã (hic chỉ vì cái security của công ty chặt quá :-( ), thì cuối cùng cái Gentoo cũng có thể connect vào mạng được.

Lesson learnt: Đọc thật kỹ cái này http://wiki.colinux.org/Network

Tham khảo thêm: http://yujianzhang.blogspot.com/2008/03/install-gentoo-with-colinux.html

Lại update tiếp: Ngay sau ngày hôm trước thành công thì đến ngày hôm sau, công ty có policy mới về quản lý các virtual machine. Mỗi nhân viên phải khai báo các MAC address của virtual machine nếu muốn vào domain của công ty hay là ra ngoài internet. Mà mấy cái slirp hay tuntap đều không thể xử lý được vụ chặn theo địa chỉ MAC của card mạng được :-( Đang không biết làm thế nào đây. Chắc lẽ lại phải dùng offline thì chuối quá.

July 21, 2008

Debug with cgdb – a curses debugger

Filed under: Resources & Tools — Hoang Tran @ 8:48 am

For those who love gdb :-) You will love cgdb.

http://cgdb.sourceforge.net/

July 14, 2008

ViM Tips – Create html with syntax highlight

Filed under: Resources & Tools — Hoang Tran @ 2:04 am

Vừa mới biết cái này
:runtime! syntax/2html.vim
Thử coi ;-)

July 8, 2008

Using vi key bindings in bash and zsh

Filed under: Resources & Tools — Hoang Tran @ 10:30 am

http://blogs.techrepublic.com.com/opensource/?p=193

By default, most shells use emacs-style key bindings for command-line editing and modification. For users of vi or vim, however, you can instead configure shells to use vi key bindings instead. This is done by editing ~/.bashrc in the case of bash, or ~/.zshrc in zsh and adding:

set -o vi

in bash, and the following for zsh:

bindkey -v

Once you have saved either ~/.bashrc or ~/.zshrc, exit the shell and open a new terminal.

By default, you will be in insert mode, which means that you type as you normally would. Commands like [Ctrl]A or [Ctrl]E no longer work, however. To get into command mode, press [ESC] (as you would in vim) and use vi key commands to navigate the command line, such as $ to go the end of the line or 0 to go to the beginning of the line.

June 2, 2008

Vimperator – Surfing net (Firefox) with vim key-bindings

Filed under: Resources & Tools — Tags: , , — Hoang Tran @ 3:43 am

http://vimperator.mozdev.org/
https://addons.mozilla.org/en-US/firefox/addon/4891
Không thể tuyệt vời hơn :-) Giờ thì đến lướt web với Firefox cũng sử dụng các command của Vi/ViM. Highly recommend!

May 13, 2008

Visual Studio Theme Setting

Filed under: Interests, Resources & Tools — Hoang Tran @ 1:14 pm

Tiếp tục chủ đề làm việc trên M$ Windows là cái Visual Studio (VS) Theme. Các blog trước đã nói cách sử dụng Vi/ViM trên VS hay chạy Linux song song trên máy Windows. Vẫn phải code VC++ hơn một tháng nữa làm mình phải cố gắng configure cái VS cho thật sướng. Đầu tiên là phải sửa cái terminal cho nó khoái về cái theme xanh – đen cho hợp gu :-) rồi chỉnh font cho thật sướng nữa. Để nghịch font mình đã cài các font khoái khẩu được recommend của mọi người như Bitstream Vera (cái thích nhất), DejaVu, Monaco (font của TextMate trên máy Mac) và cả Consolas (của Windows Vista).

Tiếp đó là chỉnh cái theme của VS thành xanh-đen (theo truyền thống sở thích trên môi trường *NIX). Không hiểu sao mình cứ khoái nhìn vào cái màn hình xanh đen ấy :-D Thật may mắn là có quá nhiều người có những sở thích – không thích cái theme mặc định của VS ấy. Sau một hồi sục sạo thử các kiểu thì cũng tìm được gã ưng ý nhất http://www.iunknown.com/2007/06/vibrant_ink_vis.html. Gã này cũng sử dùng ViEmu giống mình :-) Ngoài ra cũng có thể sử dụng của cái này cũng khá nice.

Nếu không thì có thể vô cái gallery IDE để chọn cái theme ưng ý nhất :-)

http://idehotornot.ning.com/ (Is your IDE hot or not? )

http://www.hanselman.com/blog/VisualStudioProgrammerThemesGallery.aspx

Giờ thì cái IDE của mình đây haha

April 25, 2008

Last.fm – share and love music

Filed under: Music, Resources & Tools — Hoang Tran @ 5:51 am
Want to share your music taste and listen to your favorite music? Easy! Download Last.fm software and enjoy. You could also listen to what people who have the same taste are listening.

Enjoy!

http://www.last.fm/
http://www.last.fm/user/hoangtran

Older Posts »

Blog at WordPress.com.