Sonntag, 2. Oktober 2011

Measuring compile time to check overclocking of cpu

Step 1:
Use standard cpu clock and a source of medium size:
    time -p ./configure && make
and note down time next to 'real'.

Step2:
Remove sources, extract again, overclock cpu and run

    time -p ./configure && make
again. Compare the value next to 'real' with the noted down value.

Dienstag, 27. September 2011

Dienstag, 30. August 2011

Styling Browser Validation Messages

With HTML5 there came the great power of using the browsers built-in validation methods for <input> fields. Some days ago I heared a co-worker arguing that it's not possible to style the error messages generated by the browser. It's just wrong. You can style them, they are using pseudo classes and, of course, every browser uses different pseudo classes:

Firefox: https://developer.mozilla.org/en/CSS/%3ainvalid
Chrome [Webkit]: http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css (search for 'bubble' there)

Sadly, if you want to use it today, you have to implement a fallback for IE.



Donnerstag, 25. August 2011

Coding Backwards

Now this is a really cool idea how to get a gerneral idea of the design you really need (and this is NOT the design that comes to your mind FIRST):

"I decided that I’d [...] write out a script using the yet unwritten API. I’d reverse-engineer a good design by pretending I’d already written one!"

"A better design quickly appeared when I forced myself to preemptively eat my own dogfood. Instead of shoehorning use-cases into a class structure I’d already designed, I coded backwards and the opposite happened: a design evolved from daydreaming about an API that I’d like using."

SOURCE: http://jameso.be/2011/08/19/coding-backwards.html



Montag, 25. Juli 2011

For all your opacity needs

in this order:

opacity: .5; // for all other browsers
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; // for IE8
filter: alpha(opacity=50); // for IE5-7

Samstag, 23. Juli 2011

JS Module Pattern

var someModule = (function(){
//private attributes
  var privateVar = 5;

  //private methods
  var privateMethod = function(){
  return 'Private Test';
  };

  return {
    //public attributes
    publicVar: 10,
    //public methods
    publicMethod: function(){
      return ' Followed By Public Test ';
    },

    //let's access the private members
    getData: function(){
      return privateMethod() + this.publicMethod() + privateVar;
    }
  }
})(); //the parens here cause the anonymous function to execute and return
        
someModule.getData();
SOURCE: http://addyosmani.com/resources/essentialjsdesignpatterns/book/