Programming

Polymorphism (Overloading)

Polymorphism { Overloading } means simply, same methods makes different jobs in different objects.Like how ?
Let’s say we are writing java code and we are using JCheckBox ,JTextField and JButton components.When we try to use setText method for all of them the response suppose to be same,but checkbox writes the text near to checkbox icon ,textfield writes to text into itself and button object writes to text on the button.It shows us the polymorphism because same method worked different for different object.This property called polymorphism or overloading.
› Continue reading

Tags: , , ,

Tuesday, May 19th, 2009 C & C++, Java, Programming, Uncategorized 1 Comment

Difference between C++ Class and C struct

C struct and C++ class structure is similar but by the default they have a difference in data hiding.
In struct doesn’t provide data hiding by default but class provides data hiding by default.
And the other difference is, class provides us to polymorphism and inheritance features.
We said class structure data hiding is coming default but what it means?
It means when we have a struct it is public by default so we can access our struct model wherever are we

  1.  

By myCar i can access my model,horsePower or producer because it works like public variable but same structure with class
like › Continue reading

Tags: , , , , , , , ,

Thursday, May 14th, 2009 C & C++, Programming Comments Off on Difference between C++ Class and C struct

Gcc 4.3 and Header issues

I’m using gcc 4.3.3 version and nowadays i’m trying to write hybrid file transfer system with c++ on Linux.The problem is i used to use some function in c or c++ like strcmp() with including string library but now when i try to compile I’m getting some error like
error: ‘strcmp’ was not declared in this scope
Simple example code
In gcc 4.1 version i can compile this code without any error or warning

  1. #include <string>
  2. #include <iostream>
  3. "gccHeaderIssue","gccHeaderIssue""kelimeler ayni"

› Continue reading

Tags: , , , , , , ,

Wednesday, May 13th, 2009 C & C++, Linux, Programming, Uncategorized 1 Comment

Ruby’de Sayiyi Yaziya Ceviren Program

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.
    › Continue reading

    Tags: , , , , , ,

    Tuesday, March 31st, 2009 Linux, OS, Programming, Ruby, Uncategorized Comments Off on Ruby’de Sayiyi Yaziya Ceviren Program

    Ubuntu Volume Wheel Problem [ Fix ]

    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.
    › Continue reading

    Tags: , , , , , , , , , ,

    Sunday, March 29th, 2009 C & C++, Linux, OS, Programming, Tips, Uncategorized 2 Comments