Thursday, August 26, 2010

PyDev unresolved import error!

Yeah, I spent this whole day, figuring out why PyDev cannot import modules of xml packages.
The standard ones like SAX, DOM, eTree, etc.
I almost gave up using PyDev for Python development and was about to go back to Emacs or try something else.
There was nowhere I could find the information on the web.
I did everything I could do in Eclipse Preferences, about Python-Interpreter SYSTEMPATH.
I erased Eclipse IDE and re-downloaded, re-imported the project, etc...

The problem was:
when you have a package in your project with the same name as you want to import from SYSTEMPATH, PyDev starts to load from the package in your project, doesn't look in the SYSTEMPATH, returns error and aborts running.

Sounds obvious?
Well, but when you don't have anywhere saying 'import xml.sax' in your code, and the PyDev returns error that it can't find 'xml.sax' or whatever, because somewhere in some package in your SYSTEMPATH calls 'xml.sax', it becomes a labyrinth.
Just executing it on the shell works fine, but PyDev returns error.

Tuesday, August 24, 2010

Virtualization for Cloud Computing on OS X

Virtualization of computing resource is one of a key concept for cloud computing.
But what would you select for your "virtualized computing resourse"?

VirtualBox
It is not the best, but is free for virtualization.
"Not the best" in the sense that:
- it doesn't support DirectX-3D acceleration
- frequent updates
- has more issues than the others (VMWare, Parallels)

VMware is known to be better, in the sense that it covers most of the points mentioned above.
And virtualization with VMware can be done free on Linux and Windows.
But not on Mac OS X.

I heard Parallels is even better then VMware on Mac OS X, but I have no experience at all with it.


Ubuntu
Using free-OS as your virtual OS means freedom of its deployment for you.
There are other free-OS options, I've tried several, but found out that Ubuntu is still the best option as:
- It has LTS (Long Term Support) version, which is supported up to about 2 years, compared to other free, open-source Linux distros (Fedora: 6 months, OpenSuse: 1 year, etc.)
- Easy to use (easier than the other free, open-source Linux distros like CentOS)
- Just works (Ubuntu just worked, whereas Kubuntu, OpenSuse with KDE didn't just worked smoothly)
- OpenSolaris will be discontinued by Oracle (ref. here)
- Other BSDs doesn't fully work on VirtualBox.

Friday, August 13, 2010

LaTeX Document Editing on OS X

On Mac OS X, the most common app for LaTeX documenting is using TeXShop.


You edit, save, compile, and the PDF version of the text appears next to the TeXShop application window.


BibTeX files need to be open separately with TeXShop and need to be compiled separately.
You manage your LaTeX project on Finder.

Here is a somewhat geeky way of LaTeX documenting:
With Eclipse IDE.



All the files are centrally managed by the IDE, and when you save after editing, everything compile is done automatically.
BibTeX file can be open and viewed on the same IDE window.
PDF file is updated every time after compile when you view it by the Preview (don't know about Acrobat Reader).


And even more, it's so nice to manage the LaTeX project combined with any version control system like Git, Mercurial, SVN, CVS, etc.
The IDE integrates the version control of the documentation project so nicely so that it can be viewed also in the same IDE window.

And it's OS independent, as Eclipse IDE is, so that the same environment for every OS.

You need to install TeXlipse plugin for Eclipse IDE, and need some configurations to use Eclipse for LaTeX documenting.
To integrate the version control with it, any version control plugin for Eclipse IDE should be installed.


The Little Prince - Programmer's Version - Chapter 5, 6, 10, 11

...

Chapter 5.

The little prince asked all of a sudden.
"The code you wrote, doesn't have a memory leak, isn't it?"
"Yes, because in Java there is garbage collector. But why do you worry about memory leaks for such a simple program?"

The little prince answered: "Come on!" as it was so sure. So I had to think a lot about it.

The system, the little prince had, has many applications and programs running.
When they are really running, you need to leave them alone.

But when it's a bad program, you need to detach from the memory immediately.
The most scary ones were garbages (in case of C, those written to heap and not freed...), there is no way to remove them, when they are not freed immediately.
Unfortunately, the little prince's system is so small, that when a lot of garbages occupy the system, the actual important programs cannot be run.


Chapter 6.

...
At the fourth night, I knew a new fact. As you told me:
"I like releasing programs. Please distribute it to source-forge quickly."
"We need to wait..."
"Wait for what?"
"Until the program is composed completely".
You were surprised so much at first, but then soon you said laughing:
"I feel like I'm at home yet!"
Of course, it's hard to complete a program. Unfortunately, when a project is bigger or so, then it becomes harder to release a newer version. But you coded only simple programs so that you needed to compile only for a few minutes.

"One day I deed to revert 44 times!"
Then you said after a while,
"When I'm really sad, I recompile after modifying the code just a little bit".
"Were you so sad at the day you had to revert 44 times?"
But the little prince didn't answer.


Chapter 10.

...
So he decided to go to his neighbours first who had the same system.
The first network he visited was that of a chief programmer.
He was wearing a shirt and red tie, sat on the swivel Duoback chair.

"Oh, look, there comes a subordinate" the boss said seeing the little prince coming.
...
To the chief programmer everyone is subordinate.
The little prince yawned as he was very tired.
"So, little prince, you know that today you need to work late today as well, right?"
"But I'm too tired. It has been Monday, Tuesday, Wednesday, Thursday, Friday, Friday, Friday for ever"
"Then you can go home early today. I guess it has been a while that you had went home at the right time. It a very interesting thing to watch, that you go home when your chief programmer is still working. So, try go home at the right time~"
"I'm sacred to go home at the right time after you say so"
"Hmm! Then there's no problem. Then you could go home..."
Then he gobbled. He looked like angry.
Because the chief programmer cared so much about the deadline.
So, it appeared impossible to him to go home early in an important time. Of course he thought of time so important so that the overnight working exists.
"When an important bug happened during debugging, and we got claimed from our customers, so they insisted, the manager need to be punished, is it my fault or your fault?"
"Of course it's your fault" said the little prince carefully.
"That's right. A perfect programming is based on perfect debugging. The bugs we can't reach, we can't do anything for it, but we need to do what we can do."

...

"I guess I need to leave here!" said the little prince.
"No, don't leave. I'll give you a new work to do." said the chief programmer became desperate.
"What kind of work to do..." said the little prince in vain.
"Catching bugs"
"Well... I caught all the bugs I could see"
"There was a request to fix the bug for the internet chatting program"
...
The little prince made his way after he made a sigh.
"Oh, that will not be good for your performance rating when you do that!" yelled the chief programmer in dignity.
(Adults are very odd) said the little prince to himself.


Chapter 11.

The place he visited second was that of a so called a master programmer out in the field.
"Oh! There comes one who get my superior distribution!" said the master programmer.
Master programmer happen to look at those people who use his distribution version with pitty.
...
"Do you really worship me?"
"What does ' to worship' mean?"
"'To worship' means that you write a reply like 'It's the best!' or recommend, because my creation is very superior and beautiful that you can't imitate with your ability"
"But no one uses the creation, isn't it?"
"Please make me happy! Please worship me!"
"I worship you." said the little prince (as he had no other choice.)
Then he made his way. 'The adults are weird" thought the little prince.


TO BE CONTINUED ...

Monday, August 9, 2010

Cartoon and Creativity

What comes across your mind when we talk about "CREATIVITY"?

Music, Art, Literature ...

Design ...

Animation, Cartoon ...

...

Those are just the ones they come across my mind quickly.
I'm often amazed how creative the cartoonists are.
From considering and making out the story and concept and drawing the characters ...
My hut off to them.

Yet a lot of them don't get much fame or make their living with their cartoon works.
One of those (a Korean one), which I came across recently:



Friday, August 6, 2010

The Little Prince - Programmer's Version - Chapter 2, 3, 4

Translated from the original Korean version,
which I saw here.

I started with Google Translate first, but I had to modify almost everything.
I contributed my translation back to Google Translate.


===


Chapter 2.

.....
By sunrise, a strange voice woke me. The voice said.
"Show me a sheep!"
"What?"
.....
"Do me a favor ... Draw me a sheep ..."
So I showed the following code.

printf ("Sheep. \ n");

Then he looked at carefully,
"Oh, no, you need to know include the amount of stdio.h." Said.
So I kindly showed the following code.

putchar ('S'); putchar ('h'); putchar ('e'); putchar ('e'); putchar ('p');

".. The code is too dirty, I wanted the amount of neat."

I need to continue debugging, because I wrote more impatient as follows.
Class Box:
Object sheep;
void peek ();
....
"That's a box class. The sheep you want can be called with peek() method."
But my younger supervisor saw a light break over the face, I was surprised.
"That's what I wanted! The peek () needs a lot of memory?"
"Why do you ask?"
"Because my computer is very old ..."
"It will be enough with which I gave you there. Because I used a basic data structure."

So I came to know the little prince.


Chapter 3
...
It took me long time to figure out what kind of system the little prince was using.
I knew it by listening to some commands he was saying sometimes.

For example, as he saw my iPad for the first time (I can not draw in ipad because of copyright issues...)
He asked:

"What is this thing?"

"It is not a thing. It's my iPad. iPad."

I proudly demonstrated that I can connect to werless net.

....
Then he shouted out loud.

"So you're one of the system programmers too! From what kind of developing environment are you from?"

As I heard those words, I felt like I caught a clue about his mysterious career.

....

After a while of silence he replied:
"That's good. Your class could be used in other applications as well."
"Of course. And remember, when you behave well, I'll code a method for you so that you can iterate the peek()."

"Iterating? Think it is very odd!"
"That would be annoying when you peek() every time!"
...
Then said the little prince, solemnly.
"That's fine. My system is a very small system."
And added in a somewhat lonely voice.
"It's effortless to call the method several times, because I cannot even use so much memory ..."

Chapter 4
....
I had a proof, that the system the little prince used was B612.
The system model was suggested by a Turkish computer scientist in 1999.
At that time, he showed to be a model that works well. However, his paper was written in a very ugly font that no one had no interest in the paper. ...
In 2009 he wrote it again in nice-looking IEEE type of paper, and everybody respected it.

The reason I tell this in detail because the adults. Adults like numbers.
Talking about a newly written program, they never ask about essential matters.

They don't say:
"How does the program work? What does the chip do? How does the chip look like?"

They ask:
"What's the capacity of the program? How much is the chip's price? How many second does the program to run?"

Then they think they have understood.

If we had told adults:
"RAM are stacked on the mainboard very beautifully, it had a very slim case.", then they don't understand.
We need to tell them: "We saw a computer with quad-core with 1T hard-disk drive!". Then they shout: "Oh, a really nice computer!"


===

to be continued...