Exam Questions for Computer Lab (2)

Posted in Diary on January 18th, 2012 by makhrus – Be the first to comment

Hi my students, hopefully you’re ready for the exam. Today, you need to answer all the questions based on the type you’ve been chosen by me. Remember, that you’re only allowed to work with Openoffice programs. Good Luck!

http://upload.ugm.ac.id/682soal_FKG.pdf.zip

Exam time is only 45 minutes.

Basics of Object Oriented Programming

Posted in Diary on December 28th, 2011 by makhrus – 16 Comments

Hello my students from Algorithm and Data Structures class, firstly, I need to sorry to you all because I could not keep my words on. We had a technical problem in kuantum.mipa.ugm.ac.id since in Friday, there was an accident which caused power failure in the server for about 5 days. Therefore, I upload all the materials in my blog (this is the ultimate solution which honestly, I don’t want to use…hehehe)

For our final exam, you need to read the chapters below. Any additional materials from other sources, I encourage you to read. The exam will be closed book type and the questions will be about making codes and explaining the descriptions of something we found in Java. I would like to give you the beginner level of questions since you may have this lesson again in other subject such as Object Oriented Programming.

Here are the materials :

  1. http://www.mhprofessional.com/getpage.php?c=computing_downloads.php&cat=112    : Find the book titled Java 2 : The Complete References (Fifth Edition). If you download it, you’ll get the source codes which are mentioned in the book. From that link, you can also find many sources from plenty of different kind books by McGraw Hill.
  2. http://upload.ugm.ac.id/547chapter_1_2.zip : for chapter 1 and 2.
  3. http://docs.oracle.com/javase/tutorial/java/javaOO/classes.html   : learn all of the things there.
  4. http://docs.oracle.com/javase/tutorial/java/IandI/index.html   : learn all, you’ll get interface, inheritance, and abstract class.
  5. http://docs.oracle.com/javase/tutorial/essential/exceptions/  : it’s all about java’s exception handler
  6. http://www.theparticle.com/javadata.html   : this is just the way for you to know data structures in Java. One question will come from data structures topic.

Key :

Learn all of the things from the 1st link (chapter 1-11 and chapter 15 only). If you don’t understand the codes inside them you can check the explanations from the 2-6 links. If you still dont get particular explanation, try to googling first before u ask me at faizal_makhrus#et#yahoo.com

Exam Question for Computer Lab

Posted in Diary on November 9th, 2011 by makhrus – 8 Comments

Hopefully, you are all ready with the exam now.  Before we begin with the questions, please read carefully the instructions. You have to do all the three questions directly to the computers without using any paper. This is a closed book exam and your time only 50 minutes.

Together with this, I would like to introduce to you 2 IT facilities which are supported by UGM for free and all the students in UGM can use them.

1. upload.ugm.ac.id, you can use for storing your file and share it to others.

2. blog.ugm.ac.id, you can build a blog under UGM domain.

This is the link to the questions :  http://upload.ugm.ac.id/327Soal_UTS_Praktikum_Komputer.txt

Qurbani To Fathom Our Faith

Posted in Diary on November 10th, 2010 by makhrus – 1 Comment

In Surah Al Kautsar, it is said that by doing sholah and qurbani, people have the right to Kautsar (heaven’s water). In this verse, qurbani is stood beside Sholah which is the highest worship in Islam. Therefore, qurbani is one of the deed which is highly suggested to do by Moeslems who have ability for that. If moeslem can only bear a goat to be sacrificed then it is okay and it can be intentionally cut for the whole their family (wife and children). Else, either they can buy a cow for their family or a cow to be shared with maximum 7 moeslems. It is not only cow or goat but also camel, buffalo, and other animal which is grouped in livestock.

About the practical things, still we find any errors done by the butcher or the people who doing qurbani (we call it sohibul qurban). For example, for the butcher, he sometime uses a short knife to cut the animal which tend to be lifted up during cutting. It is supposed to use a long knife rather than the short one because it is prohibited to lift up the knife during the cutting until all of the arteries in the neck have been cut off. Another error is that butcher kills the animal in front of other animal, this action is prohibited according to one of the hadits. Butcher sometimes forgets to say Bismillah before cutting or gives any torture to the animal which are prohibited.

For sohibul qurban, it is highly recommended not to cut their hair and nail starts from 1 Dzulhijah until the day they cut the animal. Sohibul qurban sometimes do errors like selling the parts of the animal directly and giving the money to poor people. They should be given to the poor people first and then if the poor people decide to sell it, then sohibul qurban can help them to sell and give the money to them (not to be sold directly). Sohibul qurban have the right of the parts of the animal only 1/3 and cannot be more than that. Sohibul qurban should buy a good animals which are not deformed. And the last thing is that sohibul qurban can give the meat to non moeslem also but they give the priority for moeslem first (it’s different with zakah which must be delivered to moeslem only.

Incredible India 2

Posted in Diary on November 4th, 2010 by makhrus – 2 Comments

It has been a year i lived in India. I started to experience with indian people’s culture. It breaks my previous notion about India which is according to me it is a great country conquering in many fields of science. It can be proved by seeing almost in every part of our live there will be indian names written there, says publications, magazines, news, books, or even movies. So what is actually happening here? Is that true that India works out in many sciences through its scientists?

This evidence, I always call it as the incredible part of India. It has 1.3 billion of citizens. In that great number, we can calculate mathematically, 20% of the total citizens equals to around 275 million (almost similar with Indonesia population). Now keep that result while we talk about the real situation here. India has a big deal with poverty, fatuity, indiscipline manner, etc. I also found here a few well-mannered peoples or you can say there are so many peoples with bad behavior (not an infamy, it’s just an stupid manner). So how could this country considered as scientist producer.

This hasn’t been proven yet but merely rough prediction, supposed those 20% of our previous mathematic calculation belong to well-mannered people or people with good behavior then those 20% can make up the rest of 80%. It can be said that we see India in 20% not the 80%. But if you want to see the rest, just come and visit this country. So, maybe 20% is to big therefore we reduce it to 10% or 7%, but if it is multiplied with the number, it will result the same number that is big number. And that number is enough to be spreaded in whole countries in the world. That’s why people know Indian people as smart people (which are the part of 20%).

Sometimes I speaks to my Indian friends, who according to me they are included in 20%, they said that they hate the 80% but they can’t run from facing them because they are exist and automatically become their part of live.

Incredible India (1)

Posted in Diary on March 21st, 2010 by makhrus – 2 Comments

10 months ago, I got the announcement about my scholarship from Indian Government to take my M.Sc Computer Science in Hyderabad. And in August 2009, I went to that city. It was not the only choice which I made at that time. Actually I chose 3 cities for my destination, those were Pune, Bangalore, and Hyderabad. Not only the cities but also the universities, which I finally got Osmania University which was not chosen by me.

As a foreigner who would go to another country, Indian Embassy cared about our situation by giving a guidance book which had its title “Incredible India”. That book was not much comprehensive but it could be used as basic guidance. There were a lot of explanation about Indian tourism spreaded around many states. Yet, it didn’t tell the truth. Why it wasn’t like that? As the title of the book “Incredible India”, it just explained the good side of India. In my sight, the book should explain the other side of India, so that people will know how the truly incredible India is. If you have watched “Slumdog Millionaire” film, that was just a few incredible-part of India. So it could be concluded that both the guidance book and that film were not enough to give you the information about the real India.

Here, I want to give the information about how incredible India is. We firstly talk about Indian people, who are called as Incredible people. These people can be known well for their habit, etiquette, and culture by observing in just a few days like i did when i arrived here. First “incredible” behavior of  Indian people (especially in hyderabad) is they like to pass urine in the side of road. They don’t feel ashame or guilt for doing such animal behavior even there are many women passing in that road. Second type is that people here are totally undisciplined. They are very reckless. This fact  can be proven by looking their behavior when they are in the road, no helmet, no side mirror, and no red light. Maybe it is the government’s program to reduce the population in this country. The other undisciplined manner is that Indian people can not keep their promise (as my experiences meeting so many Indian people, only 2-3 peoples keep their promises, the rests are liars). There are still so many Incredible type which I will expose here, but now it has already been late night, so i should go to sleep since i’ll get my exam tomorrow.

Even Muhammad Sallallahu’alaihi Wa Salam Had Ever Hesitated About Islam

Posted in Diary on June 29th, 2009 by makhrus – 1 Comment

Even Muhammad sallallahu’alaihi wa salam had ever hesitated about Islam.
I write this not because I hesitate about my religion but contrary, I do
believe that Islam is the perfect religion.

I read Yunus:94-109 and I was surprised by the verses stating that our
prophet had ever hesitated about Islam. Just because there were many peoples
who didn’t want to follow his path. And then why it was happened?

From 94th verse, we can get a precious lesson that human tends to disobey
the truth even our prophet. In the subsequent verse, there are explained
that only devout people who can hold Islam by perceiving the sign of Allah in
universe.

This is why Alqur’an is the biggest miracle from Allah, it always gives solutions
withstanding human’s instincts which tend to obey the rightness.
Our brain maybe can ask to ourself whether our religion is the right one.
Furthermore, it will make us hesitate. But Allah’s sign can be used
as the reinforcement for our believe.

Who will get the reinforcement? In the subsequent verse, there are stated that
only people agreeing with Allah’s will are able to get their believe completely without
any hesitation. So, do you still hesitate in Islam? I think I have ever done it before,
but Allah still safes me with Allah’s sign.

The Beauty of Bengkulu

Posted in Diary on May 16th, 2009 by makhrus – Be the first to comment

A few days ago i went to Bengkulu for three days. I went through Jakarta and used the connecting flight to Bengkulu. It was caused that Jogja had no flight route to Bengkulu directly so I took the Jogja-Jakarta and Jakarta-Bengkulu instead. The journey took 2 hours roughly because the connecting flight was in on time. After arrived in Fatmawati Soekarno Airport, Bengkulu, I rented a taxi car to take me on the hotel. At the time, I was surprised by the taxi car which is uncommon in my town. They used Kijang Innova which is categorized in luxurious car for a taxi. Maybe the people in Bengkulu is richer then in my town.

The distance from the airport to the hotel was not far as the distance from my home to Adi Sucipto Airport in Jogja. A long the way, I gave my view to the scenery located in alongside of the street. The situation was similar with Klaten in Jawa Tengah. In the town, there was a few of shops and the center of the town was not more than 2 km. For me, it was better than Jogja since there was less pollution than my beloved town. After I arrived to the hotel, I asked to the groom about the tourism near the hotel. He said that there were so many object near the hotel such as the great mosque in Bengkulu, ancient fortress, and the most beautiful was Pantai Panjang. All the mentioned tourism was located only 300m from the hotel.

SMS Gateway with Python-gammu v2

Posted in Computer Science on April 12th, 2009 by makhrus – Be the first to comment

I have ever discussed about developing a simple SMS gateway system using Gammu.
But it was only able to send message without ability in receiving message.
And now, I will present the complement of the last article. This is still about SMS gateway
using Gammu, yet I will use python-gammu instead of Gammu. Beside that I will use
wammu and gammu to help generating a configuration and testing the connection.

The first step is installing all the necessary programs such as Geany(Programming Environment),
Python Compiler, Python-gammu, Wammu, Gammu, MySQL, python-mysqldb
(for saving messages into database) and Cron (it’s default
installed by Linux). If you are using Ubuntu, all this programs can be found in Synaptic Package Manager.
None of those programs is difficult to install but if you are facing problems in installation,
you can find the solution from their official website.

The second is attempting to check the conection between the computer and the handphone.
To do this step, you firstly open wammu, and choose automatic detection choice. If this goes correctly,
than you will find a file named .gammurc in the home folder. If not so, then you can use Bash command which is
‘locate gammurc’ to track where the configuration file goes. Then, place the file to home folder!
Try to test your connection to your phone by executing ‘gammu –identify’ in console. There is much posibility
in unsuccessfully connection caused by the absence of the configuration file so you have to
consider it carefully. Here is some samples.

[gammu]
port=/dev/ttyACM0
connection=at19200
name=Sony Ericsson K610i

After those steps have gone well, you are ready to start to make the program.
This is for example

#!/usr/bin/env python

import gammu
import MySQLdb

def validitas_mesg(x): #function for checking message validity, if this return false then the message will not be processed
h = 0
mesg = “”
while h < 6:
mesg = mesg + x[h]
h = h + 1

if mesg == ‘Kosong’: #if first six letters compose “Kosong”
h = 6
mesg = x[h]
if mesg == ‘#’: #if sixth character is ‘#’
h = 17
mesg = x[h]
if mesg == ‘#’: #if seventieth character is ‘#’
h = 23
mesg = x[h]
if mesg == ‘#’: #if 23rd character is ‘#’
return True
else:
return False
else:
return False
else:
return False
else:
return False

def ambil_tgl(x): //function for receiving date
i = 7
tgl =”"
while i < 17:
tgl = tgl + x[i]
i = i + 1
return tgl

def ambil_jam(x): //function for receiving hour
j = 18
jam = “”
while j < 23:
jam = jam + x[j]
j = j + 1
return jam

def ambil_ruang(x): //function for receiving compartment information
k = 24
ruang = “”
while k < 28:
ruang = ruang + x[k]
k = k + 1
return ruang

sm = gammu.StateMachine()
sm.ReadConfig()
sm.Init()

status = sm.GetSMSStatus()

conn = MySQLdb.connect (host = “localhost”,
user = “root”,
passwd = “root”,
db = “smsbolos”winking
cursor = conn.cursor()

remain = status['SIMUsed'] + status['PhoneUsed']

start = True

while remain > 0:
if start:
sms = sm.GetNextSMS(Start = True, Folder = 0)
start = False
else:
sms = sm.GetNextSMS(Location = sms[0]['Location'], Folder = 0)
remain = remain – len(sms)

for m in sms:
if str(m['State']) == “UnRead”:

if validitas_mesg(m['Text']):
tgl = “”
jam = “”
dt = m['Text']
tgl = ambil_tgl(dt)
jam = ambil_jam(dt)
ruang = ambil_ruang(dt)

cursor.execute(“INSERT INTO msg VALUES (now(), \”%s\”, \”%s\”, \”%s\”, \”%s\”winking” % (m['Number'],tgl, jam, ruang))
else:
x = 1;
maks = len(m['Number'])
no = ”
while x < maks:
print m['Number'][x]
no = no + m['Number'][x]
x = x + 1
print no
message = {‘Text’: ‘Kosong#yyyy-mm-dd#hh:mm#U205′, ‘SMSC’: {‘Location’: 1}, ‘Number’: no}
sm.SendSMS(message)
print “null”

The first 3 lines indicate that the program is using python compiler and including the MySQLdb and Gammu
library.

#!/usr/bin/env python

import gammu
import MySQLdb

The next following code are functions which are explained by the comments on each.
Gammu starts used in the following codes which mean creating gammu object, reading the Gammu’s config file,
and starting Gammu communication to the phone.

sm = gammu.StateMachine()
sm.ReadConfig()
sm.Init()

Gammu will give the information about SMS status by calling this command.

status = sm.GetSMSStatus()

If you want to know what are the results of GetSMSStatus function, you can try to print the status variable.
Connection to MySQL is conducted by this code.

conn = MySQLdb.connect (host = “localhost”,
user = “root”,
passwd = “root”,
db = “smsbolos”winking
cursor = conn.cursor()

saved SMS in the inbox will be read when program execute this code

sms = sm.GetNextSMS(Location = sms[0]['Location'], Folder = 0)

the code showed above only reads our message from inbox folder. sms is an array which one of the element
is indexed with ‘State’. This element consists of UnRead or Read value.

if str(m['State']) == “UnRead”:

the above code is used to recognize while the message fetched has Read status or UnRead.

This is all my explanation regarding to the program. If you want to know it more, you can
try to print all the variables until you know its values precisely.

Memtest in Linux Mint/Ubuntu

Posted in Diary on April 7th, 2009 by makhrus – Be the first to comment

I bought a new memory for my laptop two days ago. At first, there was no problem occured
but when I tried to play videos, there was a lot of system crashed caused by unsuccessfully access to sectors.
I was wondering about the main factor while it happened. Directly, I gave my attention to my new memory. In
the other day, I told my friend about my current problem and asked for solutions. Then he told me to use
Memtest in Ubuntu.

It has been 1 years I use my Linux, but I have never paid attention with this facility. This facility is a
software for testing our memory whether it consists any error or not. It is easy to use, only accessing Grub
and then select the Linux Memtest choice. After that, Memtest will try to access each sector in the memory
with several methods. If it is facing an error sector there will be a message displayed with red highlight.
This condition will approve that our memory has malformed sector. Finally, we can replace our memory in
the shop.

From the last test, I got 41 error sectors. Those were a big amount whereas 1 error sector will cause a big
problem. Now, I have replaced my memory. So far, there is nothing happen seriously.