Sunday, June 23, 2013

reduce in javascript

Despite the simplicity of javascripts nature, this language has nice instruments, that allows us to use the power and expressiveness of some features that came from functional languages. Map, filter, reduce are widely used in functional languages (clojure, haskell, lisp e.t.c).  In this article i will show you some interesting cases of using reduce method.  All examples will be written in both - javascript and coffeescript, to demonstrate how coffeescript improves code expressiveness and readability.

Sunday, January 20, 2013

Upload images to Google App Engine(GAE) with Flask

As you understood, this article is about uploading images to GAE. Actually, this article is mostly for beginners and covers only basic concepts, but when i started to learn GAE platform i missed such kind of tutorial a lot. So, to get started, let's take app from my previous GAE tutorial from here.
I decided to add our photo upload functionality as a separate python module and wrap it in flask blueprint. Let's create it inside of gae_flask_app dir and name it upload_photo. It would be great for you to get familiar with my previous article to deal with gae_flask_app structure.

Wednesday, January 16, 2013

javascript functions partial evaluation

Recently i discovered a very useful and powerful feature - functions partial evaluation. This feature comes from functional programming languages, and gives us possibility to init some functions arguments before calling this function itself.
At first,  i looked at existing implementations in some popular frameworks - such as underscore e  t. c. and find out, that there is no magic in implementing this. After that i looked at some simple implementations,  they were quite good, but had some limitations, so i decided to upgrade them to get what i wanted.  Here are some of implementations that i found :

Sunday, December 23, 2012

Coffeescript's destructuring assignment is cool

This article is about feature that can simplify your life while you are writing on coffeescript.

This feature saves you from writing boilerplate code for accessing objects properties.

Saturday, August 18, 2012

Launching Flask on Google App Engine (GAE)

In this article i want to highlight some aspects of launching flask framework on GAE platform. I have investigated some time in this platform, and came to conclusion that flask is a good choice for building web applications on Google App Engine platform because this framework is lightweight, flexible and doesn't relate to some special kind of data storage.
So let's get started!
For the beginning you must be familiar with basics of building GAE apps. If you are not - i suggest you to pass "get started" tutorials here (for python2.7). As Google App Engine has already good support for python2.7 i decided to show example based on this version, but  it has almost no differences with 2.5 version example.
Sources are available here

Tuesday, August 14, 2012

url_for for Spine.js

Recently i discovered a new wonderful language  - Coffeescript. As front page of Coffeescripts website says - "it's a little language that compiles into javascript". Good it's or not, but nowdays javascript and HTML5 are the most convenient tools for implementing rich client web application. And Coffeescript makes our life much easier.

Spine.js it's a great choice if you building your client side on coffeescript. It's written in coffeescript, it's source code is easy to read and understand. And another thing that i like in Spine.js - is that it can be easily extended.

And, after playing some time with it, i found that it misses one useful feature - possibility to generate url links dynamically =(. As in some python web frameworks, like Pylons, Flask or Django, when we know the name of controller and the action - we can generate url for some handlers in templates. I have not found how i can do this in Spine.js - so i decided to implement it by myself.

Saturday, April 21, 2012

Voicing messages in python, or fun with Google Translate.

This will be a quite short article, that will describe how to voice some text via using google translate. I don't know where we can use this, but i am sure that you may face situation, where this feature will be useful. Besides, as for me - it's also simple and interesting.
I decided to create python package "speak" that will give us functionality for voicing string messages. As for example i will simplify the implementation of the package, so don't judge the source code too strict.

All source code is available on bitbucket. But first i suggest you to follow this article, write some code by your self and if something is going wrong check my sources.