Saturday, February 26, 2011

Tcl Python converter / interpreter

After searching the guts of the internet - I found that there is not a single working example that can convert Tcl to Python.

This is a major drawback to the industry!!
If one exists (please let me know ASAP) the industry can switch to Python, this move will give it the ability to develop more rapidly and neglect the faults of this very old and nothing oriented language.
The industry will then be able to progress much faster.

Big greedy thoughts came to my mind - 'I can be rich if I could just create such a thing', but it's really a big problem, to my opinion, and I believe that if one could be created it should be distributed almost freely to take the industry to the next level.

I'll attempt to attack this problem on my own (you are welcome to join forces).
Please, let me know if there is any solution to this problem.

I've some ideas on 'how to attack this problem', here they are:
1. Using TCP/IP pipe - HLD schema
2. Create a python script to convert Tcl script to Python (sounds like a hugh work hours).
3. Create a Tcl script to convert Tcl to Python (sound worst than #2)

Tuesday, February 22, 2011

Guide: Connect Eclipse to SVN

Installing SVN for Eclipse


Eclipse->Menu->Help->Install new software...click
Work with='http://download.eclipse.org/releases/helios'
Collaboration... select the following (click the picture for details...):



1. Subversive revision graph.
2. Subversive SVN Integration for Mylyn project.
3. Subversive SVN JDT Ignore Extensions.
4. Subversive SVN Team Provider.
Next...Next...Accept licence...Finish.

Select the appropriate SVN connector (native or Java base, and the appropriate SVN version) and follow the instructions according to your selection.

Using SVN


Connecting to an existing SVN repository


Eclipse->File->Import...SVN->Project from SVN...
URL:...Browse...
Authentication...if needed.
Next...Finish...Follow the instruction.

Connect your project to an existing SVN


Eclipse->Right click the wanted project->Team->Share Project...->SVN->Next
URL: Paste the SVN repository path...Browse...Select SVN path...
Next...Follow the wizards...
Your done.

Tcl, FIFO based on a list.

FIFO based on a list... code

Debugging Tcl, advanced way.. (part 1)

DEBUG helpers - code.

Hi,
Here is a nice helper code to make your debug life much much easier.

If you encountered in a bug and the debugger is so slow you wana die, you probabelly puts some messages in the function entry and when the function returns (with it's value).

In the attached code you'll find a very nice surprise.

Sunday, February 20, 2011

Guide: Setting up Eclipse with DLTK and ActiveState to debug TCL.

Let's start working...

Download and install Eclipse SDK
1. Download Eclipse (I used 'Eclipse IDE for Java Developers').
2. Unzip (or install, depends on the download type) to your favorite location.

Download and install DLTK
3. Run Eclipse.exe from that location.
4. Menu->Help->Install new software...
5. Right of 'Work with:' click the 'Add' button.
6. In the name enter 'DLTK'
7. location = 'http://download.eclipse.org/technology/dltk/updates/'
8. Click OK and wait a few seconds for the Eclipse environment to fetch the versions.
9. Select the appropriate version (for 'Helios Eclipse SDK' (version 3.6.1) I used DLTK 2.0v). Note: You can select the minimum for TCL (listed below), I selected all the DLTK.
10. Next.. Next ... Accept the license agreement, Wait for the download to finish.

here is a minimum list i found to install TCL DLTK:
>>> Dynamic Language Toolkit – Core Frameworks
>>> Dynamic Language Toolkit – Core Frameworks SDK
>>> Dynamic Language Toolkit – iTCL Development Tools
>>> Dynamic Language Toolkit – iTCL Development Tools SDK
>>> Dynamic Language Toolkit – TCL Development Tools
>>> Dynamic Language Toolkit – TCL Development Tools SDK
>>> Dynamic Language Toolkit – XOTcl Development Tools
>>> Dynamic Language Toolkit – XOTcl Development Tools SDK

Setting up Eclipse Tcl interpreter
11. Download and install TCL Shell and interpreter.
12. Using Eclipse IDE: Menu->Window->Preferences->TCL->Interpreters
13. click 'Add'
1. Name='TCL'
2. Browse... path to the Tcl interpreter executable (I've installed it at '')

Setting up Eclipse Tcl debugger
14. Install 'Komodo remote debugger'
15. Using Eclipse IDE: Menu->->Window->Preferences->TCL->Debug->Engines->Active State
16. Under 'Paths' tab->'External debugger engine'->Path->...->Select the debugger path and file ('dbgp_tcldebug.exe' for windows).


Now you are all set. You should be able to choose new TCL project, write your Tcl code and debug your programs.

Other posts used to create this instalation guide:
* http://blogsai.wordpress.com/2009/10/15/configuring-eclipse-as-tcltk-ide/
*

Have fun...

Monday, February 7, 2011

TCL debug tools.

I've run a search on Google 'how to debug TCL' and found these good articles:

1. What debugging tools are available to a Tcl programmer
* Use puts 'debug $message here'.
* Other strange looking ways to solve the TCL debug problem.
2. Buy 'Tcl Solutions' by 'ActiveState'
3. Try 'Dynamic Languages Toolkit' by Eclipse

As a start-up freelancer solution provider I should provide with as low cost solutions as i can, so... let's start testing these solutions.

'puts' in your code


Already using this solution - very chip, no money spend, but if you consider the work-hours spent: it's not chip at all!!

Eclipse support for dynamic language


I've started with #3: Eclipse support for dynamic language, like TCL and Python.
Very soon found this great looking presentation - Dynamic Languages Toolkit (DLTK) , Looks promising...

After a little struggle I've managed to bring up a working station with Eclipse and DLTK.

In the next post I'll describe how to setup Eclipse with DLTK and a debugger.

TCL first impression.


I've just started to do some freelance work.
First job is to do performance improvement to a legacy scripting program written in TCL. Never touched TCL.


TCL Compared to Python


There are lot's of rules in TCL to load to the mind, lot's and lot's and... Python is very simple.

OK, so... let's debug it. 'NO DEBUG for you', I'm still working on a debug platform, so far debug looks like this:
1. Write the code.
2. Run the application.
3. Wait for the right moment, be patient, wait, not yet... now
5. Missed it? go-to (2) OMG - time spender.
6. See what's happened.
7. Close the application
8. Write some debug messages ( AKA: trace print outs ).
9. Go-to (2) until you finally found the right code to make it work.
10. Refactor, code review... the rest...

I've debugged Python using Iron-Python and Eclipse, it was reasonable for the pilot I did to Python.


Conclusion so far


TCL was probably good in it's glorious days, I can see it in my mind - compared to VB script i've worked with those days, but those days are long gone, for both of them.

TCL - Frustrating, BIG time consumer in maintenance AND in development phases, no suitable DEBUG platform (so far).

WIKI - http://en.wikipedia.org/wiki/Tcl


If you can port to Python, do so, ASAP. I'm calculating the time I’m going to spend on this tool compared to building a new one in Python. It might take a month or so, but the total maintenance of the TCL might take longer.

If your stuck with TCL, like I probably am, well... read the flowing posts to see how to handle the TCL maintenance problem.

Wednesday, February 2, 2011

Iron-Python first impressions


In my previous post 'IMDb search for a given trailer', I've showed some code in Python.

I'd like to say that I'm really impressed by the easy, fast and clear code I can now manufactured with Python.

I see it as a beautiful, humanoid, cross platform, code experimental, scripting language, fast POC tool and a great development phase language.


It should be the holy grail, but....


I've compared the performance between same code in C# and Python, and not to my surprise - it's also slower, much slower, 10x times slower than a static language like C# (which is also slower compared to C++).

So, it's a 'development phase' language, where you want to deliver fast, but if we combine it with C#, like Iron-Python does, write the skeleton in python than in the 'performance phase' we move the slowest parts to C#, we have a winning combination. Almost...


'Maintenance phase'


In this phase we need a programmer familiar with python OR is willing to mess his hands with python, this can be harder to find than the horde of C# programmers.
The advantage, on the other hand, is that the code is: cleaner, more redable, less code lines ==> Easy to maintain!! ==> less time to maintain ==> Faster stable version ==> we can port the stable code to C# and have time for another coffee.


'Bug/Debug phase'


I found it very easy to debug Iron-Python, while playing it with C#-Express. But still when you put your hands in the dirt and start debuging, you can feel it's not that mature for debugging, not yet.
Still, the time i spent on curving my knowladge on python + debugging it was still less than if i had to code it in C# and debugging the same bugs.


Conclusion and personal opinion


My guts telling me - 'It's worth it'.

Go for it, but start with small projects, not important ones, not risky ones.
Try to automate monotonic stuff you do in your daily work ('Manual monitoring network drive to see if a folder changed, if it changed copy it to my personal backup folder, so i can work from home...' stuff like that...)

IMDb search for a given trailer.


This post core code...



I've started learning IronPython two weeks ago. This language is a diamond, i'm afraid i won't be able to go 'back' to .NET again :)

To summarize my study I've decided to automate something in my already overheated life.

I love movies, i can't see them all, so i see a lot of trailers.


Here is the story


Let's say you have a folder with many movie trailers that you automatically download with a daemon tool.
Let's also say that you wish to see only the trailers worth viewing, in my case: 'The score in IMDb must be above 8.0'.

Let's stop saying... here is the core code...

Code highlights / requirements


1. Given a string which contains: Trailer title keywords + superfluous keywords, extract only the title keywords.
2. Run a title search on IMDb with the title keywords.
3. From the results extract the top/first X results.
4. For each result open the title page and extract: [Title name, Year, Rating]
5. Encapsulate these results for later use.

Tuesday, February 1, 2011

First post...

Hi,
For some reason my blog was deleted (probably inactivity), so... here i go again :)