Sayfalar

13 Aralık 2013 Cuma

CSS3 How To : 1- Percentage and pixel sizing together easy way calc()

Source: Here
Let's say banner is holding 200px height of the page and we want to calculate client's rest of the page height and hold restOfThePageDiv at same proportion all the time. Mostly we use something like that with using javascript (in this case jquery):
$( window ).resize(function() {
  var bannerHeight = $("#banner").height();
  var restOfThePageHeight = $(window).height()-bannerHeight();
  $("restOfThePageDiv").height(restOfThePageHeight);
});

With css3 calc() ability we can create our page with using only css and html without using any kind of javascript code:







  
  

11 Aralık 2013 Çarşamba

Some hesitations about Object Oriented Design & Development

  Although I am a new at software development domain, with my limited experience, object oriented design and development is a good way to make everyone in the project life cycle (from product owner to devs) understand the concepts no matter what limits they have. Plus, having control over whole development process seems much more easier. I still have hesitations, but in my work environment, it seems the best way to deal with the "maximum outcome in minimum time" problem which is a motto of small-mid size companies. For bigger companies, I think it is also beneficial to measure the total effort and resource that should be spend as well as to hold the surprises at minimum rate. 

  My hesitation comes from this sentence:

"...I have yet to see an interesting piece of code that comes from these OO people..."
source:
http://www.stepanovpapers.com/LoRusso_Interview.pdf

  Even though the article is pretty old; the meaning looks more true these days. While innovation is coming from piece of codes, it is easy to kill them to pass reusability or while reusing the old solutions to the similar kind of problems.


  In addition, the technology inflation is an another matter that makes the OOD&D look ugly which I would want to discuss about, but I have only 15 letters lef... 


11.12.13




6 Aralık 2013 Cuma

JavaScript How To :1- Iterate variables inside of the object

//From the various internet sources.

//Javascript Object ad=> name ; soyad=> surname
var personalInformation = {
    ad:'Önder',
    soyad:'ALTINTAŞ',
    lineOfCodesWritten: 65536

}
//Iterating personalInformation's variables with for loop
// key : 'ad','soyad','lineOfCodeWritten'
// personalInformation['ad'] gives 'Önder' and you can re-set it with:
// personalInformation['ad'] = 'Murtaza'
for (var key in personalInformation){
   value = personalInformation[key];
   console.log(key+":"+personalInformation[key]);
}

Object Oriented Design & Development in Javascript : 1- Class Structure, Inheritance


//Mixed solution from various sources which I cannot remember. Hope it helps
//SuperClass to be Inherited
//Inherit edilecek olan SuperClass
function SuperClass() {
    //Defining class function explicitly
    //Fonksiyonun dışardan tanımlanması durumu
    this.superTest = superTest;
    //Private variable which is usable for only SuperClass
    //Sadece SuperClass a açık olan private variable
    var privateVariable = "aa";
    //Public variable that can be used from everywhere
    //Dışarıdan erişilebilen public variable
    this.publicVariable = "bb";
    //Reaching public and private variables from private method
    //Private methodun public ve private variable'lara erişimi
    var privateFunction = function () {
        return privateVariable + " " + self.publicVariable;
    }
    //Using private variable in a public method
    //Private variable' ın public bir methodda kullanılması
    this.getPrivateVariable = function () {
        return privateVariable;
    }
    //Using private method in a public method
    //Private methodun public bir methodda kullanılması
    this.runPrivateFunction = function () {
        return privateFunction();
    }
    //To make SuperClass's methods be able to reach public variables of the Class
    //Private methodların public method ve variable' lara erişebilmesi için self kullanıyoruz
    var self = this;
}

//Subclass that is inheriting SuperClass
//Inherit eden SubClass
function SubClass() {
    //Inheritance
    //Super Class inheritance olayı
    this.inheritFrom = SuperClass;
    //Running SuperClass' constructor from SubClass (like java Super())
    //SuperClass constructorının çağrılması bu constructor() methodu içerisinde de yapılabilir karar veremedim
    this.inheritFrom();
    //Implementing method explicitly
    //Medhodun dışardan tanımlanması
    this.subTest = subTest;
    //SubClass private method
    //SubClass private methodu
    var subPrivateFunction = function () {
        return self.subTest();
    }
    //Running private method from public method
    //Public method ile private methodun çalıştırılması
    this.runSubPrivateFunction = function () {
        return subPrivateFunction();
    }
    //To make SubClass's methods be able to reach public variables of the Class
    //Private method ve variable' ların public method ve variable' lara erişebilmesi için
    self = this;
}

function superTest() {
    return "superTest works!";
}

function subTest() {
    return "subTest works!";
}


var objectFromSubClass = new SubClass();