Tuesday, June 9, 2009

LaTeX: How to change the word Figure or Table

To change the word Figure or Table

What you need is \renewcommand{}{}.

Example:

  1. Change Figure to Rajah:
    \renewcommand{figurename}{Rajah}

  2. Change Table to Jadual:
    \renewcommand{tablename}{Jadual}

What about List of Figures and List of Tables?

We can still use the same \renewcommand{}{}.

Example:

  1. Change List of Figures to Senarai Rajah:
    \renewcommand{listfigurename}{Senarai Rajah}

  2. Change List of Tables to Senarai Jadual:
    \renewcommand{listtablename}{Senarai Jadual}

Tuesday, June 2, 2009

Microsoft Office 2007 service pack 2 download

The 2007 Microsoft Office Suite Service Pack 2 (SP2) provides the latest updates to the 2007 Office suite.

The updates includes improvements in stability, performance, and security.

Click here to download.

Monday, June 1, 2009

Count the number of words using Python

This article represents a way to count the number of words, the number of unique words, and the number of each word occurrences in a text file.
  1. Read the text file.
    text = open("filename.txt").read()
  2. Replace non-alphanumeric characters as a whitespace.
    import re text = re.sub('[^w&^d]', ' ', text)
  3. Change all characters to lowercase.
    text = text.lower()
  4. Split words into a list.
    text = text.split()
  5. Display the number for words in the text file.
    len(text)
  6. Display the number of unique words in the text file.
    len(set(text))
  7. Display the number of occurrences for each word.
    from collections import defaultdict
    wordsCount = defaultdict(int)
    for word in text:
        wordsCount[word] += 1
        for word, num in wordsCount.items():
            print(word, num)

Sunday, May 31, 2009

How to choose a random item from a sequence in Python

To choose a random item from a list, use random.choice().

Here is an example.
>>> items = ['Proton', 'Honda', 'Toyota', 'Nissan']
>>> random.choice(items)
'Nissan'
>>> random.choice(items)
'Proton'
>>> random.choice(items)
'Toyota'
Another example of usage is to choose a random file from a directory.
>>> random.choice(os.listdir("C:"))
'ubuntu'
>>> random.choice(os.listdir("C:"))
'tex4ht'

Saturday, May 30, 2009

How to displays a list of applications currently running in Windows XP

In Windows XP, tasklist command line tool displays a list of applications and associated tasks/processes currently running on either a local or remote system.

Examples of usage:

  1. Lists all tasks that have DLL modules loaded in them that match the given pattern name. If the module name is not specified, displays all modules loaded by each task.
    TASKLIST /M
    Tasks under module that match wbem* such as wbemcomn.dll.
    TASKLIST /M wbem*

  2. Specifies that the verbose information is to be displayed.
    TASKLIST /V

  3. Displays services in each process.
    TASKLIST /SVC