3.80.129.195 What is 9M2AR
Visit To Kuching
PROJECT DONE
THE GRAND TRADITION
WHY ?

Astralian Visit
Taj Mahal Visit

New Zealand Trip

Vietnam Visit

Visit to USA

Kampuchea Visit
MySQL Slow Learning
Trip to Jakarta

 

MySQL Slow Learning

I got a very bad habit. I don't study anything in detail and always incomplete. Because MySQL has a long literature to read, I only chose areas which I want to apply. I create file and apply it, entering data in text form. When I want to use finger print template I create the template field. What I have not been doing is putting images in the file. I thought it will be heavy and could slow down the computer. So for so many years there is no image in MySQL databases.

Recently I developed a software which will click pictures and save them. It is for security system for the attendance software. Then I start to think that if the system is in remote location people can cheat. Some teachers said that they are willing to buy the hardware as long as they don't have to go to the office to register. They want to place in their rooms. I need to send the picture to the server when they do the registration remotely. MySQL must be able to post pictures as the computer click the image.

So I looked around for the field setup, found one and tested the codes. It worked very well and I did several modifications like putting pictures in the file corresponding to the teacher concerned, adding and deleting data. I did not realize that it was too simple.

The picture below is the rough experiment described above.

I opened MySQL database, add 3 fields inclusive of the image name, it's size and the image itself. I used MySQL tool to do it. Then I open up the folder containing the pictures and transfer all the pictures to MySQL database file. The coding for transferring the clicked image while registering is not done yet.

The codes are sluggish. You can always improve it to shortened where there may be repetition.

Private Sub Add_Click()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection

conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=127.0.0.1;" _
& "DATABASE=datangguru;" _
& "UID=root;" _
& "PWD=9m2ar;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

conn.CursorLocation = adUseClient
conn.Open
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim mystream As ADODB.Stream
Set mystream = New ADODB.Stream
mystream.Type = adTypeBinary
rs.Open "SELECT * FROM datang3 where angka=1", conn, adOpenStatic, adLockOptimistic
rs.AddNew
mystream.Open
mystream.LoadFromFile "c:\smtjs\rakan\" & File1 & ""
rs!file_name = File1
rs!file_size = mystream.Size
rs!gambar = mystream.Read
rs.Update
mystream.Close
rs.Close
conn.Close
Adodc1.Refresh


End Sub

Private Sub Command1_Click()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection

conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=127.0.0.1;" _
& "DATABASE=datangguru;" _
& "UID=root;" _
& "PWD=9m2ar;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

conn.CursorLocation = adUseClient
conn.Open
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim mystream As ADODB.Stream
Set mystream = New ADODB.Stream
mystream.Type = adTypeBinary
rs.Open "SELECT * FROM datang3 where angka=" & Text1 & "", conn, adOpenStatic, adLockOptimistic
'rs.AddNew
mystream.Open
mystream.LoadFromFile "c:\smtjs\rakan\" & File1 & ""
rs!file_name = File1
rs!file_size = mystream.Size
rs!gambar = mystream.Read
rs.Update
mystream.Close
rs.Close
conn.Close
Adodc1.Refresh
End Sub

Private Sub Command2_Click()
On Error Resume Next
'CREATE CONNECTION OBJECT AND ASSIGN CONNECTION STRING
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection

conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=127.0.0.1;" _
& "DATABASE=datangguru;" _
& "UID=root;" _
& "PWD=9m2ar;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

conn.CursorLocation = adUseClient
conn.Open

'CREATE TABLE FOR SAMPLE CODE - I don' use this part because I used MySQL tool to do it
'conn.Execute "CREATE TABLE gambar2(" _
' & "file_id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY," _
' & "file_name VARCHAR(64) NOT NULL," _
' & "file_size MEDIUMINT UNSIGNED NOT NULL," _
' & "file MEDIUMBLOB NOT NULL)"

'OPEN RECORDSET FOR WRITING
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

Dim mystream As ADODB.Stream
Set mystream = New ADODB.Stream

mystream.Type = adTypeBinary

rs.Open "SELECT * FROM datang3 WHERE angka=" & Text1 & "", conn, adOpenStatic, adLockOptimistic

'rs.AddNew

mystream.Open
Image1.Stretch = False
mystream.Write rs!gambar
mystream.SaveToFile "c:\" + Text2 + "", adSaveCreateOverWrite
Image1 = LoadPicture("c:\" + Text2 + "")
mystream.Close
Image1.Width = Image1.Width / 1.5
Image1.Height = Image1.Height / 1.5
Image1.Stretch = True
rs.Close
conn.Close

End Sub


Private Sub Command3_Click()
End
End Sub

Private Sub File1_Click()
Adodc1.RecordSource = "select * from datang3 where kp like '" + Left(File1, Len(File1) - 4) + "'"
Adodc1.Refresh
End Sub

Private Sub Form_Activate()
File1 = "c:\smtjs\rakan"
Adodc1.ConnectionString = "driver={mysql odbc 3.51 driver};port=3306;server=127.0.0.1;UID=root;pwd=9m2ar;database=datangguru;option=" & 1 + 2 + 8 + 32 + 2048 + 16384
Adodc1.RecordSource = "select * from datang3"
Adodc1.Refresh
End Sub

 

People out there are excellent human beings, giving away God's knowledge to share with others. I wish God will place them in heaven too except for those who plunder the national and public coffers and stole the land belonging to the people by giving them a very very very very very small token, namely the greedy developers and the politicians.

PROJECT DONE

At last this 63 year old laser mouth ham has completed the smart card project. I only wrote the software and program the cards which contain 31 data of each of he teachers. All other things including the housing for the reader and the camera, plus the design and laminating the surface of the cards are made by a teacher named Abdul Jalil. Jalil made a beautiful and good job of the project. There is another teacher who takes care of the network and the computer system in the whole school. His name is Ong Ai Jit. I would call Ong a computer expert, who also contribute much on the hard ware and the networking side.

Besides the staffs the students will be using the smart cards as their name tags and will have to the cards in the library, hostels, media room usage and other records. I have completed most of the software.

I told the school that I need to train some of the teachers to be programmers as well because I am going to die at the age of 65. Now I am almost 63 and have 2 more years to go. They laughed when I told them so. As you know I have been writing many vicious articles on politics. The government could either put me in jail for two more years or could think deep about what I have been saying and remedy the errors.

More advance project will be coming later. My only problem is that I did not around to market my product to make some money. Because of the fiscal problem I had to struggle hard to venture into new technology. I just hope for the luck.

Below are some of the pictures taken. There are teachers who prefer to use thumb print. A few would not take out their cards out of their bags and purse.

 

 

A VISIT TO KUCHING

After 2 visits to Kuching, I thought that was my last visit. My first visit was a very long time ago with MAS Golden holidays. I just remember the hotel and the cheap price we paid. May be it was before the 80's. Sarawak was not so developed then as it is today. I also do not remember the date of the second visit but I am sure it was after 1983. We visited my friend, Hamka, who were with us while in Bloomington Indiana.

Though from time to time I and my wife talk about Hamka and his wife, it did nit cross my mind that I would be making another one. Occasionally my wife told me about what he saw in the TV. She saw the boat cruise along the Sarawak River and told me it would be nice if she can ride it.

As I have been talking much about my Dayton's Visit on the coming May, she was getting worried because I told her that I would go alone if nobody come with me. Then quietly she rang up Hamka. Unknowing to us Hamka was suffering from stroke and jus recovered. His wife was severely ill. So I decided to visit my friend and his wife. As usual we have to look at all the chores that lie ahead; about our medical check up, attending the kenduris, my work at my old school. And of course the availability of the plane ticket.

I went to MAS office at the air-port and made an inquiry about MAS Golden Holidays to Sarawak. Not too easy, we need to contact Kuala Lumpur. I asked for any other flight. "What date ? You must tell me the date," the MAS man said. "Any date after Cinese New Year." He checked and said the available date was on the 23rd. When I Oked him he asked me for the return date. "Any."
                                                                   "How about the 26th ?"
I agreed. The cost was RM642 from Alor Setar to Kuching for one person and return.

In the meantime I was surfed the internet looking for the hotel. I decided to stay in the Holiday Inn, which has acquired a new name, Magretta. I send my e-mail to the Holiday Inn. No reply.

On the 23rd we flew from Alor Setar to Kuala Lumpur. I went to the airport with my 13 year old Kanchil. The inside part of the roof collapse. I used a tape to temporarily fix it. When I placed the wheel chair at the back seat, the top of the chair supported it. I was able to see the rear end. Since the air condition  was not working I opened all the 4 doors. Immediately after the morning prayer we shot out of the house.

At Kuala Lumpur I saw my wife was talking to a pilot whom I did not recognized. later she told me he was married to my neighbors daughter. When boarding the plane my wife was asked to sit at the first class section. I continued to go to the economy class but the air hostess called me back. So I was in the First Class.  I whispered to my wife of the food we were going to have. A kampong people like us did not know to behave at such a seat. The First Class food was fantastic. We thanked God.

On the plane I talked about the possibility of staying at Holiday Inn. My wife said 'Riverside Hotel'. She continued to repeat 'Riverside'. When we arrived we went to the booking counter. I mentioned Holiday Inn. She mentioned Riverside. I paid RM810 for the 3 nights at the Riverside. We paid RM26 from Kuching Air-port to the hotel. The air-port is huge compared to Alor Setar and I saw expansion work was going on. Even Kuching itself is developing very rapidly.

I asked the taxi driver, a Chinese lady, about 'Sugar Bun'. She said the restaurant is still there but the taste is not as good as before. We gathered quite enough information about taxi fares to several locations. When finally we arrived at the hotel, I did not find it was the same as I stayed before. We checked in. My wife argued it was a water front hotel. I said no. I left her in the room and went to do a survey of the nearby area. I have to cross the road to go to the Water Front. When I came back I told her, the mistake she made.

She was heated up and said she wanted to return to Malaysia and she rang up the hotel administration saying she wanted to change the hotel. Finally the man at the air port from whom we made the booking rang me up saying that we could move to the Magaretta Hotel. After seeing my wife was cool a little I asked her to get prepared to go Hamka's House.

At about 6 pm, we took a taxi to Hamka's house. My wife gave the address to the taxi driver. We were charged RM12, the same price the lady driver had informed us previously. Hamka was surprise to see me. And was more surprise to see my wife using a walker. He and his wife were very happy to see us and we chat about the sickness. Hamka looked different from before. His body a little slimmer and face a little pale. His wife was much slimmer as compared to before. I guess she has lost more than half of her former weight.

Hamka was suffering from stoke and the wife from multiple kind of illnesses, from normal fever to skin affection and swollen neck. She could not walk for several days and had gone to see all sort of traditional doctors. Whatever I have to remind Hamka not to forget the aspirin and those other Western medicine which could prevent blood clot. I have been consuming aspirin for quite some time too.

Hamka sent us back to the hotel after we went to a sea food restaurant. We insisted that he should not have sent us there. He asked me what was the plan for the next day. I said there is a hotel tour which we might follow, among the package is to see the Orang Utan. He said he would come and fetch us at 2.30 pm.

On the 24th. morning it was drizzling. After breakfast i carried two bags with me and crossed the road to Grand Magaretta checking whether there was any booking made under my name. It was. I was given the key to my room. It was room 941. I went up and put both of my bags there. I returned to the Riverside and took the largest luggage and finally I pushed my wife.

A little later I pushed my wife to the lobby and waited for the rain to stop. Then I took her to the Water Front, looking at the river and the people. The Sarawakians are kind people. Where ever young and old wished us and talked to us, asking us where we came from, telling us where to buy cheap food. When I reached the said boat cruise flat form, she read the information about the cruise. The fee is RM60 per person . There trip would be from 5.30 - 7 pm. But going up the boat was almost impossible for the wheel chair. She decided not to go.

I pushed her back and arrived at the hotel at about 2 pm. I took a short nap because the pushing job was quite tough. She too went horizontal. At 2.20 we got ready and waited for Hamka. Hamka too us around to several places. "We come to see sick people, and the sick people took us around. This is not right..."We kept on telling Hamka and his wife. We told them not to take us anywhere on the 25th. We had our own plan.

My wife was happy sleeping and even refused breakfast. I went down alone and tasted the delicious nasi lemak and the roti canai and hash brown. After the breakfast I went to several supermarket around looking for ways which I could take her along. Then I crossed the river. The boat's charge is fixed by the government 40 cents one way during the day time and RM1.00 at night. On the other side food stalls still closed. They opened in the evening and at night. I walked about to look at houses and the people. Before I returned I bought Mee Mamak and Nasi Goreng which cost me RM4.00 each.

My wife chose the fried rice and I took the Mee. The taste of the Mee Mamak was fantastic. My wife said the Fried Rice was tasty and delicious. True as what people had told us, food are cheaper and taste better on the side of the river.

Sarawak river is very clean unlike what we are having in Kedah. With polite and kind people, you won't be surprise to see the river so very clean.

Food at the hotel is expensive. How expensive ?  I tried a fried rice with my wife. I paid RM38.00 with plain water.

I brought my laptop along with me because I told my former school to contact with me using the message form of the school web page in case it has any problem with the printing of the school leaving certificates. It was the internet cable. But on connecting I need to purchase the time; RM15 per hour. I had the money but it was too expensive for the internet time. I wrote a basic program trying to access the school web page directly but failed. May be I need to learn more about the network system.

In the evening while watching TV we got an SMS from Hamka's sister inviting us for dinner. Hamka's sister was formerly a teacher .So was his brother in-law. But both are retired. So that night we had a dinner at the same hotel and chit chat until late at night. They not only treat us with dinner but also presented us with Batik and Sarong.

Or departure date was on the 26th. We told Hamka not to fetch us to the airport. But he insisted. I had to explain that his car could not take us because of the luggage and the wheel chair. He agreed and promised us to meet at the airport. After Friday prayer Hamka and his wife arrived. Again there were gifts and he went back after seeing the plane piloted by his son lifted off.

We left Kuching at 4 pm, arriving Kuala Lumpur at 5.30 pm. A little later there was a heavy downpour. The plane was delayed. Finally we arrive our beloved home at 10.00 pm. From Kuching with love.

Top