Debian - Install JDK

  1. Add non-free in your /etc/apt/source.lst.
    deb http://debian.yorku.ca/debian/ lenny contrib non-free
     
  2. Update the packages list.

SQL

Basic

Create a table
--Create a table called t1 which has 2 columns, col1 and col2. 
--col1 is defined to allow only 1 characters and col2 is defined to allow integer.
CREATE TABLE t1( col1 CHAR(1), col2 INT);
Insert data in table
INSERT INTO t1 VALUES('A', 123); -- Insert 'A' and 123 into table t1.
INSERT INTO t1 VALUES('Z', 23 ); -- Insert 'Z' and 23 into table t1.
INSERT INTO t1 VALUES('B', 23 ); -- Insert 'Z' and 23 into table t1.

Debian - Mount Hot-pluggable devices(SD cards, USB)

  1. In the shell, run fdisk -l and note all the devices listed.
  2. Plug in your device and then re-run fdisk -l. You should see your newly added device appear in the list.
  3. Create a directory for your device.

Debian

Debian is 1 of the oldest free Linux distribution that still exist today. It was first released by Ian Murdock in 1993. It is known to be very stable. As a result, people tend to use it when they are building production servers.

Source.lst generator: http://debgen.simplylinux.ch/generate.php

Java - Multithreaded Programming

/**
 * Manager.java
 * Multithreaded example:
 * Give a job to each worker. As soon as a worker finishes his job, assign a new 
 *  job to the free worker.
 * @author Xuan Ngo
 */
import java.util.ArrayList;
 
public class Manager
{
  public static void main(String[] args)
  {
    // Variables
    int iNumOfWorkers = 3;// Number of workers.
    int iNumOfJobs = 11;  // Number of jobs.
    long lWaitTime = 1000;// Time lapse before asking who workers are free.
 
    // Create jobs list.
    ArrayList<String> aJobsList = new ArrayList<String>();

Selenium - Type characters

/**
 * Type characters.
 * Assume that you have Internet Explorer and Selenium Server is running on your
 *  computer on default port 4444. Otherwise, change accordingly in the constructor.
 *  You need to change the encoding of your editor to support the Chinese characters below.
 * @Author: Xuan Ngo
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class WritingExample
{
  private DefaultSelenium m_oBrowser = null;
 
  public static void main(String[] args)
  {
    Writing oWriting = new Writing();
 
    // Type characters.

Selenium - Select single/multiple options

/**
 * Select single/multiple options.
 * Assume that you have Internet Explorer and Selenium Server is running on your
 *  computer on default port 4444. Otherwise, change accordingly in the constructor.
 * @Author: Xuan Ngo
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class Select
{
  private DefaultSelenium m_oBrowser = null;
 
  public static void main(String[] args)
  {
    Select oSelect = new Select();
 
    // Select single/multiple options.
    oSelect.runExamples();
  }
 
  // Constructor
  public Select()
  {

Selenium - Check radio buttons and checkboxes

/**
 * Un/Check radio buttons and checkboxes.
 * Assume that you have Internet Explorer and Selenium Server is running on your
 * computer on default port 4444. Otherwise, change accordingly in the constructor.
 * @Author: Xuan Ngo
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class Check
{
  private DefaultSelenium m_oBrowser = null;
 
  public static void main(String[] args)
  {
    Check oCheck = new Check();
 
    // Un/Check radio buttons and checkboxes.
    oCheck.runExamples();
  }
 
  // Constructor
  public Check()
  {

Selenium - Click on any html element using different locators

/**
 * Click on any html element in the webpage as long as you can use the locators to identify them.
 * Assume that you have Internet Explorer and Selenium Server is running on your
 *  computer on default port 4444. Otherwise, change accordingly in the constructor.
 * @Author: Xuan Ngo
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class ClickAny
{
  private DefaultSelenium m_oBrowser = null;
 
  public static void main(String[] args)
  {
    ClickAny oClickAny = new ClickAny();
 
    // Click on any html element in the webpage.

Selenium - Click on link

/**
 * Click on a simple link(e.g Next)
 * Assume that you have Internet Explorer and Selenium Server is running on your
 *  computer on default port 4444. Otherwise, change accordingly in the constructor.
 * @Author: Xuan Ngo
 */
import com.thoughtworks.selenium.DefaultSelenium;
 
public class ClickSimple
{
  private DefaultSelenium m_oBrowser = null;
 
  public static void main(String[] args)
  {
    ClickSimple oClickSimple = new ClickSimple();
 
    // Click on Next link.
    oClickSimple.runExamples();
  }
 
  // Constructor

Pages

Subscribe to OpenWritings.net RSS