Saturday, May 26, 2012

Deniz kenarı eğlencesi

Dün wikipedia'da El-Biruni'nin bundan 1000 yıl önce Dünya'nın yarıçapını nasıl ölçtüğünü öğrenince (bkz. aşağıdaki şekil) ben de yarıçapı ölçmek istedim. Bunu yapabilmek için deniz kıyısındaki bir dağın tepesinde olmak gerek. Yanımızda Dünya'nın merkez doğrultusunu (AO) bulabilmek için basit bir çekül (bir ipin ucuna taş bağlayarak yapabiliriz) (çekül yerine su terazisi de olur), bulunduğumuz nokta ile ufku birleştiren çizgiyi (AC) temsil edecek bir kalem ve kalemle çekül arasındaki açıyı (beta) ölçmek için de iletki olmalı (ya da yanınızda akıllı telefon varsa o da olur). Bulunduğumuz noktanın denizden yüksekliğini bilirsek Dünya'nın yarıçapını hesaplayabiliriz. Misal Antalya'daki Tahtalı dağı 2366m. Bulutsuz/sissiz bir günde çıkarsak ufku görebiliriz.


Biruni'nin dağın yüksekliğini nasıl bulduğunu düşündük ve benzer üçgenlerle hesaplamanın en kolay yol olduğuna karar verdik (malum, o günlerde GPS veya barometre yok). h2 yüksekliğini, d1 ve d2 mesafelerini ölçerek h yüksekliğini bulabiliriz:


Güncelleme (27.05.2012): Dağın yüksekliğini hesaplamanın daha kolay yolu (Biruni de öyle bulmuş): Herhangi bir C noktasında dağın tepesi ile yatay arasındaki açıyı (theta1) ölçelim. Dağa doğru d mesafesi boyunca ilerleyelim (D noktası), d mesafesini ve theta2 açısını ölçelim. Bu ölçümlerle dağın yüksekliğini, hatta ek olarak dağın bize ne kadar uzakta olduğunu bulabiliriz.


Friday, May 25, 2012

C Adventures

Strings in C is a problematic matter for novices like me. You usually see that your first guess is wrong and are puzzled until you discover the "C" way. The simple '=' operator does not work (except initialization) and you have to use the strcpy function. Below is an example where I assign the file's name to the variable fileName and then use it in fopen (source code here):


Thursday, April 26, 2012

My online course experience

I enrolled in Udacity's CS262 Programming Languages course after reading The Stanford Education Experiment Could Change Higher Learning Forever. It is free. Lectures are delivered through Youtube videos. The instructor is Westley Weimer (he is good).


It will last for six weeks. Right now (April 26th), we are in the second week. My impression so far:
* The programming language is Python. They have an online interpreter. You enter your code in the edit box and hit the run button to see the result. But I encourage you to download Python to your computer so that you can do exercises on your own and save them.
* You also need the PLY library (in week 2). You download it from here. After download, uncompress the file and copy the ply directory under C:\Python27\Lib.
* There are quizzes and homework.
* Very good to learn regular expressions.
* You must know what recursion is (i.e. you must be able to write simple recursive programs) because it is used extensively and not explained much.
* Lectures are 2-5 minutes each, but there are a lot of them. The first week had 40 videos. To be able to follow the course you must set aside about an hour each day because you need time for the information to sink in. For example, the programming practice subset after Unit 3 has a video less than 5 minutes long, but it took me 2 hours to really understand it. I have been lazy thus far (i.e. spent on average 15 minutes per day) and could only complete half of the homework questions.
* In unit 3, Syntactic Structures, in the Instructor Comments box below the video, there is a link to Chomsky's Manufacturing Consent which means that these are cool guys ;)
* It has a forum in the style of Stack Overflow.
* It has a wiki.
* Unit 3 programming practice is about finding all the subsets of a set which I found interesting. This can be done
** Recursively (python code here)
** Iteratively (python code here). I found this method particularly interesting.

Update (May 10th): Unit 4 is out. It is getting difficult for me to follow. As I said, videos are short but they pack a lot of information. I would prefer them to be more like Khan Academy videos because Salman Khan does not talk that fast and he does not cut out the natural pauses. They are more relaxed and those pauses give me an opportunity to process what I just heard. In CS262, all pauses are edited out and you have to stop the video yourself which I need to do almost every 30 seconds. That gets tiring and feels a little unnatural. Since the topic of CS262 is not of urgency to me at the moment, I think I will give up for now. A better subject for me is algorithms which is the topic of Stanford's Programming Abstractions.

Tuesday, April 03, 2012

Casual Mathematics

I like to solve casual math problems. For today's episode, inspiration came from Simulation as a Practical Tool. Below is the Maple 9 script I wrote to find the angle for shortest time. Note that the angle for minimum time is independent of rotational speed, omega.


Saturday, March 03, 2012

Book: Poor Economics

Poor Economics - A Radical Rethinking of the Way to Fight Global Poverty, Ranerjee, A. V., Duflo, E., 2011, 303 pages.

It explains how the world looks from the eyes of the poor (i.e. < 1$ a day) and why many well intentioned programs to help them fail. It is especially eye opening for people like me, who have a secure life and are almost always totally ignorant about the poor. The chapter about education was fascinating because the problems are so relevant to my own country, Turkey. As someone who regularly donates via Kiva, the microfinance chapter showed me clearly what to expect from microfinance and what not to. I was embarrassed to see my half-baked ideas naked in front of me and from time to time I became quite emotional. Besides sadness, my disgust for lazy intellectuals who lecture the poor about what to do without bothering to listen to them increased ten fold.

In short, this is a must read book not only to Kiva lenders but to everyone because what happens to the poor affects all of us in some way or another. The privilege of having a secure life entails responsibility. To act responsibly, you must first understand what the real problem is. Detox your brain...

Otomobil ruhsatı maceraları - 3

Yurdum bürokrasisi işler yolunda giderken fire vermeye meyillidir, bir de normalin dışında şeyler olduğunda pirincin taşını ayıklayana kadar sizi epey yorarlar (özel sektörümüz de çok parlak değildir, ama o başka bir yazıya kalsın). Yoruculuğa güzel örnek plaka hatasını düzelttirme maceramdır.

Maceramızın bu bölümünde olaylar şöyle gelişmiştir:

Geçen hafta bana posta yoluyla Maliye Bakanlığı Gelirler İdaresi Başkanlığı'ndan (GİB) bir yazı geldi. "Değerli Mükellefimiz" diye başlayan (değerimiz sadece başlıklardadır ya hep) yazıda "sahibi bulunduğunuz taşıta/taşıtlara ilişkin motorlu taşıtlar vergisinin ve/veya taşıtınızla ilgili idari para cezalarının ödenmediği veya eksik ödendiği tespit edilmiştir" deniyor, icra tehdidinde bulunuluyordu. Aracın plakası, borcun miktarı gibi "değerli mükellefleri" için son derece önemli bilgiler yazıda yoktu. Pirincin taşını "değerli mükellef" ayıklamalıydı.

1. Yazıda dendiği gibi https://intvd.gib.gov.tr/internetvd/index.jsp adresinden araç borçlarımı sorguladım, hiçbir borcum, cezam yoktu. "Bana verdikleri aklı neden kendileri de kullanmıyorlar" diye manasızca düşündüm.

2. Aracımın kayıtlı olduğu Ankara Yeğenbey Vergi Dairesi'nin telefonunu (310 22 40) aradım, cevap yoktu

3. Motorlu taşıtlar çağrı merkezini aradım (444 0 189), sürekli meşgul çaldı ama yılmadım, 5 dakikalık aramadan sonra düşürdüm. Bu seferde "tahmini bekleme süresi 5 dakikadır" mesajı ile karşılaşıp 5 dakika boyunca Turkcell'e para kazandırdım. Sonunda operatöre bağlandım. Operatör bana Yeğenbey'in başka bir numarasını verdi (509 19 00).

4. 509 19 00'daki operatör 312 06 06 numarasını aramamı söyledi.

5. 312 06 06 numarasını düşürene kadar 5 dakika boyunca aradım. Sonunda karşıma çıkan operatöre TC numaramı verdim, üzerimde iki araç kayıtlı olduğunu söyledi. Şaşırmadım çünkü ikinci araç daha önce hatalı şekilde plakası bana da verilen araçtı. Dedim hata yaptılardı, düzelttirdiydim... Dedi ki yoh yoh... Dedi ki sizi Yeğenbey'e aktarıyorum ama numaraları da not edin, düşmeyebilir. Dediği çıktı, telefonu açan yoktu.

6. Verilen numaralardan 509 19 11'i çaldırdım, açan yoktu. 509 19 13'ü denedim, açıldı. Durumu anlattım, karşımdaki eleman "üzerinizde sadece bir araç var, onun da borcu yok" dedi. Dedim ne yapacağım, dedi birşey yapmanıza gerek yok.

Sonuçta anladığım kadarıyla kayıtlar merkezi bir yerde değil, birden fazla kayıt var. Tabi tek kaydı doğru tutmaktaki mahareti hepimizce malum bürokrasim birden fazla kayıtta doğal olarak (!) zorlanıyor.

Son olarak motorlu taşıtlar çağrı merkezinin mail adresine (mtvvd@gelirler.gov.tr) durumu anlatan bir mail attım ve hatalı şekilde üzerimde görünen ikinci aracın üzerimden düşürülmesini istedim.

Tabi ki bu işin bu kadar basit (!) şekilde bitmeyeceği konusunda müsterihim, "değerli mükellefin" bürokrasi ile imtahanındaki yeni maceralarımızı ısrarla bekleyiniz "değerli okuyucularımız".

Güncelleme, 2 Nisan 2012: Birkaç hafta önce sorunu Emrah'ın VEDOP'la ilgili bir arkadaşına mail atmıştım, o da bakacağını söylemişti (yani içerden birine ulaştım). Bugün 312 06 06'yı tekrar aradım, beş dakika bağlanmayı bekledikten sonra görüştüğüm operatör üzerimde sadece bir araç olduğunu, diğer aracın üzerimden düştüğüne dair not olduğunu söyledi. İnanılmaz ama sorun hallolmuş görünüyor.

Güncelleme, 2 Ekim 2012: GİB'den altı ay önce gelen yazının aynısı tekrar geldi, borcum olduğunu tespit ettiklerini söylüyor, ayrıntı vermiyordu. MTV sayfasına baktım, ne vergi ne de trafik cezası borcum vardı. Yazıyı umursamamaya karar verdim.

Güncelleme, 17 Temmuz 2014: Bir haftadır İş Bankası'ndaki yatırım hesabımdaki parayı vadesiz hesabıma aktarmaya çalışıyor, her seferinde "Satmak istediğiniz kıymet, hesaplarınızda bulunmamaktadır" mesajını alıyordum. Önce müşteri temsilcime mail attım, cevap alamayınca İş Bankası'nın online soru sorma servisine mesaj attım, şu cevabı aldım:
Yapılan inceleme sonucunda Bankamızdaki hesaplarınıza 6266- Yeğenbey Vergi Dairesi tarafından 20140522625000046417 HBN ( Haciz Bildirim Numarası) ye istinaden E Haciz Blokesi işlendiği tespit edilmiştir. E Haciz blokelerinin sebebi ile ilgili olarak Vergi Dairesinden bilgi alabilirsiniz. Ayrıca hesabınızdaki blokenin kaldırılması için Vergi Dairesinin Bankamıza Fek (bloke kaldırma) bildirimi yapması gerekmektedir. Şu an itibariyle Bankamıza yapılmış bir fek bildirimi olmadığı için blokeniz kaldırılamamaktadır. Bankamıza fek bildirimi yapıldığı taktirde işleminiz ivedilikle sonuçlandırılacaktır.
Öncek motorlu taşıtlar vergisi sayfasından ne vergi ne de para cezası borcum olmadığını teyit ettim. Bugün (17 Temmuz) Yeğenbey'in 312 06 06 numarasını aradım, bu sefer bir dakika içerisinde açıldı, TC numaramı verdim, üzerimde (hatalı plakaya ait) 262 + 389TL'lik borç göründüğünü söylendi. Tarfik tescilin zamanında bana yanlış plaka vermesi ile devam eden olaylar zincirini izah ettim, başka birine bağladı. O kişiye yine TC'mi verdim, aynı izahatta bulundum, hatalı plakanın üzerimden düşülmesini ve banka hesaplarıma konan haciz blokesinin kaldırılmasını istedim. Şaşırtıcı bir şekilde "tamam, halledeceğiz" dendi.

Notlar:
  • İş Bankası anlaşılmaz bir mesaj vereceğine hesaplarımda Yeğenbey'den kaynaklı haciz blokesi olduğunu ana sayfada kırmızı büyük harflerle göstermeliydi. Ya acil bir para işim olsa ne halt edecektim?
  • Haciz blokesi işlerken cep telefonuma bir mesaj göndermelilerdi.
  • Yeğenbey maceramız daha süreceğe benziyor.
Güncelleme, 21 Temmuz 2014: Bankadaki yatırım hesabımla işlem yapabildim, haciz gerçekten kalkmış sanırım.

Saturday, February 11, 2012

Book: Seeing Like a State

Seeing Like a State: How Certain Schemes to Improve the Human Condition Have Failed, James C. Scott.,  1998, 445 pages.

Seeing Like a State explains how large scale organizations like states operate and points out typical failures of planning. Most of the examples are from the agricultural sector because of its highly complex nature which in turn makes planning from above prone to disaster. James also reminds us that one of the main goals of standardization is making taxation easier.

It is a warning against being sure of how to correct social wrongs. The main lesson is that any plan should make use of local knowledge, be carried out in small steps and be corrected with actual results. But that requires a culture that values truth, especially when it is not what you want to hear, and that, in my opinion, is the main problem of humanity. As one wise man has said:
It's not that people sit down quietly and determine what is true, and then decide to act on it. Rather, quite typically, they decide what they want to do for the purpose at hand, and devise a belief system that explains that it is only right and just, which they then believe passionately.