Skip to main content

Posts

Showing posts from 2008

COM hooking research

This post is gonna be a work in progress. What I am trying to embark on is the possibility of inserting hooks to a running COM server to perform automated testing. I have seen applications tried to do this, like TestPartner, but it is crashing my application under test. Summary of available tools that may have a working COM server hooks: TestPartner   - they have ComSpy but this is crashing my application under test. COMslicer  - from the help file. COMslicer is a utility that displays information about COM/DCOM components’ activity. It reports all methods and properties called by a client of a COM component and shows values for input/output parameters. COMslicer also reports creation and destroying of COM objects as well as raising events by COM objects. It keeps track of reference counting and interfaces queried by a client. COMslicer works on Windows 98/Me/ NT4/2K. But it seems to me that the development of this tools has halted. A quick visit to their website does not event menti

Google maps on BlackBerry

Google have mobilized their Google Maps and should now be available in BlackBerry. Actually this has been available in BB eons ago (at least when talking about how fast things change in the Net). Unfortunately, not all cities have as good coverage as in the US. But it is still a nice to have application in your BB device, anyway if you stay in non-English region and you happen to not understand the local language or in some cases Google shows language that is not really the local language (like maybe your internet gateway is located somewhere else) then you can still force to view the English language, thus say: http://m.google.com/maps?hl=en ~ts

English Blogger draft on BlackBerry Asia Region

When you are in Asia,draft.blogger.com tries to automatically detect your location and sets the UI to the language that was detected by Google. Unfortunately, sometimes the gateway is provided outside of the country mostly from Hongkong. This leaves you with a Chinese interface which I can't really understand. This is even more challenging if you are trying to access sites using BlackBerry. Anyway, to access Blogger Draft in English, use the following URL: http://draft.blogger.com/ mobile-start.g?hl=en ~ts

InstallShield crashing when run from a remote machine using STAF

I have been using STAF/STAX for a while now as a framework on top of software test automation. When we started moving some of our tests in Windows Vista noticed that there have been cases where uninstallation of the software under test is crashing. I thought it was some component not playing well with Windows Vista but I when I tried to perform the uninstallation sequence manually everything was fine and dandy. So I started digging around and I found out that in Windows Vista, the following command may fail. C:\>staf remotemachine process start command "C:\PROGRA~1\COMMON~1\INSTAL~1\Driver\1150\INTEL3~1\IDriver.exe /M^{1CD6500F-DE1E-44AC-A279-4C85247A9A85^}" Poking around even more and I finally found a workaround, to get the above command working in Vista, do: C:\>staf remotemachine process start shell command "C:\PROGRA~1\COMMON~1\INSTAL~1\Driver\1150\INTEL3~1\IDriver.exe /M^{1CD6500F-DE1E-44AC-A279-4C85247A9A85^}" Notice the use of shell to ma

wxPython nuggets

Sample code playing around canvas, cursors, images. Another wxPython Tutorial The wxPython Tutorial - The wxPython tutorial is the largest and most advanced wxPython tutorial available on the Internet. Suitable for beginners and intermediate programmers Rubberbanding in wxPython

Add items to Vista Send To Menu

This is the Microsoft Windows Vista Send To: Adding item to Sent To menu in Vista is easy, just create an item (the item can be a shortcut, a small application, a folder etc..). The location of this folder is in: %APPDATA%\Microsoft\Windows\SendTo You can type this in Run dialog (Window+R), in Start Search box, in Windows Explorer locator bar. Another shortcut to this is : Shell:sendto As before you can type this in Run Dialog(Window+R) or Windows Search bar ~ts

Enable SVN access to Sourceforge project

SVN repository is not enabled by default when creating a project in SourceForge . To enable SVN is easy. Go to the summary page, see below for sample screen shot, then hover to Admin tab. You should see the screen below, then just enable "The following box should be checked to enable Subversion" and Update and off you go. Enjoy! TS

Changing Eclipse text editor font

Working long hours tinkering with code can greatly strain your eyes. I think this is the reason why most programmers are so picky with the font they are using. I spend quite a lot of time looking for the best font (my personal best). Proggy fonts are quite good, so is Envy Code R. But for quite sometime, I believe more than a year, I developed love and hate relationship with Consolas . This font is optimized for Microsoft ClearType. The problem is not all of the machines I used are upgraded to RDP 6.x clients. Older remote desktop clients does not support ClearType, so I have to use non-cleartype friendly fonts. Courier New is good candidate but most of the time I settle with Proggy fonts. Anyway, to use Consolas in Eclipse 3.4.1 (Ganymede) is easy and oh note that this font is designed for VS2005 and VS2008. Just hit on Windows | Prerences | General | Appearance | Colors and Fonts | Basic | Text Font. See below for screen shot where to access this option. Step 1: Window | Prefer

TestPartner .Net Fusion

Yesterday, I came across a Microsoft website discussing .Net and Visual Basic 6.0 integration, they dubbed this as VB Fusion . Skimming through the documentation, I came to realize that most of these stuff can be used in TestPartner. That is where my journey into the world of .Net with TestPartner, which I dubbed as TestPartner .Net Fusion, comes alive. I am planning on making this as a series of blogs discussing the ins and outs of integrating .Net functionality into TestPartner 6.1.x. For this blog post will try to get our hands wet into the world of .Net integration using System assembly. In fact, what we will do is re-implement what's being dicussed in this site into TestPartner. In a nutshell, we want to display an image downloaded automatically from  Space Science and Engineering Center, University of Wisconsin-Madison . We'll grab the latest photo from the east coast of the United States using the System assembly. So let us create a new form in Common project in T

Controlling Popup menu using Accessibility API

In my previous post I discussed about using Accessibility API to control Windows Start Menu. For this blogpost exercise we will control a popup menu using AA. For those who are familiar with VBA, they would know outright that class modules cannot use AddressOf operator within the class definition. In the spirit of Object Oriented programming, it would have been better to use solely class module for this but due to AddressOf requirements that it should be in a module then we will try to mix and match using both Class module and a module. The code is not a elegant as I hope it would be but this is the way VBA was designed. Now let us get our hands dirty, first we will create a class module named CPopupMenuController. This is a very simple class module, in the initialization section we set a hook to receive focus events coming from the system and remove the hook once the object is destroyed. See below for the code: '--------------------------------------------------------------

Start Menu handler using Accessibility API

The code below demonstrates how to run an application from Start menu using accessibility API in TestPartner making use of VBA. For this exercise, we will use Test Script, Class Module and Module. The original intent was to have the functionality built into class module and instantiate it in Test Script. But AddressOf operator does not work inside a class module in VBA hence using Module. Anyway, first let us define the class module. For this exercise name it CStartMenuController. See below for the code (save this as CStartMenuController): '------------------------------------------------------------------------------ ' Develop by : Techno.Scavenger ' Licensed to : Mankind ' Date : 26Oct2008 @ 1:39 AM + 8 GMT (Sunday @home) ' Warranty ' THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMEN

Change TestPartner script automatically

This is an ugly hack. Please be careful with this code as it is using an undocumented feature. Code below will allow you to modify a test script using VBA. Test script is an asset within TestPartner application, so if you are not using TP this may not apply to you. '------------------------------------------------------------------------------ ' Develop by : Techno.Scavenger ' Licensed to : Mankind ' Date : 11Oct2008 @ 6:55 PM + 8 GMT (Saturday @home) ' Warranty ' THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ' “Techno.Scavenger” OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY CLAIM, ' DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ' OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ' USE OR OTHER DEALINGS

Minimal Debian Etch install with X on VirtualBox host

This to document minimal installation of Debian 4.0 (Etch) on VirtualBox host. Download latest Debian Etch, I am using debian-40r3-i386-netinst.iso. During the package installation, deselect all. This should give you a minimal Debian installation. During installation, you say "No" during selecting the mirror. We will update /etc/app/sources.list after the installation anyway. Reboot virtual machine after installation. Add the following lines to your /etc/apt/sources.list, I am using nano to edit sources.list file. Since I am near Hongkong, I selected the mirror sites as shown below, change this as you see fit: hostname:/# nano -w /etc/apt/sources.list Additional entries into /etc/apt/sources.list #more entries from here of course from /etc/apt/sources.list deb http://ftp.hk.debian.org/debian etch main contrib non-free deb-src http://ftp.hk.debian.org/debian etch main contrib non-free Then do: hostname:/# aptitude update hostname:/# aptitude upgrade The above command

Install Virtualbox in EeePc 900

Draft - draft - draft - draft /etc/app/sources.list deb http://update.eeepc.asus.com/p900 p900 main deb http://update.eeepc.asus.com/p900/en p900 main deb http://xnv4.xandros.com/xs2.0/pkg/ xs2.0-xn main non-free deb http://xnv4.xandros.com/xs2.0/upkg-srv2 etch main contrib non-free deb http://download.virtualbox.org/virtualbox/debian etch non-free add public keys wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add - sudo apt-get install xandros-archive-keyring sudo apt-get install build-essential download sources http://support.asus.com/download/download.aspx unrar x Eee_PC_900_source_code_part1.rar dpkg --install linux-source-2.6.21.4-eeepc_17_all.deb cd /usr/src tar xvjf linux-source-2.6.21.4-eeepc.tar.bz2 cd linux-source -2.6 .21 .4 -eeepc ln /usr/src/linux-2.6.21.4 /usr/src/linux -s cd /usr/src/linux make oldconfig make prepare make all apt-get install virtualbox create a file, /bin/vbox/run sudo nano /bin/vboxrun and paste: --

Piping pslist or tslist to findstr

If you are are a console junkie and you frequently play around or look around what is running in your system you may find that using TaskManager can be time consuming and limiting. So I looked around and found a way to use pslist (from Windows Sysinternals) or tslist ( a built in command line ). The command below means to show information about a process running on "remote_machine" with process name of python.exe D:\><path_to_pslist>pslist.exe \\remote_machine | findstr python.exe This one is using the built in tslist command. Same as before, we want to query for a process named python.exe on "remote_machine." D:\> tslist /S remote_machine | findstr python ~ts

Powertools free software

Vitrite is a tiny utility written by me,  Ryan VanMiddlesworth , that allows you to manually adjust the level of transparency for almost any visible window. It works by utilizing a feature present in Windows 2000/XP (and all later incarnations) for variable window transparency. WinSpy++ is a handy programmer's utility which can be used to select and view the properties of any window in the system. WinSpy is based around the Spy++ utility that ships with Microsoft Visual Studio. ~ts

Windows Server 2008 64bit crashing randomly after memory upgrade

I have VMWare Server 2.0 Beta x running on Windows Server 2008 Std 64bit. At only 2GB I can only run one virtual machine. So the machine was upgraded to 8GB! I didn't notice much performance improvement in the host machine but I can start kicking in four virtual machines. But......... The big but.. was that Windows Server 2008 just crashes randomly. Sometimes just a few minutes.. booom it crashes. Digging a little further I was able to simulate the crash pretty easily. Remote the machine's console session (/admin switch in mstsc.exe) then login back to the host machine. So I was thinking/asking myself, was it because of the new 8GB memory upgrade? It must be, but is it the hardware or software that does not like the upgrade. Trying to eliminate variables, I booted the machine into System Rescue CD then run memtest for two hours. No dice here. So it must not be the new memory being faulty. Digging more, I found out that there was a video error logged in Control Panel>

Export TestPartner run into xml with xsl

TestPartner run results can be exported using command line, tpexport, or via File|Export from with TestPartner itself. Another way of exporting run results is via TestPartner.TLB automation. The beauty with TestPartner.TLB is that you can export with it the xsl. See below for the code. Option Explicit Sub TestTPResultDump() Dim t As New TPApp Dim pCount As Integer Dim p As Integer Dim sCount As Integer Dim sName As String Dim tp2 As TestPartner.TPProject2 t.Login "admin", "admin", "TestPartner_SQL", 1 pCount = t.Projects.Count For p = 1 To pCount If t.Projects.Item(p).Name = "ScratchProject" Then Debug.Print t.Projects.Item(p).Name Set tp2 = t.Projects.Item(p) Dim rc As Integer For rc = 1 To tp2.Results.Count If tp2.Results.Item(rc).Name = "scratch2" Then Debug.Print tp2.Results.Item(rc).Description

Handle popup menus manually in TestPartner

One of the areas where TestPartner 6.1.x is challenged in controlling application under test (AUT) is Popup Menus. It handles it one time but sometimes it complains that the menu is not detected but it is clearly infront of the screen. Though it is working ~80% of the time but Murphy's law has it that if anything can go wrong, it will. What I have come up so far is to handle popup menus manually. See below for the code, so far it seems to meet my needs. Option Explicit Private Declare Function SetCursorPos Lib "user32" _ (ByVal x As Long, ByVal y As Long) As Long Sub Main() 'open Windows Explorer in "My Computer" Window("Desktop Window").Attach ListView("Index=1").Select "CD Drive (E:)", tpMouseRight PopupMenuEx2 "Properties" Window("Application=Explorer.exe Classname='#32770'").Attach Button("Caption=OK").Click End Sub Private Function PopupMen

Print active application and title using pywinauto

Code snippet below shows how to get the window title and application name of the active application. That is the application on top of the z-order. Need to install pywinauto to get this to work. import pywinauto.application import pywinauto.handleprops as _handleprops import pywinauto.win32functions as _win32functions import time while 1:     hwnd = _win32functions.GetForegroundWindow()     print "Active Window title is %s"%(_handleprops.text(hwnd))     print "Application name is %s"%(pywinauto.application.process_module(_handleprops.processid(hwnd)))     time.sleep(2)    ~ts

Windbg stack tracing

This is a very crude documentation only. If you got "Module load completed but symbols could not be loaded for....." do the following to investigate: kd> !sym noisy kd> .reload This should pin point why debug symbols are not being loaded. To use the Microsoft Symbol Server 1. Make sure you have installed the latest version of Debugging Tools for Windows. 2. Start a debugging session. 3. Decide where to store the downloaded symbols (the "downstream store"). This can be a local drive or a UNC path. 4. Set the debugger symbol path as follows, substituting your downstream store path for DownstreamStore. SRV*d:\msdndebug*http://msdl.microsoft.com/download/symbols This will download debug symbols to d:\msdndebug automatically. If you got "Couldn't load mismatched pdb for appname.exe", you can force Windbg to load the pdb file via : kd> .symopt 0x40 kd> .reload To check if the symbols match: #>!itoldyouso bff c:\path\bin\bff

Test code

This is only a test of formatting source code in Blogger. See http://code.google.com/p/syntaxhighlighter/ for details. Use Notepad++ when copying source over from clipboard. Option Explicit Sub Main() Include "Common.TWin32TreeView" Dim wtv As TWin32TreeView 'Window("Desktop Window").Attach Window("Application=Explorer.exe ClassName=CabinetWClass TypeName=Window").Attach Set wtv = New TWin32TreeView wtv.Handle = TreeView("Index=1").hwnd Dim sMsg As String sMsg = "Root item is " & wtv.GetRootItemText sMsg = sMsg & vbCrLf & "Selected item is : " & wtv.GetSelectedItemText 'MsgBox sMsg If wtv.IsSelectedItemExpanded Then MsgBox "selected node is expanded" Else MsgBox "it is not yet expanded" End If End Sub

Minimal Debian Etch install with X and open-vm-tools

World wide mirror sites ( link ) After installing the base system, do the following. For main Debian repository hostname:/# nano -w /etc/apt/sources.list #more entries from here of course from /etc/apt/sources.list deb http://ftp.debian.org/debian etch main contrib non-free deb-src http://ftp.debian.org/debian etch main contrib non-free deb http://www.backports.org/debian etch-backports main contrib non-free Hongkong is best for my case too: #more entries from here of course from /etc/apt/sources.list deb http://ftp.hk.debian.org/debian etch main contrib non-free deb-src http://ftp.hk.debian.org/debian etch main contrib non-free deb http://www.backports.org/debian etch-backports main contrib non-free Notice that we added backports URL in sources.list. That's where open-vm-tools are currently hosted. Continue with installing the rest of the software: :/# wget -O - http://backports.org/debian/archive.key | apt-key add - :/# apt-get update :/# apt-get install less  Depen

Fixing VBox guest lossing networking connection

When playing around with Virtual Box guests running Linux, the network connection my get lost on Debian Etch when the virtual interface's MAC changes. This is due to the fact that this version of linux is using udev and fortunately udev detects changes to MAC address. So basically, each new network interface with new MAC address gets its new ethx network interface device name. In my case, I got 3 ethx's already so I need to get rid of the unnecessary interfaces. As a root do this: $: su #: cd /etc/udev/rules.d #: mkdir ~/bak #: cp zxx_persistent-net-generator.rules ~/bak #: rm zxx_persistent-net-generator.rules #: /etc/init.d/udev stop #: /etc/init.d/udev start Note that we make a backup of the file just in case we need to go back. Also, for zxx_persistent-net-generator.rules, xx is any two digit number. So just go check the directory for a file that resembels *_persistent-net-generator.rules. Now to prevent udev to generate new interface for every new MAC address for Virtu

Detecting Classic Start Menu or Start Menu

On some of our regression tests, we need to check that all shortcuts that our product created under Windows Start Menu is working. One of the challenge this one presents is that user can set it to either "Classic Start Menu" or the new XP style Start Menu. Since our organization likes to use Visual Tests, I was looking for a way to detect what is the current style of Start Menu, hence the script below was born: 'Refs 'http://www.themssforum.com/VisualBasic/SHGetSetSetting-SHELLFLAGSTATESHELLSTATE/ 'http://msdn.microsoft.com/en-us/library/bb762200(VS.85).aspx 'http://msdn.microsoft.com/en-us/library/bb759788(VS.85).aspx Option Explicit Private Declare Sub SHGetSetSettings Lib "shell32" _ ( ByRef lpSS As Byte , ByVal dwMask As Long , ByVal bSet As Long ) Const SSF_STARTPANELON = &H200000 Public Function IsXpMenuStyleOn () As Long

Video Capture

Debut is a simple, easy to use video recorder that lets you capture video files directly on your PC using a webcam (video camera), or capture device (from video). This software can also capture and record almost anything that can be played or displayed on the computer screen. The program saves the video on your hard drive as avi, wmv or many other file types. ~ts

Boot from USB drive

O'Reilly digital multimedia have a blog on how to create a USB bootable disk utilizing HP support tools. See the following link for details. Dell diagnostics utility can also be used to create a USB  bootable drive, see this link .  ~stepkas

Google Mobile on BlackBerry

When I tried to access http://mobile.google.com using my BB8320 in the Philippines, I am always presented with a non-English, non-Pilipino language. I was guessing that it must have been Chinese language which I can not read at all. To get around with this, use the following URL instead: http://www.google.com/m?hl=en ~ts

Customizing Windows XP Start menu via registry keys

Customizing Windows XP Start menu is quite fun but if you are using 10 or more PCs as my job requires me under a workgroup environment then sometimes it becomes tedious. I heard that this can be done using policies but I can’t remember how to do this in a non-domain setup. Anyway, for my personal taste and requirements, I need to hide some items from the Start menu(non-classic mode). Since I am using more than 10 computers, sometimes even more, I was looking for a cheap solution to customize it really quick and easy. Below shows my .reg file that one can use or as a starting point for specific needs. <—– start copying starting from the line below and save the file as xpcustom.reg ;xpcustom.reg Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] ;Show Control Panel as a submenu "Start_ShowControlPanel"=dword:00000002 ;Hide MyDocuments "Start_ShowMyDocs"=dword:00000000 ;Hide Recent Documents "S

Copy and Paste in rdesktop

I have installed Remotedesktop Client 0.23 (Gnome frontend for rdesktop) to connect to my Windows machine. Unfortunately, I am unable to perform copy and paste between my rdesktop sessions and/or rdesktop to a text editor running in Linux. The good thing is that there is a work-around for this. Connect to the Windows machine using RDP 5. Thus say: #: rdesktop -5 hostname -g 1024x768 -u user.name ~ts

Minimal Debian Install with X in Vmware

World wide mirror sites ( link ) After installing the base system, do the following. For main Debian repository hostname:/# nano -w /etc/apt/sources.list #more entries from here of course from /etc/apt/sources.list deb http://ftp.debian.org/debian etch main contrib non-free deb-src http://ftp.debian.org/debian etch main contrib non-free Hongkong is best for my case too: #more entries from here of course from /etc/apt/sources.list deb http://ftp.hk.debian.org/debian etch main contrib non-free deb-src http://ftp.hk.debian.org/debian etch main contrib non-free Continue with installing the rest of the software: hostname:/# apt-get update hostname:/# apt-get install less Depending on your Debian version, do install xorg related packages. Debian Sarge 3.1 Debian Etch apt-get install x-window-system-core apt-get install xorg Note: Based from this url , the above package is for compatibility only from Debian 3.x. Etch should instead use xorg package. hostname:/# apt-

Http tunnels for Windows

Hopster -Bypass Firewall - Bypass Proxy - HTTP tunnel HTTP Tunnel Client - HTTP-Tunnel acts as a socks server, allowing you to use your Internet applications safely despite restrictive firewalls and/or you not be monitored at work, school, goverment and gives you a extra layer of protection against hackers, spyware, ID theft's with our encryption. ~ts