retrieving sql server procedure output variables in python

Say, I have a stored procedure like this:

create procedure delete_po @po_number varchar(100) = null output, @delete_message varchar(200) = ‘deleting..’ output as….

To retrieve the the two output parameters, after the connecting with adodbapi, get the cursor and run this:

po_number = ‘ PO1487’

delete_message = ‘ ‘ * 200

result = cursor.callproc(‘delete_po’, (po_number, delete_message))

The output variables will be in result.

If I added print result to the previous code, I get this output:

[u'PO1487', u'cannot delete PO1487 because there are receiving transactions']

Note that the initial values of the variables (po_number, delete_message) must be initialized with sufficient length to contain the output values. Thus my delete_message = ‘ ‘ * 200.

Windows 7 search – indexing py, sql, php files

imageLike many others, I too had a time when I lost faith in Windows 7’s search feature, particularly with indexing the contents of py, sql, php files. These were files that I use a lot.image

I knew I had the phrase in some file but Windows 7 search returned no search.

I even switched to Google Desktop Search(GDS). But GDS does not search contents of php, py files. It did search sql files because I set it up as a text file type.

So I reverted to Windows 7 Search.

Before I gave up on Windows 7 search earlier, I did notice that it indexes files that I have worked on before. So, Windows 7 guesses that I would be interested in files that I worked on. Surely Windows 7 does not expect me to open all of my files individually before it indexes them !

imageSo I first ensured the folder and file extension are included in Windows Search and then tried this trick – copy the folder to another folder and then copy them back to the original folder. This seemed to tell Windows 7 that I would be interested in those files and after a while, the search results I was expecting, starting turning up!

I guess I only have to do this because I brought in a whole lot of file before I configured Windows Search which folder to index (Refer to the various screenshots on how to configure folders and file types for indexing).

Technorati tags: ,

Delete control characters in VIM

image

Recently I had to review some very large registry files (.reg).

Trouble was when the file was large, VIM somehow displays also the control characters.

This made the file difficult to read.

The solution is to delete all the control characters with

:%s/[[:cntrl:]]//g

and voila:

image

Technorati tags:

Microsoft’s support disappoints !! My experience of fixing “Class not registered” for mscomct2.ocx control after Microsoft support staff abandoned the case

I had a very disappointing experience of dealing with Microsoft Dynamics support.

Last month, my client started deploying Meeting Room Manager. I first noticed that the customization on my PC stopped working and soon the problem spread to the citrix server.

The symptoms of the problem was that when I fired up a customized form in GP, it would complain of missing components. The components were Microsoft Listview control and Microsoft Date and Time Picker control.

We tried to fix the problem by reimporting the package but the import also failed.

clip_image002

I (not Microsoft) identified that the problem was due to Meeting Room Manager installing its mscomct2.ocx. Microsoft only allows 1 version of the ocx. So when Meeting Room Manager installed its version, it dumped the version that GP was using.

Microsoft Dynamics support then asked us to unregister and re-register the version that is found in c:\windows\system32. It registered successfully but the problem still persisted.

Microsoft Dynamics support said they were stumped and then they went into 7 days of ‘I am following up with my colleague in US’ , ‘I am in discussion with my colleague in US’ mode without any progress. They hinted that we should just rebuild the server and not waste time fixing the cause.

At this point, the users and I were very frustrated.

I updated the case with this:

GP is a Microsoft product, Meeting Room Manager is a Microsoft Gold Certified partner product. We purchased 1 and then the other and now we cannot get both to work together. Where did we misplace our confidence.

To which, this undynamic Dynamics support chap replied to the effect of:

‘GP was working fine. After Meeting Room Manager, GP does not work, so go after the Meeting Room Manager vendor, it’s not our problem. So there. Go rebuild your server and update us on outcome’

That was SHOCKING !! Both are Microsoft or Microsoft certifed products and they cannot work together and this chap said it was not their (Microsoft) problem !!

That chap could only see that it was not a Microsoft Dynamics GP problem and so it was not his problem.

 

Utterly fed up with his attitude, I did my own research on the issue.

The issue is actually not very complex.

clip_image002[5]mscomct2.ocx though registered successfully, was actually not registering the classes within correctly.

That was the issue.

So I focused on investigating how mscomct2.ocx was distributed.

I got a recently reformatted laptop and tried to add a Microsoft Date and Time Picker control on a VB form in Excel. It worked. I thought that the Meeting Room Manager messed up some operating system files.

I then did a Windows repair. But the problem still persisted.

Then I found out that mscomct2.ocx was previously distributed with Office XP Developer. So I downloaded the mcsomct2.cab file and unzipped its contents (mscomct2.inf, mscomct2.ocx).

I unregistered mscomct2.ocx.

I installed mscomct2.inf. That copied mscomct2.ocx to the system32 directory.

Then I registererd mscomct2.ocx and Voila !! Everything was working again !

There was no secret juice, just about 1 day’s research and trial and error. That’s much better than Microsoft Dynamic’s month long of ‘discussing with my colleague’, ‘following up with my colleague’ without any results !!

Technorati tags: , ,

Coupon codes for RM 500 discount on Dell Studio systems – limited time offer

image

Dell is giving RM 500 off for Studio 14 laptop and Studio One 19 desktop.

Laptop coupon code: T79KXQ8$6P9G4W

Desktop coupon code: T79KXQ8$6P9G4W

This offer is valid from October 20-23, 2009 only.

I just bought the laptop that was configured like my dream laptop for RM 4,822. My dream previously cost RM 6,067 in July 2009.

Granted that Studio is not the Studio XPS, but my Studio has a faster T9600 CPU.

The catch is that Studio 14 is soon to be replaced by Studio 14z.

I love to get this end of season deals.

Windows 7 upgrade

According to this piece of news, Windows 7 upgrade from Vista can take a almost a day !

Whoa ! I was tempted to get a Vista system with upgrade option but now I would not.
Slashdot Technology Story | Windows 7 Upgrade Can Take Nearly a Day

A clean 32-bit install on what Microsoft calls ‘high-end hardware’ should take only 30 minutes. In the worst case scenario, the process will take about 1220 minutes. That second extreme is not a typo: Microsoft really did time an upgrade that took 20 hours and 20 minutes.

Windows 32 bit’s 4 GB RAM limit

A very bright Geoff Chappel looked into Microsoft’s claim and said this:

That 32-bit editions of Windows Vista are limited to 4GB is not because of any physical or technical constraint on 32-bit operating systems. The 32-bit editions of Windows Vista all contain code for using physical memory above 4GB. Microsoft just doesn’t license you to use that code.

I say that Geoff Chappel is very bright because he gave a very long and detailed explanation for his conclusion. In fact, there are many very good articles about the Windows Shell in his website.

How does this revelation (that 32 bit Windows can access 4GB RAM and more) affect me ?

I have my reasons to stay 32-bit and I hope that Microsoft will remove the license limit.

Technorati tags:
Pages:123456»