Thursday, April 22, 2010

PyCon Asia Pacific 2010 has been firmly announced

Now they announce the PyCon Asia Pacific 2010.

http://apac.pycon.org/

9-11 June 2010, at Ngee Ann Kongsi Auditorium, Singapore Management University.

SGD 250 for corporate.
SGD 200 for early bird individuals.

Highlights:

  • Steve Holden, Chairman of the Python Software Foundation (PSF) will be coming  as one of the keynotes
  • Mark Hammond, author of "Python Programming on Win32"
  • Wesley J. Chun, author of "Python Core Programming", now software architect at Google
  • Martijn Faassen, a long standing member of the Zope Foundation

Friday, April 16, 2010

Missed PUG monthly meeting, exploring Java byte code and BCEL

I missed yesterday's Python User Group Singapore monthly meeting. I had to finish certain document before leaving office yesterday, I couldn't make it.

Last night I was exploring this Byte Code Engineering Library (BCEL) from Apache. This library gives us a way to analyse, create and manipulate binary Java class file. This library has been used by a lot of Java frameworks and containers, as those frameworks need to add some instrumentation when deploying those components in those frameworks and/or containers.

Well, this is considered an advanced thing in Java. Java classes are stored as Java byte codes. When you compile a Java source code, you will have .class file which is a Java byte code file. Java byte code is a form of machine instruction (in this case Java Virtual Machine or JVM). So it's executable binaries for JVM. Java byte code also have opcode like assembly language.

There are 2 type of instruction sets:

  1. stack machine
  2. register machine

Stack machine operates on stack. Operands are the stack only. The first programmable scientific calculators released by Hewlett-Packard are stack machines (http://www.hpmuseum.org/). They operate in a Reverse Polish Notation. I remembered that my first one of my first Java programming assignment was to implement GUI application for a Reverse Polish Notation calculator. My Dad has his own story of owning one of these calculators and he used to be very proud of the magnetic stripe stored Moon Lander game. It's just a number only Moon Lander, but it's a game running on programmable HP calculator!

Other sample of stack machines that most of us still use is the Intel x86 math coprocessor instructions set. It uses registers that are organised as stack, which will rotate back when overflowing the boundary (of 8 registers).

Stack machines, because it's only operate on stack and usually only the last few data in stack, may have shorter instruction bits. Unlike register machines which usually take some of the bits to specify from which and which register the data is from, and to which register the result goes, stack machines enjoy the benefit of default operands, that is top 1 or top 2 of the stack. The result is always in the stack.

I think one of the main considerations why JVM uses stack machine is to pack as few numbers of bits in the opcode. As most JVM runs as virtual machine, there will be no performance advantages of having a lot of register which anyway stored in RAM by the virtual machines.

Ok, enough for the stack machine, now back to the BCEL it's exciting to touch back the assembly language, byte code, opcode, operand, and stuffs if you are really into  it. I try to code a bit and will share the code later.

Monday, April 5, 2010

What is Spring Python?

Spring Python takes the concept of the Spring Framework and applies them to Python. This means that we can take advantage of the features of Spring Framework such as Dependency Injection (Inversion of Control), aspect oriented programming (AOP), remoting, data access, transactions, and security, all with the same non-invasiveness style.

This means that:

  • it will be easier to unit test software components (Python objects with standardized dependency injection)
  • we can move cluttering code outside the object and have cross-cutting functionalities (aspect oriented programming)
  • scalability of business objects by adding remoting
  • transaction (ACID)
  • security (interceptor based which won't allow outside world to touch your application unless they are really authenticated an authorized)
  • you don't have to extends certain class in order to get all those features (non-invasiveness)

The project was started independently by Greg L. Turnquist, which later joined the SpringSource team as Project Lead for Spring Python project. He also authored "Spring Python" book from Packt.

Spring Python is now approaching version 1.1 with its second milestone before release 1.1.0.M2. Current stable release version is 1.0.0.

All about SpringPython can be found on its web site http://springpython.webfactional.com/

Saturday, April 3, 2010

PyDev 1.5.6 has been released

PyDev is a plugin that enables users to use Eclipse for Python, Jython and IronPython development -- making Eclipse a first class Python IDE -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactor, debug and many others.

Fabio Zadrozny from Aptana, the author of PyDev plugin,  passed this information through mailing list:

This Release Highlights:

  • Django integration:





    • New Django project can be created through twizard

    • Can set an existing porject as a Django project (right-click project > pydev > set as django project) I think this is a kind of Eclipse's personality, like those of Maven2 plugins where you can declare that this project is a  Maven project

    • New Django project can be created throughtwizard

    • Can remove Django project config (righ-click project > django > remove django project config)

    • Custom actions can be passed to the configured manage.py through ctrl + 2 + dj django action -- if not action is passed, will open to choose from a list of previously used command

    • Predefined/custom actions can be used through right-clicking the project > django > select custom action

    • manage.py and settings module configured

    • Django shell (with code-completion, history, etc) available

    • Run/Debug as Django available

    • See: http://pydev.org/manual_adv_django.html for more details





  • Find/Replace:

    • The search in open files is no longer added in the find/replace dialog and now works through Ctrl  + 2+  s word_to_find (in the PyDev editor) and if no word is passed, the editor selection is used





  • Go to definition:

    • Properly works with unsaved files (so, it will work when searching for a definition on an unsaved file)

    • Properly working with Eclipse 3.6 (having FileStoreEditorInput as the editor input)





  • Editor:

    • Automatically closing literals

    • Removing closing pair on backspace on literal

    • Improved heuristics for automatically closing (, [ and {

    • Removing closing pair on backspace on (, [ and {

    • Ctrl + 2 + sl (sl comes from 'split lines' -- can be used to add a new line after each comma in the selection

    • Ctrl + 2 + is (is comes from 'import string' -- can be used to transform the selected import into a string with dots



  • General:

    • Code-completion properly working on relative import with an alias

    • Fixed racing issue that could deadlock pydev (under really hard to reproduce circumstances)

    • Removing reloading code while debugging until (if) it becomes more mature in the python side

    • Fixed issue where a new project created didn't have the source folder correctly set

    • Text selection in double click no longer has weird behavior

    • Local refactoring working on files not in the PYTHONPATH

    • Edit properly working on string substitution variables

    • Using with statement on python 2.5 no longer makes lines wrong in the AST