Archive

Archive for March, 2011

A kitty dies when someone says “experience” instead of the “user interface”. Aren’t you aware of it?

March 15th, 2011 Comments off

Like the title says, am I the only one to realize that a little kitty dies in a horrible way whenever someone says “experience” instead of “user interface”? I didn’t even know how widespread it was prior to reading the Mark Shuttleworth’s article and all the replies on various blogs.

But now, I have this uncanny feeling that I’m in a minority and all’s lost, no one except for me can see the utter absurdity of saying  “The user is always able to install a different experience”. Say what?! To install an experience? I understand installing a different window manager can instill an experience of some sort but installing one? Isn’t that going too far?

What bothers me in it is that the first time I saw it was when I was installing some proprietary software and the thing asked me if I was interested in anonymously sending the installation’s experience to the company producing said software in order for them to improve my experience next time. I don’t know if I can even fully appreciate the ridiculousness of such a request. My experience is mine and is bound to be so and can never be expressed anonymously, that’s the whole deal about experience, that it’s so personal. Leave out the person and you’re left with a corporatesque gibberish meant to attract clueless victims so that they can be squeezed out of any juices left.

That’s why I was so disappointed to spot the damn term when people were talking about open-source software, I mean come on! You can do better! You don’t have to sound like some PR people speaking out to customers instead of people. I know it sounds boring and a bad style to use the same word or an expression over and over again but really, snatching the worst of what the proprietary world has to offer and using it in open-source environment sounds slovenly beyond any hope my friends! :-)

A picture of a cat sitting on a railing on a high floor. The caption says: You say "experience" and I'm gone!

Share
Categories: Software Tags:

PyMQI 1.2 has been released!

March 15th, 2011 3 comments

Woo hoo! PyMQI 1.2 – Python interface to WebSphere MQ – has been released and here’s an excerpt on new features taken from the release announcement:

  • Added support for MQ 7.0-style publish/subscribe
  • Added support for creating and parsing of MQRFH2 headers
  • Added new constants in the CMQZC.py module
  • Added new structures – MQSRO, MQSD, MQTM, MQTMC2
  • PyMQI now supports byte strings
  • New MQ verb – MQSUB
  • Simplified establishing connections to queue managers
  • Added means for checking whether a client application is connected to a queue manager

Special thanks to Hannes Wagener for his excellent contributions!

Links

Project’s homepage: http://packages.python.org/pymqi/
Download URL: https://launchpad.net/pymqi/+download
Usage examples: http://packages.python.org/pymqi/examples.html
Twitter: https://twitter.com/fourthrealm
Blog: http://www.gefira.pl/blog
LinkedIn: http://www.linkedin.com/groups?gid=3726448
IRC: #pymqi channel on Freenode network

@fourthrealm

Share

WebSphere MQ Administration with Python. Part I – introducing PCFExecute

March 10th, 2011 4 comments

Hi and welcome to the first installment in the WebSphere MQ Administration with Python series. The goal is to introduce readers to the topic of performing admin tasks with Python and encourage those who still waver over whether to migrate all those Visual Basic or Java tools to actually start using Python, a modern, fast and cross-platform programming language.

The Python interface to MQ is called PyMQI and among many goodies it provides there’s also a very useful pymqi.PCFExecute class. PCF is, as you surely remember, a short for Programmable Command Formats, which basically means it’s an API for writing programs that are meant to automate tasks MQ admins usually do.

How does it work in Python? Well, you just need to open the appropriate MQ manual and pick any PCF command, say an MQCMD_PING_Q_MGR. The name you’ve chosen is always available as an attribute of the PCFExecute class instances, like below:

import pymqi
 
queue_manager = "QM01"
channel = "SVRCONN.1"
host = "192.168.1.139"
port = "1434"
conn_info = "%s(%s)" % (host, port)
 
qmgr = pymqi.QueueManager(None)
qmgr.connectTCPClient(queue_manager, pymqi.cd(), channel, conn_info)
pcf = pymqi.PCFExecute(qmgr)
 
# Woohoo, we've just executed our first PCF command!
pcf.MQCMD_PING_Q_MGR()
 
qmgr.disconnect()

So you just need to connect to a queue manager, create an instance of the pymqi.PCFExecute class and then you can directly invoke anything that’s listed in MQ manuals.

OK, that was easy as pinging a queue manager doesn’t require any parameters nor does it return anything. How about something less trivial, like creating a new queue with MQCMD_CREATE_Q?

import CMQC
import pymqi
 
queue_manager = "QM01"
channel = "SVRCONN.1"
host = "192.168.1.139"
port = "1434"
conn_info = "%s(%s)" % (host, port)
 
qmgr = pymqi.QueueManager(None)
qmgr.connectTCPClient(queue_manager, pymqi.cd(), channel, conn_info)
pcf = pymqi.PCFExecute(qmgr)
 
queue_name = "PYMQI.1"
queue_type = CMQC.MQQT_LOCAL
 
args = {CMQC.MQCA_Q_NAME: queue_name, CMQC.MQIA_Q_TYPE: queue_type}
 
pcf.MQCMD_CREATE_Q(args)
 
qmgr.disconnect()

MQCMD_CREATE_Q obviously needs some arguments and these are passed in wrapped in a dictionary whose keys are the same as the manual says there should be. For instance, it says that MQCA_Q_NAME and MQIA_Q_TYPE are required identifiers so I knew I could use the PyMQI’s CMQC module for looking them up. Likewise, the manual lists all the supported queue types and they also can be found in CMQC and that’s how I knew I could use CMQC.MQQT_LOCAL for the queue type. So to recap, the arguments – required and optional – are explained in the MQ documentation and you need to use PyMQI constants to form a dictionary and pass it in to the PCF command of your choice. What other modules are there in addition to CMQC? Well, there’s also CMQXC and CMQCFC and PyMQI 1.2 will introduce CMQZC – they all may be used for constructing the arguments to PCF calls.

So here it is, an introduction to PCFExecute. I plan on writing more about manipulating MQ objects, queues, channels, queue managers, aliases and so on and if you’d like to have anything covered you just need to drop me an e-mail. Thanks!

@fourthrealm

Share

Looking for a clear example of using MQSUBRQ in C?

March 9th, 2011 Comments off

Some time ago I was in a middle of resolving an interesting issue in PyMQI while I found myself in a need of a clear example of how to use WebSphere MQ’s MQSUBRQ in C. Yea, in C this time, not in Python. I needed something that wouldn’t have been obscured by stuff like parsing of command line options or you know, anything that painfully reminds you how low-level C really is.

So I wrote the code and thought I shouldn’t be really keeping it for myself, maybe someone else will need it some day as well. Hence I’ve uploaded it all to my bitbucket repo, and if you need the sample code for MQCONNX, MQPUT, MQSUB, MQSUBRQ and then, finally, an MQGET :-) then here it is, enjoy!

And while I have your attention – you do know there’s PyMQI, the Python interface to WebSphere MQ, don’t you? So if one shiny beautiful day you find yourself weary of C then you are more than welcome to give PyMQI and Python a try!

@fourthrealm

Share
Categories: Software Tags: , , ,