Taner Şenyurt

Kişisel gelişim sitesi…

Ruby’de Sayiyi Yaziya Ceviren Program

March31

Ruby ile yapilmis sadece algoritma gelistirmeye yonelik bir calisma .Konsol programi olmakla beraber eger istenirse glade ile arayuz yapilip ve ya bir kac degisiklik yapilarak eklenti haline getirilebilir.Ornegin doviz birolari icin verilen paranin miktarini gonderip turkce okunus karsiligini geri gonderen bir fonksiyona donusturulebilir.Herneyse olayin genel mantigini anlatmak gerekirse eger turkce sayilarin okunusuna dikkat ederseniz,ilk uc haneden sonra bundan sonra gelen hanelerin sonuna basamak adi getirilerek devam edilir.Bir kac ornek ;
321 = Uc yuz + yirmi + bir
234754 = iki yuz +otuz +dort - bin – yedi yuz+ elli +dort // goruldgu gibi uc hane seklinde tekrarlaniyor sadece her uc hanede bir basamak adi ekleniyor.
Ozel durumlar :

  • Sifir sayi icinde gecerse okunmaz tek oldugunda okunur.
  • Normalde iki yuz,uc yuz,dort yuz gibi okundugu halde bir yuz okunmaz
  • Ustteki duruma benzer olarak bir bin okunmaz buna ragmen bir milyon ve sonrari okunur
  • Bu durumlar goz onunde bulundurularak bir kod yazmak istersek kisaca yazacagimiz kod soyle olmalidir.Sayimiz kac tane uclukten olusuyor.Bu uclukleri sirasiyla yazdirdiktan sonra (sayi degerini basamak degerini falan bulduktan sonra).Push yapip stack’a atiyoruz her atma olayindan once kacinci basamakta oldugumuzuda konrol edip sonuna ekliyoruz ki pop yaptigimizda sonucumuz sirali gelsin.Peki ama sayimiz ucun kati degilse bu olusacak ucluler patlamayacakmi bunuda en sondaki kalan kisminda tekrar baska uclu varmiscasina ama kac haneli olduguna bakarak ve ozel durumlarin ustesinden geliyoruz.
    Read the rest of this entry »

    posted under Linux, OS, Programming, Ruby, Uncategorized | Comments Off

    Ubuntu Volume Wheel Problem [ Fix ]

    March29

    I have a toshiba u305-s5077 laptop.It had a problem with volume wheel like when i tried to use volume wheel it makes the volume iteratively maximize or minimize(And it has no end).While it is happening i cant write anything or i cant click something.That’s why i had to restart X screen with CTRL+ALT+BACKSPACE.

    I search the internet and i found a solution for it.
    At first if it won’t work if you don’t want to kill X screen at least you can use this;
    Change your status to text mode via using CTRL+ALT+ {F1-F2-F3-F4-F5-F6}.Then turn back X Screen with ALT+F7.

    Lets make it works:
    Firstly lets create a backup if it wont work or if something goes wrong we can handle it.
    Read the rest of this entry »

    Google Android

    March5

    Lets develop mobile applications with using google android SDK.

    Firstly we have to download Eclipse (at least i download it :-P ).From Eclipse.Org

    after that extract it some where and open Eclipse 3.4 Ganymede

    1. Start Eclipse, then select Help > Software Updates….
    2. In the dialog that appears, click the Available Software tab.
    3. Click Add Site…
    4. Enter this as the Location:
      https://dl-ssl.google.com/android/eclipse/
      Alternatively, you can use http in the Location URL, if you are having trouble with https (https is preferred for security reasons).
      http://dl-ssl.google.com/android/eclipse/
      Click OK.
    5. Back in the Available Software view, you should see the plugin. Select the checkbox next to Developer Tools and click Install…
    6. On the subsequent Install window, “Android Developer Tools”, and “Android Editors” should both be checked. The Android Editors feature is optional, but recommended. If you choose to install it, you need the WST plugin mentioned earlier in this page. Click Next.
    7. Accept the license agreement and click Finish.
    8. Restart Eclipse.

    After all these operations lets add our SDK.Download sdk from here

    Extract your sdk somewhere and add your sdk’s path with clicking Window->Preferences-Android

    then with using browse select your sdk location. That’s it.Lets watch how its simple to write code for mobile phones.
    Read the rest of this entry »

    posted under Java, Programming | Comments Off

    Encoding mysql dump file while importing from console

    March2

    If you are working with big databases we can not import dumb file from phpmyadmin or something like that.That’s why we have to know how to import dump file over console.

    1. mysql -u root -p database_name < dump_file

    Sometimes, specially if our applications uses other languages than English, we have to define which encoding type we gonna use. In that cases we can select the default encoding just like this:{at least it worked for Turkish}

    1. mysql -u root -p database_name < dump_file –default-character-set=utf8