Friday, June 29, 2007

Add a Network Printer

To add a network printer from command line

To run a command from machine on which printer needs to be added

rundll32 printui.dll,PrintUIEntry /in /n \\PRINTSERVER\NETWORKPRINTER

To run a command from server or other machine on network

rundll32 printui.dll,PrintUIEntry /in /c\\CLIENTMACHINETOINSTALLON /n \\PRINTSERVER\NETWORKPRINTER

Wednesday, June 27, 2007

MS SQL

Some SQL queries that I find useful

Reset 'sa' password from query analyzer

Sp_password @new = 'mynewpassword', @loginame = 'sa'


Search for a string in stored_procedures

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%STRING_TO_SEARCH%'
AND ROUTINE_TYPE='PROCEDURE'

Get name of the store proceture containting the specified string
SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%STRING_TO_SEARCH%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)


When you restore a database backup to another server, if you experience a problem with orphaned users refer to http://support.microsoft.com/kb/274188/


Tuesday, June 26, 2007

Endicia ES 2200 Weigh Scale

Finally, after spending couple of days on web trying to find solution I was able to read weight from Endicia ES 2200 digital scale in my custom application.

I work for a dot com company and we use Endicia software to print postage labels for USPS shipments. So far we have been shipping USPS shipments with only Flat rate option so exact weigh was not required. Because of increase in postal rates on May 14, 2007 instead of increasing our shipping rates we decided to start shipping using First class option so we could actually reduce shipping rates and keep our customers happy. However this required me to make changes in shipping module to be able to pass exact weight to Endicia interface.

Because of high volume of orders that we need to ship on daily basis to save time we have built a custom application that works as a layer over Endicia's DAZzle and use DAZzles XML interface. So all the user needs to do is scan the order and get a label printed without having to select or answer prompts from DAZzle.

DAZzle had Weigh option which read the weight but that would have required me to set prompting ON and user would have required to click Weigh button first and then Print button to print label so 2 extra buttons to click for every package and that would have slowed down entire shipping process.

To avoid those extra steps it was required for me to be able to read weight within my application and send it in XML along with rest of the data.

We had this Endicia ES 2200 scale but no technical documentation, the documentation that came with it only specified how to connect it so that it works with in DAZzLe. Endica tech support did not have any technical documentation for the scale, only information they had which got me started was ES2200 scale is compatible with other standard serial scales from NCI

After hours on web and lots of trial error, here is what I was able to find and that worked for me to be able to read weight successfully

1. Scale is Weigh-Tronix/NCI 7010 compatible

2. I found the following driver at stamps.com
http://www.stamps.com/support/technical/hardware/10lb-scale/

3. Then I found following documentation for ActiveX control that is installed with the driver above.
http://www.salterbrecknell.com/pdfs/WTCommSclV2.pdf