Showing posts from 2010

Firebird and Visual Basic .Net example code

If you are using Visual Studio or Visual Basic to develop program connect to firebird database server, this might be a good example.

Imports FirebirdSql.Data.FirebirdClient
Public Class Principale

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Fdataa As New FbDataAdapter("select*from New_table1", "servertype=1;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\Giorgio.gdb")

Me.DataGridView1.DataSource = DataSet1
Me.DataGridView1.DataMember = "New_table1"

Fdataa.Fill(DataSet1, "New_table1")

End Sub

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
'To begin the change
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.…

You don’t currently have permission to access this folder.

Problem : Whenever trying to access files or folders which current login account don't have permission but belong to administrator group, the system will prompt :

You don’t currently have permission to access this folder.

If you click continue button , the system will add the current login account into the ACL which you might want it to happen because this will mess up your ACL.

Solution : Run Explorer.exe as administrator.

You might see some solution suggest to run explorer.exe as administrator. If you create a shortcut at desktop to launch the explorer.exe and right click select Run As Administrator. But soon or later you will notice the problem still remain.

After searching around , I found the trick which a lot of them didn't mention in their answer.

The trick : Modify the registry.

Changing the registry setting “RunAs” to “_RunAs” in HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}.

Tested on my machine , this trick is working.

Solution found from here : http://www.t…

Convert HTML to Plain Text

If you having the same problem like me wanted to display HTML tag in post body, you can refer to this page:


Very Silly Method to strip off html to get url

I know this is a very silly method on stripping off html tag from the html source code in order to retrieve the jpg url but it work , so I record down for my own use.

1. Prepare a file with all the html code and save it as txt.txt.

< onblur=" try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="">" > < style=" float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 266px; height: 400px;" src="" alt=" " id=" BLOGGER_PHOTO_ID_5539069505528919378" border=" 0"> < /a>

2. awk 'BEGIN { RS="href=\"" } { print $1}' txt.txt >txt2.txt" > < style=" float: left; margin: 0pt 10px 10px 0pt; cu…

Freeware Office tools: Database

Test your web stie with the following tools.

Some open source/free application

Here is a list of open source application that I found.

TeeChart for PHP is an Object-Oriented Charting component library for PHP. The library is completely written in PHP and ready to be used in any PHP scripts. TeeChart for PHP is offered via two formats, the Free Open Source version and the Licensed Pro version. Both include the full source code meaning that no loaders have to be used in order to create a Graph on your servers. Most of the features are identical between versions; the significant exceptions being that only the licensed Pro version of the TeeChart for PHP library may be used in a commercial context (please check the Licensing info for details) and that standard support is only available for the licensed Pro version.

FusionCharts Free is a completely free and open-source Flash charting component. It empowers you to create animated and interactive Flash charts for your web applications, desktop applicatio…

Trick and Tips when bash script dealing date

This is some tricks and tips I found when I searching around google.

Getting Yesterdays or Tomorrows day with shell date command.

When invoked without arguments, the date command displays the current date and time. Depending on the options specified, date will set the date and time or print it in a user defined way. I’ve seen many people writing a perl script for calculating yesterday or tomorrow. Computer loves numbers but we love relative terms like 2 days ago. Luckily GNU date command is designed to handle relative date calculation.

Why use relative date formats?

* Ease of use
* To write your own scripts
* Automate task using cron (example run a job on last day of the month or Nth day of the month or 3rd Friday and so on)

First, print today's date:
$ date
Sun Jun 17 12:17:24 CDT 2007

Now display Yesterday's date:
$ date --date="1 days ago"
OR try:
$ date --date="yesterday"
Sat Jun 16 12:17:20 CDT 2007

Now display Tomorrow's date:
$ date --date="-1 d…

Repair Openldap database

If you come across this problem like me , this might be able to help you.

When ever I restart the openldap daemon at my CentOS server , I received this error :
Checking configuration files for slapd: bdb_db_open: unclean shutdown detected; attempting recovery.
bdb_db_open: Recovery skipped in read-only mode. Run manual recovery if errors are encountered.
If you issue command slapcat , you might be able to start the openldap without any error. But after you stop the openldap daemon , you start the openldap daemon again , you will receive the same error again.

Then you might think of this command : slapd_db_recover . If you use this command , you might face the same scenario.

How I solve the issue about this openldap error is issue the following command in sequence .

slapd_db_recover -h /var/lib/ldap

Then try to start your openldap daemon again , you might find it working.


vmware server 2.0.2 and fedora 13

I am trying to install Vmware server 2.0.2 build-203138 into my Fedora 13 with kernel

Luckily I manage to found this page , otherwise I wouldn't know how to solve all the problem that I am facing while trying to install the Vmware server into the fedora.

The detail is in this page.

This article describes the process we went through recently to get VMWare Server 2.0.2 to run on the latest kernel in Fedora 13.

When you are editing the file , make sure there is no dot in front of the word generated for the first line.


Reverse Proxy with squid and multiple virtual host

This post is to document down the detail that I did to configure a squid as reverse proxy and also enable LDAP authentication . Not only that , I need the squid reverse proxy able to handle virtual host as well. I did a search at google and didn't find any exact match for my requirement so I did one for my self.

I have 3 physical web server but I only have one public ip.

Here is my requirement.

1. All three web server have to listen at port 80 and must be able to access from internet.
2. Some web site need authentication and some web site don't need authentication.
3. One of the web server has two virtual host and these two virtual host must be accessible from internet.

After combine knowledge from multiple page , these are the lines that I added into the squid.conf .

auth_param basic program /usr/lib64/squid/squid_ldap_auth -b "dc=example,dc=com" -f "uid=%s" -h
auth_param basic children 30
auth_param basic realm Please authenticate yourself

vtiger crm uitype

Official uitype , you can find it here:

But if you are newbie like me , you might need more description about the UI type, then may be you can have a look at this:

I am looking for text area UI.
(* notate required version of uitype)

Number 19,20* = Text Area (70x8) Spans 70 chars wide (i.e. across both columns)
Number 21,24* = Text Area (30x2) (single column)


Microsoft excel macro to compare two column for each row and highlight cell with condition

This Macro was tested with Microsoft Excel 2007.
Sub compare()
' Select first line of data.
' Set Do loop to stop at empty cell.
Do Until IsEmpty(ActiveCell)
' Check active cell for search value.
If ActiveCell.Value = Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 3
ElseIf ActiveCell.Value > Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 4
ElseIf ActiveCell.Value < Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 5
ActiveCell.Interior.ColorIndex = 6
End If
' Step down 1 row from present location.
ActiveCell.Offset(1, 0).Select
End Sub
Every time you change a value in the cell , you have to run the macro manually. In order to run it automatically, put the script into the Worksheet_Chan…

Looking for live chat icon

If you are looking for live chat icon or operator pictures or even Header images for your live chat pop up windows, you can come to this URL :

Here got some nice live chat icon , operator pictures and Header images, it might suite your help.


Download and install Cisco SDM

This is the link where you can download the SDM without need to register an account at CISCO. Although registering the account doesn't cost any money , but still feel annoying while try to get the SDM fast and immediately. So here is the link , which you can click and download without any question.

If you need a guide on how to install SDM , here is a good guide.

Hope this two page will help you to setup the Cisco SDM at your desktop.

Another tips before I forget , if you connect to the device using ssh tunnel, most of the time you will access localhost , remember to use localhost instead of , using ip address will cause the SDM failed to launch.


A list of mobile device emulators

If you like me plan to develop a series of application for all kind of mobile device, may be you will need some emulators to test out your application.

I found this web site from SUN, it contain a list of mobile emulator. Although it is not so up to date , but still worth to have a look.

And also this web site , it contain newer mobile device emulator.

If you would like to see how the opera mini work , you can try your web site at these two Opera mini online demo.


If you need a regular expression generator ...

If you are a programmer newbie like me , sometime you might need a regular expression generator to help you generate the regexp.

I tried a few site and found that this is the most suitable for me , so it might suit you as well -


List of Browser ID (User-Agent) Strings

One of my previous post said that you can always check your Browser ID (User-Agent) Strings by visit this web site - and also if you need to find out more Browser ID (User-Agent) Strings , you can visit

Now I found another list of browser agent at . Not only a list , they also explain the meaning of the string, if you need to figure our more User agent string, feel free to have a look.


run tiger (mac os x 10.4.1) in vmware or virtualbox

I found this article and found it useful, so write it down before I forget.

The guide above is very simple , use p2p to download the vmware image , extract it and launch with vmware , then you will get a running tiger (mac os x 10.4.1). But I try it with vmware player 3.0, the performance is very bad. And also the network card is not working.

Then after google around , I found that virtualbox had better support , so I try it with Virtualbox 3.1.4 Open source edition, the performance much more better and consider usable. Without much more modification , I can start browsing. One trick is you have to press F8 during boot menu and enter : platform=x86pc , otherwise the boot process will hang at acpi detection.

Now have another problem is wanted to update it from version 10.4.1 to 10.4.11 seem no possible , because tiger support intel chip only start from 10.4.4 , so officially there is no updater which can upda…

Postfix restricting users to send mails to certain domains or their own domain

Follow the steps suggested in postfix wiki will be able to restrict a list of users for sending emails to limited domains.

To add on on the wiki , we can replace the ip address with the user email address. For example :

Instead of

#Add the list of IP addresses which cannot send emails outside local_only local_only

change it to

#/etc/postfix/restricted_clients local_only local_only

The rest is the same , just try to restrict by user account instead of ip address.

Zimbra is using postfix as it smtp daemon , so these two guides might help us to have better understanding :


Checking root LVM partition

If one day you are facing the problem that I am having now , the following information might be very useful.

I am using Fedora 12 and I suspect the root partition some how corrupted or facing bad sector issue power failure.

Here is my solution:

1. Boot from Fedora 12 installation CD or DVD , select rescue installed system option.
2. Skip the mount volume step. You can't check file system when a volume is mounted.
3. When you are at the shell prompt, issue the following command. It will activate the LVM volume.

lvm vgchange --ignorelockingfailure -P -a y

4. If you don't know the volume name , you can use the following command to list all the LVM volume.

lvm lvs

5. then you can issue the following command to check for bad sector. I assume you are using ext4 file system for root partition.

fsck.ext4 -c /dev/VolGroup/logVol00

Hope this will help.


Flash Aztech dsl600ew firmware with Router Tech

I just successfully flash my Aztech DSL600EW router's firmware with Router Tech Firmware.

First upgrade firmware to official firmware 66.53.2-002 , if you need to download one , you might be able to find it at modem help web site.

Then download the Router Tech firmware - , I tested with this version and it is working.

Using the web interface to upgrade the gateway reboot and run.

The LED configuration might not correct by default , so telnet into the router , issue command : setenv led_conf led.sar600 && /sbin/reboot , the led colour should be back to normal.

In case if you flash the firmware wrongly, you can refer to this URL : to restore the router back to official firmware.


How to convert avi to flv in Linux.

I did a couple of tests and these are the results that I've come up with.
Needless to say that I am no expert,
they are personal opinions,
see them as a starting point.

In the examples we will convert ".avi" to ".flv",
and simply copy the sound.
avi properties:
codec: mpeg4 (lavc) DX50
bitrate: I think its VBR (variable bit rate)
resolution: 640x480
frames per second: 30fps
video size: 5.4MB
sound: mp3
sound size: 1MB
total SIZE: 6.4MB

The tool we will be using is called ffmpeg.
It's a command line application, but very simple to use.
Probably already installed in your computer

We use the cd command to guide the terminal
to the folder where the "input.avi" file is.

cd /home/username/Video

A typical command, then, would be:

ffmpeg the program
-i input.avi the input file
-b 1024k the output bitrate
-s 320x240 the output resolution
-r 25 the output frames per second
-acodec copy the output audio codec
movie_1024_320_25_.flv the output file

A) For minimum dec…

VMware Player 3 crash on Fedora 12

If you have the same issue like me , VMware Player 3 crash upon launching in Fedora 12, all you need is execute the following command with root privilege :

cd /usr/lib/vmware/lib

Found the solution from :


Manually compile php at centos with default installation

If you plan to manually compile php at cents with the default installation , you might need to use the following command to install additional packages before you start the compilation .

yum install gcc httpd-devel libxml2-devel openssl-devel bzip2-devel curl-devel libpng-devel gmp-devel libc-client-devel mysql-devel aspell-devel

Here is the list of error that you might get when you try to compile php yourself at the Cent OS 5.4 server.

1. Configure: error: xml2-config not found. Please check your libxml2 installation.
# yum install libxml2-devel

2. Checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's
# yum install openssl-devel

3. Configure: error: Please reinstall the BZip2 distribution
# yum install bzip2-devel

4. Configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
# yum install curl-devel

5. Configure: error: libjpeg.(a|so) not found.
# yum install libjpeg-devel

6. Configure: error: libpng.(a|so) not found.
# yum…

ping sweep bash script

I found this simple bash script which does it job - ping sweep.

for i in {1..255}; do ping 10.0.0.$i -c 1 | grep "time=";done

Remember to change to change 10.0.0 to your network subnet accordingly.

I found this script from : .