The Genius Kid who made Ruby 1.9 63% faster

The news
http://jibun.atmarkit.co.jp/ljibun01/rensai/genius/05/02.html

- He found out that fibonacci program on ruby 1.9 is slower than 1.8.
- He try to look at ruby source codes in C, and optimize the looping codes inside the interpreter.
- He fixed those to get 63% faster for loop intensive routines.

He is still in Intermediate school, and still very young, but just genius :-) , Cheers,

He is good in C#,  Java, Python too :-)

his blog
http://d.hatena.ne.jp/CanI/

#ps, I am just reading his Python posts, OMG! He is super geek! I can't do 1/5 of him. he seems too brillient.

Cheers,

နိုင္ငံအလိုက္ လူ?ျဖစ္ေပါှလာပံုအဆင့္ဆင့္

just take a look, its hilarious, myanmar should have one too.

#Memo - Myself - 2009 Oct 19

Today,

1) I have Ported My Roman to Number, Python one liner to C, Speed becomes unbeatable. :-)

Python
`R,r={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000},lambda x:reduce(lambda T,x:T+R[x]-T%R[x]*2,x,0)`

C
`int R[]={100,500,0,0,0,0,1,0,0,50,1000,0,0,0,0,0,0,0,0,5,0,10};int r(char*s){int x=0;while(*s)x+=R[*s-'C']-x%R[*s-'C']*2,s++;return x;}`

2) I Found New Python IDE, called Spyder

# I am currently using Pyscripter and sometimes notepad++, previously I use Wing (its not free), Eric IDE, ...

3) I found Python to C++ Code Generator called shedskin, it supports limited syntax only though.

# I am sometimes using psyco, its quite good actually, psyco use JIT when It can, just skip if cannot, for shedskin, it cannot proceed at all for unsupported syntaxes. Well, It make sense though.

4) I have learn something new on new languages and new ideas, new writing styles.

http://myanmaritpros.com/forum/topics/challenge-on-programming-or

# Challenging is good, I believe :-)

Cheers,
Mark

Python 3.1 In Myanmar Names

Python 3.1 in Myanmar, its Implemented Unicode.org based.

# I found that, to works properly Zawgyi and Ayar, I Need to compile Python Myself.
I will do soon though.

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32
>>> def နွုတ္ဆက္စကား_ေျပာျခင္း(နာမည္):
စကား = "မဂဿငလာပါ {0}။ ေနေကာင္းလား?".format(နာမည္)
print(စကား)

>>> နွုတ္ဆက္စကား_ေျပာျခင္း("ေမာင္ေမာင္")
မဂဿငလာပါ ေမာင္ေမာင္။ ေနေကာင္းလား?
>>>
>>>

-----

Python Code

def နွုတ္ဆက္စကား_ေျပာျခင္း(နာမည္):
စကား = "မဂဿငလာပါ {0}။ ေနေကာင္းလား?".format(နာမည္)
print(စကား)

နွုတ္ဆက္စကား_ေျပာျခင္း("ေမာင္ေမာင္")

----

Cheers,
Mark

Simple Roman Numeral Conversion in Python

For Example, We like to convert CCXCIV to 294

# Mapping of Roman Numerals to English Digits is like this
I=1
V=5
X=10
L=50
C=100
D=500
M=1000

# We can use Dictionary in Python
R={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}

# Actual Function to sum up the values for each roman numerals, in a line
roman=lambda x:reduce(lambda T,x:T+R[x]-T%R[x]*2,x,0)

In python, there is reduce function, that can do [1,2,3,4] => 10,
by summing up from left to right like this (((1+2)+3)+4)

The correct answer should be , C=100, C=100, XC=90, IV=4 => 294

But when we sum up XC, X=10, C=100, oh, its becomes 110, and actual one should be 90.

No worries, 110 is the 90 + 20, and 20 is 2 times of X, isnt it? so just substract it after you sum up :-)

-T%R[x]*2 will do it for you, got it? IV will do same as 6 - 2 => 4 too :-)

so 200 + 90 + 4 will be 294 :-)

Thats the idea I got today, may be somebody already done like that before, but I can't find anything like this in Google, so this is mine.

Here is the some of the test results

I 1 1 True
II 2 2 True
III 3 3 True
IV 4 4 True
V 5 5 True
VI 6 6 True
VII 7 7 True
VIII 8 8 True
IX 9 9 True
X 10 10 True
L 50 50 True
C 100 100 True
D 500 500 True
M 1000 1000 True
XXXI 31 31 True
CXLVIII 148 148 True
CCXCIV 294 294 True
CCCXII 312 312 True
CDXXI 421 421 True
DXXVIII 528 528 True
DCXXI 621 621 True
DCCLXXXII 782 782 True
DCCCLXX 870 870 True
CMXLI 941 941 True
MXLIII 1043 1043 True

# First column is Roman Numerals, 2nd is actual Values, 3rd is generate Results, 4th is checking the Result is Right or Wrong

Cheers,
Mark

Don't use Dive into Python Book to learn Python, If you are non-programmer

Don't use Dive into Python Online Book to learn Python, If you were non-programmer.

because, after 2 pages of hello world,

>>> print 'hello world'
hello world

its suddenly goes to following codes, its quite difficult for new programmers.

def buildConnectionString(params):
"""Build a connection string from a dictionary of parameters.

Returns string."""
return ";".join(["%s=%s" % (k, v) for k, v in params.items()])

if __name__ == "__main__":
myParams = {"server":"mpilgrim", \
"database":"master", \
"uid":"sa", \
"pwd":"secret" \
}
print buildConnectionString(myParams)

I believe, iterating dictionary object with this method for new users, just giving headache to them.
They wont even know what is the dictionary object is.

";".join(["%s=%s" % (k, v) for k, v in params.items()])

----

Instead, Read Python's built-in Manual, or Tutorials Part for start learning python.

or

Read Mark Lutz's Programming Python, 3rd Edition

Cheers,

http://en.my-mm.org/lookup.htm is going offline, and will be available with Zawgyi 2009

http://en.my-mm.org/lookup.htm is going offline, and will be available with Zawgyi 2009 only.

There is link http://myanmarnlp.org.mm about my dictionary, but I have no affiliation with MyanmarNLP.

# ps, I am working again on Zawgyi 2009 related things. Cheers!

Mark

အလုပ္မရွိ ေျကာင္မ ေရခ်ိုး

အလုပ္မရွိ ေျကာင္မ ေရခ်ိုး ဒရိုင္ယာ မွုတ္ :D

ဒီေျကာင္မ်ိုး လိုခ်င္တယ္ :D

The Reasons Why I like Python - Part 1

- python hash/dict {} is super fast

- you can save every variables and objects from memory to file and from file to memory as variables, (pickle)

- No Need to close the code block with brackets "}" or "end", its better for reading because less lines and clear tabs

- no operator overrides, so you wont see strange syntaxes when learning other codes

- Python data objects are almost same as JSON, so most of the case you dont need any special program to convert each others

- python has wonderful lambda functions too.

- its relatively fast, if you dont satisfy its speed, you still can tweak it through C,C++

- you can call C/C++ functions from python and can use from C/C++ functions to Python functions too.

- develop and maintain by many many super geeks and gurus, so its just impressive to use python :D

- python is good for text processing, web, cross platform GUI, shell scripts, almost everything you can do with python.

- you can do 9999**9999 (power) easily in python (result around 40000 length digits), i believe its better than complied languages

- array/lists [], dict/hash {}, tuple() can easily convert each others, and all of them are easy to iterate.

- sets object can save lots of your works. you can do intersections, combinations, difference objects very easily.

- i like this syntax for looping an all iterable objects [x for x in x] :-)

- adding/removing items from/to array/lists are super fast

- regular expressions are full featured

- some modules (eg, io) are rewritten eventually with C for speed by super geeks, so performance are no worries

- its now upto versions 3.*, and its very compact and not bloated one.

- my own code is readable after 6months, others languages i cannot, because python syntax is unique way and very cleared

- python comes built in with most linux machine these days, and many hosting supports python.

- most of the python authors works in big companies, and python is in use by top companies, its mean you have more chance to improve your life with python :-)

- many hacking/exploits scripts avaible in python these days, its mean you can learn lots of tricky and nice codes from that :P

- most of the cases, python codes has less characters / less lines than other languages. I am very much fun with this :-)

- its easy to write own web server, if you just need to run python based web sites, its very easy :-)

- python itself compile very fast, and very easy, if you do custom build

- you can just use g++ or mingw32-g++ to compile almost all C/C++ extensions, on almost all OSes.

- python is good friend for network engineers too. I can get PE Router configurations with python easily, and I can analyze PE Router config for each users and each circuits very effectively :D

To be continued

#ps there is many many left, i can only recall those now, cheers

Mark

Hitler Doesn't Get A Google Wave Invite

Hitler Doesn't Get A Google Wave Invite

a very very nice injected subtitles :P

I found that its successful logged in, and

facebook already knows their site phished and suspended those accounts already. (see the screenshot, there is logout button)

its mean they,facebook, are the one who got phished, not hotmail itself.

so its means hotmail login accounts also exposed.

cheers,
/mark

MySQLdb - mysql-python 1.2.3c1 for Python 2.6 - No official one for Windows, so I built it

After I upgraded my Python from 2.5 to 2.6 series, I have noticed that I forgot one extension, its MySQLdb.

I searched on MySQL-python sourceforge for py2.6, but no luck, there is only for linux version, not for windows.

So I tried to google it. i found this -> python-26-mysql

Its for mysql-python 1.2.2, they are making it themselves too. Its not official one.

So, I have decided to built my own too and seems I was able to managed it.

- My Python version is 2.6.3
- I have installed mysql server 5.4.2 in my machine
- I have compiled with mingw32 manually instead of default, Visual C++ Compiler.

Here is the installer for 1.2.3c1, python 2.6 - MySQL-python-1.2.3c1.win32-py2.6.exe

The 1.2.2 one built by others has some deprecated warnings, but mine seems fine for that.

Its properly imported with no warnings and running smoothly for database queries too.

Cheers,
Mark

#Memo - upgraded Python 2.5.4 to 2.6.3 for my working environment

#Memo - upgraded Python 2.5.4 to 2.6.3 for my working environment

reasons, almost all of the extensions are mature now, upgraded extensions I am using also.

- nltk
- numpy
- PIL
- PyQt
- pycairo
- PyGtk
- wxPython
- pywin32
- py2exe

only one extension, there is no psyco for 2.6, but I am not using currently, its okay for now.

other than that, seems so far so good.

# KeyMaster recompiled with Python 2.6 now.
# So from KeyMaster version 0.8.1, it will be with python 2.6.
# DLL files are included in installer, so normally, no problem at all.

cheers,
Mark

#Memo - Google Chrome now have Bookmarks Sync & Extensions

Google Chrome now have Bookmarks Sync & Extensions

version 4.0.220.1 dev

Google's Bookmarks sync idea is better than Google Toolbar's Bookmarks Menu, because this one can use seperate account for bookmarks, it can give better security because you dont need to store password for your main Gmail account.

Cheers,
Mark

Gave up installing any Windows on my AMD64 machine finally

Windows is very much unstable on my x64 machine.

First
- XP x64, 2003 x64, there is some incompatibily with graphic driver, its crash seriously, like when i open firefox, its just hanged or sometimes reboot automatically in chance of 30%.

- Vista x64 - tried 4 times, within 3 years, its installed properly, but never boot.

- Windows 7 x64 - tried today, also same, its installed very smooth, but never boot, just show white screen and freeze.

I need to use x64 because the performance on x64 and x32 is very much different.

I installed x64 versions of ubuntu, kubuntu, xubuntu, and unbuntu-server with lxde desktop.
Its no problem, and I dont see any serious crashes.

I love Windows very much because of easiess, and user friendly things.

But, Finally, I gave up using Windows on my home PC, with AMD64 Dual Core 5200+, with 8GB RAM.

I will dive into Linux more deeper.

Cheers,
Mark

My ToDO List or Not ToDO

Here is what I am doing now.

My Hobby Projects
- Zawgyi 2009 (not yet finished)
- KeyMaster for Zawgyi 2009 - Windows (not yet finished)
- Myanmar Search Engine (not even started yet)
- wxPyDict - Dictionary Lookup program - Windows (currently no updates)
- Myanmar Text Tools - Windows (dont have time to touch it)
- Burglish Systems (currently no updates)

Old Projects (being suspended)
- Prince Kanaung Converter Engine (never touch now)

Paid Projects (almost done)
- one web based engine (taking too much time)
- one myanmar text related program (i like this)

My Works
- My Current Cisco Network Engineering work for MPLS (its my profession, so same as ever)
- New Juniper Router configurations for IPSec Tunnels, Static, BGP to MPLS Networks (starts from 1 Oct, 2009) (a new exciting technology)

What I like to do / research
- Zawgyi 2009 for Mac OS X (imm, i need one Mac, or Emulator to run at my one)
- KeyMaster for other OSes (no idea yet)
- wxPyDict, Myanmar Text Tools to works in other OSes (its able to run but not going to release for now)
- to upgrade Burglish Systems to Zawgyi 2009 (no idea now)
- CAPTCHA Cracking (i really want to try this)
- Myanmar OCR (I like to do this)
- Myanmar Text Analyzer, Word Breaker (like to continue this)
- My Own Web Server, My Own Database Server, A Fast Search Engine (this is fun)
- Some certificates on Cisco, and Juniper (lazy though, need to learn/take at sometimes)
- learn more on FreeBSD (I need to improve this field more)

Wah, There's a lot. what should I do first or last? or Forget Everything?

Just NO IDEA, there is lots of other stuffs and personal related things left to do so.

I need to postponed or suspend or stop half of them at least.

/mark

Memo# JUNOS As A Second Language & Myself

http://www.juniper.net/us/en/training/elearning/jsl.html

I start learning JUNOS from today because I suddenly got handover from
other team in my work.

I got a few basis idea about some commands & concepts from my work like,

- commit check,
- commit synchronize,
- run moniter start messges
- show, show | compare, show | match
- delete unit No.
- some interfaces, rsp0, lo0, ae0
- and knew there is some services like, ike, ipsec-vpn
- rounting instances, static routes
- some policy-options prefix-list ipsec-peer
- shared key generations
- telneting, sshing ....

I will go on routing tables, and bgp advertise, receive checks, bgp
summary tomorrow.

well, I will try my best.

cheers,
Mark

• 6 hours ago
• 2 months ago
• 3 months ago
• 6 months ago
• 7 months ago
• 9 months ago
• 1 year ago
• 2 years ago
• 3 years ago
• 4 years ago
• 4 years ago
• 5 years ago
• 6 years ago
• 6 years ago
• 6 years ago
• 6 years ago
• 7 years ago