Navigation: Page 1 | Page 2

April 15, 2005

IronPython .72

Is anyone still experimenting with IronPython? The last time I really mucked with it , it was barely usable. Version .72 has just come out and I would dare say not much has changed in the last 8 months. Here is the simplest working snippet of invoking a .NET ListView from IronPython.


  import sys
  sys.LoadAssemblyByName("System.Drawing")
  sys.LoadAssemblyByName("System.Windows.Forms")
  
  from System.Windows.Forms import *
  from System.Drawing import *
  f = Form(Text=" Forms ListView ")
  f.FormBorderStyle = FormBorderStyle.FixedDialog
  f.StartPosition = FormStartPosition.CenterScreen
  mainList = ListView(Location=Point(30,30), Size=Size(300,300))
  mainList.View = View.Details
  mainList.GridLines = True
  mainList.Columns.Add("Column A", 100, HorizontalAlignment.Left)
  mainList.Columns.Add("Column B", 200, HorizontalAlignment.Left)
  mainList.Columns.Add("Column C",300, HorizontalAlignment.Left)
  for i in range(20):
      mainList.Items.Add("item " + str(i), i)
  f.Controls.Add(mainList)
  f.ShowDialog()

I tried making the sample dump a list of running processes in the system. It would be a very simplistic mimic of the task manager. Unfortunately import os bombs in IronPython .7. In .72, it succeeds but the methods and attributes lists are empty. Quite a useless import if the module is empty.

Oh well, I suggest people wait a couple of years before using IronPython for serious work. For now though, experiment away.

February 19, 2005

IOS Command Line

Ever since first using IOS, I have disliked its command syntax. The thought process always begins with: "I need to configure something, how do I do it?". After some time of digging through the documentation, experimenting with various command options, or (heaven forbid) ask someone who might know.... I end up with the correct syntax. However, as I stare at the command-line.... it, in no way, reflects what I want to do. IOS tries to embed meaning via verbs and nouns, however the eventual command-line just never makes any sense.

Ok, I have to qualify the above statement by saying that I have added a couple of commands to the bulk of IOS myself. I follow Cisco development procedures and added code into the existing bulk. It is standard-operating-procedure, however, I must admit that IOS is as far away from "user friendliness" as you can really get. The engineers at Cisco have decades of experience with computer networking. However, they don't understand how the human mind works. A wonderful product is one that bridges the gap between machines and humans. Steve Jobs understands this concept and is making it felt at Apple. I wish there was someone high up at Cisco that recognize that there is something missing here.

I could go into talks of the arcane build procedure, but that is a long topic left for another time.

Posted by Hoang at 05:58 AM | 2 Comments | TrackBack | OS and Frameworks

December 21, 2004

Pervasiveness of OS'es

Most of the world uses and are familiar with the Windows operating system. Folks here at Cisco claim that IOS is so widely used that it comes in as the second most widely used. Additionally, there is CatOS which is the precursor of IOS and is still in used in much of Cisco's existing equipment. I guess most of the world doesn't muck with networking but the other networking companies seem to be rushing to micmic IOS (or at least, implement the established command set). Furthermore, most of the equipment is hidden in back-offices that only techie types will have need to access and use these operating systems. So as pervasive as they may be, the OS'es are still underwater as far as the known world is concerned.

September 10, 2004

Links to share

Just some links to useful utilities and resources:

- Adam Nathan's PInvoke center (if you have to write PInvokes into existing Win32) . PInvokes are just very error prone so if someone else has got it working, why not just stand upon their shoulders?

- Virtual CD-ROM Control Panel for XP

- Outlook add-in for creating backups

- Outlook add-in for video email

September 09, 2004

Timing function calls

Timing how long a specified function or a certain amount of code would take to execute used to involve calling the hi-performance timer from Windows. With .NET, there is a small DateTime class which allows you to do this pretty easily. System.DateTime is supposed to be accurate up to tens of microseconds. For all but a very few extreme needs, that is more than good enough. Here is a small snippet of code which writes the timing out into a text file:


using System;
using (StreamWriter sw= File.AppendText(@"c:\out.txt"))
{
 	DateTime dt = DateTime.Now;
 	{  PUT YOUR FUNCTION CALL HERE }
 	DateTime later = DateTime.Now;
 	sw.WriteLine("Execution Time is: {0}", later-dt);
 	sw.Close();
}

August 19, 2004

Carefully treading on IronPython

For background, IronPython is the new Python implementation that works with dotNet's CLR. I asked this
question
on comp.lang.python on "how to interface with a collection via IronPython". The right answer is to use: get_Item(index) . However accessing instances of a collection this way makes a mess of reading code. I certainly hope that I am using this wrong or that there is a bug in IronPython that needs to be fixed. The nagging problem will be that when you are trying to access an index of a collection, how will you know it is a Python datastructure or a CLR datastructure?

Navigation: Page 1 | Page 2