Friday, November 10, 2006

Viva LaTeX :: Installation

TeX, and associated programs such as LaTeX, form a system for computer typesetting, for placing text on a page. (Pronounce the name "tech".) It is well known for its abilities with the most difficult typesetting jobs: mathematical and scientific text, long and intricate documents, and multilingual works. To know more about LaTeX, visit ctan.

What I care for, is LaTeX is free! It's opensource! Provides way better capabilities than Microsoft Office or open office and it's really easy to use.. Everything is automated, you don't need to care for numbering, bullets, justification, outlining, formatting, figures layout, etc etc...

I don't need to convince you to use LaTeX, if you don't like it, don't use it, but then try to withstand others making jokes about your microsoft office documents.

To start TeXing, you need to:

Install a Tex distribution:
  1. Download latest version of Miktex. For convenience, you better use the "Downlood 'Basic MikTeX' Installer" on the MikTex setup page.
  2. Install Miktex and now it's a good idea to test it. Go on write this simple test in a file test.tex
    \documentclass{article}
    \begin{document}
    My first \TeX~document.
    \end{document}
  3. Open a console window and cd to where test.tex is and type "latex test.tex". You should obtain test.dvi, normally you can open it with YAP on a windows environment.
Obtaining Postscript/PDF:
  1. To obtain Postscript from the dvi file:
    >> dvips test.dvi
  2. To obtain PDF from the dvi file:
    >> dvipdfm test.dvi
  3. To obtain PDF directly from the tex file:
    >> pdflatex test.tex
Installing an editor:
  1. Now it's obvious you can start TeXing right away, but you need an editor, or else working on the notepad you will hate LaTeX before finishing your first paragraph. There are plenty of editors out there, personally I like LEd, because it's simple! Other sophisticated editors are taking LaTeX down! They're trying to build a word-like editor based on the LaTeX engine, it's just stupid..
  2. Download LEd Installer and install it.
  3. Now Launch LEd, and go to options from the configuration menu.
  4. In the DVI viewer, under application menu item. Choose the Tex distribution to be MikTex 2.
  5. Set the directory of the TeX executables to the bin directory of your distribution. It should be something like "D:\Program Files\MiKTeX 2.5\miktex\bin"
  6. The value of Font searching library should be set to MiKTeX-core-2.dll. Font making script should be set to makepk.exe, Fallback font should be set to cmr10, Mode should be set to ljfour, Resolution should be set to 600 dpi.
Resolving DVI Viewer bug in LEd:
  1. Download dvi_miktex25.dll. Copy this file to your MikTeX bin directory, it should be somehting like "D:\Program Files\MiKTeX 2.5\miktex\bin"
  2. Launch LEd and go to Configuration >> Properties and then the DVI Viewer properties.
  3. Change the TeX distribution to "based on MikTex"
  4. Change the font searching library to "dvi_miktex25.dll"... you have to type it not select it from list.
  5. Click ok and Restart LEd. Now the DVI Viewer will show you a preview of your document whenever you do "LateX Compilation" (F9).

Now you have the configurations, go on and play around with your editor and make it useful. I will try to post an introductory tutorial to typing your first latex document, See ya...

Happy TeXing!

--
"Better to remain silent and be thought a fool than to speak out and remove all doubt." - Abraham Lincoln

Sunday, November 05, 2006

Using Eclipse as C++ development platform

Albert Einstein once said, "Two things are infinite: the universe and human stupidity. But I’m not sure about the universe." If only he has been here for a bit more, he would have said "Three things are infinite: the universe, eclipse plugins and human stupidity. But I’m not sure about the universe."

To start developing C and C++ applications on eclipse you need to:
  1. Ofcourse If you're not already an eclipsian (how dare you!) you need to download eclipse SDK.

    Installing Cygwin:
  2. Download cygwin. Cygwin is a UNIX®-like environment for Windows that includes a GCC port, along with all necessary development tools, including automake and the GNU Debugger (GDB). Cygwin is built around the cygwin1.dll library.
  3. When the download is complete, run setup.exe, click next and then 2nd option, download without install.
  4. After choosing a mirror and blabla, make sure you to select the most two important packages, "gcc-g++" and" make".. You will find them under All >> Devel category. Do not skip this step! click next and wait for the download to finish.
  5. Rerun setup.exe, but this time with the 3rd option, install from a local directory.
  6. Now you should have a window with the title "Choose Installation directory"Choose UNIX file type and choose the directory where you want to install cygwin.
  7. Click next, on the window with the title "Select local package directory", select the directory which you have used when downloading in step 4.
  8. Select the packages to install and still make sure to select "gcc-g++" and" make".. You will find them under All >> Devel category. Do not skip this step! click next and wait for the installation to finish.
  9. To check cygwin version open cygwin bash shell cygwin.bat and type "cygcheck -V" you should see
    "cygcheck version 1.43
    System Checker for Cygwin
    Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
    Compiled on May 25 2004"
  10. To make the tools also available in a dos window add the Cygwin bin directory to your path.
    e.g.: PATH=%PATH%;C:\Tools\cygwin\bin
  11. To verify if the utilities are installed, In a dos window type: g++ --version
    You should see:
    g++ (GCC) 3.3.3 (cygwin special)
    Copyright (C) 2003 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

  12. type: make --version
    You should see:
    GNU Make 3.80
    Copyright (C) 2002 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.

    Installing CDT
  13. Open eclipse. Go to Help >> Software updates >> find and install. Select Search for new features and click next.
  14. Create a new remote site with a Name, CDT and URL "http://download.eclipse.org/tools/cdt/releases/callisto".
  15. Select this remote site to search and click next. Proceed as the installer suggests until it's done. It should ask to restart eclipse.
  16. Congrats! Now you can start developing C++, but remains a concrete example.

    Creating a project
  17. To create a new project, go to File >> New >> Project and select C++ >> Standard Make C++ Project. Give it a name and click finish.
  18. Now you can right click the new project in the workspace and New >> File. Give it a name .cpp for example "test.cpp"
  19. Open the file and go on write your C++ program. For example
    #include "iostream"
    using namespace std;


    int main() {
    cout << "This is a demonstration! \n";
    return 0;
    }
  20. Now you need a make file. Right click the project and New >> File. Name it "makefile". Here's a sample makefile:
    CC = g++
    LN = link.exe
    EXENAME = test

    all: $(EXENAME).exe
    [tab]@echo ********************************
    [tab]@cmd /c $(EXENAME)
    $(EXENAME).exe: $(EXENAME).o
    [tab]$(CC) -o $(EXENAME).exe $(EXENAME).o
    $(EXENAME).o: $(EXENAME).cpp
    [tab]$(CC) -c $(EXENAME).cpp
    clean:
    [tab]rm $(EXENAME).exe
    [tab]rm *.obj
  21. Please note you need to change the EXENAME to match your .cpp file. And also replace the [tab] with an actual tab not spaces!
  22. Now right click the project and then "Build project". Voilaaa!
Happy Eclipsing !

--
"I pretended to be somebody I wanted to be until finally I became that person. Or he became me." - Cary Grant

Using Eclipse as J2ME development platform

I believe the most powerfull asset of eclipse is the number of plugins available for almost any technology integration, working towards making it programers' heaven.

To start developing J2ME applications on eclipse, you need to:
  1. Download Sun Java Wireless Toolkit
  2. Ofcourse If you're not already an eclipsian (how dare you!) you need to download eclipse SDK.
  3. After Installing eclipse, go to Software Updates >> Find and Install from the Help Menu and then "Search for New Features to install"
  4. Select "New Remote Site" and specify the Name as "J2ME" for example and the URL needs to be specified as "http://eclipseme.org/updates/"
  5. Continue with the procedure as the installer suggests, you need to accept installing the plugin and then eclipse will request to restart.
  6. Before creating a project you should revise your eclipse default build settings. Go to Window >> Preferences. and then from the tree menu Java >> Build path. Make sure that you select the "Folders" radio button from the "Source and output folder" tab and that Source folder name is "src" and output folder name is "bin" confirm your modification by clicking on ok.
  7. When eclipse restarts now you need to create a project. Go to File >> New >> Project.
  8. A wizard will popup, you should find J2ME >> J2ME Midlet Suite and then specify a project name, click Next.
  9. If this is the first time to create a J2ME project, eclipse needs to locate the devices which will be used to run your application. Click on Manage Devices >> Import >> Browse and then locate the root folder for your Wireless toolkit. It should look like "WTK25". Click on Ok and then refresh. After eclipse is done with locating the devices click on "Select All" and then "Finish".
  10. Back to the New J2ME Project, you should have "Sun Java(TM) Wireless Toolkit 2.5 for CLDC Beta" in the Group element and select your preferable device from the list below and then click "Finish".
  11. Now you have the project created. To create your primary Midlet right click on the "src" folder and New >> Other. From the menu select J2ME >> J2ME Midlet.
  12. Click Next, give it a Name and click Finish.
  13. Congrats! Everything is now ready. If you need to add any resources like images or icons, place them in the "res" folder under your project root.
Happy Eclipsing !

--
"I’ve never looked through a keyhole without finding someone was looking back." - Judy Garland