Deni Lukmanul Hakim

C, C++, C#
See also: Other Geeks@INDC
Belum ada XNA Game Studio Express buat Visual C# 2008 Express?

Belum ada yah? Kalo ada bagi2 dunk :) Kok gw googling gak menemukannya ya..huhuhuhuhu

Pengin cepet2 liat tampilan ini jadi lebih kaya seperti dibawahnya. Atau mungkin lebih kaya? :)

Visual C# XNAVisual C# XNA

 Visual C# 2008

Share this post: | | | |
Menjalankan OpenGL dengan Visual Studio 2005

Halo, ini langkah-langkah yang saya lakukan untuk menjalankan OpenGL dalam Visual Studio 2005.

Pertama, siapkan 3 buah file:
1. glut32.dll -> taruh di C:\WINDOWS\system\
2. glut32.lib -> taruh di C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib
3. glut.h -> taruh di C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include\gl

Kalau tidak punya salah satu atau ketiga file ini, bisa download di http://www.xmission.com/~nate/glut.html

Setelah menunaikan tugas menaruh ketiga file tersebut, bukalah Visual Studio 2005.

1. Buatlah sebuah project baru
satu


2. Pilih Visual C++, lalu di tab Win32 pilih Win32 Console Application. Namakan project pertama anda, misal CobaOpenGL
dua


3. Kemudian akan muncul Window Win32 Application Wizard. Ceklist Empty Project.
tiga


4. Setelah muncul window utama, tekan Ctrl + Shift + A. Akan muncul sebuah jendela Add New Item. Pilihlah Tab Code dibawah Visual C++. Lalu pilihlah C++ FIle (.cpp). Namai file cpp anda. Misal saya menamai dengan segitiga.cpp
lima


5. Akan muncul sebuah file segitiga.cpp yang kosong. Copy paste Ketik ulang code yang bisa didonlod dimana saja. Silahkan googling smile Dalam contoh kali ini saya membuat sebuah segitiga.


enam


6. Kalau sudah selesai, di menu Project, pilih CobaOpenGL Properties.
tujuh


7. Setelah muncul CobaOpenGL Properties Pages, di Configuration yang drop down list sebelah kiri atas, pilih All Configuration.
delapan


8. Di bagian Configuration Properties pilih Linker, lalu Input. Di sebelah kanannya, ada Additional Dependencies kan. Tambahkan:
opengl32.lib glu32.lib glut32.lib
sembilan


9. Setelah selesai, pilih tombol yang gambarnya kayak play dibawah menu Community. Program akan dibuild terlebih dahulu, kemudian di-run
sepuluh


10. Beberapa saat setelah command prompt muncul, muncullah gambar segitiga2 yang besar dan yang kecil itu smile
sebelas

Happy OpenGL-ing!! smile

Deni

Share this post: | | | |
Kurose & Ross sama-sama punya 3 anak

Kalau ada yang belum tau siapa beliau berdua, Jim Kurose dan Keith Rose adalah pengarang buku Computer Networking -  A Top Down Approach. Dinamakan Top Down Approach karena buku tersebut membahas Computer Networking dari sisi aplikasi, seperti TCP, UDP, POP, IMAP, dll, baru kemudian turun ke akarnya, dari mulai bahasan tentang IP, kemudian berlanjut membahas signal-signal yang ada dalam jaringan komputer.

 

Menarik untuk disimak, di halaman ucapan thanks to, baik Kurose maupun Rose mempersembahkan buku tersebut untuk istri dan ketiga anaknya. Cuman bedanya semua anaknya Rose itu wanita semua.

Apa hubungannya punya 3 anak sama Computer Networking? Saya tertarik dengan prestasi Kurose dan Rose yang tetap gemilang walaupun mereka sudah punya anak tiga. Di buku itu ditulis Kurose merupakan Distinguished University Professor plus Outstanding Teacher, pernah memenangkan berbagai macam award di 3 universitas di US.

Begitu pula dengan Rose yang mendapatkan gelar professor di 2 bidang, yakni di System Engineering dan Multimedia Communication. Rose telah menjadi supervisor untuk setidaknya 15 mahasiswa PhD, yang topik tesisnya mengenai P2P, network protocols, dan stochastic networks.

Agak ngiler juga yah baca halaman About the Authors tersebut. Padahal baru aja baca mengenai pengarang buku Computer Networking. Belum tentang Leonard Kleinrock, yang komputernya menjadi first node of the internet di tahun 1969.

Ngiler merindukan ada orang-orang Indonesia yang namanya terpampang di buku pedoman kuliah-kuliah dasar, yang mengabdikan dirinya dengan research, tentunya tanpa melupakan bangsanya. Yah seenggaknya kata-kata temen gw yang said that seorang professor komputer kebanyakan gak nikah atau gak punya keluarga yang hangat itu gak bener :)

Share this post: | | | |
Harus Berapa Game Lagi?
 
    

Several years ago I was playing Spider Solitaire on my computer all the time. Sometimes I won, sometimes I lost. Then I stopped playing Spider Solitaire and started participating in programming competitions. After a few years I happened to start my old solitaire program again. I was pleased to discover that with the skill I gained during the years I am now able to win each and every game of Spider Solitaire. However, the program still remembers some of my previous games and thus the statistics don't necessarily reflect my current perfect skills.

The program displays the statistics in the following way:

Games played: X

Games won: Y (Z %)

The number Z is the percentage of games I won, rounded down to the nearest integer. For example, if X=53 and Y=47, then Z=88.

(The value Y/X is roughly equal to 0.8868, which means that I won roughly 88.68% of the games I played. 88.68% rounded down to an integer is 88%.)

You will be given two ints played and won - the number of games I played so far, and the number of games I won so far. Return the smallest positive integer G such that if I now win G games in a row the displayed value of Z will increase. If this is impossible, return -1 instead.

Problem ini muncul di Single Round Match (SRM) TopCoder 2 hari yang lalu. Pertama kali baca soal ini, algoritma yang terpikir oleh 'orang normal' adalah:
1. Jika played == won return -1.
2. Hitung persentase kemenangan, misal persen = won*100/played.
3. Buat sebuah variabel yang menampung game harus kita mainkan, misal tambah.
4. Selama (jumlah game menang (won) + pertandingan tambahan (tambah)) *100 / played + tambah masih sama dengan persen, tambah = tambah + 1.
5. return tambah.

Nah, jika yang terpikirkan adalah algoritma seperti diatas, maka pada saat Challenges Phase, pasti kamu kena Challenges. :)

Kita bisa saja menaikkan persentase dari 1 ke 2, dari 68 ke 69, bahkan dari 98 ke 99. Tapi kita nggak akan bisa menaikkan persentase dari 99 ke 100. Hal ini karena bila persentase==100, artinya kita memenangi seluruh pertandingan. Jadi kita harus menghandle dengan statement:

    Jika persen >= 99 return -1

Sudah benarkan solusi kita sampai saat ini? Ternyata belum. :) Untuk soal ini, dibatasi time limit adalah 2 second. Jadi kita gak akan bisa melakukan loop terus menerus apabila diberikan sebuah case dimana played = 1,000,000,000, won = 980,000,000. Disini kita harus menambahkan 1,000,000,000 games. Maka akan terjadi 1,000,000,000 looping.

Nah, menurut misof, salah satu anggota topcoder juga, ada 2 kategori cara untuk menyelesaikan problem ini. Yang pertama cara hacker, yang kedua cara programmer, yang ketiga cara jago matematik. :)

Cara Hacker:

  int howManyGames (int played, int won) {
int currentDisplay = display(played,won);
if (currentDisplay >= 99) return -1;

int g;
for (g=1; ; g+=1000)
if (display(played+g,won+g) > currentDisplay)
break;

// We already crossed the boundary.
// Now we return one step back and find its exact position.
g-=1000;
for ( ; ; g++)
if (display(played+g,won+g) > currentDisplay)
return g;
}

Cara Programmer:

 int howManyGames (int played, int won) {
int currentDisplay = display(played,won);
if (currentDisplay >= 99) return -1;

long minG = 0, maxG = 1;
while (display(played+maxG,won+maxG) == currentDisplay)
maxG *= 2;

while (maxG - minG > 1) {
long midG = (maxG + minG) / 2;
if (display(played+midG,won+midG) == currentDisplay)
minG = midG;
else
maxG = midG;
}

return maxG;
}

Share this post: | | | |
Introduction

Hello, guys. In my first writing, let me introduce myself. My name is Deni Lukmanul Hakim. I'm still being an undergradute student in Faculty of Computer Science, University of Indonesia.

Talking about my 'programming life', the first programming language which I know is Basic. I learn this programming language when I was in first year in Senior High School. By the way, I was graduated from SMA 28 Jakarta. Then, I learn Pascal and C when I want to join Indonesian Computer Olympiad Team (TOKI). In my 3rd year of Senior High School, I first learn about Object Oriented Programming. I prefer C++ to Java because its speed *sorry, no offense* :) When entering my new faculty, I started learn about .NET Framework. In my campus, there are an organization which provide a good condition for me to learn .NET Framework. That is Enterprise Application Lab (EAL). In this organization, I meet Sagi Arsyad, who gave me this blog *thanks*, and can participate in any workshop which held by EAL. Recent workshop held in my campus is how to make an interpreter using C++ *Thanx to Mr Zeddy Iskandar, It was really a great workshop*

Why I chose to enter computer science program? Hmm..I proud to be a computer science student, because this is the faculty which I really want, although there is a different ways of major that I really want and my parents really want. But, I still choose to entering this faculty when a particular memory of my childhood popped up. It was a memory where I constructed my first computer back when I was in junior high school. I remembered that, on that day, I dreamt of being a computer engineering. I then asked my self, “Isn’t this I really want? Isn’t this my actual dream?” Therefore, I rose up from my chair and promised myself that I will start to pursue this ambition. I hope I can contribute my experience and skill to the academic and my country development.

Anyway, I want to apply my application to Microsoft someday. Beside that, I had been thinking about going for a PhD in the near future to pursue a full time teaching position in the university. *wish me luck*

OK, I think this will become not interesting and boring. Right? :) I hope my blog can be a useful source for 'non-expert .NET programmer' ^_^

Share this post: | | | |
Posted: Nov 12 2006, 08:08 PM by denilukman | with 2 comment(s) |
Filed under: