1:00
07-04-2008

Learning Python 1

   Posted by: clarezoe   in Python

I’m learning python these days. I’ve set up two projects in google code: dicthon , a Chinese-English and English-Chinese dictionary based on dict.cn. Huahua has writen a script for me. It works perfect, it is my default dictionary now. You can download it from the project site. I’m planning to add some more functions in it, such as “read the word”, “my new words”. The second is tuvio, a violin tuner, I need to read some guitar tuners.

I have the ideas, now I need to make them into practice. However, I’m just a beginner, and there are not so many exercises for beginners. So I picked up some exercises and algorythms in C , and rewrite them by python.

And I’ll recommend another editor Geany, it’s just wonderful, better than editra I introduced before. It can complie and run the script, I could say it’s a lightweight IDE. I’m so bad at vim, and eclipse is too powerful for me, geany just fits well.

Now, it is my first exercise:

Input 2 integers from the keyboard, and print out their sum.

#!/usr/bin/python
# Filename : sum.py
x = int(raw_input(”Please enter a integer for x : “))
y = int(raw_input(”Please enter a integer for y : “))
sum = x + y
print “The sum of x and y is “, sum
print “The sum of x and y is “, x+y #You can either declare a new variance or just sum them up.

Run the script:

Please enter a integer for x : 9
Please enter a integer for y : 78
The sum of x and y is  87
The sum of x and y is  87

What did I learn?

  1. Of course, how to run python: first line of the script; file extension; python filename
  2. How to get input from keyboard: raw_input( ” What ever you want to say ” )
  3. There’s no need to use comma, but if more than one command in one line, you need to use comma. I used to use it in Perl and C :)

Tags: , , , , , , , ,

14:26
07-01-2008

Cry, Silently…

   Posted by: clarezoe   in Nonsense

I talked with Cong for a while yesterday. He has been to China for a few weeks, I haven’t gotten any news from him, finally, he’s still alive. He is still as before, like a big brother, bla bla talks about his experiences.

He is not like the kind of person that has powerful background, he is so independant, he want’s to fight himself. But we still have diffent background. He won’t be worried one day he is tired and don’t wanna fight any more. But not me, to find a bright future for myself, to achieve my childhood dreams, I came to Sweden. Everyone envies me. They thought I was lucky and would live better than them. But it’s not true, indeed. The life here is so stressful.

Dream, is just nothing, once you achieve it, you will nothing to do, and you get nothing from it but some kind of satification.

I’m bored, I really wanna work. I don’t wanna sleep for long every day, but I can’t do anything if I get up, so I just keep sleeping. I play badminton almost everyday, let myself be very tired, so I won’t have time to think about my future.

Joacim said I was so quiet when I was crying. Because I don’t wanna cry, I don’t wanna let anyone know I’m crying. I just wanna find a corner, only me. But finally I cried, for my unknown future, for my parents who are still working hard for me.

I don’t want to say, I don’t what did I say. This post just to tell people I’m alive. Dear friends, don’t worry about me, I’ll be OK.

Tags: , , ,

22:54
06-26-2008

Fighting with Mr. Mayor

   Posted by: clarezoe   in Violin, Encouragement

Please please don’t be surprised, it’s not the major of Gothenburg, he is a “major” in the Violin Forum. He is so persistent that he is keeping posting his records in the forum, no matter how critically people are commentating.

I’m practicing the Suzuki Violin these days, and found that he’s also playing the songs and posted his records. So I posted my records too. I just found a really good example and friend. I won’t be alone any more.

He never uses IM applications to chat, but we chatted on Fetion today. He shared his experience with me and even said he would mail me a book and when I said my bow is kinda broken, he said he could mail his bow to me too. What a kind man! I should practice more and make me deserve it!

Here are my records today:

Long long ago 多年以前

Audio clip: Adobe Flash Player (version 6 or above) is required to play this audio clip. You also need to have JavaScript enabled in your browser.


Perpetual Motion in D Major D大调无穷动

Audio clip: Adobe Flash Player (version 6 or above) is required to play this audio clip. You also need to have JavaScript enabled in your browser.


Allegro 快板

Audio clip: Adobe Flash Player (version 6 or above) is required to play this audio clip. You also need to have JavaScript enabled in your browser.

Tags: , , ,

This is a serenade song that girls sing to boys. It was sung by for girls, how lovely!

Talking about serenade, I recalled the news that I saw during the earthquake, those about couples, wives and husbands, the moving love stories. After a girl was rescued, a reporter asked her boyfriend:”How would you think about your future after this time?” He said:”Our whole lives!”  They suffered from this disaster together and sure that they will have a happy life no matter how tough it will be. God bless them!

Please listen…

Audio clip: Adobe Flash Player (version 6 or above) is required to play this audio clip. You also need to have JavaScript enabled in your browser.

Tags: , , , , , ,

0:24
06-19-2008

How to Make Your Large Memory as A Hard Drive?

   Posted by: clarezoe   in Linux

I bought a new memory for my laptop, now I have 1.5G memory, but my xubuntu can’t eat that much, so I’m thinking about how to use it. I found a very easy way that can use the memory as a hard drive. I can save my hard drive space and can make full use of my memory as well, that’s cool.

I don’t have to worry about the temperary files take so much space and make my computer slower. It will be cleaned up every time I restart my computer.

The settings are quite simple:

Choose your favourite text editor and edit the fstab file. I’m using vim.

sudo vim /etc/fstab

Add the following line into it:

tmpfs /tmp tmpfs defaults,mode=1777 0 0

And save, then restart X window, we are done.

If you have questions, please don’t hasitate to contact me, either write your comments here or fill in the conatct form under “Contact Me”.

Tags: , ,

收藏 & 分享

Powered by 17fav.com