tutorial 3: sql

query with operator

SELECT firstName + '  ' + lastName AS [full name]
FROM memberDetails
WHERE city='yogyakarta';
SELECT filmName
FROM films
WHERE yearReleased <= 1990;

operator AND

SELECT filmName, lastName, street, city, state, zipCode
FROM memberDetails
WHERE dateOfJoining >= '2004-01-01' AND dateOfJoining <= '2005-03-01';
SELECT firstName, lastName
FROM memberDetails
WHERE dateOfBirth <= '1990-05-05' AND state='jakarta';

operator OR

SELECT state, dateOfJoining
FROM memberDetails
WHERE state='new state' OR state='golden state'
AND dateOfJoining >= '2005-01-01';

 

SELECT firstName, lastName, city, DateofBirth
FROM memberDetails
WHERE (city = 'Townsite' OR city='bigcity')
AND
      (DateofBirth >= '1989-05-29' OR DateofBirth <= '1945-08-17');

operator NOT

SELECT firstName
FROM memberDetails
WHERE NOT STATE='golden state';

operator BETWEEN

SELECT filmName, yearReleased, Rating, AvailableonDVD
FROM Films
WHERE (Rating BETWEEN 2 AND 4)
AND
      (AvailableonDVD = 'y');

operator LIKE

SELECT lastName
FROM memberDetails
WHERE lastName LIKE 'J%';

 

SELECT lastName
FROM memberDetails
WHERE lastName LIKE 'D_s';
SELECT lastName
FROM memberDetails
WHERE lastName NOT LIKE 'J%';

operatot IN

SELECT filmName, yearReleased, Rating
FROM Films
WHERE yearReleased in (1967,1977,1987)
AND
RATING in (4,5);

operator ORDER BY

SELECT yearReleased
FROM Films
ORDER BY yearReleased DESC;

Tutorial 2: sql

create table with referential integrity

create table barang

CREATE TABLE barang (
kd_brg varchar(4) NOT NULL,
nm_brg varchar(25) NOT NULL,
harga_beli double NOT NULL,
harga_jual double NOT NULL,
stok double NOT NULL,
PRIMARY KEY (kd_brg))
ENGINE=MYISAM;

create table pembelian_detil

CREATE TABLE pembelian_detil (
no_beli varchar(4) NOT NULL,
kd_brg varchar(4) NOT NULL,
harga_beli double NOT NULL,
jumlah double NOT NULL,
PRIMARY KEY (no_beli, kd_brg))
ENGINE=MYISAM;

add referential integrity

ALTER TABLE pembelian_detil
ADD CONSTRAINT FOREIGN KEY (kd_brg)
REFERENCES barang (kd_brg);

create table penjualan_detil

CREATE TABLE penjualan_detil (
no_jual varchar(4) NOT NULL,
kd_brg varchar(4) NOT NULL,
harga_jual double NOT NULL,
jumlah double NOT NULL,
PRIMARY KEY (no_jual, kd_brg))
ENGINE=MYISAM;

add referential integrity

ALTER TABLE penjualan_detil
ADD CONSTRAINT FOREIGN KEY (kd_brg)
REFERENCES barang (kd_brg);

tutorial: SQL

create table pelanggan

CREATE TABLE pelanggan (
kd_plg int(4) unsigned zerofill NOT NULL auto_increment,
nm_plg varchar(20) NOT NULL,
alamat varchar(50) NOT NULL,
PRIMARY KEY (kd_plg))
ENGINE=MYISAM AUTO_INCREMENT; 

entering information

INSERT INTO pelanggan (nm_plg, alamat)
VALUES
('slamet','jl.karang-tengah 24 demak'),
('vera','jl.kaliurang 2 yogyakarta');

query information

SELECT kd_plg, nm_plg, alamat FROM pelanggan

Selecting Data from different tables (INNER JOIN)

create table barang

CREATE TABLE barang (
kd_brg int(4) unsigned zerofill NOT NULL auto_increment PRIMARY KEY,
nm_brg varchar (30) NOT NULL,
harga double NOT NULL); 

entering information

INSERT INTO barang (nm_brg, harga)
VALUES
('LED samsung','1500'),
('Macbook','6000');

create table penjualan

CREATE TABLE penjualan (
no_jual int(4) NOT NULL auto_increment PRIMARY KEY,
kd_plg int(4) NOT NULL,
tgl DATE NOT NULL)
ENGINE=MYISAM;

entering information

INSERT INTO penjualan (kd_plg,tgl)
VALUES
(1, '2012-07-05')
(2, '2012-09-01');

create table penjualan_detil

CREATE TABLE penjualan_detil (
no_jual int(4) NOT NULL,
kd_brg int(4) unsigned zerofill NOT NULL,
harga double NOT NULL,
jumlah int(4) NOT NULL,
PRIMARY KEY (no_jual,kd_brg));
INSERT INTO penjualan_detil (no_jual,kd_brg)
VALUES
(1,1, '1500',2)
(1,2, '6000',5);
SELECT no_jual, nm_plg, alamat, tgl
FROM penjualan AS p
INNER JOIN 
pelanggan AS pl (p.kd_plg=pl.kd_plg)

rails 3 in nutshell

Create new ‘Application’, write in commandline ‘railsinstaller’

>rails new first_web

running web server, running on port number 3000

first_web>rails server

open again ruby console commandline

first_web>rails generate scaffold User name:string email:string

by including name:string and email:string, need to migrate the database using rake

first_web>rake db:migrate

then, running web server

first_web>rails server

I was using redcar-editor

sites>gem install redcar

running the redcar-editor

first_web>redcar

 

 

then, select the theme appearance

 

installing apache tomcat

Installing Apache Tomcat

“zip” ⇒ “apache-tomcat-7.0.xx.zip“.

  1. UNZIP into a directory of your choice. DO NOT unzip onto the Desktop (because its path is hard to locate). I suggest using “d:\myproject“. Tomcat will be unzipped into directory “d:\myproject\apache-tomcat-7.0.xx“. For ease of use, we shall shorten and rename this directory to “d:\myproject\tomcat“. Take note of Your Tomcat Installed Directory. Hereafter, I shall refer to the Tomcat installed directory as<TOMCAT_HOME>.

I recommend “zip” version, as you could simply delete the entire directory when Tomcat is no longer needed (without running any un-installer). You are free to move or rename the Tomcat’s installed directory. You can install (unzip) multiple copies of Tomcat in the same machine.

 STEP 2: Create an Environment Variable JAVA_HOME

You need to create an environment variable called “JAVA_HOME” and set it to your JDK installed directory.

  1. First, take note of your JDK installed directory (the default is “c:\program files\java\jdk1.7.0” or “c:\program files\java\jdk1.6.0_xx“).
  2. Start a CMD shell, and issue the command “SET JAVA_HOME” to check if variable JAVA_HOME is set:
    prompt> set JAVA_HOME
    Environment variable JAVA_HOME not defined

    If JAVA_HOME is set (by other applications), check if it is set to your JDK installed directory.

  3. To set/change an environment variable in Windows 2000/XP/Vista/7: Click “Start” button ⇒ “Control Panel” ⇒ “System” ⇒ (Vista/7) “Advanced system settings” ⇒ Switch to “Advanced” tab ⇒ “Environment Variables” ⇒ “System Variables” (or “User Variables” for the current user only) ⇒ “New” (or “Edit” for modification) ⇒ In “Variable Name” field, enter “JAVA_HOME” ⇒ In “Variable Value” field, enter your JDK installed directory (e.g., “c:\program file\java\jdk1.7.0“) – I suggest that you copy and paste the directory name to avoid typo error!
  4. To verify, RE-START a CMD shell and issue:
    prompt> set JAVA_HOME
    JAVA_HOME=c:\program file\java\jdk1.7.0   <== CHECK! YOUR JDK installed directory

(For Mac and Unix Users only) Take note of your JDK installed directory (most likely under /usr/local). Start a Terminal (Bash Shell), run:

$ java_home=your_jdk_install_directory  // Set environment variable java_home
$ export java_home                      // Make this variable available to all applications

To make permanent changes, store the above command in “.bash_profile” in your home directory (denoted as '~'), and run “source $HOME/.bash_profile” to refresh.

  STEP 3: Configure Tomcat Server

The Tomcat configuration files are located in the “conf” sub-directory of your Tomcat installed directory (e.g. “d:\myproject\tomcat\conf“). There are 3 configuration files:

  1. server.xml
  2. web.xml
  3. context.xml

Make a backup of the configuration files before you proceed.

Step 3(a) “server.xml” – Set the TCP Port Number

Use a text editor (e.g., NotePad++, TextPad or NotePad) to open the configuration file “server.xml“, under the “conf” sub-directory of Tomcat installed directory (e.g. “d:\myproject\tomcat\conf“).

The default TCP port number configured in Tomcat is 8080, you may choose any number between 1024 and 65535, which is not used by an existing application. We shall use port 9999 in this article. (For production server, you should use port 80, which is pre-assigned to HTTP server as the default port number.)

<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="9999" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
Step 3(b) “web.xml” – Enabling Directory Listing

Again, use a text editor to open the configuration file “web.xml“, under the “conf” sub-directory of Tomcat installed directory.

We shall enable directory listing by changing “listings” from “false” to “true” for the “default” servlet, as shown in red.

<!-- The default servlet for all web applications, that serves static     -->
<!-- resources.  It processes all requests that are not mapped to other   -->
<!-- servlets with servlet mappings.                                      -->
<servlet>
  <servlet-name>default</servlet-name>
  <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
  <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
  </init-param>
  <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>
Step 3(c) “context.xml” – Enabling Automatic Reload

Again, use a text editor to open the configuration file “context.xml“, under the “conf” sub-directory of Tomcat installed directory.

We shall add the attribute reloadable="true" to the <Context> element to enable automatic reload after code changes, as shown in red.

<Context reloadable="true">
   ......
</Context>

  STEP 4: Start Tomcat Server

The Tomcat’s executable programs are kept in the “bin” sub-directory of the Tomcat installed directory (e.g., “d:\myproject\tomcat\bin“).

Step 4(a) Start Server

Launch a CMD shell. Set the current directory to “<TOMCAT_HOME>\bin“, and run “startup.bat” as follows:

// Change the current directory to Tomcat's "bin"
// Assume that Tomcat is installed in "d:\myproject\tomcat"
prompt> d:                     // Change the current drive
D:\...> cd \                   // Change Directory to ROOT directory
D:\> cd \myproject\tomcat\bin  // Change Directory to YOUR Tomcat's "bin" directory

// Start Tomcat Server
D:\myproject\tomcat\bin> startup

A new Tomcat console window appears. Study the messages on the console. Look out for the Tomcat’s port number (double check that Tomcat is running on port 9999). Future error messages will be send to this console. System.out.println() issued by your Java servlets will also be sent to this console.

......
INFO: Initializing Coyote HTTP/1.1 on http-9999
......
INFO: Starting Coyote HTTP/1.1 on http-9999
......
INFO: Server startup in 699 ms

(For Mac and Unix Users Only) First, change directory to Tomcat binary directory. You may need to use “./startup.sh” to start the server.

(source:http://www3.ntu.edu.sg/home/ehchua/programming/howto/tomcat_howto.html )

foreign students at universitas nasional

foreign students at universitas nasional (UNAS)

Dual degree program: faculty of Economics, UNAS

A total of 27 students from Guangxi University for Nationalities, P.R. China led by its faculty member, Ms. Yang Junchu, arrived in Jakarta on July 27, 2012. Following their seniors who had graduated from the Indonesian Study Program, these students would begin their two-year joint degree program to study Management in the Faculty of Economics, UNAS. After settling in their accommodations, the 20 female and 7 male students immediately took part in Akselerasi Bahasa Indonesia (Indonesian Language) program, led by Drs. Somadi Sosrohadi, M.Pd, Arju Susanto, S.S., M.Pd, and team which would take place until the beginning of September 2012 and preliminary lectures on culture given by Dr. Wahyu Wibowo, M.M., introduction to economics by Suryono, S.E., M.M., and cross-cultural orientation by Nia Levina, M.Si. Cooperation between UNAS and GXUN which began in 2007 had included exchange visits from the Presidents and faculty members of both universities. Last year, the Memorandum of Understanding was renewed by the Rector of UNAS, Drs. El Amry Bermawi Putera, M.A. and the President of GXUN, Prof. Dr. He Longqun. and 7 students from nagasaki university and nagasaki institute applied sciance- japan study for reptiles

Darmasiswa

in addition,  and 16 student from other countries study bahasa indonesia (indonesian language) from DARMASISWA program. before, 11 students and 13 students from other countries in year 2010 & 2011.

further information visit  at: www.darmasiswa.diknas.go.id, applicants should notify to the Indonesian Embassy/Consulate General before applying online.

office of international cooperation

Universita Nasional, selasar 2nd floor

Jl. Sawo Manila, Pejaten, Pasar Minggu- Jakarta, 12520 Indonesia

email: oic@unas.ac.id

Darmasiswa

Darmasiswa

DARMASISWA is a scholarship program offered to all foreign students from countries which have diplomatic relationship with Indonesia to study Bahasa Indonesia, arts, music and crafts. Participants can choose one of 45 different universities located in different cities in Indonesia. This program is organized by the Ministry of National Education (MoNE) in cooperation with the Ministry of Foreign Affairs (MoFA).

The DARMASISWA program was started in 1974 as part of ASEAN (Association of South East Asian Nations) initiative, admitting only students from ASEAN. However, in 1976 this program was extended to include students from other countries such as Australia, Canada, France, Germany, Hungary, Japan, Mexico, the Netherlands, Norway, Poland, Sweden, and USA. In early 90’s, this program was extended further to include all countries which have diplomatic relationship with Indonesia. Until to date, the number of countries participating in this program is more than 75 countries.

The main purpose of the DARMASISWA program is to promote and increase the interest in the language and culture of Indonesia among the youth of other countries. It has also been designed to provide stronger cultural links and understanding among participating countries.

Darmasiswa RI Program is conducted in 2 schemes, i.e :

  • Regular 1 (One) Year -Darmasiswa RI scholarship Program

Regular One Year program is a one-year scholarship program offered to foreign students from countries which have diplomatic relationship with Indonesia to study Bahasa Indonesia, Art (traditional music, traditional dance, craft) Culinary and Tourism in selected Indonesian Higher Education Institutions.

  • Regular 6 (Six) Months – Darmasiswa RI scholarship Program

Regular six-month program is a six-month scholarship program offered to foreign students from countries which have diplomatic relationship with Indonesia to study Bahasa Indonesia in selected Indonesian Higher Education Institutions.
The Scholarship Covers
Monthly allowance will be received by participant is Rp 1.500.000,00 (one million and five hundred thousand rupiah), and will be transferred to the University/college where they study.

The participant is advised to bring enough money in US dollar for unexpected additional expenses in Indonesia.
 Qualifications of Applicants

  1. Fill out application form
  2. Not more than 35 years old
  3. Completed secondary education or its equivalent
  4. Copy of academic transcript
  5. In good health as proved by Medical Certificate
  6. Passport size color photograph (5 pieces)
  7. Full-page copy of passport valid for at least 18 months from time of arrival in Indonesia
  8. Able to communicate in English and have a basic knowledge of the field they are applying for
  9. Procedure
    The applicant should apply through the following procedures:

    1. Indonesian Embassy/Consulate General in the country of residence.
    2. Visit the website at: www.darmasiswa.diknas.go.id, applicants should notify to the Indonesian Embassy/Consulate General before applying online.

    The documents of applicants who have been selected by the Indonesian Embassy will be submitted to the Bureau of Planning and International Cooperation, Ministry of National Education or the Directorate of Public Diplomacy, Ministry of Foreign Affairs, addressed:

    Head Bureau of Planning and International Cooperation
    Secretariat General
    Department of National Education

    Jalan Jenderal Sudirman,
    Senayan-Jakarta
    Telp./Fax. (62-21) 5724707, 5738181
    Website: http://darmasiswa.diknas.go.id
    and mail to : darmasiswa_pkln@diknas.go.id

    or
    Director of Public Diplomacy
    Ministry of Foreign Affairs
    Jalan Taman Pejambon No. 6
    Jakarta
    Telp. (62-21) 3813480,
    Fax. (62-21) 3858035

    Further inquiries:  

    Center for Language Services / Pusat Pelayanan Bahasa
    Universitas Nasional
    Pejaten Campus, Block 1, 3rd Floor
    Telp       : +62 21 7806700
    E-mail    :  bipa@unas.ac.id