Posts

Showing posts with the label design pattern

Python yield paradigm

Image
Python yield paradigm Table of Contents generator or iterator generator pipe coroutine concurrency The yield keyword in python language is its landmark and invention, it is not just a language syntactic and feature, it lets python programming rocks in the functional programming way. Here in this article, I try to collect all the yield magic here to surprise the python newbie. 1 generator & iterator "yield" is the keyword that to make a generator in python, so what the generator is? Before that, I just try to explain what the Iterator is first? An iterator is an easier and more common concept in objective oriented languages, take java, for example, basically, every container can be converted to an iterator. List < String> namesList = new ArrayList < String> (); // add 3 names namesList.add( "moses" ); namesList.add( "jacobs" ); namesList.add( "davide" ); // iterate via Iterator Iterator < Str...

Dropbox Hacking

Image
Dropbox hacking Table of Contents Background How Dropbox implement its command mode? Loading image from serialized data 1 Background Yesterday, I upgrade my ubuntu into Trusty Tahr, the development branch of the newest ubuntu. Dropbox is one of many problems after the upgrade, although I found the solution finally, I discovered that Dropbox's technology to release software is worth hacking. Another reason to hacking Dropbox is that I love it so much, my daily works in computers depended on it, it is the coolest cloud storage tool, absolutely the best one. The first time I run dropbox after I install it, it emits a dialog to indicate the progress of download a package from its website, which is the real program to does the sync job, and its default install location is ~/.dropbox-dist. I think that's so cool, and I wanna learn how to do it. This article is hacking Dropbox release package in a linux environment. I tried to hack its Mac OS X's package,...

Chain of Responsibility design pattern

Chain Of Responsibility design pattern Table of Contents 1 What is it? 2 Practice this pattern in C 1 What is it? According to Gof95, Chain of Responsibility belong to Behavioral Patterns. The definition of this pattern in Gof95 is: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. 2 Practice this pattern in C In wikipadia , it gives an example code to illustrate this pattern in java code. And I translate those code into C. I upload the source code into the github. chain of responsibility in C