samedi 29 juin 2013

Change Wicket component behavior

Behaviors are kind of plug-ins for Components. They allow functionality to be added to a component and get essential events forwarded by the component. They can be bound to a concrete component (using the bind method which is called when the behavior is attached), but they don't need to. They can modify the components markup by changing the rendered ComponentTag. These are some of them : 
  1. AbstractAjaxTimerBehavior

  2. A behavior that generates an AJAX update callback at a regular interval. java doc

    WicketComponenet.add(new AbstractAjaxTimerBehavior(Duration.milliseconds(300)){
    @Override
    protected void onTimer(AjaxRequestTarget target) {
    // TODO Auto-generated method stub
    System.out.println("ajax here!");
    target.add(ComponentToModify);
    }});
    



  3. AjaxEventBehavior

  4. An ajax behavior that is attached to a certain client-side (usually javascript) event, such as onClick, onChange, onKeyDown, etc. Example:
    WebMarkupContainer div=new WebMarkupContainer(...);
             div.setOutputMarkupId(true);
             div.add(new AjaxEventBehavior("onclick") {
                 protected void onEvent(AjaxRequestTarget target) {
                     System.out.println("ajax here!");
                 }
             }
    
    This behavior will be linked to the onclick javascript event of the div WebMarkupContainer represents, and so anytime a user clicks this div the onEvent(AjaxRequestTarget) of the behavior is invoked. Java doc

  5. AjaxFormComponentUpdatingBehavior

  6. If you have a form component in wicket with some components and you want to change using ajax some things in that form before submit (when you click or edit on one of the components), then you have to use AjaxFormComponentUpdatingBehavior. This is a behavior that updates the hosting FormComponent via ajax when an event it is attached to is triggered.

    WicketComponenet.add(new AjaxFormComponentUpdatingBehavior("onchange"){ 
    @Override
    protected void onUpdate(AjaxRequestTarget target){
    // TODO 
    System.out.println("ajax here!"); 
    target.add(ComponentToModify);
    }}.setThrottleDelay(Duration.seconds(1))
    );
    ComponentToModify.setOutputMarkupId( true );
    

    The key is that your component must be a FormComponent, otherwise the event won't be triggered. Simple components like CheckBox, TextField, DropDownChoice are all FormComponents. Java Doc
    you should be careful to set setOutputMarkupId(true) of the component that will be modified after defining the behavior !

mercredi 26 juin 2013

Jenkins getting Started


Jenkins Overview

Jenkins Continuous Integration (CI)

server was created to manage and control development lifecycle processes of all kinds, including build, document, test, package, static analysis and many more. Jenkins supports two main functions to help you improve code quality:

Ongoing building and testing

an easy-to-use continuous integration system, Jenkins lets you easily integrate changes to a software project and then automatically initiate a fresh build. By integrating changes as soon as they're ready, you'll find problems sooner, reduce integration conflicts and ensure you always have a working build.

Monitoring the execution of externally-run jobs

Jenkins schedules, monitors and manages externally-run jobs as well, such as cron jobs and procmail jobs and can even handle operations on a remote machine. The tool immediately informs you if something goes wrong, so you can fix the problem right away.

Built-in Automatic Backup

Jenkins lets you define regular backup schedules and control what to back up. Backups can be pushed to a remote server via SFTP or to a local file system. In this way, you configuration will be protected even in case of disaster like disk failures.

Self-upgrade

Upgrading Jenkins to a newer version is really easy. If you choose the native package (such as .deb or .rpm), your package manager will update it automatically. If you choose other installation methods, Jenkins will update itself with a click of a button from GUI.

Jenkins Jobs

in the table you find the list of existant jobs.

Create New Job

you have just to click to new job in the left and the folowing screen will appear.

next give a small description to your job :

Build New Job

After creating your job you can start your build by clicking on Start Build :

Job Configuration

The created jobs must be configured as follow :

Git Configuration

to use Jenkins you have to use a system version Control like Git or svn. If you are using an Http protocol to manage remote repository you need to specify the user credentials in the URL :
http://username:password@ci.opuntia360.com/....

Cron Configuration

the automation build is managed by the peridic Build option. This field follows the syntax of cron (with minor differences). Each line consists of 5 fields separated by TABs or spaces:
MINUTES HOURS JOURMOIS MONTH JOURSEMAINE
MINUTES The minutes in an hour (0-59)
HOURS The hours in a day (0-23)
JOURMOIS the day in a month (1-31)
MONTH The month (1-12)
JOURSEMAINE The day of the week (0-7) where 0 and 7 are Sunday
for example I have so far used Periodic build in jenkins where the schedule:
*/2 * * * * builds the project every 2 minutes


Email Notification

Jenkins offer to you the oportunity to make a post build task.one of the import tasks is mail notification.

Smtp Config

it is very import to configure jenkins to know you smtp server.

Send Email After Build

click to create a post build step and choose "Editable Email Notification" and specify your mail adress.

UBUNTU: HOW TO CHANGE THE COMPUTER NAME (HOSTNAME)




Change Your Computer Name (Ubuntu)
You might run into a situation that requires you to change your (hostname) computer name, either because you need it to meet a naming scheme or you’re just bored with it and want something better. By following these steps, you’ll give your computer a new identity in no time.
  1. To get started, press Ctrl – Alt – T on your keyboard to open the Terminal. Next, type the command below to open the hostname file.
  2. Type this commande into the terminal and remember that the current computer name is @aymen-Aspire-E1-571


gksu gedit /etc/hostname
3.   Then change the name to whatever you like and save the file.

4. Next, while command console is still open, type the command below to open the hosts file.
gksu gedit /etc/hosts

5. Finally, change the name shown to complete the change and save the file.

6. Close all open windows and restart your system.
After your system has restarted, it will have the new computer name.

Git Over Http




How To use the http protocol to manage git traffic ?


Traditionally git used to work only over ssh or git protocols while there was only a dumb version of git over http which was slow and inefficient.
While this was ok for most of the time sometimes git needs to be able to work over http. 
Now starting from git 1.7 both git servers and clients have support for smart http which works over http(s) and is supposed to be as efficient as the ssh version.



the git-http-backend tool

This functionality is made available by a cgi script called git-http-backend provided with git-core.
So for git to work over http(s) there should be a web server already configured and as a result there won’t be any conflicts by both the web server and git trying acquire port 80.

Configuration

The following steps can be used to configure git to work over http(s) with Apache.

Apache Configuration

Make sure mod_cgi, mod_alias, and mod_env are enabled. to activate the WEBDAV module just use this command :
a2enmod dav_fs
1) Open the Apache config file
2) Append the following. Debian based system should have it under /etc/apache2/apache2.conf by default : SetEnv GIT_PROJECT_ROOT /home/user/git_pub SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
The GIT_PROJECT_ROOT should point to the root folder where git repositories would be hosted.
Set this away from the document root of the web server. What the above do is direct any requests with /git/ to the git-http-backend and tell the script that the root of git repositories is GIT_PROJECT_ROOT.
That is all that needs to be done that is specific to git over http(s). The manual for for the git-http-backend explains these steps pretty thoroughly. Now for some tit-bits that are not explained in the manual. Those who are experienced with Apache and Git would find the following very boring.
3) User Righs
For authentication for both read and write accesses append the following to the Apache config file /etc/apache2/apache2.conf :
$  <Location /git>

$  AuthType Basic

$  AuthName “Private Git Access”

$  AuthUserFile /etc/apache2/authusers
 
$  Require valid-user

$  </Location>

What the above do is make requests to /git only accessible to valid users and tell valid users are listed on the file /etc/apache2/authusers. Make sure the file authusers is accessible by Apache. If there is no AuthUserFile in your system the following command can be used to create the user list at /etc/apache2/authusers and add the user ‘username’ to it. The command will prompt for a password for the user :
$ htpasswd -c /etc/apache2/authusers username
4) Restart Apache
On debian most probably :
$ sudo /etc/init.d/apache2 restart

Git Over Http Example

1) Create an empy bare git repository under the specified GIT_PROJECT_ROOT (/home/user/git_pub in our example) :
$ cd to GIT_PROJECT_ROOT
$ mkdir project
$ cd project
$ git init –bare
2) Make the folder ‘project’ and it’s children owned by the user which the web server is run from. This should be done for push requests by clients to work or otherwise the web server won’t be able to merge files.
On debian based systems this user is usually www-data and is defined in a file called envvars under apache2 installation :
$ sudo chown -R www-data project/
$ sudo chgrp -R www-data project/
Now the bare git repository should be pull-able and pushable by authorized users.
3) Clone the git repository over http(s) from another location:
$ git clone http://username@host/git/project
4) Do the first commit:
$ cd project
$ touch readme
$ git add readme
$ git commit -m “first commit”
$ git push origin master

How do I increase the permgen size of Tomcat Server ?





  • Increase the Heap size from the catalina.sh file



Tomcat production server sometime will hit the following java.lang.OutOfMemoryError: PermGen space error.


java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

you should increase the memory by make change in catalina.sh.

Cataline.sh is located at \tomcat folder\bin\catalina.sh
Assign following line to JAVA_OPTS variable and add it into catalina.sh file.
export CATALINA_OPTS="-Xms512m -Xmx1024m"
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms2536m -Xmx2536m
-XX:NewSize=256m -XX:MaxNewSize=1024m -XX:PermSize=1536m 
-XX:MaxPermSize=1536m -XX:+DisableExplicitGC"

  • Increase the Heap size from the the Eclipse IDE


if you are using tomcat sever with eclipse you need to resolve this exception by modifying the tomcat arguments :
If you see java.lang.OutOfMemoryError: PermGen space errors, you need to increase the permanent generation space available to Eclipse.
PermGen is the permanent generation of objects in the VM (Class names, internalized strings, objects that will never get garbage-collected). An easy, if somewhat memory-hungry fix is to enlarge the maximum space for these objects by adding


  • double click on the tomcat server
  • Click to Open Launch Configuration

  • Choose the Arguments tab and add the following parameters
     -Xms1024m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m





  • Be Careful !!!!
you have to be careful when increasing the heap size of your tomcat server and jvm.


 As you can see, if you allocate a large Java Heap (2 GB+) for a 32-bit JVM process, the native memory space capacity will be reduced automatically, opening the door for JVM native memory allocation failures.
you will get the following exception :OutOfMemoryError: unable to create new native thread


For a 64-bit JVM process, your main concern, from a JVM C-Heap perspective, is the capacity and availability of the OS physical, virtual and swap memory.
 What you will learn shortly is that this JVM problem is very often related to native memory depletion; either at the JVM process or OS level. For now please keep in mind that:



  • A 32-bit JVM process is in theory allowed to grow up to 4 GB (even much lower on some older 32-bit Windows versions).
  • For a 32-bit JVM process, the C-Heap is in a race with the Java Heap and PermGen space e.g. C-Heap capacity = 2-4 GB – Java Heap size (-Xms, -Xmx) – PermGen size (-XX:MaxPermSize)
  • A 64-bit JVM process is in theory allowed to use most of the OS virtual memory available or up to 16 EB (16 million TB)






mardi 25 juin 2013

Wicket: Get Request Parameter from URL

In case you want to retrieve a value from the URL  , you can simply do it with Wicket 1.5  with one line of code :

StringValue game = RequestCycle.get().getRequest().getRequestParameters().getParameterValue("game");

there is also a several  paramters you can retrieve from URL like : 
  1. getClientUrl()
  2. getOriginalUrl()
  3. getUrl()
keep it simple,keep it clean  :)

Wicket PageParameters example

In Wicket 1.5 , you can use “PageParameters” class to store parameters values and pass it to another page. this is how you can do it :
first you should set your page parameters before redirection to be able then to receipt them in destination page

  @Override
  protected void onClick() {
 
   PageParameters pageParameters = new PageParameters();
   pageParameters.add("game", "Tombe Raider");
   setResponsePage(game.class, pageParameters);
 
  }

the next step is to capture these parameters into a method of destination page as follow :
String gameValue = pageParameters.get("game").toString();

that all :) !

Freeing up a TCP/IP port



Usually when using tomcat server the following exception will be handled :

Several ports (8005, 8080, 8009, 8443) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).



To resolve this exception you need to free the TCP/IP ports that are already on 'LISTEN' state.
you'll have to kill all processes that are listening on that port. The easiest way to do that would be to use the fuser(1) command. For example, to see all of the processes listening for http requests on port 8080 (run as root or use sudo):


netstat -ln | grep ':8080 ' | grep 'LISTEN'



If you want to kill them, then just add the -k option.


fuser -k 8080/tcp
fuser -k 8443/tcp
fuser -k 8005/tcp
fuser -k 8009/tcp

dimanche 23 juin 2013

How to git ignore files that are already tracked

for all people who use  eclipse , they always don't want to track some kind of files like (.properties,.metadata ...) that are automatically created by eclipse .
also the other problem is that git will not ignore a file that was already tracked before a rule was added to the file  .gitignore to ignore it 

So what is the Solution ?

In such a case , you should follow these two steps :
    1. files must be un-tracked, usually with 
      git rm --cached filename
    2. now they do not show up as "changed" but still show as untracked files in git status , so add some  exclude rules into .git/info/exclude  file in your repository
       
In case of Eclipse ,  do these two steps  to completely remove files and repositories from being tracked :
  1. execute this script after git add . :
    git rm --cached *.pydevproject
    git rm --cached *.project
    git rm --cached *.metadata
    git rm --cached */bin/**
    git rm --cached */tmp/**
    git rm --cached *.tmp
    git rm --cached *.bak
    git rm --cached *.swp
    git rm --cached *~.nib
    git rm --cached *local.properties
    git rm --cached *.classpath
    git rm --cached *.settings/*
    git rm --cached *.loadpath
    git rm --cached *org.eclipse.wst.common.component
    git rm --cached *org.eclipse.wst.common.project.facet.core.xml
    git rm --cached *.properties
    git rm --cached *.orig
    git rm --cached *.classpath
    git rm --cached *.xml
    git rm --cached *.jar
    git rm --cached *.class
    

  2. add this code to .git/info/exclude  file in your repository
    # git ls-files --others --exclude-from=.git/info/exclude
    # Lines that start with '#' are comments.
    # For a project mostly in C, the following would be a good set of
    # exclude patterns (uncomment them if you want to use them):
    # *.[oa]
    # *~
    
    #Eclipse#
    ###################
     
    *.pydevproject
    *.project
    *.metadata
    */bin/*
    */bin/
    */tmp/**
    *.tmp
    *.bak
    *.swp
    *~.nib
    *local.properties
    *.classpath
    *.settings/*
    *.settings/
    *.loadpath
    *org.eclipse.wst.common.component
    *org.eclipse.wst.common.project.facet.core.xml
    *.properties
    *.orig
    *.classpath
    *.xml
    
    # Package Files #
    ##################
    *.jar
    *.war
    *.ear
    
    # Compiled source #
    ###################
    *.com
    *.class
    *.dll
    *.exe
    *.o
    *.so
    
    # Packages #
    ############
    # it's better to unpack these files and commit the raw source
    # git has its own built in compression methods
    *.7z
    *.dmg
    *.gz
    *.iso
    *.jar
    *.rar
    *.tar
    *.zip
    
    # Logs and databases #
    ######################
    *.log
    *.sqlite
    
    # OS generated files #
    ######################
    .DS_Store
    .DS_Store?
    ._*
    .Spotlight-V100
    .Trashes
    Icon?
    ehthumbs.db
    Thumbs.db
    
These rules are not committed with the repository so they are not shared with others. This method can be used for locally-generated files that you don't expect other users to generate, like files created by your editor.

for more informations visit the official github site.



I hope that this sample tutorial can help someone else :)

vendredi 21 juin 2013

How to install amd drivers on Debian ubuntu


Some People can have problems after installing amd drivers and after viewing the specific error log file we see this error :

    "one or more tools for installation cannot be found on the system. install the required tools before installing the fglrx driver. Optionally, run the installer with --force option to install without the tools. Forcing install will disable AMD hardware acceleration and may make your system unstable. Not recommended. see log for details."


So to fix this error you just need the headers for your kernel. Run the following to install them:
sudo apt-get install linux-headers-$(uname -r)

after these step , you are able now to install your amd driver . 
I hope this can help you :)

jeudi 20 juin 2013

How install LaTex with Apt-Get (Debian)


Get Request parameters with Wicket 1.5.x




To get the current request parameters (for example in Ajax behavior processing) in Apache Wicket 1.4:
    String parameterValue = RequestCycle.get().getRequest().getParameter(parameterName);
In 1.5 you have a better control where the parameter comes from:
   // GET request
   StringValue parameterValue = RequestCycle.get().getRequest().getQueryParameters().getParameterValue(parameterName);

   // POST request
   StringValue parameterValue = RequestCycle.get().getRequest().getPostParameters().getParameterValue(parameterName);

Or if you don't care about the method:
   StringValue parameterValue = RequestCycle.get().getRequest().getRequestParameters().getParameterValue(parameterName);

mercredi 19 juin 2013

How to find files in Linux using 'find'

Files can be found under Linux in many different ways. Using the find tool is one of the best ways to find files. The find tool has a huge number of parameters which can be set so that Linux finds exactly those files that you were searching for. 

Many users use the find tool with just the basic parameters. They get the results that they were looking for.

 Unfortunately most of the users don't spend time to learn all about find. If they do, they can make excellent use of this tool and I am sure you would be surprised at the possibilities.

In case you just want to know where a particular file exists on your system, and nothing else is required, then use locate tool



$ find / -name 'program.c'




/
Start searching from the root directory (i.e / directory)
-name
Given search text is the filename rather than any other attribute of a file
'program.c'
Search text that we have entered. Always enclose the filename in single quotes

mardi 18 juin 2013

Wicket Motivations


Motivations :

Most existing web frameworks provide weak to non-existent support in managing server-side state

This normally means lots of ad-hoc code in web applications dealing with the gory mechanics of state management. While Wicket will not allow you to stop thinking about server state, it goes a long ways towards making it easy and often transparent to manage that state.
In Wicket, all server side state is automatically managed. You will never directly use an HttpSession object or similar wrapper to store state. Instead, state is associated with components. Each server-side page component holds a nested hierarchy of stateful components, where each component’s model is, in the end, a POJO (Plain Old Java Object). Wicket maintains a map of these pages in each user’s session. One purpose of this page map (and the component hierarchy on each page) is to allow the framework to hide all details of how your components and models are accessed. You deal with simple, familiar Java objects and Wicket deals with things like URLs, session ids and GET/POST requests.
You will also find that this well-structured server state makes it very easy to deal with the dreaded “back button problem”. In fact, Wicket has a generic and robust solution which can identify and expire browser-cached pages that have become stale due to structural changes to the model of a component on the page.
Finally, Wicket has been designed to work with POJO persistence frameworks such as JDO or Hibernate. This can make database driven web applications quite easy to write.
For many applications, it will be worth trading off the increased server load of extra server-side state for decreased development costs, lower maintenance costs, quicker time-to-market and generally higher quality software. The basic observation here is that software is expensive and complex while servers from companies like E-machines and Dell are relatively dirt cheap.
In terms of efficiency versus productivity, perhaps Wicket is to JSP as Java is to C. You can accomplish anything in Wicket in JSP. You may even do it more efficiently in terms of memory or processor consumption. But it may take you weeks or months longer to develop your application. And in the end, since state management in JSP is ad-hoc, you are likely find security problems and bugs popping up everywhere. Most of the other frameworks above will do only a little more to help you.

Most existing frameworks require special HTML code

JSP is by far the worst offender, allowing the embedding of Java code directly in web pages, but to some degree almost all of the frameworks from the list (except Tapestry) above introduce some kind of special syntax to your HTML code.
Special syntax is highly undesirable because it changes the nature of HTML from the kind of pure-and-simple HTML markup that web designers are familiar with, to some kind of special HTML. This special HTML can be more difficult to preview, edit and understand.
Wicket does not introduce any special syntax to HTML. Instead, it extends HTML in a standards-compliant way via a Wicket namespace that is fully compliant with the XHTML standard. This means that you can use Macromedia Dreamweaver, Microsoft Front Page, Word, Adobe Go Live, or any other existing HTML editor to work on your web pages and Wicket components. To accomplish this, Wicket consistently uses a single id attribute in the Wicket namespace (“wicket:id”) to mark HTML tags that should receive special treatment by the toolkit. If you prefer not to render Wicket namespaced tags and attributes to your end-users, Wicket has a simple setting to strip them all out, resulting in ordinary, standards-compliant HTML.
No “special sauce” in your HTML means designers can mock up pages that you can use directly in development. Adding Java components to the HTML is as simple as setting the component name attribute. And you can then give the HTML back to your web designers knowing that they can change it with confidence.
Wicket, more than any other framework gives you a separation of concerns. Web designers can work on the HTML with very little knowledge of the application code (they cannot remove the component name tags and they cannot arbitrarily change the nesting of components, but anything else goes). Likewise, coders can work on the Java components that attach to the HTML without concerning themselves with what a given page looks like. By not stepping on each other’s toes, everyone can get more work done.

Existing frameworks are not easy

Most of the existing toolkits have poorly defined or non-existent object models. In some cases, the model is defined using special XML syntaxes. The syntaxes may be so cumbersome that special tools are required to manipulate all the configuration information. Since these toolkits are not simple Java libraries you may or may not be able to use your favorite IDE tools such as editors, debuggers and compilers.
Wicket is all about simplicity. There are no configuration files to learn in Wicket. Wicket is a simple class library with a consistent approach to component structure. In Wicket, your web applications will more closely resemble a Swing application than a JSP application. If you know Java (and especially if you know Swing), you already know a lot about Wicket.

Existing frameworks inhibit reusability

Tapestry and JSF at least have component models that allow reuse, but you are likely to find that it is not particularly trivial to do, at least when compared with Wicket. Wicket has been explicitly designed to make it very, very easy to create reusable components. It’s surprisingly simple to extend existing components and to make compound components such as a SignInPanel or AddressForm. It is also relatively easy to create components that exploit new features of browsers. Components in Wicket can be packaged up in JAR files and reused by simply dropping them in your lib folder - no configuration necessary!

Web programming should be fun!

This is my most personal goal for writing Wicket . None of the existing frameworks are appealing to me in terms of intuitiveness, quickness, ease of development, etc. It is my hope that Wicket represents a significant step in the direction of making web applications easy and fun to write.




For more informations : Official wicket site

Introduction to Wicket



Why Wicket?


If you are looking to do web application programming in Java, you have a very large number of choices these days. In fact, there are so many web application frameworks now that it has become somewhat of a joke. One blog site on the Internet poses the question: How many Java web frameworks can you name? The answer they show looks like this:

Frameworks, Frameworks Everywhere

EchoCocoonMillstoneOXF
StrutsSOFIATapestryWebWork
RIFESpring MVCCanyamoMaverick
JPublishJATOFoliumJucas
VergeNiggleBishopBarracuda
Action FrameworkShocksTeaServletwingS
ExpressoBentojStatemachinejZonic
OpenEmceeTurbineScopeWarfare
JWAAJaffaJacquardMacaw
SmileMyFacesChibaJBanana
JeeniusJWarpGenieMelati
DovetailCameleonJFormularXoplon
JappleHelmaDinamicaWebOnSwing
NachoCassandraBaritusStripes
ClickGWT


Why “Reinvent the Wheel”?

In light of this, you may be wondering “What good is another web application framework?” Indeed. Why “re-invent the wheel?” One snappy comeback to that old saw is: because this time we could make it rounder!
But it was not simply a desire for higher quality that drove the creation of Wicket. Even with so many options, there really is no web toolkit which fills exactly the niche that Wicket fills. In fact, Wicket is quite unlike each of the frameworks above.
Wicket’s closest cousins are probably Tapestry and Echo, but even there the likeness is very shallow. Like Tapestry, Wicket uses a special HTML attribute to denote components, enabling easy editing with ordinary HTML editors. Like Echo, Wicket has a first-class component model. But Wicket applications are not like applications written in either Tapestry or Echo, because in Wicket you get the best of both worlds. You get the benefits of a first-class component model and a non-intrusive approach to HTML. In many situations, this combination may prove to be a significant development advantage.
To understand why Wicket is so different, it may help to understand the motivations that created it.


lundi 17 juin 2013

Latex , Sample introduction and how to install it on Unix system



What is LaTeX?

LaTeX is a document preparation system for high-quality typesetting. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing.
LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content


TeX Live ?

TeX Live is an easy way to get up and running with the TeX document production system. It provides a comprehensive TeX system with binaries for most flavors of Unix, including GNU/Linux, and also Windows. It includes all the major TeX-related programs, macro packages, and fonts that are free software, including support for many languages around the world.

How to install it on Ubuntu ( Unix-like system) ?

If you don't want to bother reading the full install documentation and just want to install everything in TeX Live, on a Unix-like system ,users can follow the instructions for Unix-like systems, but make sure you have the Cygwin prerequisites before beginning the installation.

  1. For typical needs, we recommend starting the TeX Live installation by downloading  install-tl-unx.tar.gz (2.5mb) 
  2. The simplest way to start it on a Unix-compatible system is as follows:
    1. > cd /path/to/installer 
    2. > perl install-tl
  3. To install in expert GUI mode , you’ll need the Perl/TK module compiled with XFT support, which is generally the case with GNU/Linux, but not necessarily with other systems. Given that, you can run:
    1. perl install-tl -gui
  4. after installation complete (it take a long time) you should edit your PATH environment by
     adding this line into your .bashrc (in Ubuntu) :
    1. PATH=/usr/local/texlive/2012/bin/x86_64-linux:$PATH; export PATH
    2. MANPATH=/usr/local/texlive/2012/texmf/doc/man/man:$MANPATH; export MANPATH
    3. INFOPATH=/usr/local/texlive/2012/texmf/doc/info:$INFOPATH; export INFOPATH
  5. the last step is to check your installation by typing tex --version on cmd Terminal

If this is the first time you are trying out LaTeX, you don't even need to install anything. For quick testing purpose you may just create an user account with an online LaTeX editor .for example :


  • Google Documents or LaTeX Lab allows real-time simultaneous collaborative editing of text files for anyone with a Google account (and its option to make the document available through a URL makes local download and compilation easily scriptable).
  • LIMSUP is an online LaTeX editor allowing real time collaboration of LaTeX documents (announcement)



 These websites offer collaboration capabilities while allowing you to experiment with LaTeX syntax without having to bother with installing and configuring a distribution and an editor.

I wish this sample tutorial make your life easier :)


 for more information Go to the  official page .
Other references :
 http://en.wikibooks.org/wiki/LaTeX