Uncategorized

pray for the nation (the true worshippers)

I pray for the people

I pray for the nation

For us to bow before You

And humble ourselves and pray

You hear our prayer from Heaven.

 

You heal our land today

You turn our hearts From all the wicked ways

I kneel right now before You

I lift my hands towards the heavens

I pray yes I pray for the mercy and grace over us


You’re seated on the highest throne

You’re lifted up above all things

Exalted and adored.

I worship you in awe.

Be glorified and magnified


There’s now no more condemnation.

Over this land no more.

There’s now no more no more curses

Over our lives over our family over our church Today

 

We humble our selves and pray

( You hear our prayer from heaven )

We turn from our wicked ways

( You heal our land today )

Advertisements
Uncategorized

Tugas Algoritma – Strukdat (SORTING) kelas Kamis

Tugas Praktikum ASD adalah tentang bubble Sort. Perhatikan dan jalankan source code Sorting- Algoritma Bubble berikut ini:

 

#include<stdio.h>
#include<conio.h>

void main()
{
	int i,temp;
	int data [] = {22,10,15,3,8,2};

	printf("Data SEBELUM di urutkan :\n");
	for(i=0;i<6;i++)
	{
		printf("%d\t",data[i]);
	}
	printf("\n\n");
	printf("Proses Buble :\n");

	for(i=0; i<6-1 ;i++)
	{
		for(int j=0; j<6-1-i ;j++)
		{
			if(data[j]>data[j+1])
			{
				temp = data[j];
				data[j] = data[j+1];
				data[j+1] = temp;
			}
		}
		for(int k=0; k<6 ;k++)
		{
			printf("%d\t",data[k]);
		}
		printf("\n");
	}
	printf("\n");
	printf("Data SETELAH di urutkan :\n");
	for(i=0;i<6;i++)
	{
		printf("%d\t",data[i]);
	}
	getch();
}

 

Tugas temanku semua adalah mengubah Source Code di atas, sehingga mampu membuat INPUTAN untuk di SORTING. Jadi Buat Inputan untuk kasus di atas!

 

Kumpulkan Pada saat Praktikum Minggu depan di kelas. HARD COPY Dengan PRINT SCREEN

Oke!

 

Salam Sayang,

Semangat, Aku dan Kamu Bisa!

Uncategorized

Mobile Computing (Kelas Kamis) – Simulasi REG(spasi)XXX

SMS atau Short Message Service merupakan salah satu fitur dalam dunia Mobile yang sangat primer, artinya sebagian besar menggunakan fitur ini dalam melaksanakan proses komunikasi.

 

 

Berikut adalah Source code “di balik layar” SMS:

 

UNTUK SERVER:


import javax.microedition.io.Connector;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.wireless.messaging.Message;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;

public class terimaSMS extends MIDlet implements Runnable, CommandListener {

    private TextBox tb;
    private String text = "Menunggu pesan...";
    private Command okComand;

    public terimaSMS() {
        tb = new TextBox("Hello MIDlet", text, 150, 0);
    }

    protected void destroyApp(boolean arg0) {
        notifyDestroyed();
    }

    protected void pauseApp() {
    }

    protected void startApp() {
        try {
            Display.getDisplay(this).setCurrent(tb);
            new Thread(this).start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void addConfirmation(String msg) {
        tb = new TextBox("SMS MIDlet", text, 150, 0);
        tb.setString(msg);
        okComand = new Command("OK", Command.OK, 1);
        tb.addCommand(okComand);
        tb.setCommandListener(this);
        Display.getDisplay(this).setCurrent(tb);
    }

    public void run() {
        try {
            MessageConnection rconn = (MessageConnection) Connector.open("sms://:1234");
            while (true) {
                Message msg = rconn.receive();
                if (msg instanceof TextMessage) {
                    TextMessage tmsg = (TextMessage) msg;
                    String msgOut = tmsg.getPayloadText();
                    addConfirmation(msgOut);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void commandAction(Command arg0, Displayable arg1) {
    }
}

UNTUK CLIENT


import javax.microedition.io.Connector;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;

public class kirimSMS extends MIDlet implements CommandListener, Runnable {

    private Form sendMessageForm;
    private TextField number, msg;
    private Command cmdOK, cmdExit;
    private String telpNum, isiPesan = "";

    public kirimSMS() {
        cmdExit = new Command("Back", Command.EXIT, 2);
        cmdOK = new Command("Send", Command.SCREEN, 2);
        sendMessageForm = new Form("Send Message");
        msg = new TextField("Message:", null, 50, TextField.ANY);
        number = new TextField("Telepon:", "+5550000", 15, TextField.PHONENUMBER);

        sendMessageForm.append(number);
        sendMessageForm.append(msg);
        sendMessageForm.addCommand(cmdOK);
        sendMessageForm.addCommand(cmdExit);
        sendMessageForm.setCommandListener(this);
    }

    protected void destroyApp(boolean arg0) {
        notifyDestroyed();
    }

    protected void pauseApp() {
    }

    protected void startApp() throws MIDletStateChangeException {
        Display.getDisplay(this).setCurrent(sendMessageForm);
    }

    public void commandAction(Command c, Displayable arg1) {
        if (c == cmdOK) {
            telpNum = number.getString();
            isiPesan = msg.getString();
            new Thread(this).start();
            number.setString("");
            msg.setString("");
            Display.getDisplay(this).setCurrent(sendMessageForm);
        } else if (c == cmdExit) {
            destroyApp(true);
        }
    }

    public void run() {
        try {
            String nomorTelp = "sms://" + telpNum + ":1234";
            MessageConnection conn = (MessageConnection) Connector.open(nomorTelp);
            TextMessage msg = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
            msg.setPayloadText(isiPesan);
            conn.send(msg);
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

Tugasnya adalah membuat simulasi SMS Premium  (Ketik REG<spasi> bla-bla-bla) Terserah teman2, Jadi di sini nati akan ada 2 device satu bertindak sebagai client (yang mengirim SMS) satu sebagai Server (Yang menerima SMS).

Setelah Server menerima SMS maka SECARA OTOMATIS akan mereply (membalas SMS) tanpa mengetik terlebih dahulu.

Contoh:

Client (Ketik) : REG PRIMBON
Server (Reply) : Selamat Datang di dunia Primbon, anda akan mendapatkan SMS tentang hal-hal gaib di sekitar Anda
Client (Ketik): rEg PriMBon
Server (Reply) : Selamat Datang di dunia Primbon, anda akan mendapatkan SMS tentang hal-hal gaib di sekitar Anda
Client (Ketik) : r39 pR1mBoOoNnN
Server (Reply) : Maaf SMS anda Terlalu Alay Sehingga Server tidak dapat membaca

Untuk Interfacenya tidak penting, yang penting teknik programmingnya:

Kemudian Setelah Dikirim:

Terakhir Server akan membaca String yang diterima kemudian Akan Automaticaly Reply

KUMPULKAN:

  • Seperti biasa agar lebih romantis, paling lambat (Malem Minggu besok)
  • Jam Malam (Biar sekalian Ronda Malam)
  • kepada yth: yere.getlife@yahoo.com
  • Subject: BANG_ADASMS_NIM

 

Salam Sayang!!!

Semangat, aku dan kamu bisa

Uncategorized

Scalable Vector Graphics in J2ME

SVG merupakan salah satu implementasi Low Level dalam membuat tampilan di jendela mobile phone. Berikut adalah contoh animasi bola memantul dengan menggunakan SVG J2ME

 

Untuk source code-nya adalah sebagai berikut:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Enumeration;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Graphics;
import javax.microedition.m2g.SVGImage;
import javax.microedition.m2g.ScalableGraphics;
import javax.microedition.midlet.*;
import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGElement;
import org.w3c.dom.svg.SVGRGBColor;
import org.w3c.dom.svg.SVGSVGElement;

/**
 * @author LADUK
 */
public class contoh extends MIDlet implements CommandListener{

    kanfas kanfas;
    Form form;
    Command tambah, exit, tambah2;
    Vector v;
    Enumeration enums;

    public contoh()
    {
        this.form = new Form("form");
        this.v = new Vector();
        this.kanfas = new kanfas();
        this.tambah = new Command("tambah", Command.OK, 0);
        this.tambah2 = new Command("tambah", Command.OK, 0);
        this.exit = new Command("exit", Command.EXIT, 0);
        this.kanfas.addCommand(exit);
        this.kanfas.addCommand(tambah);
        this.kanfas.setCommandListener(this);
        this.form.addCommand(tambah2);
        this.form.setCommandListener(this);
    }

    public void startApp() {
        Display.getDisplay(this).setCurrent(form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable d) {
        if(c==exit)
        {
            notifyDestroyed();
            destroyApp(true);
        }
        if(c==tambah)
        {
            new tret().start();
        }
        if(c==tambah2)
        {
            Display.getDisplay(this).setCurrent(kanfas);
            new tret().start();
        }
    }

    public class kanfas extends Canvas
    {

        SVGImage svgImage = SVGImage.createEmptyImage(null);
        Document doc = svgImage.getDocument();
        SVGSVGElement svg = (SVGSVGElement) doc.getDocumentElement();
        ScalableGraphics sg = ScalableGraphics.createInstance();

        public kanfas(){}

        protected void paint(Graphics g) {
            g.setColor(255, 255, 255);
            g.fillRect(0, 0, getWidth(), getHeight());
            sg.bindTarget(g);
            svgImage.setViewportWidth(getWidth());
            svgImage.setViewportHeight(getHeight());
            sg.render(0, 0, svgImage);
            sg.releaseTarget();
        }
    }

    public class tret extends Thread
    {

        SVGElement elm;
        SVGRGBColor warna;
        Timer t;
        TimerTask ts;
        Random r = new Random();
        int i = (int) (r.nextFloat() * 12);

        public tret()
        {
            this.elm = (SVGElement)kanfas.doc.createElementNS("", "rect");
            switch(i)
            {
                case 0:
                case 6:
                    this.warna = kanfas.svg.createSVGRGBColor(255,0,0);
                    break;
                case 1:
                case 7:
                    this.warna = kanfas.svg.createSVGRGBColor(0,255,0);
                    break;
                case 2:
                case 8:
                    this.warna = kanfas.svg.createSVGRGBColor(0,0,255);
                    break;
                case 3:
                case 9:
                    this.warna = kanfas.svg.createSVGRGBColor(255,255,0);
                    break;
                case 4:
                case 10:
                    this.warna = kanfas.svg.createSVGRGBColor(255,0,255);
                    break;
                case 5:
                case 11:
                    this.warna = kanfas.svg.createSVGRGBColor(0,255,255);
                    break;
            }

            this.elm.setRGBColorTrait("fill", warna);
            this.elm.setFloatTrait("width", 30);
            this.elm.setFloatTrait("height", 30);
            int rt = (int) this.elm.getFloatTrait("height");
            System.out.println("height : "+String.valueOf(rt));
            kanfas.svg.appendChild(this.elm);
            v.addElement(this.elm);
            t = new Timer();
            ts = new task(this.elm);

        }

        public void run()
        {
            this.t.schedule(ts, 0, 30);
        }

    }

    public class task extends TimerTask
    {
        SVGElement e, elm;
        int x, y, rx = 0, ry = 0, xx, yy, counter;
        boolean ab = true;
        Random r = new Random();

        public task(SVGElement e)
        {
            this.e = e;
            counter = 0;

            this.x = kanfas.getWidth()/2;
            this.y = kanfas.getHeight()/2;
            this.xx = (this.r.nextInt() % 3);
            if (this.xx == 0)  this.xx = 1;
            this.yy = (this.r.nextInt() % 3);
            if (this.yy == 0)  this.yy = 1;
        }

        public void run()
        {

                this.e.setFloatTrait("x", x);
                this.e.setFloatTrait("y", y);
                this.e.setFloatTrait("rx", rx);
                this.e.setFloatTrait("ry", ry);

                if(x + 30 + xx > kanfas.getWidth()||x - 30 + xx < -25)
                {
                    xx = -xx;
                }
                if(y + 30  + yy > kanfas.getWidth() + 45||y - 30 + yy < -25)
                {
                    yy = -yy;
                }

                x+=xx;
                y+=yy;
                if(ab)
                {
                    if(rx<15&&ry<15)
                    {
                        rx++;
                        ry++;
                    }
                    else
                    {
                        ab = false;
                    }

                }
                else
                {
                    if(rx>0&&ry>0)
                    {
                        rx--;
                        ry--;
                    }
                    else
                    {
                        ab = true;
                    }
                }

                kanfas.repaint();
        }
    }

}

Lha Tugasnya temen2 adalah:

  • Modifikasi source code di atas sedemikan rupa sehingga
  • Terapkan hukum pemantulan pada Fisika, untuk bola yang saling bersentuhan/bersenggolan/bertabrakan/berpelukan/bersalam-salaman/berciuman/ber…gitu’an… dan ber-ber yang lain
  • Sekali klik Tambah akan menghasilkan 2 anak (2 bola maksud beta)
  • Kumpulkan saat kuliah
  • Tetaplah Semangat Kawan!

Salam Sayang,

Aku dan Kamu Bisa!!! (bisa gila wkwkwk)
Uncategorized

Tugas 4 PAM1 – Multiclient-Emoticon Bluetooth Chat

‘ncen marai emosi kowe ki mas Wisnu!!!!
senengane nge’i tugas ‘ik ya… 😦 😦

Anda Punya Masalah Dengan Berat Badan (nggak nyindir Tiu* + Dew* kok 😛 :P)???

Anda Ingin Langsing tanpa Sedot lemak dan Fitness???

Anda Punya bakat Melek malam alias insomnia???

Anda Ingin menyalurkan bakat anda ini???

yak… Anda Tepat jika datang ke sini….

dijamin anda tak akan pernah menyesal

NO!!!

Klik Di Sini, Nggak Nyesel Dehhh..

 

Syarat-Syarat (KELAS RABU):

  • Bikinnya Kelompok kayak kemaren… (pas bikin peta)
  • Kumpulin besok SABTU, 23 Oktober 2010 JAM MALAM (Seperti Biasa… biar ga dilihat orang 😀 )
  • Ke yere.getlife@yahoo.com
  • SUBJECT dan FILE : UNTUBIRU_NIM1_NIM2
  • Tugas Sebagai Nilai Asisten Dan Nilai Dosen

Kalo agan-agan nggak ngerjain +nggak  ngumpulin berarti agan

maho DETECTED

 

mohon cendolnya gan….. Jangan di kasih Bata

 

 

Mari Kita Berbuat Untuk Negeri Tercinta Ini!!!

PET[m]UNJ[y]UK dari A’ak Marsel:

Server:


import java.io.InputStream;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.UUID;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import javax.microedition.io.StreamConnectionNotifier;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.*;
/**
 * @author hardjodiningrat
 */
public class Server extends MIDlet implements CommandListener, Runnable {
    Form formUtama;
    Command start;
    String url = "";
    UUID REFCOMM_UUID = new UUID(5000);
    LocalDevice perangkat;
    StreamConnectionNotifier notif;
    StreamConnection con;
    InputStream is;
    public Server() {
        this.url = "btspp://localhost:" + this.REFCOMM_UUID + ";name=rfcommtest;authorize=true";
        this.formUtama = new Form("Form Server");
        this.start = new Command("Start", Command.OK, 0);
        this.formUtama.append("Form Server");
        this.formUtama.addCommand(start);
        this.formUtama.setCommandListener(this);
        Display.getDisplay(this).setCurrent(formUtama);
    }
    public void startApp() {
    }
    public void pauseApp() {
    }
    public void destroyApp(boolean unconditional) {
    }
    public void commandAction(Command c, Displayable d) {
        if (c == this.start) {
            new Thread(this).start();
        }
    }
    public void setDiscoveredOn() throws Exception {
        this.perangkat = LocalDevice.getLocalDevice();
        this.perangkat.setDiscoverable(DiscoveryAgent.GIAC);
    }
    public void openConnection() throws Exception {
        this.notif = (StreamConnectionNotifier) Connector.open(this.url);
        System.out.println("URL: " + this.url);
        this.formUtama.append("\nServer started. Waiting for client...");
        this.con = this.notif.acceptAndOpen();
        this.is = this.con.openInputStream();
        int c = 0;
        String data = "";
        while ((c = is.read()) != -1){
            if((char)c == '|'){
                this.formUtama.append(data);
                data = "";
            }else
                data += (char) c;
        }
    }
    public void run() {
        try {
            this.setDiscoveredOn();
            this.openConnection();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

Client:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.ServiceRecord;
import javax.bluetooth.UUID;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.*;
/**
 * @author hardjodiningrat
 */
public class Client extends MIDlet implements CommandListener, DiscoveryListener{
    List listUtama;
    Command com;
    LocalDevice perangkat;
    DiscoveryAgent agent;
    DiscoveryAgent serv;
    Vector listPerangkat = new Vector();
    StreamConnection con;
    OutputStream os;
    String url = "";
    boolean ada = false;
    public Client() {
        this.listUtama = new List("List Perangkat", Choice.IMPLICIT);
        this.com = new Command("Kirim", Command.OK, 0);
        this.listUtama.setCommandListener(this);
        Display.getDisplay(this).setCurrent(listUtama);
        try {
            this.cariPerangkat();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void startApp() {
    }
    public void pauseApp() {
    }
    public void destroyApp(boolean unconditional) {
    }
    public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
        try {
            this.listPerangkat.addElement(btDevice);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    public void servicesDiscovered(int transID, ServiceRecord[] records) {
        for (int i = 0; i < records.length; i++) {
            this.url = records[i].getConnectionURL(ServiceRecord.AUTHENTICATE_ENCRYPT, false);
            System.out.println("URL: " + this.url);
            if(this.url.startsWith("btspp")){
                break;
            }
        }
    }
    public void serviceSearchCompleted(int transID, int respCode) {
        try {
            if(!this.ada){
                if(this.con != null) this.con.close();
                this.con = (StreamConnection) Connector.open(this.url);
                this.os = this.con.openOutputStream();
                this.ada = true;
                this.listUtama.addCommand(com);
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    public void inquiryCompleted(int discType) {
        try {
            RemoteDevice dev = null;
            for (int i = 0; i < this.listPerangkat.size(); i++) {
                dev = (RemoteDevice)this.listPerangkat.elementAt(i);
                this.listUtama.append(dev.getFriendlyName(true), null);
            }
        } catch (Exception e) {
        }
    }
    public void commandAction(Command c, Displayable d) {
        if(c == List.SELECT_COMMAND && !ada){
            try {
                RemoteDevice dev = (RemoteDevice) this.listPerangkat.elementAt(this.listUtama.getSelectedIndex());
                int searchId = this.agent.searchServices(null, new UUID[]{new UUID(5000)}, dev, this);
            } catch (BluetoothStateException ex) {
                ex.printStackTrace();
            }
        }
        if(c == this.com){
            if(this.ada){
                try {
                    this.os.write("yere busuk....|".getBytes());
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }
        }
    }
    public void cariPerangkat() throws Exception{
        this.perangkat = LocalDevice.getLocalDevice();
        this.agent = this.perangkat.getDiscoveryAgent();
        this.agent.startInquiry(DiscoveryAgent.GIAC, this);
    }
}

Salam Sayang,

Happy Source Code