LaTeX vs. Microsoft Word – part 2

December 25, 2006

Word is WYSIWYG (what you see is what you get). But in LaTeX, LaTeX separates the content from the command that will determine what the format of the content will look like.

Some things in LaTeX are more difficult to do as compared with Microsoft Word. But for academic, its strength is in generating cross-reference, tables of contents, bibliography, methamatical typesetting…

Preparing a LaTeX document requires an extra step to format or typeset the document (i.e. converting from .tex to .pdf.) When using LaTeX, it is normally we cannot see the final output while typing the text as in Microsoft Word (a WYSIWYG system). But the final output can be previewed.

Complex structure like footnotes, references, table of contents, and bibliographies can be generated easily. Moreover, there are many free add-on packages (i.e. packages with some predefined commands that help you to format your text easily.)

Introduction to LaTeX – part 1

December 25, 2006

LaTeX is a de-factor standard tool of scientific writings in almost all fields of computer science.

LaTeX is not a word procesor nor is it a text editor. It is rather a kind of a formal language by which you describe what your document should look like. You can use a text editor (e.g. WinEdt, Lynx…) to write your text and include formatting commands.

For example: \textit{Hello World!} –> output: Hello World!

Then, run LaTeX on that text file to produce output that looks better than that of Microsoft Word.

LaTeX is a macro package that enables user to produce highest typography quality, using a predefined, professional layout

Nàng công chúa và hạt đậu

December 15, 2006

    Ngày xửa ngày xưa (Once upon a time) có một chàng hoàng tử luôn muốn cưới một nàng công chúa; một nàng công chúa thật sự… Có rất nhiều công chúa (there were princesses enough), nhưng để tìm ra một người thực sự thì thật khó khăn… Anh trở về vương quốc và buồn bã, vì (for) chàng thực sự rất thích có được một nàng công chúa thực sự (he would have liked very much to have a real princess.)

  • Would have + p.p = past unreal conditional (talk about imaginary situations in the past)

     Vào một bữa tối giông bão, với sấm và chớp (thunder and lightning), và mưa lớn tạo thành dòng nước lũ (the rain poured down in torrents)…Một nàng công chúa xuất hiện. Nhưng trời ơi (good gracious! = gracious me!) mưa và gió đã làm cho cô ấy trông thật tội nghiệp (what a sight the rain and the wind had made her look). The water ran down from her hair and clothes; it ran down into the toes of her shoes and out again at the heels. Và lúc đó (yet) cô nói rằng mình là một nàng công chúa thực sự. 
     … Hoàng hậu già bỏ một hạt đậu vào dưới hai mươi lớp nệm giường (mattresses).
     Buổi sáng khi được hỏi về giấc ngủ tối qua. “Ôi, thật tồi tệ!”, cô nói. “Con không thể chợp mắt được cả đêm. Có trời mới biết cái gì ở dưới giường (Heaven only knows what was in the bed), nhưng con thấy mình nằm trên cái gì đó cứng, vì thế con bị nhức mỏi bầm tím khắp người (I am black and blue all over my body). Thật là tồi tệ!” 
     Tới đây thì họ đã có thể chắc rằng đây chính là nàng công chúa thực sự. Chẳng có ai ngoài một nàng công chúa thực sự có thể nhạy cảm như vậy được (
Nobody but a real princess could be as sensitive as that).
     Vì thế chàng hoàng tử cưới nàng về làm vợ, từ bây giờ (for now) chàng biết rằng mình đã có được một nàng công chúa thực sự; và hạt đậu được đưa vào viện bảo tàng.
     There, that is a true story.

Cross-validation in MatLab

November 8, 2006

Cross-validation is a technique that help one to estimate the error precisely in terms of statistics. Two common types:

– leave-one-out cross validation: use only observation for testing, and the other for training –> use in data set with sparse data.

– k-fold cross validation (we often use k = 10): divide the dataset into k parts equally, then iteratively use one part for testing and the other parts for training. Finally, compute the average error.

How to have multiple “instances” of PowerPoint

November 5, 2006

Sometime, you want to view two ppt files at the same time for easily comparing the contents. Because PowerPoint is a single instance program, we have no chance of creating multiple windows of PPT.

Here is the trick to cross over it:

   * Use another account or create a new one (i.e.  you should have at least 2 active account), e.g. user myaccount

   * From a higher level account, run the PPT using the other account: 

runas /user:myaccount “c:\program files\microsoft office\office11\POWERPNT.EXE”
  NOTE: You can create a batch file for this

Remove an entry from the ContextMenu (when right-click)

November 4, 2006

Run regEdt32

    * In the HKEY_CLASSES_ROOT folder, you will see a list of every file type that is set up on your PC.

    * Expand the * folder

    * Expand the Shellex and ContextMenu Handlers folders (HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers)

    * Look through the list until finding the entry you want to remove.

Prevent Windows to reboot

November 4, 2006

After Windows Updates, the restart message or auto-restart process always occur unwantedly. To remove this, run Regedt32

   * HEY_LOCAL_MACHINE\SOFTWARE\Policies … Microsoft\Windows

   * Right-click on Windows and create a new Key. Type WindowsUpdate.

    * Right click on that new folder, and create another new Key, named AU (which stands for Auto Update)

     * Go to right-hand panel, create new DWORD value. Enter the string: NoAutoRebootWithLoggedOnUsers

     * Double click to that entry and change the Value data to 1 with a Base button of Hexadecimal selected.

Search for only curly quotes, or only straight quotes

November 4, 2006

In English writing literature, to wrap a speech, we use quotation (‘ or “): curly quotes (look like a 6 or 9 – Unidoce(Alt-8216,8217, Alt-8220.8221)) are used in body text, straight quotes (‘ or ” – Unicode(Alt-39, Alt-34)) are used in lines of code.

   * Search for straight quotes (‘): In Find dialog, click More and check Use wildcards. Enter a regular double-quote to search for straight quotes.

  * Search for curly quotes ( ): Uncheck Use wildcards. Enter this into the Find what box: [“”] (that is, open square bracket, left curly quote (Alt-0147), right curly quote (Alt-0148), and right square bracket)

Disable MSN Messenger to start-up at boot time

November 4, 2006

Run this command in Run dialog (Windows-R):

     RunDll32 advpack.dll,LaunchINFSection %windir%\INF\msmsgs.inf,BLC.Remove

Outlook or Outlook Express may try to launch MSN Messenger, to disable this option:

   * Outlook: menu Tools, Options, then Other  –> clear a check box that reads Enable Instant Messaging in Microsoft Outlook. Problem fixed!

   * Outlook Express: menu Click on Tools | Options | General  –> clear the check box next to Automatically log onto Windows Messenger to keep it from starting up.