Basirudin Rachman

See also: Other Geeks@INDC
(500) Internal Server Error on IronPython

I tried to use IronPython to create a SOAP request to a Web Service but got an Internal Server Error.

The same script has been tested from C# withouth error. Anyone got a clue?

Following is the ironpython command:

  1: IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4927
  2: Type "help", "copyright", "credits" or "license" for more information.
  3: >>> from System.Net import *
  4: >>> from System.Text import *
  5: >>> from System.IO import *
  6: >>> query = Encoding.UTF8.GetBytes('''<?xml version="1.0" encoding="utf-8"?>
  7: ... <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns
  8: :xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://www.w3.org/2003/05
  9: /soap-encoding" xmlns:tns="http://www.witsml.org/wsdl/120" xmlns:types="http://w
 10: ww.witsml.org/wsdl
 11: ...   <soap12:Body soap12:encodingStyle="http://www.w3.org/2003/05/soap-encoding
 12: ">
 13: ...     <q3:WMLS_GetVersion xmlns:q3="http://www.witsml.org/message/120" />
 14: ...   </soap12:Body>
 15: ... </soap12:Envelope>''')
 16: >>> req = WebRequest.Create("http://localhost:81/Petrolink.Powerstore.Webservice
 17: /wmls.asmx")
 18: >>> req.Headers.Add("SOAPAction", "\"\"")
 19: >>> req.Credentials = NetworkCredential("fred", "derf");
 20: >>> req.ContentType = "application/soap+xml; charset=utf-8"
 21: >>> req.Accept = "text/xml"
 22: >>> req.Method = "POST"
 23: >>> requestStream = req.GetRequestStream()
 24: >>> requestStream.Write(query,0,query.Length)
 25: >>> requestStream.Close()
 26: >>> response = req.GetResponse()
 27: Traceback (most recent call last):
 28:   File "<stdin>", line 1, in <module>
 29: SystemError: The remote server returned an error: (500) Internal Server Error.
 30: 

And below is the C# code with the screenshot of the result:

  1: byte[] query = Encoding.UTF8.GetBytes("<?xml version=\"1.0\" encoding=\"utf-8\"?><soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://www.w3.org/2003/05/soap-encoding\" xmlns:tns=\"http://www.witsml.org/wsdl/120\" xmlns:types=\"http://www.witsml.org/wsdl/120/encodedTypes\" xmlns:rpc=\"http://www.w3.org/2003/05/soap-rpc\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\"><soap12:Body soap12:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\"><q3:WMLS_GetVersion xmlns:q3=\"http://www.witsml.org/message/120\" /></soap12:Body></soap12:Envelope>");
  2: 
  3: HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost:81/Petrolink.Powerstore.Webservice/wmls.asmx");
  4: // if SOAPAction header is required, add it here...
  5: req.Headers.Add("SOAPAction", "\"\"");
  6: 
  7: req.Credentials = new NetworkCredential("fred", "derf");
  8: req.ContentType = "application/soap+xml; charset=utf-8";
  9: req.Accept = "text/xml";
 10: req.Method = "POST";
 11: 
 12: Stream requestStream = req.GetRequestStream();
 13: requestStream.Write(query,0,query.Length);
 14: requestStream.Close();
 15: WebResponse response = req.GetResponse();
 16: 
 17: StreamReader sr = new StreamReader(response.GetResponseStream());
 18: 
 19: Console.WriteLine(sr.ReadToEnd());
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

image

Share this post: | | | |
Problem With Port 80 – Skype Took It

I tried to start my default web site from IIS Manager this morning, but it gave me an error – inform that the port 80 is already used.

Investigation using netstat –ao command, I got this:

image

Lookup to Task List, got the application which use the port 80. It was Skype. Does anyone know what does Skype use port 80 for?

No worry, you don’t have to tell me now because I’m going back to the code :)

See this:

image

Happily ever after…

Share this post: | | | |
Silverlight Week

It was on two weeks a go I got invitation to talk and discuss about Silverlight.

The first one was in Computer Science IPB, .NET Community arranged by Ecko (one of MSP from IPB). Since there’s some new students in the audiences, so I tried to explain from the beginning, introduction to .NET Framework, then went to Silverlight things – of course this also an introduction.

Following pictures taken from the event (not many students came to the event, since they have some assignment from the lecturer):

Class 1 - a  Class 1

The 2nd event was conducted in the next Sunday  (Oct 18th 2009). This event was conducted by Informatic Diploma Department of IPB. I did not expected this event as formal as I though, but it was. There was speech from the lecturer, head of student group and then me.

Following pictures taken from the event:

Class 2 - a  Class 2

Share this post: | | | |
Petrolink Is (Still) Hiring

If you are a good .NET Developer with following criteria:

  • Experience in C# for 3 years or more.
  • Love to code any kind of application – web, network, communication, messaging, real time data transfer, etc.
  • Good Attitude (Done is the target).
  • Able to work together in a team or alone.
  • It would be an additional value if you have experience with WPF/WCF.
  • Graduated from University with Background in Computer Science or Mathematics or Physics or Electrical Engineering.
  • Interesting in create application for Oil and Gas industry and standard such as WITSML, PRODML.

If you are interested to join us, please send your cv to jakarta.vacancies@petrolink.com

Petrolink is a well established information and communications technology service company specializing in the oil and gas exploration and production sector. If you interest to know more about Petrolink, pelase visit our website: http://www.petrolink.com

Share this post: | | | |
Never Underestimate readme.txt

Have you been in the situation where you got an error that you have previously encountered?

I got this error after installing Oracle Data Access Component (ODAC) 11.1.0.6.21 in my machine (Windows 7 Ultimate x64):

Unable to load DLL 'OraOps11w.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

What have I done? Let’s figure out what steps that drove me to this situation:

  1. I opened the “readme.txt”, it just to remind me the command for installation, and got this: install.bat odp.net20 c:\oracle odac. Yes, I only need this component to be used by at least .NET 2.0.
  2. Finish – I thought that was enough. And then running the application then got the error.

Hmm, figure out, I remember that I need to put the binary path of C:\oracle into environment system path, then I put the C:\oracle\bin. Run the application? Still got the error.

Ok, now, I’m going to read each item in readme.txt carefully, and then in the point 4 in that readme.txt file I got this: Add the install directory and install directory's bin subdirectory… add c:\oracle and c:\oracle\bin to the system PATH. Yes, you’re right I forgot to put c:\oracle in the system PATH.

So, never underestimate readme.txt, at least for my self :)

Now I got my application log:

2009-11-01 17:50:11.096, GET, P,………. Do you know what does the caracter P mean? Yes it means the applicatin runs smoothly (PASSED).

Share this post: | | | |
Windows XP Mode

I’m installing Windows XP Mode now.

It is required because I need to instal Oracle 10g because it cannot be installed on Windows 7.

image

Automatically detect Active Drives:

image

Instal AVG Anti Virus:

image

Instal Oracle 10g:

image

image

Share this post: | | | |
Upgrade Vista Ultimate To Windows 7 Ultimate

Alhamdulillah, after waiting about more than an hour I was successfully upgrade my Dell XPS M1330 machine from Vista Ultimate to Windows 7 Ultimate 32 bit.

I’ve got no errors when the upgrade process running, only a message in the beginning of process that inform me that some applications will not run on Windows 7 after upgrade from Vista (i.e. SQL Server Management Studio). As l recalled, only three applications that will not run.

win7

My XPS provides finger print reader to log in to system, and it works fine.

Next, first time first, check following applications:

VS 2008

This should be run, just wanna make sure.

vssc

SQL Server Management Studio

When the upgrading process runs, this application is included as one application that need to be uninstalled first. However, i did not uninstall it and will see what happen when I try to open it:

sqlerr

I got above an error message when trying to open SQL Server Management Studio. Ok will do something to make it run (hmm, probably need to reinstall it again, don’t know yet).

OpenOffice Writer

I got this runs well too:

ooss

Oracle Services

Oracle services: both the listener and the service looks fine, all have been up and started:

orcss

Others application such as my internal office messaging system created using Java looks good on Windows 7.

So, no reason not to upgrade my Vista to Windows 7. Thanks to Naren for the iso, so I don’t have to download from MSDN.

Share this post: | | | |
Posted: Aug 08 2009, 10:42 AM by basir | with no comments
Filed under: ,
Caching Strategy for Collection Object – Part I

Background

In a cache management pattern, usually the object that stored in the cache will exactly same with the object returned from the real data store.

Following diagram shows the working of cache:

CacheRepositoryAgentDiagram

As shown in diagram above, the cache repository agent (CRA) will responsible to return object requested by the client.

1. Client request Object.

2. CRA will check to the cache, if the object available, than return it back to client.

3. If not exist in the cache, get the object from repository (REP) (i.e. database repository), return to the client and asynchronously add it to the cache.

Problem

With the following condition, some problems might be appeared when the usage of CRA and Cache is come after the system running well in the model of Client <-> REP. The problems are:

1. Object returned by REP is not the one that expected by CRA to be stored in the Cache.

2. More precisely, if the CRA expects object which contains a raw data structure, but the REP return an object which contains processed data structure.

Solving the problems above is actually the objective of this article. We will assume the object used by REP and CRA is not a simple object such like a Person object which can be retrieved using a key/ID (REP.GetByID(id) or CRA.GetByID(id)), but the object that contains collection of item, that act like a table in database but stored in the Cache (we call it CollectionObjectInfo). Following diagram shows the sample structure of CollectionObjectInfo:

CollectionObjectInfo

While the object that returned by REP is already in product format, i.e.: an xml string produced from the combining subset data of the DataList:

   1: <?xml version="1.0" encoding="utf-8"?>
   2: <ObjectInfo>
   3:   <data>v11, v12, v1n</data>
   4:   <data>vm1, vm2, vmn</data>
   5: </ObjectInfo>
Share this post: | | | |
Call Means Enable Me

Just realize and smell something bad in my code. Call a method with passing boolean if the logic inside the method is enable and check it inside that method.

Let me show one of a method that uses a boolean parameter.

   1: public static T Get(bool isEnable, string key)
   2: {
   3:     if (isEnable)
   4:     {
   5:         //Main Logic.
   6:     }
   7:  
   8:     return default(T);
   9: }

The method above is a member of some kind of a façade class that try to make our life simpler when need logic steps inside the method.

The caller itself will pass the boolean parameter based on configuration related with their context. So let see two callers use this façade:

  • In first caller class, let say class RepositoryOne<T>:
       1: protected ObjectInfo<T> getFromFacade(Guid objectID)
       2: {
       3:     return FacadeClass<ObjectInfo<T>>.Get(IS_ENABLE, objectID.ToString());
       4: }
  • In the other class, let say class RepositoryTwo: 
       1: public override IPrincipal Find(IPrincipal sample)
       2: {
       3:     StoreIdentity sampleIdentity = (StoreIdentity)sample.Identity;
       4:     IPrincipal principal = (IPrincipal) FacadeClass <StorePrincipal>.Get(IS_ENABLE, sampleIdentity.Name);
       5:     
       6:     //Main Logic. 
       7:     
       8:     return principal;
       9: }

Btw, where is IS_ENABLE come from? IS_ENABLE Is a readonly variable in class level which the value set and got from a config value.

Ok, back again, the objective is to make the usage of IS_ENABLE to be as efficient as possible, even though all the codes above will run smoothly without any warning or error message. Fortunately we're the master, who can smell something not good appears in front of our face. Let me make it clear, to make the usage of IS_ENABLE to be as efficient as possible is never pass it to the façade. Let the logic be handled by the caller.

The Caller

Now, let me define the caller. The caller is any class that needs the façade. In the current case all the callers are some kind of Repository that need to retrieve something from the façade. And also, in the current case the all callers are inherited from one class, let say RepositoryBase<T> class.

In this case also, yes, the all callers should have a configuration to be able to use the façade. However, in the other case or other class, yes the other class can use the façade without has to be bothered with any of configuration, just call it and get from it.

Now, it makes sense that what I wrote has something wrong in it. Please see conditions below:

  1. One or more classes should have config value to determine whether they'll be able to call the façade or not.
  2. Other classes don't have to worry with this determination.

Solution

It has clear now that only the repository things need this: IS_ENABLE.

Let us refactor the façade class to remove all IS_ENABLE parameters usage.

Now, the façade will look like this:

   1: public static T Get(string key)
   2: {
   3:     //Main Logic.
   4:     
   5:     return default(T);
   6: }

The problem was on the caller, more specifically is on the base class, RepositoryBase<T> that should encapsulate the process call the façade so the inherited classes will use this call method efficiently. I add following members inside the base class:

  1. A readonly variable of IS_ENABLE which is moved from the child classes.
  2. Constructor that got the value for IS_ENABLE from configuration owned by each child class.
  3. New get method which uses IS_ENABLE to filter call to the façade, so the filter now happens in the caller.
   1: protected readonly bool IS_ENABLE;
   2:  
   3: public BaseAgentRepository(bool isEnable)
   4: {
   5:     IS_ENABLE = isEnable;
   6: }
   7:  
   8: protected T get(string key)
   9: {
  10:     if (IS_ENABLE)
  11:     {
  12:         return FacadeClass<T>.Get(key);
  13:     }
  14:     
  15:     return default(T);
  16: }

The consequence for the child classes is to override the constructor to pass the config value for IS_ENABLE and call the get to façade using the one in base class.

  1. In RepositoryOne<T>:

    Constructor:

       1: public RepositoryOne()
       2: : base(OneConfig.Instance.Tuning.Facade.Enable)
       3: {
       4: }

    Change in getFromFacade:

       1: protected ObjectInfo<T> getFromFacade(Guid objectID)
       2: {
       3:     return get(objectID.ToString());
       4: }
    					
  2. In RepositoryTwo<T>:

    Constructor:

       1: public RepositoryTwo()
       2: : base(TwoConfig.Instance.Facade.Enable)
       3: {
       4: }

Change in Find method:

   1: public override IPrincipal Find(IPrincipal sample)
   2: {
   3:     SampleIdentity sampleIdentity = (SampleIdentity)sample.Identity;
   4:     IPrincipal principal = (IPrincipal)get(sampleIdentity.Name);
   5:     
   6:     //Main Logic. 
   7:     
   8:     return principal;
   9: }
			

Conclusion

None of the code can be perfect at the first time, at least which happens in lot of my code. Event one variable can mess up your application a lot, not for the warning or error, but for the smell.

However, this solution is not the best, in the feature, if the smell appears as bad as the current condition, I'll let the code to adapt.

Share this post: | | | |
Solve TF53011 Problem

I've got a problem when try to add a new user as Team Foundation Server (TFS) "Licensed User" from my TFS Client event I logged in as TFS administrator.

The problem is the target machine (TFS machine) cannot be resolved from my machine. Following image shows dialog of TFS Client on my machine:

Unresolved Machine

To add new user as "Licensed User" in TFS, please see following url: http://social.msdn.microsoft.com/forums/en-US/tfssetup/thread/0939d3aa-6acc-41f1-b674-c33a9f75351d/

Yes, I have tried the GUI way, but as we can see on above picture, I cannot resolve my server machine to get the user name. So another alternative is to use the command utility (TFSSecurity.exe) directly in the server machine.

So, go log in to the server, find the TFS folder (usually TFS is installed on following path: [SYSTEM_DRIVE]:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools.

Use following command, then expected user will be registered as  "Licensed User":

TFSSecurity.exe /server:TCNBW2K8A /g+ "Team Foundation Licensed Users" n:maulida

And following is the result from above command: 

TFSSecurity Result

Share this post: | | | |
Siap Menguji Aplikasi Anda?

Terakhir kali mempersiapkan aplikasi untuk diuji sebagai salah satu syarat menjadi Microsoft Partner, pernah saya lakukan sekitar tahun 2005/2006. Alhamdulillah produk kantor saya waktu itu lulus sehingga layak mendapatkan status sebagai Microsoft Partner.

Saat ini saya kembali harus menyiapkan produk untuk mengikuti ujian untuk tujuan yang sama yaitu menjadi Microsoft Partner. Tentunya banyak perubahan pada kriteria yang harus dipenuhi oleh produk sehingga dapat lulus dari ujian yang diberikan.

Catatan ini adalah catatan awal dari persiapan untuk mengikuti ujian yang terbaru, dan barangkali dari temen-temen pembaca sekalian ada yang sudah mengikuti dengan aturan yang terbaru ini sehingga dapat memberikan sumbang saran J.

Terdapat dua jenis pengujian untuk mendapatkan label Microsoft Partner yaitu:

Microsoft Platform Test for ISV Solutions dan Microsoft Platform Test for Hosted Solutions.

Perbedaan dari keduanya adalah jenis aplikasi yang akan diuji. Untuk aplikasi yang memerlukan penginstalan langsung pada computer pengguna cocok untuk pengujian jenis pertama, sementara untuk tipe aplikasi yang menawarkan service kepada pengguna maka diuji oleh pengujian jenis kedua.

Cara pengujian dan nilai poin:

1.       Foundation Test

Ini merupakan ujian yang wajib diambil. Untuk jenis pertama ada dua ujian yang ditawarkan dan boleh diambil salah satu saja:

-          Windows Server Test

-          Windows Client Test yang berjalan pada system operasi XP.

Sementara untuk ujian jenis kedua hanya satu jenis ujian yaitu Windows Server Test. Masing-masing ujian memiliki nilai 10.

2.       Elective Test

Ini merupakan ujian pilihan yang harus diambil minimal satu dengan masing-masing nilai adalah 10:

-          Microsoft  Office

-          SQL Server

-          Web Services plus .NET Framework

-          Managed Code

Syarat kelulusan dari aplikasi yang diuji adalah minimal lulus satu ujian dari Foundation dan satu ujian dari Elective. Sekedar tambahan, pengujian terhadap Windows Server 2003 dan SQL Server 2005 akan berakhir per 31 Maret 2009. Bagi Anda yang ingin menguji aplikasi terhadap kedua perangkat tersebut Anda masih punya waktu sekitar 6 hari, karena berikutnya syarat pengujian berubah menjadi Windows Server 2008 dan SQL Server 2008.

Untuk lebih jelas materi apa saja yang diujikan dan berapa biaya untuk masing-masing pengujian, silakan langsung unduh persyaratan dari situs Lionbridge.

Silakan mencoba dan jangan lupa untuk berbagi cerita kalau aplikasi Anda dapat lulus dari ujian-ujian tersebut.

Share this post: | | | |
Kesalahan Multithread? – Bagian I

Beberapa hari berkutat dengan masalah yang sebenernya sederhana (ini tahunya belakangan :D), tapi mencari solusi yang kelewat kompleks (menurut saya).

Masalah pertama adalah kecurigaan terhadap kesalahan thread dari program yang saya buat (hehehe emang enak nyalahin orang lain – baca: program) ketika terjadi kondisi di akhir thread terhadap suatu proses yang diharapkan, tetapi harapan tersebut tidak terjadi. Hmm bingung ya? Paragraf berikut ini berusaha menerangkan kasus yang terjadi.

Saya memiliki 2 komponen yang saling berinteraksi, masing – masing berjalan dengan thread yang berbeda, masing-masing adalah:

·         Komponen pertama K1 memiliki tugas yang sangat sederhana yaitu menuliskan hasil parse data mentah DM1 menjadi data yang valid DV1 yang disimpan ke dalam antrian Q1, ke dalam suatu file F1. DV1 sendiri merupakan data tunggal yang ada di dalam suatu antrian (yang berharap ditulis ke dalam file) Q1, sehingga di dalam Q1 terdapat DV11, DV12, sampai DV1n. Aturan yang saya buat adalah akan menulis ke dalam file F1 jika satu atau lebih kondisi berikut terpenuhi (menggunakan relasi “atau” – or):

1.       Jika jumlah DV1 di dalam antrian Q1 adalah lebih besar atau sama dengan nilai tertentu yang dapat dikonfigurasi.

2.       Jika jumlah DM1 lebih kecil atau sama dengan 0.

Karena proses penulisan ke dalam file yang dilakukan oleh K1 berada dalam thread yang terpisah dari thread utama, maka proses ini akan dilakukan terus selama tidak ada signal dari thread utama untuk mengakhiri proses.

·         Komponen kedua K2. Memiliki tugas juga sangat sederhana, yaitu membuka setiap file yang telah ditulis oleh K1 dan melakukan proses konversi menjadi data lain yang diinginkan, sebut saja DV2. Selanjutnya di dalam K2 ini juga kumpulan hasil konversi akan disubmit menggunakan Web Service, tetapi ini tidak akan dibahas di tulisan ini karena memang bukan permasalahan yang berhubungan dengan thread.

Thread ini juga merupakan anakkan dari thread utama seperti halnya thread terhadap K1. Di dalam K2 saya menggunakan satu komponen lain yang melakukan pengamatan terhadap folder dimana F1 akan dituliskan – merupakan enkapsulasi dari satu kelas standar di dalam .NET yang disebut “FileSystemWatcher”. Di dalam folder tersebut akan terdapat lebih dari satu F1, sebut saja F11, F12, sampai F1n.

Harapan saya terhadap komponen ini adalah apabila terdapat penambahan file yang dihasilkan K1 akan dapat masuk ke dalam antrian untuk diproses.

Kondisi yang akan dijalankan oleh thread ini adalah:

1.       Jika signal berhenti belum diterima.

2.       Jika jumlah F1 yang belum diproses lebih besar dari 0.

Sperti halnya K2, maka K1 akan berhenti jika mendapat signal dari thread utama.

Ok, mudah-mudahan masih mudeng, sebelumnya mohon maaf, tulisan ini bukan tulisan yg pop karena ga ngebahas LINQ, ADEM, dll yang lagi ngetrend :D. Back to business…

Harapan saya adalah ketika thread utama mengirimkan signal bahwa proses telah selesai (di trigger dari luar sistem) maka semua file yang berada di dalam folder yang diamati oleh K2 akan diproses. Kenyataanya adalah bahwa ketika signal proses selesai telah dikirim, maka secara “berurutan” thread K1 akan melakukan “Join” – menyelesaikan masalah2 yg belum tuntas, lalu K2 juga demikian. Tetapi apa yang terjadi?

1.       Ketika K1 menyelesaikan masalahnya, maka ada beberapa F1  yang akan di buat oleh nya. Harapan saya adalah semua F1 yang dibuat pada masa-masa akhir ini akan dikonsumsi oleh K2.

2.       Ketika K2 menyelesaikan masalahnya, ternyata tidak satupun F1 yang dibuat pada “injury time” ini yang diproses.

Hmmm, saya berulang kali menyalahkan algoritma yang ada pada K1 dan K2 (padahal saya sendiri yang membuatnya). Kecurigaan pada proses signaling sampai kesimpulan “Ini pasti bug nya VS 2008” :D. Sampai tadi malam saya berpikir kembali, lalu melihat algoritma yang ada pada thread utama ketika melakukan penyelesaian proses. Melihat, berpikir sebentar, lalu saya tertawa, dan berlari ke kamar menemui istri saya yang sedang tertidur, lalu berkata “Ternyata bukan salah threadnya…., hahaha ini salah saya menuliskan algoritma di dalam thread utama”.

Apa yang sebenarnya terjadi di dalam thread utama yang menyebabkan kesalahan fatal diatas? Sebelum menuju masalah mari kita lihat apa yang biasanya dilkaukan terhadap suatu aplikasi multi thread ketika mengakhiri aplikasi?

1.       Mengirimkan signal ke semua thread untuk mengakhiri proses.

2.       Melakukan join.

Dua konsep sederhana diatas jika ditulisakan dalam algoritma yang salah akan berakibat fatal (tidak sesuai dengan apa yang diharapkan, walaupun aplikasi berakhir secara normal).

Kesalahan yang saya lakukan adalah dengan algoritma berikut:

  1. Mengirimkan signal ke semua thread K1 yang sedang berjalan untuk mengakhiri proses. (langkah ini adalah benar dilakukan pertama kali).
  2. Mengirimkan signal ke semua thread K2 untuk mengakhiri proses. (Inilah kesalahannya, karena thread K2 akan langsung berhenti karena tidak ada lagi F1x yang diproses).
  3. Melakukan join pada semua thread K1. Sehingga pada saat ini K1 akan menuliskan DVx sejumlah m yang tersisa menjadi F1x sejumlah m pula.
  4. Melakukan join pada semua thread K2. Disini diharapkan melakukan proses terhadap F1x sejumlah m, tetapi tidak terjadi karena sudah keluar dari kondisi untuk melakukan proses akibat dari point 2 diatas.

Lalu apa yang dilakukan?

  1. Proses ini benar.
  2. Melakukan join thread K1, sehingga akan menuliskan semua file F1x yang tersisa. Di sisi lain karena K2 masih berjalan, maka setiap penambahan file akan disimpan dalam antrian K2.
  3. Mengirim signal ke semua thread K2 untuk berhenti. Kondisi proses akan tetap dilakukan di dalam K2, karena masih ada file yang tersimpan di dalam antrian menunggu untuk dip roses.
  4. Melakukan join, menyelesaikan semua proses terhadap F1x.

Pelajaran apa yang bisa didapat?

1.       Bagi saya adalah menganggap sepele permasalahan yang sebenarnya memang sepele tanpa logika yang kuat akan berakibat fatal.

2.       Terlalu cepat mengambil kesimpulan sehingga menyalahkan hal lain yang belum tentu salah tanpa bukti yang kuat, akan berakibat fatal juga.

3.       Akhirnya, mencoba menjernihkan pikiran kembali, dan mengamati masalah dari akarnya (thread utama), melakukan investigasi secara teliti dan berurutan.

Wallohu a’lam.

 

Share this post: | | | |
Memperkenalkan BIND-C

BIND-C merupakan komunitas pengembang perangkat lunak berbasiskan .NET di kota Bogor dan sekitarnya.

BIND-C merupakan kependekan dari “Bogor Indonesia .NET Developer Community” atau bisa dibilang INDC nya Bogor, atau INDC cabang Bogor J

Beberapa hal menjadi alas an kenapa BIND-C harus dibentuk:

1.       Seringkali acara komunitas yang rutin diadakan di Jakarta (biasanya di kantor MS di gedung BEJ), pada jam kerja (800 – 1700) ataupun selepas jam kerja (1900 – 2100). Hal ini membuat beberapa orang kawan tidak bisa hadir apabila bentrok dengan jam kerja ataupun terlalu malam untuk mengikuti acara – acara yang diadakan selepas jam kerja. Inisiatif untuk membuat acara serupa dengan waktu dan tempat yang terjangkau menjadi salah satu keinginan dari kami – kami yang bekerja di Jakarta tapi tinggal di Bogor.

2.       Beberapa kawan justru kerja di Depok, atau bahkan di Bogor, dan ternyata cukup banyak pengembang perangkat lunak yang tinggal di Bogor, dan menggunakan teknologi .NET sehari – hari.

3.       Keingingan untuk memperoleh informasi teknologi terkini dirasakan perlu, sehingga kebutuhan komunitas yang dapat saling isi, saling berbagi secara online ataupun offline dipandang perlu juga. Mengaplikasikan teknologi .NET terbaru hanya mungkin jika pengetahuan tentang hal tsb sudah diperoleh.

Dari keinginan – keinginan diatas, lalu kami (orang – orang Bogor), saling berdiskusi melalui jalur pribadi email untuk mengatur langkah apa yang bisa dilakukan, sehingga lahirlah milis BIND-C dengan alamat bind-c@googlegroups.com untuk membuat diskusi lebih efisien. Awalnya ada sekitar 10 orang yang bergabung di milis ini, yaitu:

1.       Aang

2.       Mas Agung Putranto

3.       Arif Muhammad Iqbal

4.       Arum Madarum

5.       Saya, Basirudin Rachman

6.       Bayu Wicaksana

7.       Firyan Gustano

8.       Luhur

9.       Bos Marulam (Bos Acong)

10.   Istri saya, Maulida Rahmatillah

Group BIND-C dibentuk tanggal 16 Januari 2008, sampai saat ini anggotanya mencapai 29 orang.

Pertemuan pertama secara offline diadakan di kantor Bos Acong, di Asmara, Jl. Pandu Bogor. Yang hadir 4 orang: Saya, Bos Acong, Bayu dan Firyan. Hasilnya adalah perlunya penyamarataan pemahaman tentang bagaimana pengembangan perangkat lunak yang sebaiknya dilakukan, lebih kepada software construction. Sehingga direncanakan akan diadakan pelatihan Pengembangan Perangkat Lunak berbasis Obyek.

Selanjutnya pelatihan sendiri baru bisa dilaksanakan pada tanggal 30 Maret 2008, dengan kehadiran sekitar 9 orang, laporan untuk kegiatan ini bisa dilihat di postingan blog istri saya di alamat berikut: http://lidalucu.multiply.com/journal/item/59/Hasil_Pertemuan_Pertama_BIND-C

Selanjutnya, silakan teman – teman yang ingin aktif dan tinggal di daerah Bogor sekitarnya bergabung bersama kita, sukur – sukur bisa memberikan ilmunya kepada kita – kita melalui acara yang rencananya dibuat 2 kali dalam 1 bulan.

Acara berikutnya dari BIND-C Insya Allah akan diadakan tanggal 20 April 2008.

Salam.

Bsrd.

 

Share this post: | | | |
Hired by PE ;)

This is a late blog I think, but better late than nothing right ? :)

About three weeks ago, Agus called me and asked me to substitute him to train ASP .NET 2.0 to a company in Jakarta. Fortunately the company is located in the same building with company I work for.

Hired by PE (People Enterprise), I continued the training session as the final session of Object Oriented Training (is it right Gus ?). Being a substitute I tried to "read" the participants how the training will flow. And then I open with new features in ASP .NET 2.0 such as : Master Page, Membership, bla bla bla....

Started at 9.30 am and end at 5 pm I think. It was a good class, we discussed about lot of issues in what happened in my participants company related to the daily application they used. In the end we agreed to create a little community of developer in our building (Wisma BNI 46), and then we can create such as Community In touch event like what we already did monthly in INDC.

So It was a nice training, meet with developers from other company, discuss and talk about CODE :D.

</bsrd>

Share this post: | | | |
Posted: Nov 26 2006, 11:44 AM by basir | with 2 comment(s)
Filed under:
OO day

Yesterday was a full Object Oriented day

I was invited by my former company to share my knowledges about such things like : Object Oriented Programming, Implementation of this concept using current technology (I prefer .NET, using C# in VSTS), little orientation about "How to design architectures", and other things related to code and development.

Yes, it was a full OO day, starting at 9.30 am, we ended at about 5 pm. With 10 participants from my former company, including the boss (Assalamualaikum Pak Indra :)), 2 persons that I know since I left the company, and the others are new comer in the company.

Started with, as usually giving presentation about OO with attributes on it, like : What is an object, Identical or Equal, Encapsulation, Association - Aggregation, Messages, Invokin an Operation, Collaboration, How an OO Program Work, Classes, Hierarchy of classes, Shared Data / Operation, ie. static.

But not only one way communication that happened in the event, but we discussed about daily problem that usually come to us when we develop something, and find the way out. Current technology such as CAB, Ajax, ORM, bla bla bla ;D.

After break with shalat Zuhur and Lunch, we continued with more deeply dig to the code :). Still using presentation, but more technical presentation, we talked about : What type means (class, struct, interface, generic), what is modular vs. reusable code, scope, inheritance, abstract;virtual function, using Interface, and ended with three patterns : Singleton, Bridge, Factory (yes as preliminary I just show these patterns to them). After presentation (or while doing presentation) we try to design little system, writing the class diagram, and put it in the CODE of course :D. We dig more into how to use interface as the public contract to the client, but keep the implementation as a "SECRET" recipe :D. Showing how to implement the definition of "INTENTION"... :)

Yes yes-ter-day was an OO day. In the closing we discussed the road map after this action, to determine the next action. Yes we deal about the next action, implement the code with the concept we have learned together, and then sharpen them using what we will learn next... {still secret, but don't worry I'll blog it Insya Allah :)}.

</bsrd>

 

Share this post: | | | |
Posted: Nov 26 2006, 09:22 AM by basir | with 1 comment(s)
Filed under:
More Posts Next page »