Code Migration to Delphi 2009

Delphi 2009 <> Delphi 2007 (any old version) is STRING type: In Delphi2009 (12)

type STRING = UnicodeString

UnicodeString is not the same WideString

In Delphi 2007 (6,7,8,9,10,11) STRING is the same AnsiString WideString support for Unicode.

Some others conversion.

Replace VclJpg with VclImg Replace WideString with string Replace WideChar with Char Replace WChar with Char Replace AnsiStrComp with StrComp

Do that with any Ansi function. Find some words as “Ansi” to remove it if you need.

Usefull Centos Command Line for Die Hard System Administrator

Find disk usage by partition in a human readable format.

df -h

Find the top 100 space eating monster file/dir under a directory.

du -a [dir] | sort -n | tail -100

Find out what files a logged in user has opened (ignoring libs, devices, sockets, pipes)

lsof | grep [username] | egrep -v '(lib|/dev|pipe)'

Find which process is connected to what port and which remote host.

netstat -pat

Find the NIC speed.

mii-tool

Move all files with specific pattern to a sub-directory which might already have files with same pattern ..

find . -maxdepth 1 -name "*2008*.txt" -exec mv {} 2008 \;

Simple DNS Server and Caching for Centos Using dnsmasq

dnsmasq is a very light DNS forwarder and capable of serving as DHCP server. It’s also can be configure as a simple DNS server with a caching capability.

On Centos distro, the dnsmasq package can be install using following command, this step is compulsary.

yum install dnsmasq

After successfully installd the package, we need to edit the Centos DNS resolution file in /etc/resolve.conf using your favorite editor. Make sure you have the following line.

nameserver 127.0.0.1 
nameserver 8.8.8.8

The first line must be pointing to local IP address, the second line is acting as backup if no local DNS server it will forward the DNS packet to appropriate public DNS server. Now let’s start the dnsmasq sevice.

/etc/init.d/dnsmasq start

Edit the configuration file in /etc/dnsmasq.conf and makesure following setting is in there.

listen-address=127.0.0.1
port=53
domain-needed
bogus-priv
cache-size=1000

Use Delphi Package Installer to Install Component Easily

Delphi Package Installer (DelphiPI) is a tool which aids you installing components to your Delphi IDE. DelphiPI automatically resolves dependencies between packages, compiles, installs and adds source paths to your IDE.

DelphiPI

Run your virtual OS directly from GDM

Run your virtual OS directly from GDM in UbuntuIf you regularly run a couple of OS from your VirtualBox and want to login to those OS directly from GDM session, here is a quick way to do it. For this to work you should have already set up your VirtualBox.

Here we won’t be talking about how to setup VirtualBox but only how to login to a virtual OS from GDM session.

Run Virtual OS Directly