Bash 101 Redux

Bash 101 Redux 

Vyper Logix Corp Makes ITC (Inter-Thread Communications) Easy as 1,2,3 !!!

Take a look at the code sample found in this article !!!

Very Lean !!!

Very Cool !!!

Threaded !!!

Best of all the main process terminates itself once all the work has been done !!!



Code sample was printed using Wing IDE and Snag-It 10.


Python Type-Cast the Easy Way !!!

Python objects hold key and value pairs – this is what every object holds, key and value pairs.

Python objects that have a __dict__ make it easy to convert the object from one class to another simply by replacing the old object instance with another as follows:

See the attached file with a sample of how this can be done most simply. (

There are other ways to accomplish the same goals using more elaborate means however this works using less code.

What to do when your objects do not implements the magic methods required for the aforementioned code sample ?

Easy, you can use method injection as described here or here or here or here.

It also helps to use a really good Python Debugger in the form of the Wing IDE.  Stare at the debugger while debugging Python code just long enough and sooner or later you may begin to see how to accomplish goals you may find useful.

I am not recommending you try using the aforementioned code as part of any professional solutions unless  you know who will be doing a Peer Review of your code but I am saying these techniques may be useful in learning something about the object types being used as to whether or not the object types are meaningful.

The point being, you can either grouse and lament how things cannot be done or you can learn the Agile Method for getting things done…

String splits versus lists for static data ?!?

Every so often someone will ask a really interesting Python question, this is not one of those however the data seems to disagree with the opinions.

In some python code, I see this:

switch_fields = “id switch_model ip”.split()

which is surely the same as this:

switch_fields = [‘id’, ‘switch_model’, ‘ip’]

Since the intent is clearly to create a list of three items, why would someone create a string instead and invoke a string method to create a list?

My preference is for the “say what you want” side; I don’t consider myself to be a “Python Programmer”, though.

Some responses from various Python programmers…

I agree with saying what you want. I’d probably ask the author if they would ever be inclined to do the reverse, i.e. switch_field_str = ‘ ‘.join([‘id’, ‘switch_model’, ‘ip’]) to prove a point about how confusing/silly that can be.


     I agree, there is no logical or practical reason to have a static string that has a split performed on it every time the code is run. It is a waste of computational time.

Now for my response…

I was curious…

I had to run over 100,000 iterations to see a measurable difference…

Apart from the run-time differences one might find it easier to maintain code with static arrays loaded from string splits especially if one had to sit and type a lot of quote marks and commas… or maybe I have had far too many late night coding sessions in my past.

Thought I would share the attachment.

Seems the data does not really seem to support the opinions if the concern is computational time and performance… unless you wanted to do the string splits to list thing something close to 1,000,000 times; even 100,000 iterations is nothing you can measure let alone notice.

Eh, such is life.

Built-In Unit Test !!!

This code has a built-in Unit Test

You know what…  I think this means I know how to write Unit Tests !!!

Well I wrote this one anyway – this is my story and I am sticking to it… LOL

Yet another Ruby on Rails Programming Test *yawn*

So here we are again with yet another Ruby on Rails Programming Test !!!

Maybe someday people will just take as proof everything else I have publishing here but that day has apparently not yet arrived…

The Problem – Not exactly any kind of real business problem…

Rails Exercise:

We’d like you to create a simple Rails 3 application.
Create models that allow a user to follow another user.
The user model’s only attribute is “name”. You may scaffold the create action.
Create an interface that accepts post requests that allows users to
“follow” other users.
The user’s “index” action should list all of the users.
The user’s “show” action should show:
1) The user’s name
2) The users the user is currently following (with a button to remove
that following)
3) The users the user is not following (with a button to add that following)
4)  The users currently following this user
Do not create a login system for this exercise.

The Solution

Download it from this link; only 600 KB  !!!

Programming Test sponsored by NASA and RackSpace *yawn*

Programming Tests that have no bearing on the reality of software engineering are a real hoot – this one comes to us from NASA and RackSpace – I especially liked the one from my early childhood – the one that counts coins… LOL

Enjoy !!!

dev project 3 – Voccio

dev project 3 – Voccio (response on 11-17-2011)

%d bloggers like this: