Saturday, June 30, 2007

Getting PUTTY to draw line correctly

This is a shameful direct copy of the information from this link. To make it all work right, you need to twiddle the following configuration settings: Terminal → Keyboard: Change the sequences sent by: The Functions keys and Keypad: Select Linux. Window → Appearance: Font settings: Pick a font that contains the Unicode line drawing characters, such as Andale Mono or Lucida Console. (Unfortunately Vista’s gorgeous new Consolas font does not have those.) Window → Translation: Character set translation on received data: Select UTF-8. Adjust how PuTTY handles line drawing characters: Select Use Unicode line drawing code points. Connection → Data: Terminal details: Terminal-type string: Enter “linux”. Now line drawing characters should show up as they are supposed to. ~ts~

Tuesday, June 26, 2007

Generate GUID in Python running in Windows

GUID can be useful as a primary key for a databases and also for the records or rows of data that needs to be unique. There are a lot of tools that can generate a GUID but in this quickie blog, I am documenting how to generate a GUID using Python in Windows.

To generate a GUID, import the code below:

import pythoncom

_guid = pythoncom.CreateGuid
_guid_str = str(_guid
"%s GUID is %d long"%(_guid_str,len(_guid_str))


Wednesday, June 20, 2007

Grab screen capture programatically

  1. Python 2.5 for Windows
  2. Python Imaging Library (PIL).

Install Python 2.5 for Microsoft Windows. Make sure that you have administrative rights to be able to install the application properly. After having verified that Python is installed and working, install Python Imaging Library. See below for a sample of screen capture python script.

#--<-start code here->--

import ImageGrab;

img = ImageGrab.grab


#--<-end code here->--

Saturday, June 09, 2007

Direct link download to Yahoo Messenger installer

Here is the link for downloading v10 Yahoo Messenger.
Here is the link for downloading v9 Yahoo Messenger.
Here is the link for downloading v8 Yahoo Messenger.


Friday, June 08, 2007

Detecting the process using/locking a file

In Windows, if a file is being used, normally user cannot delete it. But there are cases, especially during development and/or troubleshooting, where a file needs to be deleted or renamed. The issue here is that deleting a locked/used file is not allowed in Windows. Windows Explorer does not give even a slight hint as to who has the lock on the file. Fortunately, Mark Russinovich of Microsoft, developed a tool to list the process that is having a lock on the file. The name of the tool is "handle" and can be downloaded from the site. If you have a file readme.txt and you want to delete it and for some reason their is a rouge application getting hold of it. To get the process name of the application that's using it, just issue the command:
handle readme.txt

Thursday, June 07, 2007

Clear arp cache

Background: The address resolution protocol (arp) is a protocol used by the Internet Protocol (IP), specifically IPv4, to map IP network addresses to the hardware addresses used by a data link protocol. The protocol operates below the network layer as a part of the interface between the OSI network and OSI link layer. It is used when IPv4 is used over Ethernet. The term address resolution refers to the process of finding an address of a computer in a network. The address is "resolved" using a protocol in which a piece of information is sent by a client process executing on the local computer to a server process executing on a remote computer. The information received by the server allows the server to uniquely identify the network system for which the address was required and therefore to provide the required address. The address resolution procedure is completed when the client receives a response from the server containing the required address. An Ethernet network uses two hardware addresses which identify the source and destination of each frame sent by the Ethernet. The destination address (all 1's) may also identify a broadcast packet (to be sent to all connected computers). The hardware address is also known as the Medium Access Control (MAC) address, in reference to the standards which define Ethernet. Each computer network interface card is allocated a globally unique 6 byte link address when the factory manufactures the card (stored in a PROM). This is the normal link source address used by an interface. A computer sends all packets which it creates with its own hardware source link address, and receives all packets which match the same hardware address in the destination field or one (or more) pre-selected broadcast/multicast addresses. The Ethernet address is a link layer address and is dependent on the interface card which is used. IP operates at the network layer and is not concerned with the link addresses of individual nodes which are to be used.The address resolution protocol (arp) is therefore used to translate between the two types of address. The arp client and server processes operate on all computers using IP over Ethernet. The processes are normally implemented as part of the software driver that drives the network interface card. There are four types of arp messages that may be sent by the arp protocol. These are identified by four values in the "operation" field of an arp message. The types of message are: ARP request ARP reply RARP request RARP reply To reduce the number of address resolution requests, a client normally caches resolved addresses for a (short) period of time. The arp cache is of a finite size, and would become full of incomplete and obsolete entries for computers that are not in use if it was allowed to grow without check. The arp cache is therefore periodically flushed of all entries. This deletes unused entries and frees space in the cache. It also removes any unsuccessful attempts to contact computers which are not currently running. To clear the Arp Cache on a Windows-based system, the following command line should be used:
netsh interface ip delete arpcache