Skip to main content

Posts

Showing posts from 2009

Installing Qt 4.6 in OpenSuse 11.2

This is a quick how-to in installing the latest, as of 12/24/2009, Qt framework 4.6 in OpenSuse 11.2. By the way, Qt is a cross-platform application and UI framework. It can be used to develop web-enabled applications and user interfaces once and deploy them across Windows, Mac, Linux/X11, embedded Linux, Windows CE and Symbian. Download the binaries from http://qt.nokia.com/ . As of this writing, the latest version is 4.6 which comes with a lot of new features especially the multi-touch aware which is pretty much what is expected from latest generation of smartphone applications. Change to the directory where the file was downloaded, like: $: cd /home/username/ $: chmod u+x qt-sdk-linux-x86-opensource-2009.05.bin What we just did was to make the file executable. Finally, install the application by running the following command: $: ./qt-sdk-linux-x86-opensource-2009.05.bin See below for screen capture while installing Qt. Note that Qt SDK needs additional software to work

Emacs common commands

Character Operations: DELETE : Delete character to the left of point (Also marked ROBOUT) C-d    : Delete character to the right of (or under) point Word Operations: M-d    : Delete one word to the right (C-y yanks it back at point) Cursor movement: C-p    : Move to the previous line C-n    : Move to the next line C-f    : Move forward one char C-b    : Move backward one char M-f    : Move forward one word M-b    : Move backward one word C-a    : Move cursor beggining of the line C-e    : Move cursor end of the line M->    : End of file M-<    : Beginning of file Line operations: M-m       : Move point to the first non-space in the line Copying Text: M-w     : Runs command kill-ring-save. This is like copy in Windows editors Deleting Text: C- select text C-w         : Delete selected text M-d     : Kill the next word after the cursor Searching for text: C-s           : Incremental search forward C-r           : Incremental search backward Convenience function

Installing VirtualBox guest additions in Fedora 11 guest

This is a short guide on how to install VirtualBox 3.0.6 guest additions in Fedora 11. It is always a good practice to update your system before installing VirtualBox guest additions, so let us do just that. Open a terminal in Fedora guest, thus say, Login as root: $: su Check for updates and install as necessary #: yum check-update #: yum update Note that when I installed Fedora 11, I selected Development machine, so most of the common development tools are already installed by default. But if you have selected Destkop machine, then you have to do the following: #: yum -y install gcc kernel-devel You probably need to reboot after all the updates. It is now time to install the Virtual Box guest additions. From the host machine, using Virtual Box main application do, "Devices > Install Guest Additions..." or You should note that in the guest machine, Fedora 11, will mount the guest addition automatically. Now it is time to install the much needed software. Open a t

Creating new user in Fedora Linux

Creating a user in Fedora now is so much easier that it used to 5 years ago. To do this, do "System > Administration > Users and Group" or through console command "system-config-users" as regular user. Once the program is run it should ask for root password. Once the required password is entered, you should see a window as shown below. Now to create the new user either do "File > Add User" or click on Add User button. Let us try to create a new user with the corresponding information: User Name: timus Full Name: Timus Tunes Password : password Confirm Password : password Login Shell: /bin/bash Leave the rest with the default values. Enjoy! ~ts

Fedora 11 Fatal boot failure on vbox

I tried installing Fedora 11 on Virtual Box 3.0.6 and really surprised of the result after the first reboot, I was presented with following fatal error message: Booting from local disk... FATAL: INT18: BOOT FAILURE Or this image capture: Though the issue is easy to work-around, thus say, unmount the DVDROM from VirtualBox but this got me thinking why is it that this issue is not present in Ubuntu 9.04 nor OpenSUSE 11.1? Was this a regression in Fedora or due to VirtualBox? Note that this issue was  reported in Virtual Box and claimed to be an issue with Fedora installer. But this issue was reported way back Fedora 10? :(... I wish I am brave enough to mess around with probably GRUB or Linux kernel to help fix this minor hiccup. ~ts

Windows name to ip resolution order

Oder of resolution for TCP/IP names to IP for Windows environment:  Local cached information. Can be cleared using ipconfig /flushdns.  Hosts file DNS server NetBIOS over TCP/IP In older versions of Windows up to NT 4.0, the priority can be configured through system.ini section [DNS]. The said section cannot be found in XP SP3, it might be still working and defaults normal resolution order if the section is not defined. Resources: Link 1 Link 2 ~ts

SHGetFolderLocation C++ sample code

Original code is from MSDN . Sample code demonstrates how to use  SHGetFolderLocation in C++. #include #include #include #include int main() {     IShellFolder *psfParent = NULL;     LPITEMIDLIST pidlSystem = NULL;     LPCITEMIDLIST pidlRelative = NULL;     STRRET strDispName;     TCHAR szDisplayName[MAX_PATH];     HRESULT hr;     hr = SHGetFolderLocation(NULL, CSIDL_DESKTOP, NULL, NULL, &pidlSystem);     if (!SUCCEEDED(hr))     {         std::cout << "hr bad" << std::endl;         return -1;     }     hr = SHBindToParent(pidlSystem, IID_IShellFolder, (void **) &psfParent, &pidlRelative);     if(SUCCEEDED(hr))     {         hr = psfParent->GetDisplayNameOf(pidlRelative, SHGDN_NORMAL, &strDispName);         hr = StrRetToBuf(&strDispName, pidlSystem, szDisplayName, sizeof(szDisplayName));         std::wcout << "SHGDN_NORMAL - " < << '\n';     }     psfParent->Release();     CoTaskMemFree(pidlSyste

SHGetFolderLocation

Sample code on how to use SHGetFolderLocation, shamelessly copied from this link . This code was verified to work in Windows 2000 and VB SP6. Private Declare Function SHGetFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, ByVal hToken As Long, ByVal dwReserved As Long, ppidl As Long) As Long Private Declare Function SHBrowseForFolder Lib "shell32.dll" (lpbi As BROWSEINFO) As Long Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As Long) Private Type BROWSEINFO hwndOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Private Sub Command1_Click() ' This code is licensed according to the terms and conditions listed here. ' Open the Browse

Converting CString to CComBSTR

Code below shows how to convert CString to CComBSTR. // CComBSTR.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include int _tmain(int argc, _TCHAR* argv[]) { CComBSTR szDbgMsg; CString sMsg; sMsg = _T("Hello world new"); sMsg.Format(_T("%s : %d"), sMsg, 12); //szDbgMsg = L"Hello world "; szDbgMsg = sMsg.GetBuffer(); CW2A printstr(szDbgMsg); std::wcout << ((CString)szDbgMsg).GetBuffer() << std::endl; std::wcout << sMsg.GetBuffer() << std::endl; return 0; } ~ts

List all installed applications in a machine

The script below will list and save all installed applications to a csv file. Save the script as say, save.vbs. Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.CreateTextFile("c:\software.csv", True) strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSoftware = objWMIService.ExecQuery _ ("Select * from Win32_Product") objTextFile.WriteLine "Caption" & vbtab & _ "Description" & vbtab & "Identifying Number" & vbtab & _ "Install Date" & vbtab & "Install Location" & vbtab & _ "Install State" & vbtab & "Name" & vbtab & _ "Package Cache" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _

Dump PE format string resource

Code below can be used to dump PE string resource using python. import os import re import pefile #http://code.google.com/p/pefile/ import sys def DumpStr(fname): try: pe = pefile.PE(fname) except: print sys.exc_info()[0] print "Continue to the next exe/dll" return # The List will contain all the extracted Unicode strings # strings = list() # Fetch the index of the resource directory entry containing the strings # try: rt_string_idx = [ entry.id for entry in pe.DIRECTORY_ENTRY_RESOURCE.entries].index(pefile.RESOURCE_TYPE['RT_STRING']) except (ValueError,AttributeError): return # Get the directory entry # rt_string_directory = pe.DIRECTORY_ENTRY_RESOURCE.entries[rt_string_idx] # For each of the entries (which will each contain a block of 16 strings) # for entry in rt_string_directory.directory.entries: # Get the RVA of the st

Mouse Invisible in VirtualBox guest

In VirtualBox 3.0.2, I have noticed that most of the times the mouse goes invisible on text areas. For example, if you are in Notepad, once you starting writing some text in the text area the mouse pointer goes into the black hole. The work around is really easy. Go to (Windows XP) Control Panel –> Mouse –> Pointers, then select Windows Black (system scheme). ~ts

Partimage invalid compression level workaround

For some reason, some diskimages created using partimage will encounter "invalid compression level" when restored. See below for the workaround to restore the image back. #: ntfs-3g /dev/sda1 /mnt/windows #: mv /mnt/windows/img/vista.img.000 /mnt/windows/img/vista.img.gz #: gunzip -c /mnt/windows/img/vista.img.gz | partimage restore /dev/sda1 stdin ~ts

Installing Easy Peasy in EEE PC 900 using external hard drive

Easy Peasy is a linux distribution tuned for EEE PC (Asus Netbook) computers. http://www.geteasypeasy.com/ http://www.kernel.org/pub/linux/utils/boot/syslinux/ D:\Software\iso\syslinux\win32>syslinux.exe -m -a -d / i: -f Working with swapfile http://ubuntuforums.org/showthread.php?t=1042946&highlight=swapfile Swappiness https://help.ubuntu.com/community/SwapFaq#Performance%20tuning%20with%20%27%27swappi ness%27%27

Windows dialog rc file is using dialog system units

This has never occurred to me before, I have been tweaking win32 API for awhile, but I really never paid much attention with the dimensions as saved in resource files for dialog boxes. Interestingly, the units stored in rc file are not really in pixel but rather in dialog unit. :( My understanding is that this will make the dialog independent of the font size. If user/developer changes the font size, the dialog box will adjust accordingly. Seems like a neat idea but I was dumbfounded at first sight. It makes my life harder though as I am trying to cross-reference runtime dialog boxes against design time. I was planning to cross ref them using the dimensions but it turns out to be not a good option. The quest is on........... Related links: http://msdn.microsoft.com/en-us/library/aa380902(VS.85).aspx ~rs~

VC++ 2008 link crash

I am getting the following crash in VC++2008: Linking... Embedding manifest... Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 Copyright (C) Microsoft Corporation.  All rights reserved. LINK : fatal error LNK1000: Internal error during IncrBuildImage It turns out that this a bug of a VC++ 2008 linker, see hotfix 948127 from Microsoft. ~TS

Office 2007 RibbonX resources

Custom UI Editor : Custom UI Editor for Open XML file format. XML Notepad 2007 provides a simple intuitive user interface for browsing and editing XML documents. 2007 Office System: XML Schema Reference RibbonX Resources blog by Savraj Dhanjal. Customizing the 2007 Office Fluent Ribbon for Developers ( Part 1 of 3) Customizing the 2007 Office Fluent Ribbon for Developers ( Part 2 of 3) Customizing the 2007 Office Fluent Ribbon for Developers ( Part 3 of 3) 2007 Office System Document: UI Style Guide for Solutions and Add Ins VSTO version 3.0 How To Create Office COM Add-Ins by Using VBA and Office Developer ~ts

Minimal Debian Lenny install on VirtualBox

Pre-requisite: - internet connection - Virtual Box installed on host machine. This exercise will be using Vista as host. As of this writing, Debian Lenny is still at testing stage. For this exercise we will use RC1, visit http://www.debian.org/releases/testing/ for the netinstall iso. Once download is done, create a new virtual machine using Virtual Box, use the following configuration: 512 MB Memory, 120 GB HD, use Intel PRO/1000T server for the network card. For the VirtualBox networking I am using host network configuration. Once VirtualBox guest configuration is set, start the guest machine and then mount the CD-ROM image. In installer boot menu, select Graphical Install. For "Chose the Language" screen, select English or your language of choice. For the country, select whichever you are currently in. In my case, I will be using Philippines. In "Keymap to use" select "American English" or whichever is much appropriate for your system. After this s

Minimal Ubuntu Gnome Intrepid install on Virtual Box

Pre-requisite: - internet connection - Virtual Box installed on host machine. This exercise will be using Vista as host. Download server edition of Ubuntu Intrepid 8.10 from the nearest mirror. Once done, create a new virtual machine using Virtual Box, use the following configuration: 512 MB Memory, 120 GB HD, enable PAE, use Intel PRO/1000T server network. Start virtual machine of the CD-ROM. During the install sequence, select F4. Select the option which mentions about virtual machine installation. Use the default options, reboot and login to the newly install minimal system. Update the system and install aptitude, say: username@hostname:/# apt-get update username@hostname:/# apt-get safe-upgrade username@hostname:/# apt-get install aptitude Then install minimal Gnome, thus say do: username@hostname:/# aptitude install xorg gnome-core gdm gdm-themes My first install of gnome-core didn't work well. Doing username@hostname:/# apt-get update username@hostname:/# apt-get sa