Monday, April 15, 2013

Installing Junit Offline on Netbeans 7.3

To install JUnit with Netbeans 7.3, you normally need an internet connection during the installation of Netbeans. If that is not the case for you, here is how you do it offline:
  1. Install the JDK and Netbeans 7.3.
  2. Download the files in http://repo1.maven.org/maven2/junit/junit/3.8.2 and put them under <local user>\.m2\repository\junit\junit\3.8.2.
  3. Download the files in http://repo1.maven.org/maven2/junit/junit/4.10 and put them under <local user>\.m2\repository\junit\junit\4.10.
  4. Download org-netbeans-libs-junit4.nbm from http://dlc.sun.com.edgesuite.net/netbeans/updates/7.3/uc/final/certified/modules/extra/
  5. Download org-netbeans-modules-junitlib.nbm from http://dlc.sun.com.edgesuite.net/netbeans/updates/7.3/uc/final/certified/modules/extra/
  6. Start Netbeans, go to Tools/Plugins/Downloaded/Add Plugins, select org-netbeans-libs-junit4.nbm and org-netbeans-modules-junitlib.nbm, press install. After about 30 seconds you should see the success message.

Wednesday, March 13, 2013

Book: When Brute Force Fails

"When Brute Force Fails - How to Have Less Crime and Less Punishment", Mark A. R. Kleiman, 2009, 227 pages

Mark discusses how to improve our crime control policies by shifting from raw punishment to more intelligent methods and the obstacles that make it difficult. The basic idea is to concentrate efforts on high risk individuals. The most original ones are investing in parenting education and making post-release well being of prisoners a performance criteria of prison wardens.

Saturday, March 02, 2013

Fun for nerds stuck in boring meetings

Most meetings I attend are %90 boring and only 10% useful. I found that if I have pencil and paper I can prevent boredom by doing some simple derivations. By "simple" I mean that the derivation should take less than 5 minutes so that I can still follow the meeting. Here are some examples that I use to keep myself busy:

Friday, March 01, 2013

Detect Turkish characters with Java

To check if a string contains Turkish characters with Java, i.e. any of "ıİşŞğĞüÜöÖçÇ", you can use the following function (bonus: how to check if a string starts with a number):


Tuesday, February 12, 2013

The main obstacle in writing unit tests

I am an advocate of unit testing and try to implement them as much as possible. In the beginning of a software project, it is relatively easy and most of my tests pass. As my code gets bigger and bigger, tests start to fail. What is interesting is that the pass/fail behavior is not smooth, i.e. the number of passed tests might be lower than a month ago although I have written many new tests:


As my unit test base gets larger, the main reason of failure becomes out-of-date tests that need to be updated to match the design. In the messy middle portion of the project, I realize that I spend more time updating tests than fixing bugs found by my tests. There is so much oscillation that I'm on the verge of loosing hope and think about abandoning unit tests. If I persevere, I eventually reach a point where all my tests pass, but it takes a lot of will power. That is for me the main unit test challenge.

Friday, February 01, 2013

Dude, WTF is this shit?!

I am involved in maintaining legacy Java code written by long forgotten souls and came across a mesmerizing function that finds the minimum of a double array. It boils down to the following:


A classic "WTF is this shit!" case...

Thursday, January 10, 2013

Bankaların nefis (!) web sayfaları

Bankaların web sayfaları pek kullanıcı düşünülerek yapılmış gibi görünmüyor, özellikle de büyük bankalarınkiler (para ile empati ters orantılı). Duygu pıtırcığı reklamlar vermeyi bilirler de misal az önce olduğu gibi EFT talimatım ad kısmındaki uyuşmazlık nedeniyle gerçekleşmediğinde uyarı maili atmak onların ufkunu aşar. Bu bloğa karşılaştığım özensiz konuları yazayım da sinirim geçsin biraz:

Ziraat Bankası:
* EFT talimatı verirsiniz, IBAN'ı doğru yazsanız bile ad kısmında en ufak bir fark olursa talimatınız önce gerçekleşti görünür, "işlem tamam" diye düşünürsünüz. Ama kısa bir süre sonra para sessiz sedasız hesabınıza geri yatar, olur olmaz mesaj/mail atmakta beis görmeyen bankanız bu detayı size ne mail ne de mesajla bildirmez. Ancak alıcı size telefon açıp "hacı para nerde?" dediğinde haberiniz olur.

* Havale yaparken hep vadesiz hesabımı kullanmama rağmen default seçenek hep "hazine operasyonları" zımbırtısı olarak gelir.

İş Bankası:
* Havale hesabı eklemek için şimdi adını unuttuğum nalet uygulamayı cep telefonuma kurmam gerekir. Ama benim basit telefona o naneyi kurmak mümkün olmadığından havale hesabını ancak imzalı dilekçe fakslayarak ekletebiliyorum. İş Bankası ile tüm ilişkimi minimize etmeme neden oldu bu nefis kısıtlama, kendilerini tebrik ederim.

* Vadeli hesapla ilgili hesap yapmak deveye hendek atlatmakla yarışır.