Thursday, July 26, 2007

Paypal Payflow Pro setup

If you get "The certificate chain did not validate, no local certificate found " error, the application needs access to "certs" folder under Verisign folder of the extracted SDK

You can make it accessible under windows OS using one of the following 2 methods


1. Copy entire "certs" folder to System32 ( C:\WINNT\Sytem32 or C:\Windows\system32)
OR

2. Add Sytem Environment variable PFPRO_CERT_PATH with value set to complete path to "certs" folder

Wednesday, July 18, 2007

Managing System Environment Variable

OS: Windows 2000 or higher

System Environment Variables can be managed using one of the ways below

1. Start->Control Panel-> System->Under Advanced tab->Click Environment Variables button->Add, modify, delete system or user variables by clicking New, Edit or Delete buttons respectively . Reboot the system for changes to take an Effect.

2. System Environment Variables can be managed by making changes to the registry key Below

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment

  • Run command->regedit
  • Browse to the above registry key
  • Add Variable -> Create a New Value under this Key
  • Modify Variable-> Modify Value if it already exists under this key
  • Delete Variable -> Delete a registry value for the variable

    Modifying registry requires a reboot for changes to take an effect

3. SetEnv command can be used to manage system environment variables and avoid reboot

Download a free tool at link below

http://www.codeproject.com/tools/SetEnv.asp

  • Add or modify a system variable
    SetEnv –a [VARIABLENAME ] [VARIABLEVALUE]

  • Add to a variable with multiple values, prefix value with % character
    SetEnv –a [VARIABLENAME ] %[VARIABLEVALUE]

  • Add User Variable
    SetEnv –ua [VARIABLENAME ] [VARIABLEVALUE]

  • Deleting a variable
    SetEnv –d [VARIABLENAME ] [VARIABLEVALUE]

  • Deleting a value from multiple value variable
    SetEnv –d [VARIABLENAME ] %[VARIABLEVALUE]

  • Deleting a user variable
    SetEnv –ud [VARIABLENAME ] [VARIABLEVALUE]

____________________________

Sunday, July 8, 2007

Control Service from command line

You can remotely start, stop and query status of service from command line using NETSVC.EXE tool

For more information refer to
http://support.microsoft.com/default.aspx?scid=kb;EN-US;166819


Monday, July 2, 2007

Taking ownership of a file or folder in Windows XP

To take ownership of a folder

1. Right-click the folder that you want to take ownership of, and then click Properties.
2. Click the Security tab, and then click OK on the Security message (if one appears).
3. Click Advanced, and then click the Owner tab.
4. In the Name list, click your user name or group. If you want to take ownership of the contents of that folder, select the Replace owner on subcontainers and objects check box.
5. Click OK, and then click Yes when you receive the following message: You do not have permission to read the contents of directory folder name. Do you want to replace the directory permissions with permissions granting you Full Control?
All permissions will be replaced if you press Yes.Note folder name is the name of the folder that you want to take ownership of.
6. Click OK, and then reapply the permissions and security settings that you want for the folder and its contents.

To take ownership of a file
1. Right-click the file that you want to take ownership of, and then click Properties.
2. Click the Security tab, and then click OK on the Security message (if one appears).
3. Click Advanced, and then click the Owner tab.
4. In the Name list, click Administrator, or click the Administrators group, and then click OK.
The administrator or the Administrators group now owns the file. To change the permissions on the files and folders under this folder, go to step 5.
5. Click Add.
6. In the Enter the object names to select (examples) list, type the user or group account that you want to give access to the file. For example, type Administrator.
7. Click OK.
8. In the Group or user names list, click the account that you want, and then select the check boxes of the permissions that you want to assign that user.
9. When you are finished assigning permissions, click OK

For more information refer to microsoft article
http://support.microsoft.com/kb/308421

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