Friday, June 4, 2010

Back up Encrypting File System (EFS) certificate

SkyHi @ Friday, June 04, 2010
If you encrypt data on your computer, you need a way

to recover that data in case something happens to the encryption key.
If your encryption key is lost or damaged and you don't have a way to
recover your data, the data is lost. You will also lose data if you
store your encryption key on a smart card and the smart card is damaged
or lost. To make sure you can always access your encrypted data, you
should back up your encryption certificate and key. If more than one
person uses your computer, or if you use a smart card to encrypt files,
you should create a file recovery certificate. For more information, see
Create a recovery
certificate for encrypted files

Based on my further research, you could run cipher.exe tool to display the encryption of foldes and files on NTFS volumes. To do this, please take the following steps.

1) Type "Command Prompt" in the search box and right click to run as Administrator.

2) Type the following command:

cipher /u

Then it will list encrypted folders and files if your system owns.

3) Please locate to the above encrypted folders.

For more information about cipher.exe, please refer to the following website.


BTW, after finding the encrypted folders, you may need to recover this files. I would like to share a link with you.

Recover encrypted files or folders


Back Up Your File Encryption Key in Windows Vista

SkyHi @ Friday, June 04, 2010

WIndows Vista includes a file encryption technology very similar from a user perspective to the one that existed in Windows XP, but Vista makes it very easy to make a backup of the file encryption key. In XP, your encrypted files would be lost if you changed your password. In Vista, an encryption key is used to sign the encrypted files, which also means it can be backed up.

It’s critically important that you make a backup of your encryption key if you decide to use the encryption features. Thankfully Vista reminds you immediately after the first time you encrypt a file.

To use the Wizard to back up the encryption key, just click on the popup notification when it comes up.

Select “Back up now” from the wizard screen.

Hit next…

You may as well select all the possible information to back up, in case you have multiple keys for some reason.

You’ll have to enter a password for the key. This password will be used if you try and restore the encryption key later. Make sure you choose a good password, and make sure that it’s also something you’ll remember. This is where a password safe application might help.

On the next screen, you can enter a filename, or you can click the Browse button and choose a folder location. (It was easier for me to click Browse) Type in the file name that you want here.

Hit next and then finish, and you should see that the export was succesful.

Now it’s very important to back that file up to somewhere safe. A spare USB drive wouldn’t be a bad idea.


Note: If you selected “Never Back Up”, or you just don’t see the popup notification, don’t fear, you can still back up the encryption key. Just open up Control Panel, and type in “certificate” (or the first few letters, as you can see below) 

Click on “Manage file encryption certificates” and then hit next on the resulting dialog window.

You should see a very simple screen that makes it easy to back up the encryption key in a single step. Honestly, I think this route is faster than using the other wizard, and it bugs me that they made two different screens to accomplish the same thing. 

Same as before, select a filename and password (Use the browse button to select the filename more easily)

Check the box for “I’ll update my encrypted files later”, because you aren’t actually changing the certificate at this point, just backing it up.

…make sure that you back up the key file safely.


Vim Plugins You Should Know About: NERDTree

SkyHi @ Friday, June 04, 2010

This is the sixth post in the article series "Vim Plugins You Should Know About". This time I am going to introduce you to a vim plugin called "nerd_tree.vim". It's so useful that I can't imagine working without it in vim.

Nerd Tree is a nifty plugin that allows you to explore the file system and open files and directories directly from vim. It opens the file system tree in a new vim window and you may use keyboard shortcuts and mouse to open files in new tabs, in new horizontal and vertical splits, quickly navigate between directories and create bookmarks for your most important projects.

This plugin was written by Marty Grenfell (also known as scrooloose).

Previous articles in the series:

Ps. Please help me reach 10,000 RSS subscribers. I am almost there. If you enjoy my posts and have not yet subscribed, subscribe here!

How to use nerd_tree.vim?

Nerd Tree plugin can be activated by the :NERDTree vim command. It will open in vim as a new vertical split on the left:

Vim Nerd Tree

A screenshot of Nerd Tree plugin in action.

Here are the basics of how to use the plugin:

  • Use the natural vim navigation keys hjkl to navigate the files.
  • Press o to open the file in a new buffer or open/close directory.
  • Press t to open the file in a new tab.
  • Press i to open the file in a new horizontal split.
  • Press s to open the file in a new vertical split.
  • Press p to go to parent directory.
  • Press r to refresh the current directory.

All other keyboard shortcuts can be found by pressing ?. It will open a special help screen with the shortcut listings. Press ? again to get back to file tree.

To close the plugin execute the :NERDTreeClose command.

Typing :NERDTree and :NERDTreeClose all the time is really inconvenient. Therefore I have mapped the toggle command :NERDTreeToggle to the F2 key. This way I can quickly open and close Nerd Tree whenever I wish. You can also map it to F2 by putting map <F2> :NERDTreeToggle<CR> in your .vimrc file.

How to install nerd_tree.vim?

To get the latest version:

  • 1. Download
  • 2. Extract to ~/.vim (on Unix/Linux) or ~\vimfiles (on Windows).
  • 3. Run :helptags ~/.vim/doc (on Unix/Linux) or :helptags ~/vimfiles/doc (on Windows) to rebuild the tags file (so that you can read :help NERD_tree.)
  • 4. Restart Vim.

Related Posts

Thursday, June 3, 2010

Developing PHP in VIM - VIM IDE for PHP

SkyHi @ Thursday, June 03, 2010

I was going to write something long and smart about how its important to know what YOUR NEEDS are when it comes to coding and using specific IDEs and how do they satisfy them, but decided its best to cut to the chase and just post my VIM configs as requested by several from NYC Drupal User Group during our Feb 10 2010 monthly meetup.


Attached to this post ZIP file contains customized .vimrc and .vim folder which contains several plugins which make vim very useful when developing in PHP. Contents are dot files so you will not see them unless viewed through terminal or enable displaying hidden files on unix system. P.S. Windows users can use the same .vimrc and .vim but make sure to google for instructions where to place them correctly.

Place both .vimrc and .vim in your $HOME directory so each will have the following respective paths: ~/.vimrc and ~/.vim


Attached _.ctags.txt file is CTAGS customization to perform PHP language map to drupal specific file extensions such as .test, .module, etc... Instructions: Place this file into webroot of your website that you are developing and make sure to rename it to ".ctags" (no leading _ and no .txt, i added these to be able to upload the file). To generate tags file you will need to run the following command in your webroot where you placed .ctags file (without quotes): "ctags -R ."

Without this file ctags will not know how to handle drupal specific files and you will not be able to use IDE features like code completion and jump to resource definition

If it is not clear how to use the customized plugins and other features once installed, leave a comment with your question for me to reply to.

edit:Last notes of wisdom: Make sure you are using _vim_ 7.2 or later, not _vi_(see the missing _m_?). Thx Rob Loach.

AttachmentSizeHitsLast download
myvim.zip400.39 KB11721 hours 37 min ago
_.ctags_.txt50 bytes18321 hours 36 min ago

I suggest installing vim-full. The default vim package tends to be more limited in functionality. Also the ctags package name may be different.

sudo apt-get install vim-full exuberant-ctags

3. Screen and VIM

hey litwol, thanks for the heads up on the vim and ctags configuration. i also started messing with Screen too. luckily you mentioned it during that meetup. As of now i got vim and screen configured but when i run vim in screen i can't get the colors highlighting to come up. it works outside of screen tho.

here is my ~/.screenrc config if anyone wants. im sure it can be better, but its a good starting point:

also when i split the screen, how do u scroll up/down in that specific window? cant seem to figure that out.

got all of this from:

------------- ~/.screenrc ----------------------
term xterm-256color
autodetach on
startup_message off
activity "%c activity -> %n%f %t"
caption always "%{= Wk}%-w%{= Bw}%n %t%{-}%+w %-="
vbell off
defscrollback 5000

bind c screen 1
bind 0 select 10

# F8 to turn the status bar off
#bindkey -k k8 hardstatus alwayslastline
# F9 to turn the status bar on
#bindkey -k k9 hardstatus alwaysignore
# F5 and F6 to move one screen forward or backward
#bind F7 to change focus window
bindkey -k k7 focus up
bindkey -k k8 focus down
bindkey -k k5 prev # change window with ctrl-left
bindkey -k k6 next # change window with ctrl-right

#let pgup/pgdn scroll under urxvt (see .Xdefaults)
bindkey "^[[5;2~" eval "copy" "stuff ^u"
bindkey -m "^[[5;2~" stuff ^u
bindkey -m "^[[6;2~" stuff ^d

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

# Default screens
screen -t TAB1 1
focus down
screen -t TAB2 2
screen -t TAB3 3
select 2

4. Installed!

When I ran "vi", I got a bunch of errors. Forgot this was for "vim" :-) .

So, you'll need:
sudo apt-get install vim ctags


Setting up xdebug/DBGp for PHP on Debian/Ubuntu

SkyHi @ Thursday, June 03, 2010

Developers frequently need to trace the execution of their code, and debug it, and Drupal/PHP is no exception.

There are several PHP debugging frameworks/APIs available, including DBG, Gubed, Zend, and xdebug. Each of those supports different IDEs (Integrated Development Environments).

This article focuses on xdebug, and how you can set it up on your development machine or server.

xdebug provides the ability for more than one person to have debug sessions concurrently on the same server, using the DBGp protocol. Not all IDE's available support this feature however.

IDEs that use DBGp at present are:

  • Vim with the xdebug plugin (command line, non-GUI).
  • ActiveState Komodo (multi-platform)
  • Quanta Plus (KDE on Linux)


To install xdebug on a debian/Ubuntu system enter the following commands from sudo bash or root shell:

First, install PHP and MySQL if you already do not have them. You may not need the gd library if you do not have image manipulation modules.

aptitude install apache2 php5 php5-gd mysql-server php5-mysql

Next, install PHP development, Apache development, and PEAR.

aptitude install apache2-dev php5-dev php-pear make

Lastly, install xdebug using PHP's pecl

pecl install xdebug

This last step will run for a while, compiling xdebug from source. It should not have any errors.


After the last command completes, you will have an library. You now need to configure apache to use it.

To do this, edit your PHP configuration file /etc/php5/apache2/php.ini and add in it the following section just before the [Date] heading:


; Remote settings

; General

; Trace options

; Profiling

If you are using this on a server that is separate from the machine that you run the IDE in, then change the host name in xdebug.remote_host from localhost to the name of your server.

You can now use an IDE that supports DBGp to debug PHP applications, including Drupal.


To Do List After installing Ubuntu

SkyHi @ Thursday, June 03, 2010

Delete a message stuck in the Outbox

SkyHi @ Thursday, June 03, 2010

Applies to
Microsoft Office Outlook® 2003
Microsoft Outlook® 2002

If you send an e-mail message with an attachment but the message remains in your Outbox, you can try to delete it. If you can't delete the message, the following are some options you can try.

HideOption 1: Temporarily uninstall or disable firewall and antivirus software

One reason for a message to get stuck in the Outbox

is that you have some type of firewall or antivirus software installed. If you have
any firewall or antivirus software installed, exit Outlook, and then temporarily uninstall or
disable the firewall and antivirus software.

Restart Outlook and try to delete the e-mail message in your Outbox. If you still can't delete the message, reinstall or enable your firewall and antivirus software and try to Option 2.

HideOption 2: Start Outlook in safe mode

  1. Exit Outlook if you have it open.
  2. On the taskbar, click
    Start, and then click Run.
  3. In the Open box, type Outlook /safe.

     Note   There is a space between Outlook and the forward slash (/).

  4. Click OK.
  5. Try to delete the e-mail message in your Outbox.

    If you still can't delete the message, exit Outlook started in safe mode, restart Outlook, and
    try Option 3.

HideOption 3: Create a new Outlook profile

Your profile might be damaged. Creating a new profile requires you to set up your e-mail accounts again, but if you save your messages to your computer, you can still use your old e-mail messages. The Personal Folders file (.pst) (Personal Folders file (.pst): Data file that stores your messages and other items on your computer. You can assign a .pst file to be the default delivery location for e-mail messages. You can use a .pst to organize and back up items for safekeeping.)
that you used in the original profile can be used with the new profile.

  1. Make sure you know the name of the .pst file that contains all of your Outlook items.


    1. In the Navigation Pane (Navigation Pane: The column on the left side of the Outlook window that includes panes such as Shortcuts or Mail and the shortcuts or folders within each pane. Click a folder to show the items in the folder.), right-click Personal Folders, and then click Properties.
    2. Click Advanced.
    3. The location and name of the .pst file appears in the Filename box.
  2. Open the Mail Setup dialog box.


    ShowIn Microsoft Windows XP or Microsoft Windows Server 2003

    • In Control Panel, click User Accounts, and then click Mail.

       Note   If you are using Control Panel classic view, double-click Mail.

    ShowIn Microsoft Windows 2000

    • In Control Panel, double-click Mail.
  3. Click Show Profiles.
  4. Click Add.
  5. Type a name for the profile (Outlook e-mail profile: A profile is what Outlook uses to remember the e-mail accounts and the settings that tell Outlook where your e-mail is stored.), and then click OK.
  6. Add your e-mail account.

    ShowAdd an e-mail account

    1. Click
      Add a new e-mail account, and
      then click
    2. Select the e-mail server used for your account, and then click

       Note   If you are setting up an MSN e-mail account, click
      POP3 for MSN Internet Access version 5.3 or earlier. For MSN
      Explorer, click HTTP.

    3. In the appropriate boxes, type the information given by
      your Internet service provider (ISP) (ISP: A business that provides access to the Internet for such things as electronic mail, chat rooms, or use of the World Wide Web. Some ISPs are multinational, offering access in many locations, while others are limited to a specific region.) or administrator.


      • If you are using an MSN or MSN Hotmail account, we recommend that you use the Microsoft Office Outlook Connector, which provides more reliable access to your e-mail messages, calendar, contacts, tasks, and notes attached to your account.
      • Unless your ISP has indicated that your service uses Secure
        Password Authentication (SPA), do not select the
        Log on
        using Secure Password Authentication (SPA)
        check box.
      • Unless specified by your ISP, all server and address entries
        are typed in lowercase letters. Some ISPs require a combination of lowercase
        and uppercase letters for passwords to add further security — for example,
        passWorD. Check with your ISP to see if it requires a case-sensitive
        password. Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down.
      • You have the option of having Outlook remember your password
        by typing it in the
        Password box and selecting the
        Remember password check box.
        While this means that you won't have to type your password each time you
        access the account, it also means that the account is vulnerable to anyone who
        has access to your computer.

    4. Do any of the following:
      • If you are adding a Microsoft Exchange Server account, click
        Check Names to verify that the server
        recognizes your name. The name and server that you entered should become underlined.
        Be sure your computer is connected to your network. If your name does not
        become underlined, contact your administrator.
      • If you are adding a
        POP3 (POP3: A common protocol that is used to retrieve e-mail messages from an Internet e-mail server.) server
        account, click
        Test Account Settings to
        verify that your account is working. If there is missing or incorrect
        information, such as your password, you are prompted to type or correct
        it. Be sure your computer is connected to the Internet.

    5. If you want to configure additional settings, such as how you
      want your computer to connect to your e-mail server, click
      More Settings. Otherwise, click
    6. Click

  7. In the Mail dialog box, click Prompt for a profile to be used, and then click OK.
  8. Restart Outlook, and then select the new profile.

You can import your saved messages from your old .pst file that was used by the previous profile by doing the following:

  1. On the File menu, click Import and Export.
  2. Click Import from another program or file, and then click Next.
  3. Click Personal Folder File (.pst), and then click Next.
  4. In the File to import box, specify the path and file name of the .pst file that you want to import.
  5. Choose one of the following:

    Replace duplicates with items imported  Existing data is overwritten with the information in the .pst file being imported.

    Allow duplicates to be created  Existing data is not overwritten, and duplicates are added to the current Outlook folder.

    Do not import duplicate items  Existing data is kept, and the duplicate information in the .pst file is not copied to the current Outlook folder.

  6. Follow the remaining instructions in the Import and Export Wizard.

 Note   You should not import items (item: An item is the basic element that holds information in Outlook (similar to a file in other programs). Items include e-mail messages, appointments, contacts, tasks, journal entries, notes, posted items, and documents.) created in multiple languages or in a language that is not supported by your system code page to a file type that does not support Unicode. For example, if you have items created in multiple languages in a .pst file, you should not import the items to a Microsoft Outlook 97-2002 .pst file. This file type does not support Unicode; therefore, for any items containing characters in any language other than those supported by the system code page, where these characters appear in text fields other than the body of items
(such as the To and Subject lines of messages), the ContactName and BusinessTelephoneNumber properties of contact items are interpreted incorrectly and result in the display of question marks ("?"s) and other unintelligible text.


How to troubleshoot e-mail messages that are stuck in your Outbox

SkyHi @ Thursday, June 03, 2010
When you try to send an e-mail message, the e-mail message may move to
your Outbox and not be sent. This article describes how to troubleshoot
problems with e-mail messages that remain in your Outbox.

This behavior can be caused by any of the following conditions:

  • You open the e-mail message in your Outbox before the e-mail message is sent.
  • You work offline and have not made a remote connection.
  • Your sending options are not set to send e-mail messages immediately by using the correct connection.
  • Your mail folders or e-mail messages within the folders are damaged.

Message Opened from Your Outbox

After you send an e-mail message, Outlook moves the e-mail message to your Outbox. When Outlook connects to your mail server, the e-mail message is delivered and a copy of the sent e-mail message appears in your Outbox. If you open and close an e-mail message while it is in your Outbox, the e-mail message may not be sent because you may have changed its status. If the status of the e-mail message has been changed, the title of the e-mail message no longer appears in bold.

To send the e-mail message, open the message, and then click Send. The message title changes back to the bold format in the Outbox Messages view. The next time that you make a connection to the mail server, the e-mail message is delivered.

You Are Working Offline

To change the Work Offline command:

  1. On the File menu, click Work Offline.
  2. On the Tools menu, point to Send/Receive, and then click the name of the account from which you want to send the message.

Send Options

To make sure that you have selected the correct send options:

  1. On the Tools menu, click Options.
  2. On the Send tab, click to select both the Send messages immediately and Save copy of sent messages in the 'Sent Items' folder check boxes.
  3. On the Connection tab, click Change under Internet Connection Settings, and then make sure that the correct dial-up or local area network (LAN) settings are in the list.
  4. Click OK, click OK, open the message in your Outbox, and then click Send.

Damaged Mail Folders

Your mail folders or e-mail messages within the folders may be damaged. There are two ways to troubleshoot this type of problem. The first method is to concentrate only on the Outbox folder. The second method is to create all new folders.

You can create a new Outbox folder using the following steps:

  1. Exit Outlook Express.
  2. Search your hard drive for Outbox.dbx and delete this file.
  3. Restart Outlook Express. A new empty outbox folder is created automatically.

You can create all new mail folders if you create a new identity. After you create the new identity, you can import your old e-mail messages to your new identity.

Create a New Identity

  1. On the File menu, point to Identity, and then click Add New Identity.
  2. Type a name for the new identity, and then click OK.

    When you are prompted to switch to the new identity, click Yes. Outlook Express quits, and then restarts with the new identity.
  3. Follow the prompts in the Internet Connection Wizard to configure Outlook Express for your new identity.
  4. When the Outlook Express Import Wizard starts, click Do not import at this time. You can import your files later.
  5. Create a new e-mail message, and then send the new e-mail message to make sure that the new identity is working correctly.

Import Messages from the Old Identity to the New Identity

After you send an e-mail message from the new identity, you can import messages from your old identity:

  1. On the File menu, point to Import, and then click Messages.
  2. Under Select an e-mail program to import from, click your version of Outlook Express, and then click Next.
  3. Under Specify Location, click your old identity, click OK, and then click Next.
  4. Click All folders, click Next, and then click Finish.

For more information about using identities, click the following article number to view the article in the Microsoft Knowledge Base:



How to create and use identities in Outlook Express 5.x and 6.0


1. Message stuck in Outbox

It doesn’t happen too often but when a message is stuck in the Outbox it can be a real pain. Below you’ll find three methods to get the message out of the Outbox.

Method 1

Open the message from the Outbox and close it again. Now select the message and press DELETE

Method 2

Put Outlook in offline mode. To do this go to File-> Work Offline. Now restart Outlook and see if you can delete it (you can try this in combination with method 1). Don’t forget to put Outlook back On-line again.

Method 3

  1. Create a new pst-file; File-> New-> Outlook Data File…
  2. Set this pst-file as your default delivery location in your Account settings; Tools-> E-mail Accounts-> button Next
  3. When you now restart Outlook your original pst-file will show up as the secondary set of folders where should easily be able to remove the file from or even the complete Outbox folder
  4. Set the original pst-file as the default delivery location again and restart Outlook; the Outbox folder will be recreated and will be empty.

Method 4

Use the Microsoft MDBVU32.EXE tool to forcefully clear the Outbox. The instructions for this are the same for when removing a stuck read receipt but instead of choosing “MDB-> Open Root Folder” choose “MDB-> Open IPM Outbox”.


2. Empty the Outbox in Outlook Express, move any messages you want to Send later to the Drafts folder.

Close Outlook Express.

Do a Search for .dbx files.

  • Start > Search > For Files or Folders > All files and folders,

    In the field for: all or part of the file name

    Key in:

    Below that, click on More advanced options

    in the field: Type of File, select (All Files and Folders)

    place a checkmark in:
  • Search system folders
  • Search hidden files and folders
  • Search subfolders

    click Search

Locate the Outbox.dbx file and delete it.

Restart Outlook Express, a new Outbox.dbx file will be created.

Send yourself a Test message to see if it leaves the Outbox.

You may need to enable Show Hidden Files and Folders to see the .dbx files.
Windows XP:
  • Open My Computer,
    Tools > Folder Options > View tab,

    under Hidden Files and Folders, verify Show Hidden Files and Folders is selected.

    Remove the check mark for Hide Extensions for known file types.
    Apply, OK to save and close.


3. Find 2 possible solution from support (applies to Outlook 2003), an article on Outlook tips and one forum sites that posted the problem (similar to your) and the solutions


1. Delete a message stuck in the Outbox (for the details step on the option, visit the URL below)

If you send an e-mail message with an attachment but the message remains in your Outbox, you can try to delete it. If you can't delete the message, the following are some options you can try.

Option 1: Temporarily uninstall or disable firewall and antivirus software

Option 2: Start Outlook in safe mode 3.

Option 3: Create a new Outlook profile



2. My messages stay in the Outbox

The following are some common reasons why new messages that you send never leave the Outbox in Microsoft Outlook:

* If you use offline folders or Remote Mail, you must use different commands to send and receive messages.
* If you open a message in the Outbox, or edit it and then save changes, the message is not sent. Open the message, and then click Send. Messages waiting to be sent are formatted in italic in the Outbox.
* You might have specified that messages not be sent until the next send/receive. On the Tools menu, click Options, and then click the Mail Setup tab. Select the Send immediately when connected check box so that a message is sent when you click Send in the message. If you connect by using a LAN (LAN: A computer network technology designed to connect computers separated by a short distance. A local area network (LAN) can be connected to the Internet and can also be configured as an intranet.), messages are sent in the background. If you use a dial-up networking connection, Outlook tries to connect to the server (server: On a local area network, a computer that controls access to all or part of the network and its resources, such as printers. On the World Wide Web, a computer running Web server software that responds to HTTP protocol requests. Also called a host.) after you click Send in a message.
* If you are using Cached Exchange Mode, you might have chosen to work offline and have no send/receive group settings configured to periodically connect to the Microsoft Exchange Server. If you are working offline, the status bar will display Offline. To return all accounts in the profile online, on the File menu, click Work Offline . To only reconnect the Exchange Server e-mail account, on the File menu, click Connect to Microsoft Exchange Server.



Article on 'Delete a Message Stuck in the Outbox' from

Delete a Message Stuck in the Outbox

If you attempt to send a message that is too large for your mail server you may be unable to delete it from the Outbox. An error dialog will say that the MAPI spooler has begun sending the message.

First, try setting Outlook offline using the File, Offline menu. Wait about a minute or so or close Outlook and reopen.

If you are unable to delete the message while in offline mode or cannot go into offline mode, you'll need to change your default delivery location.

The following steps are for Outlook 2002/2003, the steps for older versions are the same, although the menus are different..

1. Add a new PST using the File, New, Outlook Data File menu.

2. Open the Email Accounts dialog on the Tools menu.

3. Select view or Change existing email accounts and click Next.

4. Select the new personal folders file from the Deliver new email to the following location list.

5. Click Finish and restart Outlook.

6. Show the folder list, using Ctrl+6 if necessary, and find the old Outbox. Delete the message.

7. Repeat steps 2, 3, 4, and 5 to restore the original pst as the default delivery location.

8. Show the folder list and move any new messages from the new pst to the original pst.

9. Right click on the new folder's name and Choose Close to remove it from your profile.


How do I delete an email from Outlook outbox



Wednesday, June 2, 2010

HOWTO: Set a custom firewall (iptables) and Tips [Advanced user only]

SkyHi @ Wednesday, June 02, 2010

CHKCONFIG on Ubuntu sysv-rc-conf

SkyHi @ Wednesday, June 02, 2010
Ubuntu has got it's own tools for telling the system which services to automatically start at the different run levels, none of them unfortunately is chkconfig which happens to be my favourite tool on Red Hat derivative distributions if you are like me and like using what you are used to by typing the following into your bash shell you can use chkconfig instead of the Ubuntu tools.

$ apt-get install libnewt0.52
$ ln -s /usr/lib/ /usr/lib/
$ wget
$ dpkg --force-all -i chkconfig_1.2.24d-1_i386.deb

usage of chkconfig is as follows

chkconfig --level 0123456 program_name on
will turn on program_name so that it starts up on all runlevels, this is a bad example since you would seldom want an app or service to run on runlevel 0 (shutdown) or run level 6 (reboot)

chkconfig --list

will show you a comprehensive list of all services / programs and what run levels they will start on.

another easy to use tool for editing runlevels is sysv-rc-conf

to install
apt-get install sysv-rc-conf

and then just type sysv-rc-conf
gives a very easy to use interface for managing your runlevel symlinks

Ubuntu now includes chkconfig in the repositories
so now you can simply $sudo apt-get install chkconfig


Red Hat/Debian/Gentoo Startup Commands

Since there are so many similarities and differences between Linux distributions, I put together this quick summary of the differences between the startup commands on a few of the popular distros (Red Hat, Debian/Ubuntu, and Gentoo):

The commands:

Red Hat: chkconfig

Debian: update-rc.d

Gentoo: rc-update

Start on bootup using the defaults:

chkconfig --add foobar

chkconfig foobar on

update-rc.d foobar defaults

rc-update add foobar default

Explicitly setting run levels (the 30/70 below are the sequence numbers):

chkconfig --level 2345 foobar on

chkconfig --level 016 foobar off

update-rc.d foobar start 30 2 3 4 5 . stop 70 0 1 6 .

Disabling/removing a service:

chkconfig foobar off

chkconfig --del foobar

update-rc.d foobar stop 20 2 3 4 5 .

update-rc.d -f foobar remove

rc-update del foobar

On Debian-based systems adding a script to runlevels is accomplished
with the following (assuming you have the script in /etc/init.d):

-f myservicename start 80 2 3 4 5 . stop 30 0 1 6 .

priority (80 for start and 30 for
stop) is set and the runlevels
(starting in 2 3 4 5 and stopping in 0 1 6) in which the script will be

List current settings (no Debian version):

chkconfig --list foobar

rc-status --all


Ubuntu firewall for Home users and Save / Restore Iptables Rules

SkyHi @ Wednesday, June 02, 2010

For a personal home computer (running no services for the outside world), here is a simpler version :



#---- Script to setup a simple firewall using iptables -----


# * Blocks all incoming connections, except those opened by

# me, or related to already open connections

# * Blocks all forward requests

# * Allows all outgoing connections



# Clearing all previous rules

iptables -F

# Setting Default Policies

iptables -P INPUT DROP


iptables -P FORWARD DROP

# Allowing already-established and related-incoming connections

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A INPUT -i lo -j ACCEPT

I have network interfaces on eth0 and eth1, so this script has rules which cover both; if your interfaces have different names, you will need to edit the rules to cover that. This drops everything incoming, except for connections which were initially established by my outgoing packets (thanks Luke! - see comments); which means it's no good for servers.
I put this script in /opt/scripts/iptables.script and made it executable. Once you run it, you can find out whether it has worked by displaying your current iptables rules with:
sudo iptables -L -v
I then created a simple init script to start/stop the firewall (in /etc/init.d/firewall):
if [[ $1 == start ]] ; then
  sudo /opt/scripts/iptables.script
  sudo iptables -F
Then I symlinked this into my /etc/rc.* directories using the update-rc.d tool, so the firewall starts before the network comes up:
update-rc.d firewall start 20 2 3 4 5 . stop 99 0 1 6 .
I find having this script helps me a lot. I have it integr

iptables auto on/off
Run in terminal the next command:
sudo iptables-save > /etc/iptables.rules
2.) Edit /etc/network/interfaces file and add this two line to interface configuration:
pre-up iptables-restore < /etc/iptables.rules
To sum:
auto eth1
iface eth1 inet static
pre-up iptables-restore /etc/iptables.rules
3.) Save and test (reboot)


Install AWStats on CentOS 5

SkyHi @ Wednesday, June 02, 2010

This page summarizes how to perform a basic installation of AWStats on CentOS 5. This tutorial assumes you are either logged in as root or have sudo.




Add RPMForge Yum Repository

Install & Configure Prerequisites

  • Install Apache
    • yum install httpd
  • Configure Apache to start on boot
    • /sbin/chkconfig --levels 345 httpd on
  • Configure iptables to allow Apache traffic
    • /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    • /etc/init.d/iptables save
    • /etc/init.d/iptables restart

Install & Configure AWStats

  • Install AWStats
    • yum install awstats
  • Modify AWStats Apache Configuration
    • Edit /etc/httpd/conf.d/awstats.conf
Alias /awstats/icon/ /var/www/awstats/icon/

ScriptAlias /awstats/ /var/www/awstats/

Options ExecCGI
order deny,allow
allow from all

  • Edit the following lines in the default awstats configuration file
    • /etc/awstats/awstats.localhost.localdomain.conf

  • Rename config file
    • mv /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats...conf
  • Update Statistics (Note: By default, statistics will be updated every hour.)
    • /usr/bin/ now -confdir="/etc" -awstatsprog="/var/www/awstats/"
  • Start Apache
    • /etc/init.d/httpd start

Verify Install

  • Go to

Stale NFS file handle

SkyHi @ Wednesday, June 02, 2010
Same problem here, check this out... I got this after a system crash on debian lenny; after which i've reinstalled the root partition but kept /home (which is on a different partition).

fsck.ext3 says that /home is clean...

igi:~$ ls -l

ls: cannot access bin: Stale NFS file handle

ls: cannot access PICTURES_nortel_tmp: Stale NFS file handle

total 78568

d????????? ? ? ? ? ? bin

d????????? ? ? ? ? ? PICTURES_nortel_tmp

drwxr-xr-x 2 penguin penguin 4096 2008-11-22 23:06 TESTATICA

-rw-r--r-- 1 penguin penguin 31395624 2008-12-03 16:25 test.avi

-rw-r--r-- 1 penguin penguin 14698436 2008-12-04 15:36 test_divx_mp3.avi

-rw-r----- 1 penguin penguin 4240419 2008-11-19 22:43 toolsdev.tar.bz2

-rw-r--r-- 1 penguin penguin 5366 2008-10-19 13:29 tourpart7.html

drwxr-xr-x 10 penguin penguin 12288 2008-12-04 23:25 UNIX_HELP

Notice the weired directories with: d?????????

These dirs give me the: "Stale NFS file handle" error

igi:~$ rm -rf PICTURES_nortel_tmp

rm: cannot remove `PICTURES_nortel_tmp': Stale NFS file handle

Can't remove them or "ls -l" them or anything else (neither as root or when booted from a live distro, etc...)

Any insight on solving this issue (other than salvaging whats left on the /home partition and then recreating a new partition and or the file system) would be appreciated

Solved it:

Even though the first time i did fsck.ext3 on the home partition.... it
said it was clean but then when i tried with "force"... it found a bunch
of "problems". after fsck finished (and i had to press "y" <yes>
a few hundred times... it got rid (deleted the weired directories with:
"Stale NFS file handle")

umount /dev/hde

fsck.ext -f /dev/hde


Install Awstats on Ubuntu

SkyHi @ Wednesday, June 02, 2010

This has been tested with Ubuntu server 8.04 (Hardy Heron).


sudo aptitude install awstats

To see the country of your visitors (not required)

sudo aptitude install libnet-ip-perl
sudo aptitude install libgeo-ipfree-perl


Let's assume you want to analyze the Apache 2 log file of your website “” (It can be just an IP address).

Create configuration file

sudo cp /etc/awstats/awstats.conf /etc/awstats/

Update these parameters

# apache2

# domain name


You can also activate these plugins



sudo /usr/lib/cgi-bin/ -update

You should get something like this

Create/Update database for config "/etc/awstats/" by AWStats version 6.7 (build 1.892)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 191338
Found 0 dropped records,
Found 24 corrupted records,
Found 0 old records,
Found 191314 new qualified records.

Configure Apache to view the statistics

Create /etc/apache2/conf.d/statistics

Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /statistics/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch

Restart Apache

sudo /etc/init.d/apache2 restart

View your statistics

or (in case you have more than one config file)

Update your statistics with cron

In /etc/crontab add

# update every 10 min
*/10 * * * * root /usr/lib/cgi-bin/ -update > /dev/null

How to reset awstats

Just delete the files in /var/lib/awtstats (directory defined by DirData parameter)

sudo su - root
cd /var/lib/awstats
rm *


  • you have to be root because for some reason, sudo rm -R awstats/* wouldn't work.
  • if you get the message Never updated (See 'Build/Update' on awstats_setup.html page) whereas the awstats files are there in /var/lib/awtstats, it's probably a permission problem on this folder.



awstats "Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats. "

Try to this URL (with your values):


Install AWStats on CentOS 5.3

SkyHi @ Wednesday, June 02, 2010

From AWstats website: “AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.”

The installation procedure is done on a typical LAMP install on CentOS 5.3 x64_86

Your apache needs the combined log directive for the virtual host you are going to monitor with AWStats, so in your virtualhost you must have something like:

CustomLog logs/ combined

If you use the common log format some statistic features (browsers, os, keywords…) can’t work.

In this tutorial I am using so change it with your own domain and docroot location.

As root install the rpmforge repository:

# wget

# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

# yum install yum-priorities # if you have other repos you might want to add the priority options in the .repo file so you don’t mess up packages. More info

In case you are using i386 change the .x86_64 with .i386

# yum install awstats

Optional: (To see what countries are visiting your website)

# yum install perl-Geo-IP

# yum install GeoIP-data

Prepare the configuration file:

# cd /etc/awstats

# mv awstats.model.conf awstats.model.bak # Keep a backup of the original

# mv awstats.localhost.localdomain.conf # Change it to your domain

Edit the configuration file:

# vi /etc/awstats/

In line 51: change LogFile=”/var/log/httpd/access_log” to the location of the access_log file you want to gather statistics.

Ex: LogFile=”/var/log/httpd/”

In line 153: change SiteDomain=”localhost.localdomain” to SiteDomain=”

In line 168: change HostAliases=”localhost″ to HostAliases=””

In line 203: change DirData=”/var/www/awstats” to your docroot.

Ex: DirData=”/var/www/htdocs/”

If you installed the Geo-IP plugins you need to enable it:

In line 1305 change #LoadPlugin=”geoip GEOIP_STANDARD /pathto/GeoIP.dat” to LoadPlugin=”geoip GEOIP_STANDARD /var/lib/GeoIP/GeoIP.dat”

Move the awstats directory to your docroot:

//uncessary, check

# mv /var/www/awstats /var/www/htdocs/

Change the permissions to the awstats directory:

# chown -R localuser:apache /var/www/htdocs/

Edit the awstats.conf to setup the aliases and restrictions:

# vi /etc/httpd/conf.d/awstats.conf

Change the Alias, ScriptAlias and Directory location to where the awstats is in your docroot.


Alias /awstats/icon/ /var/www/htdocs/

ScriptAlias /awstats/ /var/www/htdocs/

<Directory /var/www/htdocs/>


Options ExecCGI

order deny,allow

deny from all

allow from 192.168.1. # Allow access to awstate from the subnet only


#Alias /css/ /var/www/awstats/css/

#Alias /js/ /var/www/awstats/js/

Reload Apache:

# service httpd reload

In case you don’t have the Options FollowSymLinks in httpd.conf, awstats will not work so you need to add it in the /etc/httpd/conf.d/awstats.conf above.


Options ExecCGI

Options FollowSymLinks


Update your statistics:

# cd /var/www/htdocs/

# perl -update

If you see something like:

Create/Update database for config “/etc/awstats/” by AWStats version 6.9 (build 1.925)

From data in log file “/var/log/httpd/”…

Phase 1 : First bypass old records, searching new record…

Direct access after last parsed record (after line 4)

Jumped lines in file: 4

Found 4 already parsed records.

Parsed lines in file: 13

Found 0 dropped records,

Found 0 corrupted records,

Found 0 old records,

Found 13 new qualified records.

Then everything went fine.

If you changed your logs from common to combined it might throw some errors when you update awstats so you need to clean the log file to have only the combined logs:

# cat /dev/null > /var/log/httpd/

run the update again:

# perl -update

Update for config "/etc/awstats/"

With data in log file ""

Phase 1:

Seaching new records from beginning of log file

Phase 2:

Found 2389 new qualified records.

Navigate to

If the update time on the upper left hand corner is the same as the time you run the update and you can see the statistics, then everything works fine.

Setup the cron job (it will run hourly and redirect the output to /dev/null so it’s not going to send an email to root every hour) :

cd /etc/cron.hourly

echo “perl /var/www/htdocs/ -update > /dev/null 2>&1″ >

chmod 755

test the script:


Refresh your browser and if the update time changes then you are all set.

Enjoy the statistics on your website!


Parse log file with most accessed ip

SkyHi @ Wednesday, June 02, 2010

1. grep "30/May" access_log > access_log.1
2. cut -d' ' -f1 access_log.1 > access_log.2
3. sort access_log.2|uniq -c|sort -n

netstat -ntu |awk '{print $5}'| cut -d: -f1 | sort | uniq -c |sort -nr

Find the most accessed ip
awk '{print $1}' 10stillhack.txt |cut -d: -f1 | sort | uniq -c |sort -nr|more

def CalculateApacheIpHits(logfile_pathname):
    IpHitListing = {}
    Contents = open(logfile_pathname, "r").xreadlines( )
    for line in Contents:
        Ip = line.split(" ")[0]
        if 6 < len(Ip) <= 15:
            IpHitListing[Ip] = IpHitListing.get(Ip, 0) + 1
    return IpHitListing

def TimeSpan(logfile_pathname):
    Dates = open(logfile_pathname, "r").readline( )
    Last  = open(logfile_pathname, "r").readlines( )
    firstdate = Dates.split(" ")[3]
    lastdate = Last[len(Last)-1].split(" ")[3]
    print ""
    print "Log covers the dates of: " + firstdate[1:] + " - " + lastdate[1:]
    print ""


HitsDictionary = CalculateApacheIpHits("access.log.19")
width = 10
ip = "IP Address"
hits = "Hits"
print '%15s         %5s' % (ip, hits)
print '     ----------          ----'
for key in HitsDictionary.keys():
    print '%15s    ->   %5s' % (str(key), str(HitsDictionary[key]))

Kill all process:
#ps ax -o user,pid |grep 'postfix' |awk '{print $2}' |xargs -l
#ps ax -o user,pid |grep 'postfix' |awk '{print $2}' |xargs -r kill -9
#killall -9 PROCESS

Apache process memory usage
ps -ylC httpd --sort:rss

sort the top entries in your access.log
awk '{print $1}' /var/log/http/access_log | sort |uniq -c |sort -n
netstat -ta |grep ESTABLISHED
sar -w
sar -I SUM
sar -d 5 0

Web Technologies

SkyHi @ Wednesday, June 02, 2010

HOWTO: Basic Apache performance tuning (httpd)

SkyHi @ Wednesday, June 02, 2010
This article will provide some basic apache (httpd) performance tuning. The objective of this article is to perform simple edits that will allow your (dv) server to run with less memory and to ensure higher availability under heavier loads.

This is Part 1 of a series of articles on how to tune your (dv) for better performance. Please see (dv) HOWTO: Performance tuning (Optimization) for additional articles in this series.


  • Frequent apache (httpd) crashes
  • Slow server response
  • "Server unreachable" errors
  • kmemsize warnings in your QoS Alerts (Plesk Control Panel under Virtuozzo)
  • privvmpages warnings in your QoS Alerts (Plesk Control Panel under Virtuozzo)

LINKS: Apache Doumentation site Documentation on the Timeout setting. Documentation on MaxClients


Apache Timeout setting

The timeout setting is the number of seconds before data "sends" or "receives" (to or from the client) time out. Having this set to a high number forces site visitors to "wait in line" which adds extra load to the server.
  1. First backup the file with the following command:

    cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bkup.kb-246.1
  2. The following command opens httpd.conf and searches for the term Timeout:

    vi +/Timeout /etc/httpd/conf/httpd.conf 
    You should see the following lines:

    # Timeout: The number of seconds before receives and sends time out.
    Timeout 120
  3. Edit the section that reads:

    Timeout 120
    to a more reasonable value like the following:

    Timeout 20
  4. Save this file by pressing the escape key followed by :wq! which will save the file and exit vi.
  5. Restart Apache to apply the changes:

    /etc/init.d/httpd restart

Max Client Settings

On (dv) Dedicated-Virtual v2.0 Servers:

  1. First backup the file with the following command:

    cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bkup.kb-246.2
  2. The following command opens httpd.conf and searches for MaxClients:

    vi +/MaxClients /etc/httpd/conf/httpd.conf
    You should see the following section marked prefork MPM.
  3. Edit the section that reads:

    StartServers 2
    MinSpareServers 1
    MaxSpareServers 5
    MaxClients 10
    MaxRequestsPerChild 1000

    to something more like this:
    • For Base servers:

      StartServers 1
      MinSpareServers 1
      MaxSpareServers 3
      MaxClients 50
      MaxRequestsPerChild 1000

    • For Rage servers:

      StartServers 2
      MinSpareServers 2
      MaxSpareServers 5
      MaxClients 100
      MaxRequestsPerChild 1000

    • For Extreme servers:

      StartServers 2
      MinSpareServers 2
      MaxSpareServers 5
      MaxClients 200
      MaxRequestsPerChild 1000

  4. Save this file and restart Apache to apply the changes:

    /etc/init.d/httpd restart

On (dv) Dedicated-Virtual v3.x Servers:

  1. First backup the file with the following command:

    cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bkup.kb-246.2
  2. The following command opens httpd.conf and searches for MaxClients:

    vi +/MaxClients /etc/httpd/conf/httpd.conf
    You should see the following section marked prefork MPM.
  3. Edit the section that reads:

    StartServers 1
    MinSpareServers 1
    MaxSpareServers 20
    ServerLimit 20
    MaxClients 150
    MaxRequestsPerChild 4000

    to something more like this:
    • For Base servers:

      StartServers 1
      MinSpareServers 1
      MaxSpareServers 3
      ServerLimit 50
      MaxClients 50
      MaxRequestsPerChild 4000

    • For Rage servers:

      StartServers 2
      MinSpareServers 2
      MaxSpareServers 5
      ServerLimit 100
      MaxClients 100
      MaxRequestsPerChild 4000

    • For Extreme servers:

      StartServers 2
      MinSpareServers 2
      MaxSpareServers 5
      ServerLimit 200
      MaxClients 200
      MaxRequestsPerChild 4000

    • For Nitro servers:

      StartServers 20
      MinSpareServers 20
      MaxSpareServers 50
      ServerLimit 500
      MaxClients 500
      MaxRequestsPerChild 4000

  4. Save this file and restart Apache to apply the changes:

    /etc/init.d/httpd restart


If you are running into frequent Apache crashes you can check the error_log for MaxClients-related problems.

To check your error logs to see if you have MaxClient issues you can run the following command as root:

grep -i maxclient /var/log/httpd/error_log*
If this command returns any results after making the above changes you may need to fine-tune the MaxClients variables further.

The official documentation on these settings and many others can be found here:


07-20-2009: Minor Fixes