Monday, June 29, 2009

what is lost+found/ directory

As was explained earlier during the overview of the FSSTND, Linux should always go through a proper shutdown. Sometimes your system might crash or a power failure might take the machine down. Either way, at the next boot, a lengthy filesystem check (the speed of this check is dependent on the type of filesystem that you actually use. ie. ext3 is faster than ext2 because it is a journalled filesystem) using fsck will be done. Fsck will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in this directory. The files recovered are not likely to be complete or make much sense but there always is a chance that something worthwhile is recovered. Each partition has its own lost+found directory. If you find files in there, try to move them back to their original location. If you find something like a broken symbolic link to 'file', you have to reinstall the file/s from the corresponding RPM, since your file system got damaged so badly that the files were mutilated beyond recognition. Below is an example of a /lost+found directory. As you can see, the vast majority of files contained here are in actual fact sockets. As for the rest of the other files they were found to be damaged system files and personal files. These files were not able to be recovered.

source: http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/lostfound.html

Multiple Connections using wget?

Noooo!  wget cannot!

You had better use aria2c - The ultra fast download utility

aria2 (its main program is aria2c) is a utility for downloading files. The supported protocols are HTTP(S), FTP, BitTorrent, and Metalink. It has a powerful segmented downloading ability, downloading a file from multiple sources and multiple protocols and utilizing your download bandwidth to the maximum. It supports downloading a file from HTTP(S)/FTP and BitTorrent at the same time, while the data downloaded from HTTP(S)/FTP is uploaded to the BitTorrent swarm. Using Metalink´s chunk checksums, aria2 automatically validates chunks of data while downloading a file like BitTorrent.

Monday, June 22, 2009

how to not remember text in html text input field

try this attribute:

autocomplete="off"

e.g.

<input type="text" name="username" autocomplete="off" />

how to rename default folder in microsoft exchange mailbox

  • You cannot rename the folder from Outlook Web Access
  • You cannot rename the folder from Microsoft Outlook
  • You can rename the folder from IMAP.  You can also set Microsoft Outlook to connect to the Exchange server using IMAP to rename the folder too.
  • You can rename the folder by invoking Outllook with /ResetFolders switch too.

Sunday, June 21, 2009

Tricky thing about Internet Explorer 7 + JVM and UOB CyberBanking

For those who have been having the same problem as me, I have asked a support person of UOB CyberBanking about the problem on there website that makes my web browser to be hung every time I try to login.   They came back to me with an answer that just works!

Please see that attachment.  In summary, we just uncheck the option on the Sun Virtual Machine.  Restart Internet Explorer 7.  That's all!

how to install microsoft visual studio 2005 dvd from iso image files

This is due to Microsoft Visual Studio 2005 DVD (License) it have installation problem.
The step for install it :

  1. Copy folder DISK1 and DISK2 from folder \English\VS2005Pro
  2. Copy all files in folder DISK2 to DISK1
  3. Click setup.exe to install

Thursday, June 18, 2009

word focus from longman - "cut"

*chop* to cut vegetables, meat, or wood into pieces
*slice* to cut bread, vegetables, or meat into thin pieces
*dice* to cut vegetables into small pieces
*peel* to cut the outside part off an onion, apple etc
*grate* to cut cheese or vegetables into small pieces by rubbing them
*against* a special tool
*carve* to cut pieces from a large piece of meat
*saw* to cut wood using a special tool called a saw
*chop* down to cut down a tree, using an axe
*snip* to cut something quickly using scissors
*shave* to remove hair from your face or body
*trim* to remove small parts of something to make it look neat
*mow* to cut grass
*prune* to cut off the top part of plants, in order to make them grow better

Monday, June 8, 2009

mutt - screen - fetchmail

As mutt does not print out new mail notification to xterm title for some reason (alpine and msnlib do), there is no easy way to notify the new mail if we are not on the mutt screen.  By using screen and fetchmail (together with a cronjob), we can get this resolved.

1. create ~/.fetchmailrc with this configurations:
poll mail.someserver.ca
proto IMAP 
user "your_username"
pass "your_password"

2. have this perl script in your ~/bin/ directory:
#!/usr/bin/perl
$_ = `fetchmail -c`;
s/(.*\)).*/$1/;
print;
 name it get_mail (chmod +x get_mail)


3. add this line into your crontab (scheduled for every 5 minutes):
*/5 * * * * ~/bin/get_mail > ~/bin/get_mail.out

4. edit your ~/.screenrc file to contain 2 lines like this:
caption always "%{+b bk}$USER@%{wk}%H | %{yk}(load: %l |%{rk} cpu: %1` | %{Gk}net: %2` | %{mk}mail: %3`) %-21=%{wk}%D %d.%m.%Y %0c"

backtick 3 150 150 cat /home/your_username/bin/get_mail.out  
the important part is: "%{mk}mail: %3`".  The 150 means 150 seconds.

With this, you will see the number of new emails in your screen status bar (within 5 minutes interval at most).

mutt and imap - checking new mail interval

Here comes another important setting. This is only required for IMAP with mutt. The default time for checking new emails is 600 seconds (10 minutes) which is too low. The recommended setting for imap is 15 seconds which you can set it by:

set timeout=15

in your .muttrc file.

mutt mime type problem with microsoft exchange

Microsoft Exchange has been lying people that it supports 8bit mime.  You have to disable 8bit mime in mutt or else you will not be able to forward/reply some emails (with mime) to any of the emails that are on the exchange server. The error message will be sent in an email.

To disable this, you have to set:

set allow_8bit=no

in your .muttrc file. You will find that variable in .muttrc with a default value already. I had to do this setting when I used alpine too.

Good luck.

Wednesday, June 3, 2009

How To Install Perl Module From CPAN

To install Perl Module from CPAN, please see an example below:
perl -MCPAN -e 'install Time::JulianDay'

How To Install GD Perl Module in Ubuntu Linux

# apt-get install libgd2-xpm-dev
# cd /root/.cpan/build/GD-2.35
# perl Makefile.PL -options "JPEG,FT,PNG,GIF,XPM"
# make<
# make test
# make install

how to set system date/time in unix

An example of how to set system date time to Jun 4 ad 1 minute past midnight:

# date -s 'Jun 4 00:01'

Monday, June 1, 2009

Using Pine With Imap On an Microsoft Exchange Server

Microsoft Exchange Server which supports IMAP. Below is the piece of configurations for pine to use IMAP on duckass (a server):

inbox-path={duckass.com/user=duck}inbox
folder-collections=mail\[],
"IMAP Folders" {
duckass.com/user=duck/notls/novalidate-cert}[]
default-fcc={
duckass.com/user=duck}inbox
postponed-folder={
duckass.com/user=duck}Drafts
trash-folder={
duckass.com/user=duck}Trash

How to mount Windows partitions (NTFS) manually, and allow all users to read only

# mount /dev/hda1 /media/windows/ -t ntfs -o nls=utf8,umask=0222
/dev/hda1 is a parition in /dev/hda disk device. To see the list of available partitions of the specified disk device, run this command: 

# fdisk -l <device>
The device can be, for example, /dev/hda, /dev/hdb, /dev/hdc, /dev/sda, /dev/sdb, etc 
I tested this on Ubuntu 8.04 Server Edition.

How To Install SQL Server from image files

I have just successfully installed SQL Server 2005 with SQL Server Management Studio on a server.

The cause of the problem is that we installed this program from harddisk. If we instal it from the disc, we will not encouter this problem.

To install from the harddisk, we have to rename the folders to be "Servers" and "Tools", respectively.

For Disk #1:

c:\tmp\ms\Servers

For Disk #2:

c:\tmp\ms\Tools

Then we can just double click setup.exe inside:

c:\tmp\ms\Servers

And everyone is happy!

How To Connect VPN With PPTP Client

If you are using Linux or other UNIX like operating systems and you want to create VPN connection to Company's network, you can use these sample configurations:
In /etc/ppp/chap-secrets:
# for PPTP server (Windows VPN server) without domain
your_username server_name "your_password" *
# for PPTP server with domain
your_domain\\your_username server_name "your_password" *

To connect to PPTP server without domain

In /etc/ppp/peers/server_name:
pty "pptp server_name --nolaunchpppd"
require-mppe-128
lock
noauth
nobsdcomp
nodeflate
name chaitat
remotename server_name
ipparam server_name

To connect to PPTP server with domain

In /etc/ppp/peers/server_name:
pty "pptp server_name --nolaunchpppd"
lock
noauth
nobsdcomp
nodeflate
name your_domain\\your_username
remotename server_name
ipparam server_name
refuse-eap
refuse-chap
refuse-mschap
require-mppe-128
You might also have to do a post configuration after connecting by adding a route to Company's internal ip addresses:
# route add -net 10.10.0.0 netmask 255.255.0.0 gw [the ip address of the gateway you are connected to]
e.g. route add -net 10.10.0.0 netmask 255.255.0.0 gw 10.10.13.10

How To Break An RCS Lock

Here's how to break a lock.

  1. cp file file.BAK
  2. rcs -u file
  3. rcs -l file
  4. edit file
  5. diff file file.BAK
  6. put back any changes if any that you clobbered by breaking the lock
  7. rcs -u file

Coveo Search With French Interface

To use French Interface, you have to use this (assuming that you are using Coveo Search on ASERVER):

<iframe src="http://aserver:8888/default<# IF language_id == 2 PRINT "-fr" ENDIF #>.aspx?sk=duckass (live)&q=<# PRINT StrToHtml(q) #>" style="width: 900px; height: 600px; overflow-x: hidden; overflow-y: auto" frameborder="0"></iframe>

Basically, it is that you have to use:

http://aserver:8888/default-fr.aspx

How can I know which files have been changed between releases? It seems like cvs diff applies per file basis. Please advise.

It seems there's no obvious way to diff between specific revisions or tags using tortoise UI. However you can do it on the command line.

If you have cvsnt installed (I guess it comes with tortoise), try this

cd $the_proj_root_you_checked_out_using_tortoise # eg. Z:/duckass
cvs diff -r DUCKASS_1-0-0_RELEASE_20080619_001 -r DUCKASS_1-0-0_RELEASE_20081112_002

But if you do this on unix with unix's cvs, try this

cd $the_proj_root_you_checked_out_using_tortoise # eg. /projects/work/duckass
cvs -d duck@duckserver:/projects/cvsroot diff -r DUCKASS_1-0-0_RELEASE_20080619_001 -r DUCKASS_1-0-0_RELEASE_20081112_002

The two cvs recognizes CVSROOT differently, so you need that -d option if you checked out with tortoise but want to diff with unix's cvs.

How To Export As Text File Using Any Separator Character

Reference: http://office.microsoft.com/en-us/excel/HP011305991033.aspx
You can change the separator character used in both delimited text files and comma separated values (CSV) text files.

Change the delimiter in a delimited text file

For a delimited text file, you can change the delimiter from a Tab character to another character in the second page of the Text Import Wizard. From the same wizard page, you can also change the way consecutive delimiters, such as consecutive quotes, are handled.

Change the separator in a CSV text file


  1. Click the Windows Start menu.

  2. Click Control Panel.

  3. Open the Regional and Language Options dialog box.

  4. Click the Regional Options Tab.

  5. Click Customize.

  6. Type a new separator in the List separator box.

  7. Click OK twice.
Note After you change the list separator character for your machine, all applications will use the new character. You can change the character back to the original character by using the same procedure.

How To Open VBA Editor In Microsoft Excel 2007

simply press ALT + F11


.
.

CGI with IIS6

If the CGI pages appear as "404 Not Found" even after mapping the apropriate extension to a CGI application, then you may have to do something like

iisext.vbs /AddFile "C:\Program Files\Python\Python.exe %s" 1 Python 1 Python

how to search string in files on unix system

Here is an example to search string in .cgi files in every directory (including current directory), you use this command:

$ find . -name '*.cgi' -exec grep -n 'string to search for' {} \; -print

disc got stuck in macmini

June 1, 2009

A dvd disc got stuck in my macmini last week.  I searched through the Internet and found nothing that could help me resolve the issue.  Fortunately, after rebooting my computer for around 10 times, the disc icon appeared on the desktop and I could properly eject it.  I am no kidding!


July 3, 2010

Today, my disc got stuck again.  But this time I could eject it properly by running this command in Terminal:

$ drutil eject

How to Set Host Name in Windows

Host name or hostname represents the mapping between ip addresses and host names.

The file is stored in:

C:\Windows\System32\drivers\etc\hosts

how to print to standard error in php

php has a function to print message to standard error which normally will be in the log file set by apache.

this function is error_log($message). Example:

<?php
error_log('some error message');
?>

References:
http://php.net/manual/en/function.error-log.php

DBD::Oracle Perl Module and Oracle - Versions

The truth is that DBD::Oracle 1.19 will work with Oracle 9i only.

Newer version of DBD::Oracle module will not be able to be compiled with Oracle 9i, unfortunately.