Posts tagged ‘programming’

Make python wait for you by sleep function

import time

will make python wait for you 1 second before processing next line. To make python wait for you with another value of time, change 1 to whatever you need, remember the unit here is second.
Very useful when you have to check your code, see the temporary result and so on.

Happy coding!


Hello world by fortran

This is just a very basic script to run a Hello world! program by the language Fortran in Ubuntu.

program hello
print *, "Hello world!"
end program hello

Save the text file as fortran extention, here I save it as hello.f90

To compile in, open terminal and navigate to that folder, run this:

gfortran -o hello hello.f90

Explain: This code define the compiler gcc-fortran, output file has name “hello” and the script file is “hello.f90”.
When the compilation is finished, in that folder we will see the hello program, in terminal, to run it, just input


And you will see the line “Hello world!” in the terminal window.
Have fun programming!

Some programming apps on Android system

To begin with, coding on phone or table is not a fun thing to do, virtual keyboard sucks, and come on! Programming on PC is the best thing. But:

Coding on PC, want to work on your phone + tablet as well? Or just love coding? Android serves you with these apps:

1. C4droid: C/C++ IDE (paid)

This app help you write, compile C/C++ code right on your phone.

2. QPython (free)

Run basic Python on your phone, cannot import numpy or scipy, but for common algorithm, this app runs well, can’t complain for a free, no ad program.

3. DroidEdit (paid):

This one is the one I use the most, why? It helps me read my code everywhere, highlight syntax is good, and for a script, space on phone is like Sahara to a cat. I work only with python and sometimes C++, but DroidEdit supports more than you need, remember Notepad++? Remember gEdit?

4. C# Shell (paid)

I discovered this one recently, and I still haven’t used it, but the first impression is the cleanUI (blue color, yay!)

5. MathStudio (paid)

This expensive app is a little hard to use at the beginning, but when you get used to it, it reminds us, somehow, of Matlab and Maple on PC. Try searching on Google, you may find a free apk of this app somewhere to test it before purchase.


Chạy python qua CMD

Trong window, để bật python và ipython thông qua cửa sổ cmd, cần phải sửa mục path của hệ thống trước, sau đó, vào trong CMD, có thể chạy python bằng lệnh tắt python và enter. Quá trình làm như sau:

1. Control panel –> system –> Advanced .. –> Environment …

2. Tại đây trong cửa sổ PATH, thêm path của python vào. Ví dụ trong trường hợp python 2.7 được cài trong thư mục C:\Python27\python.exe thì giá trị path cần thêm vào là C:\Python27, để phân biệt path này với các path có sẵn, chỉ cần nhét dấu chấm phẩy (;) giữa các path, sau đó save lại. Có thể cần phải khởi động lại để thay đổi có hiệu lực.

Để test tính năng này có thể vào cửa sổ RUN, gõ cmd, sau đó bấm python để kiểm tra.

Python 3 làm tương tự.


Good programming fonts

To begin with, I’m not professional programmers.

There there, you’re a painful programmer and you really care about the font of your code editor, I see. So I collect a few advices from all over the world and put them here.

The important point of the programming font is easy to read, neat and last but not least, the difference between 0 (zéro) and o (or O), you see, with the font of this blog post: 0o0 is a pain in the eye. and on the keyboard, O and zero are placed near each other.

1. Consolas:

Highly recommended by programmers and experts, I see if you love fat font, you can choose this.



2. Ubuntu Mono Regular:

If you’re on Linux, well I guess and hope so, Linux is a perfect place for coding. This font go with the system, and even (this is a small notice) the Space and the Point is greatly defferent if you choose to show the space (this is an option in gEdit, mostly depends on editing theme)


3. Pragmata Pro™:

Just found it this morning, look good to my eyes and I’m kinda like it, one disappointing point is that the space highlight is not so good but anyway, still better than a lot of others)


I recommended only 3 fonts I used and I’m satisfied with what they gave me. Right now my choice is the 3rd.

Hope you find your most favorite and productivitive one.


Tag Cloud

%d bloggers like this: