How to embed HTML Code in WordPress post?

December 27th, 2008 No comments

Occasionally I am writing a post about HTML which I need to post the code to illustrate my argument (I guess I am not alone).

By default, WordPress will convert unrecognized uses of < and > into characters which actually look like &lt; and &gt;, which will “look” like a < and a > when posted. Or, if it finds the use of an HTML tag within the post, it will use the tag like it is HTML and you will have funky looking text and a messed up layout. (quoted from codex discussion)

I find this very frustrating when my post doesn’t appear to the way I wanted it to.

How to get around it?

You just simply convert your html open and close bracket “< and >” to “&lt; and &gt;“. However you are not going to do it one by one or do search-replace in text editor, it will be time consuming.

I wrote a simple Java Swing program which does just what I mention above plus it can convert html character code back to html code in case you need to make any changes.
Read more…

Categories: FAQ & Tip, Software

How to include CSS Style Sheet file in HTML Document?

December 27th, 2008 No comments

Here is a quick tip. Code below showing you how to include CSS Style Sheet file in to HTML document

<html>
<head>
<title>Page Title</title>
<link type=”text/css” rel=”stylesheet” href=”path_to/styles.css” />
</head> <body>
</body>
</html>

Categories: Programming

How to convert String to Date in SQL statement?

December 24th, 2008 No comments

This is a list of handy tips that could help you in a blink on how to convert String to Date in SQL. This post cover 5 popular databases (Oracle, MySQL, DB2, PostgreSQL, Informix)

Post your comment here if you find this post useful or want to contribute more explaination.

Oracle

Syntax:

to_date(date_string, format)

Example:

SELECT user.name, user.location FROM user
WHERE user.starteddtm = to_date('20/10/2007 16:01', 'dd/mm/yyyy hh24:mi');

Read more…

Categories: Programming

How to find out Ubuntu version?

December 24th, 2008 No comments

There are a few options/commands you can use to find out which version of Ubuntu you are using. They give very similar information which you wanted to know but present in different format.

Command line:

cat /etc/lsb-release

Example:

manet@ubuntu:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
DISTRIB_CODENAME=intrepid
DISTRIB_DESCRIPTION="Ubuntu 8.10"

Command line:

lsb_release -a

Example:

manet@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.10
Release:        8.10
Codename:       intrepid

Command line:

cat /ect/issue

Example:

manet@ubuntu:~$ cat /etc/issue
Ubuntu 8.10 n l

Command line:

cat /proc/version

Example:

manet@ubuntu:~$ cat /proc/version
Linux version 2.6.27-9-server (buildd@rothera)
(gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) )
#1 SMP Thu Nov 20 22:53:41 UTC 2008
Categories: FAQ & Tip

How to do Find and Replace in VBA?

December 24th, 2008 No comments

If you want to automate your find and replace in MS Office Word Document
You could use or modify this Sub to suit your own needs.

Remember it only support upto 512 bytes (512 characters) of text at the time.

Sub FindReplace()
' Find and replace string in document
' Support up to 512 bytes (double size the default)
  With Selection.Find
    .ClearFormatting
    .Text = "old text"
    .Replacement.ClearFormatting
    .Replacement.Text = "new text"
    .Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
  End With
End Sub
Categories: Programming

How to copy entire folder in Linux?

December 12th, 2008 No comments

Here’s another simple command for novice linux user

Copy entire folder (including content) to another location

cp -R

Example:

cp -R /home/myid/myfolder /var/www/newfolder

This will copy myfolder to newfolder. In another word, content inside myfolder will be now in newfolder

Categories: FAQ & Tip

How do I delete none-empty folder in Linux?

December 10th, 2008 No comments

The command you should use is

rm -r

Example

rm -r /var/mydir

This will remove “mydir” folder, if there’s content it will be recursively deleting them all.

Categories: FAQ & Tip

Which is the current most popular Web Browser?

December 10th, 2008 No comments

First of all, how many popular Web Browser are there at the moment?

As far as I observe there are 5 of them, and they are on the big race at the moment

  • Internet Explorer (Windows)
  • Firefox (Windows, Linux, Mac)
  • Opera (Windows)
  • Safari (Mac)
  • Google Chrome (Windows)

According to W3Schools Browser Statistics

The result base on November 2008

IE7 IE6 Chrome Firefox Safari Opera
26.6% 20.0% 3.1% 44.2% 2.7% 2.3%

From table above, you can see Firefox is ruling the market now. Chrome (by Google Inc.) is new and I would describe Google Chrome as young and dangerous to the browser war. It could take over the market in a very short time.

Categories: Software

How to run External Program in VBScript?

December 10th, 2008 No comments

In some case, you need to tell VBscript to open external program or open a certain file using external program.

Example below demonstrates how execute adobe reader (pdf reader)

OPTION EXPLICIT
 
Dim fso, ws, file, APP_PATH
Set ws = WScript.CreateObject("WScript.Shell")
 
APP_PATH = """C:\Program Files\AdobeReader 9.0\Reader\AcroRd32.exe"""
file = "C:\temptest.pdf"
 
ws.run APP_PATH &amp; " " &amp; file

To run this example:

  • Copy this code, past it in to new text file
  • Change value to correct path and file
  • Save it OpenFile.vbs
  • Double click on OpenFile.vbs

Or you might download source file vbs-openfile.vbs and make modification to it.

Advertisement » VBScript Programmer’s Reference by Adrian Kingsley-Hughes
Categories: Programming

How to install PHPMyAdmin in Ubuntu Server?

December 8th, 2008 No comments

If you are using Ubuntu version 7.10 or above, you can install PHPMyAdmin using apt-get.

I assume that you have apache and php installed on your system.

The following steps is guiding you to install PHPMyAdmin and get it running

  1. Run this command

    sudo apt-get install phpmyadmin

  2. Edit this file

    sudo vi /etc/apache2/apache2.conf

  3. Add this line
    Include /etc/phpmyadmin/apache.conf
  4. Save file and exit
  5. Now go to http://localhost/phpmyadmin
  6. Login using your mysql root account and make sure all the databases/tables are showing
Advertisement » PHPMyAdmin Book for your further reading
Categories: FAQ & Tip