Archive for November, 2007

some thing I like most

One night of weekend

not busy with any thing, no appointment with some one else, with no exercise, with no consideration, with no awareness of anything…

Like the night like a night of past, I do some thing like the way I used to be accustomed.

One night with music, with xitrum.net, with newsletters, with some thing I like …

Hey getting rid of some thing in my mind, throwing my troubles out of box, bringing myself into a wonderful place where I got used to belong…

Hey Tell me who I am…

Two things I will keep in mind: how to take care for some one and who is really my true friend. Some thing does not like what I imaged in the past.

No one I keep deeply in heart. Waiting something new with all my soul and heart.

Two things I would like to own: one is English – English dictionary and the rest is “baby with long led”.

Two persons I would like to meet now: my mother and some one else I do not know.

One person I do not want to meet at that time.

Two persons I would like to reply emails in which one is my teacher, who I really respect. However, only after tomorrow I can send a mail to you because at that time I just have a practical reason for my delay

No one I would like to talk… Keep silence … This is wonderful time that the god spends only on me. Do not disturb if you want to live peacefully :D

hey two things I have to do tomorrow…

Two things I would like to do in Sunday of next week. This is my interesting :D ….

New week with new plans, with new works…

Hug me now and hug me tightly …

When you embrace by yourself is the time you really feel being lonely. Do not talk me about your this feeling because it is the world belonged to me. :D

Hey All thing is best again and do not fear when you have to cope with some troubles. I always think carefully that: there are not place for bad luck in our life. Your world is full of happiness, luck and lottery.

If luck is favor in prepared people and you should do all things to look forward to one day that happiness come to you.

If you are in love and are happy when you can clean on your darling anytime to fade away your sorrow. I think that you should hold tightly him or her, because it is really mystery with you…

Believe me keep tightly :D

If you are going on your path with big dream, big plan and big vision. You should do it immediately because when the time passes you will be older with any thing that no one can foretell. Believe me because I passed all impotent feeling when seeing time passing and lot of things floating or around me.

If you are healthy, should spend 15 minutes per day for doing exercise. Practice and doing exercise will bring to you a great present, health.

If you are a student, should concentrate on your study and improve your foreign language.

If you have some friends, should be yourself and think for other. Selfish people are types that I hate the most.

…..

Conclusion<my habit is maybe never extinct>

Hug me tightly :D

Leave a Comment

Xử lí file trong Linux

Linux và Unix cung cấp hai cách truy cập file.

  • System call
  • Thư viện chuẩn stdio

Thư viện chuẩn khá quen thuộc do nó nằm ở lớp cao nên thư viện chuẩn tương tự như nhau cho hầu hết hđh ( cả Window và Linux). Những hàm xử lí file ở mức thấp hơn là System call, hay còn gọi là mức kernel. Dĩ nhiên nó chạy trong kernel space.

Thực tế thì thư viện stdio chạy ở mức user space, khi được triệu gọi nó sẽ chuyển sang kernel space xử lí. Các system call sẽ có trách nhiệm truy xuất xuống phần cứng. Việc truy xuât file đã khá quen thuộc đối với chúng ta với thư viện chuẩn. Bài viết này tui lặp lại cách truy xuất bằng thư viện chuẩn. Còn phần truy xuất file bằng system call sẽ post phần sau.

Chúng ta sử dụng thư viện chuẩn của C để xuất nhập file. Các hàm xử lí file bao gồm:

  • fopen
  • fclose
  • fread, fwrite
  • fflush, fseek
  • fgetc, getc, getchar
  • fputc, putc, putchar
  • fgets, gets
  • printf, fprintf
  • scanf, fscanf

Tất cả hàm này được khai báo trong stdio.h
Đóng mở file

Giả sử chúng ta muốn mở file /home/user/data.text
FILE* f_read;
FILE* f_write;
FILE* f_append;
f_read = fopen(“/home/user/data.text”, “r”); // mở file để đọc
f_write = fopen(“/home/user/data.text”, “w”); //mở file để ghi
// Mở file để thêm dữ liệu vào cuối file
f_append = fopen(“/home/user/data.text”, “a”);
Một khi đã mở file và thực hiện xong thao tác cần thiết các bạn phải đóng file lại
if(!fclose(f_read)
{
perror(“Dong file khong duoc: /home/user/data.text”);
exit(1);
}

Đọc dữ liệu file đang mở
int c;
char buf[500];

Đọc từng kí tự
c= fgetc(f_read);
Đọc theo từng khối
if ( fread(buf, 499, 1, f_read)) perror(“fread”);
Kiểm tra đến cuối file chưa
if ( feof(f_read)) printf(“Den cuoi file gu`i”);

Để ghi dữ liệu

FILE* file_rw;
file_rw = fopen(/home/user/data.text);
char buf[200];
strcpy(buf, “Hello, my friend”);
fputs(buf, file_rw);
fflush(file_rw);

Source: http://forums.congdongcviet.com/showthread.php?t=3677

Leave a Comment

What is the difference between a compiler and an interpreter?

A compiler, in general, reads higher level language computer code and converts it to either p-code or native machine code. // interpreted by software

An interpreter runs directly from p-code or an interpreted code such as Basic or Lisp. Typically, compled code runs much faster, is more compact and has already found all of the syntax errors and many of the illegal reference errors.

Interpreted code only finds such errors after the application attempts to interpret the affected code. Interpreted code is often good for simple applications that will only be used once or at most a couple times, or maybe even for prototyping.

Compiled code is better for serious applications.

http://en.wikipedia.org/wiki/P-code_machine

Some programing languages:

Duck_typing: http://en.wikipedia.org/wiki/Duck_typing

Script: http://en.wikipedia.org/wiki/Script

Leave a Comment

Concurrent Versions System

Source:http://en.wikipedia.org/wiki/Concurrent_Versions_System

The Concurrent Versions System (CVS), also known as the Concurrent Versioning System, is an open-source version control system that keeps track of all work and all changes in a set of files, typically the implementation of a software project, and allows several (potentially widely-separated) developers to collaborate. It was invented and developed by Dick Grune in the 1980s. CVS has become popular in the open source software world and is released under the GNU General Public License.

  1. Features:
    CVS uses client-server architecture:

    • a server stores the current version(s) of the project and its history
    • clients connect to the server in order to check out a complete copy of the project, work on this copy and then later check in their changes.
    • client and server connect over a LAN or over the Internet, but client and server may both run on the same machine if CVS has the task of keeping track of the version history of a project with only local developers.
    • The server software normally runs on Unix (although at least the CVSNT server supports various flavors of Windows and Unix), while CVS clients may run on any major operating-system platform.
    • Several developers may work on the same project concurrently, each one editing files within their own working copy of the project, and sending (or checking in) their modifications to the server. To avoid the possibility of people stepping on each other’s toes, the server will only accept changes made to the most recent version of a file. Developers are therefore expected to keep their working copy up-to-date by incorporating other people’s changes on a regular basis. This task is mostly handled automatically by the CVS client, requiring manual intervention only when a conflict arises between a checked-in modification and the yet-unchecked local version of a file.
      If the check-in operation succeeds, then the version numbers of all files involved automatically increment, and the CVS server writes a user-supplied description line, the date and the author’s name to its log files //file log will up to date all versions to avoid conflict
    • .CVS can also run external, user-specified log processing scripts following each commit. These scripts are installed by an entry in CVS’s loginfo file, which can trigger email notification or convert the log data into a Web-based format.
    • Clients can also compare versions, request a complete history of changes, or check out a historical snapshot of the project as of a given date or as of a revision number. Many open-source projects allow “anonymous read access”, a feature that was pioneered by OpenBSD. This means that clients may check out and compare versions with either a blank or simple published password (e.g., “anoncvs”); only the check-in of changes requires a personal account and password in these scenarios. Clients can also use the “update” command in order to bring their local copies up-to-date with the newest version on the server. This eliminates the need for repeated downloading of the whole project.
    • CVS can also maintain different “branches” of a project. For instance, a released version of the software project may form one branch, used for bug fixes, while a version under current development, with major changes and new features, forms a separate branch.
    •  CVS uses delta compression for efficient storage of different versions of the same file. The implementation favors files with many lines (usually text files) – in extreme cases individual copies of each version are stored rather than a delta.
  2. Terminology
    A single project (set of related files) managed by CVS is called a module. A CVS server stores the modules it manages in its repository. Acquiring a copy of a module is called checking out. The checked out files serve as a working copy. One’s changes to the working copy will be reflected in the repository by committing them. To update is to acquire the latest changes from the repository in the working copy.
  3. History
    I created CVS to be able to cooperate with my students Erik Baalbergen and Maarten Waage on the ACK (Amsterdam Compiler Kit) C compiler. The three of us had vastly different schedules (one student was a steady 9-5 worker, the other was irregular, and I could work on the project only in the evenings). Their project ran from July 1984 to August 1985. CVS was initially called cmt, for the obvious reason that it allowed us to commit versions independently.– Dick Grune
  4. Limitations:
    For each commonly listed limitation of CVS there is also a commonly listed reason:

    • Moving or renaming of files and directories are not versioned. It was implemented this way because in the past Refactoring was avoided in development processes. More recently the thinking has changed and refactoring can be managed by an administrator (by moving the RCS file) as it is required. If you develop in Oracle Forms, Cobol, Fortran or even C++ then the CVS reasoning is quite commonly accepted; if you develop with Java then the CVS reasoning may seem counterintuitive.
  • No versioning of symbolic links. Symbolic links stored in a version control system can be a security risk – someone can create a symbolic link index.htm to /etc/passwd and then store it in the repository; when the “code” is exported to a Web server the Web site now has a copy of the system security file available for public inspection. A developer may prefer the convenience and accept the responsibility to decide what is safe to version and what is not; a project manager or auditor may prefer to reduce the risk by using build scripts that require certain privileges and conscious intervention to execute.
  • Limited support for Unicode text files and non-ASCII filenames. Unix systems run in UTF-8 and so CVS on Unix handles UTF-8 filenames and files natively. If you only work on Unix systems then this response seems reasonable; however when you work on AS/400 and Windows it may not.
  • No atomic commit.

Over time, developers have wanted to change the CVS code significantly to add new features, refactor the code and improve developer productivity. This has led to the phrase YACC: “Yet Another CVS Clone” (itself a play on the Unix command named, “yacc“, which stands for “yet another compiler compiler”). CVS replacement projects include CVSNT (first released 1998), OpenCVS (not released as of 16 October 2007) and Subversion (first released 2004).

Useful tool to work in a team :D  

Leave a Comment

Gió!

Tôi quyết định ngồi viết 1 entry cho riêng mình…

Khi tôi cảm thấy mình k còn khỏe như trước nữa, khi tôi bạn tôi cố gắng nó luôn bảo tôi fighting fighting con àh, khi 1 đứa bạn thân giận tôi và đặc biệt khi tôi từ Hải Phòng lên…

Một làng ven đô những ngày tháng 11 vẫn lặng lặng như hơn 20 năm về trước. Khi tôi sinh ra cũng là khi ba mẹ tôi chuyển sang Thủy Nguyên để tiện đi làm. Khi tôi sinh ra cũng là khi mà ba mẹ nhận án kỉ luật vì đẻ con giày và cũng là khi ba tôi 1 lần thất vọng vì cả nhà 6 người con của ông bà, duy nhất ba tôi k có con trai…

Cả tuổi thơ tôi là sự nuông chiều của ba mẹ. Nhà tôi k giàu nhưng tôi vẫn nhớ như in khi tôi còn nhỏ. Tôi được mặc quần áo đẹp nhất trong những đứa bạn, váy xòe váy sụp rồi quấn áo bò đi giày adidas đủ cả. Tuổi thơ tôi êm đềm lắm. Êm đềm cả những ngày hè ba mẹ cho về quê 1 tuần để thăm ông bà. Tôi vẫn nhớ nhà bà tôi hồi nhỏ sao mà chật thế? Một cái nhà 3 gian xung quanh 4 bên là vườn. Hè về tôi theo bà đi chợ sáng, theo bà ra Từ nhổ lạc, theo chú ra chùa vặt chộm vải… Tuổi thơ của tôi là những ngày hè chèo ổi vặt na. Lúc tôi còn nhớ được thì ông nội tôi cũng đã yếu. Tôi nghe ba tôi kể, ông nội tôi là thợ may có tiếng ở vùng này. Ngày ngày ông may quần áo còn bà đi chợ, 6 đứa con như ba tôi bám lấy ông qua những ngày đói rét.

Thế nhưng khi tôi còn nhớ được thì tôi k thấy ông tôi may nữa, tôi chỉ thấy có một chiếc máy khâu ở nhà.

Mỗi hè lại về thăm ông bà 1 tuần. Tôi lớn lên… Cảm giác dầu tiên là thấy nhà bà tôi k còn sạch như trước. Ông tôi yếu dần k ra vườn nữa mà chỉ ngồi góc nhà để đan rổ. Bà tôi khỏe hơn nên vẫn ngày hai buổi chợ….

Lúc tôi còn nhỏ, ông thường giúp chị em tôi dính ve sầu rồi về rang với mỡ. Món này tưởng quái gở nhưng lại rất ngon…

Lớn hơn một chút khi về nhà bà thì tôi bắt dầu nghe nhiều hơn những lời chí chóe của ông bà. Chủ đề chỉ mỗi thứ đơn giản: ông thấy tôi về ra vườn vặt cho cháu quả ổi xanh còn bà thì mắng ông vì chuyện đó…

Lớn nữa về nhà là thấy cảnh ông tôi ốm, lụ khụ ngồi trong giường nghe thời sự. Bà tôi một mình nấu cơm rồi mang vào cho ông…

Lớn nữa thấy cả ông và bà đều yếu hơn trước nhưng vẫn cãi nhau đều đều… Ông bảo bà bênh cháu bênh con nên cô Huyền lười nhác, thằng ku Dũng hư… Bà mắng ông k thương con thương cháu, lắm mồm…

Hai ông bà như hai thái cực…

Thế rồi khi ông tôi bệnh nặng… Ngày nào bà cũng nấu cháo bưng vào cho ông… Trước khi ông đi ông dặn mẹ tôi” Ông đi rồi thì đưa bà ra nhà toi ở, bà ở 1 mình tội lắm”

Ngày ông mất, bà tôi bắt đầu lẩn thẩn… Bà bảo thương ông, con cháu nó về đông đủ thế này mà k ở lại nói chuyện…

3 tuần sau ngày ông mất tôi về ngủ với bà. Baf tôi sáng dạy sơm, nấu cơm cho ông… Tôi sững người khi thấy bà đút chuối cho bức ảnh của ông, đút nước, đút cơm cho bức ảnh đó…

Bà tôi thương ông tôi biết nhường nào…

Thấy thương bà quá….

…..

… Viết 1 entry cho riêng mình…

Tôi k chọn hubican 360 độ, nơi tôi gắn bó hơn 2 năm với hơn 100 entries, nơi tôi có rất nhiều nguoi ban quan tam va chia se.

Tôi chọn wordpress, nơi k ai biết tôi, k ai doc blog cua toi… nhu la luc toi dang tung len và thả 1 cánh diều vào bầu trời cao vời vợi… nơi tôi có thể release mọi tâm sự của mình…

….

Tự nhiên tôi lại nghĩ về tôi. Một con bé nhí nhố, nhí nhố… tôi vẫn đang waiting 1 điều gì đó mới mẻ hơn với mình…

Leave a Comment

Lập Trình Viên – Bạn Sẽ Bị Đào Thải Ngày Mai?

http://hoangtran.wordpress.com/2007/10/22/l%e1%ba%adp-trinh-vi

en-b%e1%ba%a1n-s%e1%ba%bd-b%e1%bb%8b-dao-th%e1%ba%a3i-ngay-mai/#comments

Copy from Anh Hoang’s blog

Leave a Comment

Idol

Today, I would like to talk about some people in which some one I meet others I have never see anytime.

It is difficult to talk all of them. However, now I would like to write about one person, who I have never chat, have never meet. All things I know about him is some stories from some friends. The person I would like to mention is the person make me create the wordpress blog.

I am sorry before long I have never know what is exactly his name, just things I known about him is his name, “Hoang”. That is all for one idol.

This blog I will update some useful information from him. I believe that with his knowledge and information, I will gather practical knowledge and become more mature.

Thanks for my idol..

Leave a Comment