—
Tom Cargill
Who am I?
—
Tom Cargill
If he/she was really born to program, it wouldn’t be in PHP…
— Mike Tyson
The python zip built in function is described like this:
This function returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables.
Which means that:
zip((1, 2, 3), (4, 5, 6))
gives:
[(1, 4), (2, 5), (3, 6)]
In appsflyer, for some of our analytics aggregation, I get rows of daily data aggregated data that I need to aggregate further according to the selected date range which practically is summing up the columns.
I came up with this simple code that does the job:
rows = [(1, 2, 3),(4, 5, 6)]
map(sum, zip(*rows))
gives:
[4, 6, 8]
At appsflyer, we provide our users reports as charts but also as downloadable csv files.
The creation of the csv files includes exporting documents out of couchdb to tabular format which means we have to map hierarchical documents to rows.
In order to achieve that we created dictmapper, a python library to transform documents to flat structures and open sourced in on bitbucket.
Have fun!
In this post I will describe how I worked with coffeescript for developing the chrome extension of appsflyer.
First of all, coffee-watcher is a must IMO. What it does is to watch .coffee files in a folder and compile them to javascript files as they are saved. At first I thought, what’s the point? One of the nice features of dynamic languages is the no need for compilation. With coffeescript however it felt more like validation and less like compilation. It actually made me feel confident about the code I write, something that is lacking in javascript.
Since I created a chrome extension and in order to publish chrome extensions you generally zip compress a folder and upload it, by default the .coffee files will be packed as well. This can be easily handled by a script however I was lazy and just hardlinked (using the ln command, on windows you can use junction) the output javascript file from coffee-watcher to the extensions folder.
If you know something about chrome extensions, then you probably know that content scripts which are the components used to interact and manipulate the DOM of the webpage itself, are just javascript files. This means that adding html to the page can be a pain, unless you consider messing around with javascript string concatenation fun. With the help of coffeescript’s heredocs to hold html markup and Mustache when you need templating, this problem is easily solved.
After creating a chrome extension with the help of html5, I am convinced that the browser is a viable runtime environment for rich application. For the next projects I plan to use backbone.js or something similar.
The introduction of the iCloud made me re-think a product idea I had before.
I once thought that it would be cool to have a product like the eye-fi that will send a photo from your high-quality camera to the iPhone, iPad or Android device for quick editing (instagram style) before sharing. Eye-fi has an mobile app that can do something like that however I don’t own a card so I never tested it.
Now, with the iCloud, if you had a (lets call it) iCard, you could turn every digital camera to an iCloud enabled device with seamless iOS devices (and OSX) integration.
I am an Android user.
I started with the Samsung Galaxy, moved to the Nexus One and moved on to the Samsung Galaxy S.
In between, I had an iPhone 3GS for a short while, hated every minute, and just wanted to go back to Android. It had nothing to do with multitasking and technical stuff like that. It was all about the basic stuff like user experience in the broader meaning.
The iPhone’s contacts management is terrible. I manage my contacts in Gmail. Synching to Android is transparent (obviously) but synching to iPhone was a nightmare. Setting it up was confusing, it messed up my contacts in Gmail, a cable was required (is it the 90’s?) and updating in one place (Gmail or iPhone) required another synching. Having it as master(pc)-slave(iOS) is just stupid.
It appeared to me that Apple are on a crusade to make iTunes the center of the world and that nothing could change that.
Apparently I was wrong…
But wait, one more thing I couldn’t stand about the iPhone lame notification system - an annoying and ugly popup. The Android’s notification drawer is so much better (as Apple indirectly admit with their new notifications system). Was a javascript’s alert the best apple could come up with? Even now with the new notifications it amazes me that a company like Apple released such a none user friendly feature.
Here I want to take the opportunity and close some open bills with iPhone groupies I know. They are so into following apple blind-folded, they actually tried to convince me that the popup notification the best notification system! Well apparently you were wrong…
One more thing that the iPhone misses is a back button. A real back button that can get you back from a browser window to the app that opened it. The crippled soft back button can’t do that and I use it a lot. I don’t consider closing the browser and then looking for the application again a good user experience. Please don’t argue on that groupies.
The home screen of the iPhone is a issue in itself. Dropping all the installed apps over there (and the folders don’t really help) make it looks like a feature phone on steroids. Cleaning it up and adding widgets could really help.
As I stated before I am an android user and a happy one. However, the iCloud is amazing, it is actually something that can make me move to the other camp. It took the good things that android had and did it even better. When I take a picture with my Android phone, I have to “explicitly” upload it to picasa. With iCloud it will just be there (if I got it correctly) as it should be.
I just hope that the iPhone 5 will have a back button.
I recently left my job to try to bootstrap something on my own (http://appsflyer.com).
Originally I am a .net developer with extensive experience with server-side technologies but I decided to make a transition and move to Python since I felt that the innovation happens on the Python/Ruby side. Besides, I always want to remove the shackles of static languages and I felt the the .net community follows the java community and embraces over-engineering.
It takes time to develop working habits, but for now here is how I work:
I usually use ipython first of all for prototyping. It is awesome to have something like that for a C# developer who used only to a compiler and a debugger.
After I got my results, I use the %hist -n command to get the command history, copy it and paste it to the text editor (PyCharm) for proper formatting.
Since Python does not require the boilerplate of C# to create an entry point, it makes sense to start with a script and then refactor it to classes and methods.
One of my favorite features of ipython is the embedding feature of ipython that lets you run a script and then work on the results in the interactive shell. Same goes for the %run command.
Improving my working habits and being more effective is a subject that really interests me and I would be happy to hear about more techniques for self improvement.
I want to share the idea of a pet project I currently work on.
As the title suggests, it is a site for bookmarking movies. Currently I code-named it Stardust.
Why?
Wandering through the internet (imdb for example), I encounter a lot of movies I know I would like to watch, however, when I want to watch a movie, all these movies just pop out of my head and I can’t seem to remember none!
I usually end up just selecting a film that plays in a close by theater. It’s the same when watching a movie at home.
I am starting with with a basic and simple web application, but hope to continue with a mobile app and with features such as map display of theaters showing your bookmarked films.
I would love to get feedback - for both motivation and more ideas. You can leave a comment hear or ping on Twitter (@reshefm).
Gedit - When trying to close an unsaved document in Gedit a dialog tells you how much work will be lost based on the time since the document was...