3SUM algorithm tweak

http://en.wikipedia.org/wiki/3SUM this is the algorithm. I just thought that I can start from the middle, the rationale is that I have the work done not to be due. I wrote down the value of an example and try to iterate on the outer cycle starting from middle (max value + min value) then down to the […]

Read More…

Solved my problem with knockout

Using a model with nested observable array I did not know how to refer to self in a event handler (click) on a element in a cycle on that observableArray … function subObject(data,index) { var self = this; self._index = index; // … } function MyWholeModel() { var self = this; self.subObjects = ko.observableArray([]); self.currentSubobj […]

Read More…

Static method and testable code

Following this discussion http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&discussionID=130090944&gid=42193 enlight me on use of static methods and relation with TDD, what I learned so far is that is better to define a collection class implementing a collection interface, which has method that operate on collection of object, if this is the intend of the use of static methods. Example: Interface […]

Read More…

Zend Certification: ZCE PHP 5.3

I just passed Zend Certification exam for PHP 5.3 . It means I have paid Zend, first of all. They gave me a printed paper (phisical paper) with instruction on what I can do. It says I can use Zend Certified Engineer icon found in http://www.zend.com/en/services/certification/zce-logo on my CV and site. This is the one that […]

Read More…

Some Terms: Registry Pattern, object hash

I would talk about a pattern whose name I fail to know before, giving it the name of multi-singleton. Registry pattern I read about it in PHP 5 certification study guide from php|architect’s series. This is the example given: class Registry { private static $_register; public static function add(&$item, $name = null) { if (is_object($item) […]

Read More…

Moving development to the extreme

For sparing time, you end up wasting all time. A colleague, when first time talked my about XP (more than 10 years ago), said something like “It’s wonderfull. You are much quicker. You know it? Beautifull: you write tests, and then …”, and me “tests?!?”, “yes, then the system continue to work along time .. […]

Read More…