Saturday, June 09, 2007

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
~ts~

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
~ts~

Saturday, May 12, 2007

Uninstall an application from the command line

Software automation testing sometimes need to perform installation and un-installation of software products. One of the new things that I learned was that a user can un-install a certain application from the command line. To determine how to uninstall a certain product, open registry and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. For the application that you want to uninstall look for the key "UninstallString". Copy and paste this string in the command line, hit on {ENTER} and it should uninstall the application for you. ~ts~

Determine the application that spawn a certain process

Maintaining the performance of a computer takes a lot of research and tinkering of the system. One of the tools that that I find really useful is Process Explorer formerly of Sys Internals which is now a part of Microsoft. It was originally and still is designed/maintained by Mark Russinovich, et al. One of the key features that I like with Process Explorer is that it shows a tree view of the running process in a system. And in addition to that it allows the user to search by process handle or a DLL substring. The best feature that I like with this tool is that it shows you the command line arguments used to run the application. If you think this is too good to be true, see for yourself. Head to http://www.microsoft.com/technet/sysinternals/utilities/ProcessExplorer.mspx and download the file. ~ts~

Saturday, April 28, 2007

Programming icons

"Packaging is the product itselft." This is the matra for most marketing folks. This is no different in designing user interfaces for customer use. Selecting a nice set of icons then becomes a serious issue if the product is for general public consumption. This complicates even more for small shops or one man team designing software solutions. Thanks to the current revolution in software development... open source, creative commons and the likes. Listed below are some icon set that are either LGPL, CCA or etc. Ximian icon sets License : LGPL The icons are being used in OpenOffice and Ximian Desktop 2 Silk Icon set License : Create Commons Attribution 2.5 License “Silk” is a smooth, free icon set, containing over 700 16-by-16 pixel icons in strokably-soft PNG format. Containing a large variety of icons, you're sure to find something that tickles your fancy. And all for a low low price of $0.00. You can't say fairer than that. ~ts~

Sunday, April 22, 2007

List Microsoft Windows products installed in a system

I develop a short python script to display Microsft Corporation software that is installed on a system. This script can be modifed easily to check for all installed OS hotfixes if need be. See below for the script:
<---code-----
import _winreg
import sys

hkcu = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE
)m_key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"m_UnInstall = _winreg.OpenKey( hkcu, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
_index =
0while True:    try:        m_subkey = _winreg.EnumKey(m_UnInstall,_index)        m_newkey = m_key + "\\" + m_subkey
        m_RegistryKey = _winreg.OpenKey( hkcu, m_newkey
)        try:            if _winreg.QueryValueEx(m_RegistryKey, r"Publisher")[0] == r"Microsoft Corporation":                
                
print _winreg.QueryValueEx(m_RegistryKey,
r"DisplayName")[0
]                _winreg.CloseKey(m_RegistryKey)        except:#            print "Unexpected error:", sys.exc_info()[0]            pass
#        print "current key %s" % m_newkey        _index = _index + 1        
    
except EnvironmentError
:#        print "Nothing to retrieve"         break_winreg.CloseKey(m_UnInstall)_winreg.CloseKey(hkcu)
<---code-----
Or download it from here.
~ts~

Installing QNX 6.4.1 on Ubuntu 20.04

Installing QNX 6.4.1 on Ubuntu 20.04 Install pre-requisites $: sudo dpkg --add-architecture i386 $: sudo apt update $: sudo apt install li...