Online lectures: Udacity

This is the third part of a short series about my experience with online education.

I took two Udacity courses – Design of computer programs and Intro into statistics.

There are things I like about Udacity and things I don’t. Unfortunatelly, those that I don’t like are the important ones for a online education platform.

The good things are that there are wise people building the platform. Technically, it is very good. I like that they use the Youtube player or the smooth transition between video playback and in-lecuture quizes. In some programming courses, you have a Python interpreter directly embedded in the browser window. They also built relationships with potential employers of Udacity “graduates”. All of this is smart and helpful, yet it doesn’t help with the main problem.

Udacity is not a good place to learn.

In my opinion it is mainly because of the format of the “lectures” – 2 minute videos are just too short and, as crazy as it might sound, I had trouble keeping my attention focused exactly because of this. Two minutes is not enough to pass on any principle. You try to keep it them in your head but the constant video switching suck. It interupts your train of thought.

Also, it doesn’t help that you can’t easily see the code or examples written previously and so you get stuck thinking “Why is it this way? What did the lecturer mean? How is it supposed to work?”. If you are not thinking exactly the same way as the lecturer, you’re going to have trouble following him.

The 2 mintue videos are at the heart of Udacity as you can hear from Peter Norvig in this TED talk, yet I hope they change it, and also improve on the other problems I’ve encountered. Until they do, I’ll prefer sites like Coursera.

Python pre-commit hook

This is a pre-commit hook I use in my Python projects.

Nevermind my feak bash-fu, in the end the script does what I want it to – the three following things:

  • First, it checks if I haven’t forgotten to add a new module to the requirements.txt file. Most of the time this works like a charm with virtualenv and pip. The only drawback is installing modules in local experimental branches – these modules are not necessary in upstream branches and so they don’t belong to requirements.txt yet. When you switch back and want to commit in an upstream branch, the pre-commit hook fails. However, this is easily avoidable by using the --no-verify option of git commit.
  • Second, it runs pyflakes on all the .py files in the repository. If there’s something pyflakes doesn’t like, the pre-commit hook fails and shows the output of pyflakes. There’s one case which is ignored and that is using the _ (underscore) function from the gettext module as install makes it available everywhere. Pyflakes documentation is non-existent and I guess there’s no way to create a configuration profile for it, so I had to resort to this hack.
  • Finally, since I deployed code with forgotten set_trace() calls a couple of times, the third thing the script does is it checks for these and prints out the file and line number if it encounters any.

I keep this file as a part of the repository, making a symbolic link to it in .git/hooks/pre-commit. Make sure the file is executable.

    Do you have similar stuff in your VCS hooks? Is there anything I could improve in mine? I’ll be glad to see your tips in the comments.

    Getting the cellular network information on your iPhone

    I got this neat little trick from my colleague Petr. Dialing *3001#12345#* on your iPhone launches a hidden app called Field test. In it, you’ll find a lot of detailed information about your network. You can disable wifi to see even more data.


    To be honest, I don’t even know what half of those values mean, but you can easily Google for them. The EF-ICCID value in SIM Info can be useful even for non-developers. It’s the ID of your SIM card, the one your operator often times asks for. This way, you don’t have to take out the card from the device.

    Server-side verification of Google Play subscriptions

    TL;DR To programatically verify Google Play subscriptions, you have to use the OAuth 2.0 for web server applications auth flow, not service accounts. This is a massive FUBAR on Google’s side and makes life of developers very painful.

    Lately, I’ve been working on the backend part of a upcoming app we’re developing for one of our clients. This app offers monthly and yearly subscriptions, so I had to implement a check if the recurring payment happened, the credit card got billed and the app provider got the money. Of course, for multiple reasons, this has to be done server-side, completely automatically and without any intervention from the app user or provider.

    Google provides an API called android-publisher for this. To use any API from Google, first you have to enable it from the Console and then authenticate with it. The authentication is done via OAuth 2.0. As Google offers API access to many of their services which are used in different occasions, they also offer different OAuth 2.0 authentication flows.

    The flow/mechanism for server to server communication is called Service accounts in Google terminology. This is precisely what I needed. However, for reasons beyond my understanding, this is not the one used for android-publisher API. Instead, they chose Web server applications flow, which for this use case is absurd.

    (Sidenote: When we started to build the aforementioned app, recurring transaction were not even available for Android. We planned to use Paypal as we did for the Blackberry version. However, during development, Google introduced subscriptions for Android which made us happy.

    I started reading the docs and implementing the whole auth and check code, but it didn’t work; I was getting “This developer account does not own the application.” HTTP 401 error. Googling for this didn’t help – at that time, the only search results were two couple of hours old questions on Stack Overflow. I would swear the docs at that time mentioned to use Service accounts for authentication and later Google changed it. I had to re-read the docs from the beginning to debug this infuriating error.)

    Using Web server applications flow is ridiculous because human interaction is involved. At least once, you (in this case our client!) need to press an “Allow” button in you web browser. Palm, meet face.

    Here are the instructions you need to follow to achieve automated subscription verification. The code is in Python but it’s easy to adapt.

    First of all, in the Console, you need to create a Client ID for Web applications. You can use http://localhost as the redirect hostname. As you’ll see in a minute, it doesn’t matter much. You mostly need the Client ID and Client secret.

    Next, fire up the Python REPL and enter this:

    Use the Client ID and Client secret you obtained from Console. This piece of code will give you an authentication URL; by default, it will contain access_type=offline parameter. This is very important, make sure it’s there. Open the URL in your browser and log in with the Google account that you will be using for publishing the Android application. After a successfull login and authorization, you’ll be redirected to localhost in your browser. Unless you’re running a webserver locally, this will probably fail, but it doesn’t matter. The address you are redirected to will contain a code parameter. Copy its value and go back to the REPL again:

    Finally you’ve got an instance of the oauth2client.client.OAuth2Credentials class. It contains couple of properties but the only one that’s really interesting is the refresh_token. Store the refresh token to your server configuration, you can use it forever meaning until someone does not revoke the access to the API. Then you would have to got through this whole process again.

    Basically, thanks to this refresh token you will able to obtain a new access token on each call to the API. To do that, you create an instance of OAuth2Credentials and use that to authorize an httplib2.Http object:

    You can now build a service and call the get purchases API call.

    The following gist summarizes the whole blogpost:

    As long as the API access will not be revoked, you should be fine using this method.

    In praise of the future

    We’re living in the most exciting era of mankind. The scientific progress of the last hunderd years is just astonishing. This makes me happy.

    The Internet is just a little over 20 years old but now all of man’s knowledge is available to anyone with a connection to it. Thank you Sir Tim Berners-Lee. We have autonomous cars and planes; 100 years ago, man wasn’t able to fly at all. We have built a large underground tunnel to ram particles against each other really fast and discovered the Higgs boson. We have put a nuclear powered rover on Mars.

    With this amount of recent progress, can you imagine what’s waiting for us in the future? I hope for a squad of on-demand robots that will print a house according to my personal design. If I won’t be able to have a holiday in space in 30 years, I will be disappointed. Oh, and please, someone, bring back public supersonic flights.

    Online lectures: Technology entrepreneurship (a.k.a

    This is the second part in a series about my experience with online education. Some months earlier I wrote about taking a couple of online classes. This second post is about Technology entrepreneurship class.

    Spoiler alert – this class was a big disappointment. A waste of time, really.

    The promise of was to form a team and build a company. This fact alone should have been a warning sign, but I was optimistic and eager to try it out.

    For the first two assignments, the system automatically diveds students into teams of 10 based on geographical location and language preferences. This worked well. When my teammates were chosen, I sent a first email saying hi to all of them. Just one replied.

    The first assignement was that everyone of us should come up with either a best or worst business idea ever. We were supposed to fit it into the business model generation canvas. This was an easy and fun task and was supposed to bind the team together. Unfortunatelly, only one other member (Hi Carlos!) from my “team” participated.

    Next, we were given an idea created by some other team in the first assignment and were supposed to create a business pitch. Either a slide deck, a video or a text selling the business to potential investors. Again, as with the first task, only two of us participated. I was starting to get annoyed.

    These two tasks, however, were supposed to be just warm-up duties. The “real” would be the next one. We were instructed to create a 3 or 4 person teams (could be from the current teammates or any other enrollees). I sent another mail to my current team, again with no reply but one. Since they have been inactive for the whole course, I decided to post to the forums, looking for a team, advertising my skills. As I should have known, people who responded we’re “business types” looking for a iPhone developer to build their awesome SoLoMo app idea that’s better than Foursquare. I’m not kidding here, this really happened.

    Irritated by the whole experience, I decided to spend my time more productively and quit This experiment was a failure.

    There were also other mishaps resulting from the rest of the teammates not communicating, but I won’t go into details as they are not that important.

    Another defect of the class was the organization of study materials and video lectures itself. It was just chaotic. I understand that it is the first year and so I hope they’ll improve it.

    Yet I believe the whole premise of this course is flawed. You just cannot pick people at random, put them together and think they’ll build a company even if it’s the aim of every single one of them. If this course taught me anything, it was that building a company is all about people. Surround yourself with the right ones.

    Online lectures: General Assembly

    This is the first part in a series about my experience with online education. Some months earlier I wrote about taking a couple of online classes. This first part is about General Assembly.

    The Fundamentals of Entrepreneurship online course is just awesome. Really. It beats reading articles on HN hands down. It’s the best advice on “how to build a company” I came across. The tutors are experienced and give great advice. Lecures are clear, concise and to the point. Even if you already have started a company, sign up for the coures. You’ll find a lot of valuable info about how to make it even better.

    My favorite lecture was on building communities and delighting your customers by Alexis Ohanian. I find this topic very interesting and often overlooked. There’s not much information about it on the web and what Alexis shares is of the highest quality. It almost feels like he’s letting you in on some kind of well-kept secret. Alexis recently published a book on this topic, I highly encourage you to buy it.

    If you’re not based in the US, you can skip the class on how to incorporate, but otherwise, I highly encourage you to sign up and go through the other lectures.

    The downside is that after finishing, you’ll want more. This stuff is so good it’s adictive. If you’re living in NY, you’re lucky. GA offers a lot more in their space. Some classes are live-streamed, but not all of them. For the rest, you’ll just have to move there.

    Any tips on acquiring visa?

    Displaying currency pairs in the Stocks app

    Hat tip to my friend Petr for showing me this trick.

    Did you know it is possible to display currency pairs in iOS Stocks app? Because it uses Yahoo Finance API, it is quite easy. For example, if you want to add EUR/USD, search for “EURUSD=X”.


    You can of course change the currency symbols and the selected currency pairs are also displayed in the notifications section. This nifty trick makes the Stocks app much more useful for me.

    13 virtues of Benjamin Franklin

    I’m currently reading The Autobiography of Benjamin Franklin. If you have a Kindle, you can get it for free.

    In this book, Mr. Franklin recollects 13 virtues he lived by:

    1. Temperance. Eat not to dullness; drink not to elevation.
    2. Silence. Speak not but what may benefit others or yourself; avoid trifling conversation.
    3. Order. Let all your things have their places; let each part of your business have its time.
    4. Resolution. Resolve to perform what you ought; perform without fail what you resolve.
    5. Frugality. Make no expense but to do good to others or yourself; i.e. waste nothing.
    6. Industry. Lose no time; be always employ’d in something useful; cut off all unnecessary actions.
    7. Sincerity. Use no hurtful deceit; think innocently and justly, and, if you speak, speak accordingly.
    8. Justice. Wrong none by doing injuries, or omitting the benefits that are your duty.
    9. Moderation. Avoid extreams; forbear resenting injuries so much as you think they deserve.
    10. Cleanliness. Tolerate no uncleanliness in body, cloaths, or habitation.
    11. Tranquillity. Be not disturbed at trifles, or at accidents common or unavoidable.
    12. Chastity. Rarely use venery but for health or offspring, never to dulness, weakness, or the injury of your own or another’s peace or reputation.
    13. Humility. Imitate Jesus and Socrates.

    What I find even more interesting then this list of virtues is how he implemented them in his life. He seeked to acquire them all, but he didn’t try to do it all at once. By his own words:

    I judg’d it would be well not to distract my attention by attempting the whole at once, but to fix it on one of them at a time; and, when I should be master of that, then to proceed to another.

    In fact, the list is orderd in the way he trained himself in these traits. As Benjamin Franklin was considered one of the most honorable persons of his age, his approach together with his will obviously works. You can read more about it in the book.

    Programming for iOS from the point of view of a python developer

    I gave a talk at Prague’s python user group meetup. It was about my experience of learning and using Obj-C to develop iOS apps as a python developer. You can check out the recorded video below. Slides are on Speakerdeck (I tried to embed them but Posterous doesn’t play nicely with Speakerdeck).

    A huge thanks to Jiří, Aleš and Jakub for inviting me and everyone else who attended.

    Why you should create your app for iPhone first

    We have a wide range of clients and projects going on at Wildfuse at any time. If we’re builiding multiple mobile clients as a part of the same project, we always recommend to have the iOS application built first. It’s not because it’s faster or cheaper. There is one simple reason for it:

    Influential people have iPhones.

    By influential, I mean people who can help you. Investors, advisors, bloggers, connectors. People with a loud voice, opinion makers, passionate people who can spread the word. You will want to show them the progress you’re making first.

    There’s nothing more to it. It’s simple, but it works. Stick to this rule, it will help you.

    Beginning my online education

    The world of online education is booming right now. It feels like we’re at the beginning of a major disruption of higher education. Although I don’t think this will put the top universities out of business (but they might have to transform to more of an R&D institutions rather than “only” providing education), I believe the less prestigious universities do have a problem.

    The whole boom started with the excellent Khan academy. Salman Khan paved the way and inspired other people to provide education through a web browser to thousands of individuals all around the world. I too felt a hunger for new information and reading HN just didn’t cut it anymore so of course I jumped on board. Here are the courses I’m taking:

    • Fundamentals of entrepreneurship at General Assembly – I cannot recommend this course highly enough. If you’re starting a company, spend time going through the lectures. Seriously, it’s the best you can do for your business right now. I’ll blog about this later in more detail.
    • Design of computer programs at Udacity. This course, together with 3 others, starts April 16th, so you still have time to enroll. Udacity should also provide a Distributed systems course later in the year which I’m looking forward to.
    • Technology entrepreneurship a.k.a You can find more about it in Chuck Eesley’s blogpost.
    • Human-computer interaction at Coursera. Although it was supposed to start in January, it has been delayed due to some licensing/administrative issues. However Coursera provides a wide range of other topic. I was also thinking about taking the Natural language processing, which started just recently, but that would be overwhelming. I’ll keep that one for next semester.
    • I also visit often to learn about new technologies and techniques. The quality of speakers at conferences differs widely, but the topics covered are very interesting. Similary, I found Google Tech Talks to be ok, but usually the name of the video is much more promissing then the actual talk.
    • There’s also MITx, but it’s just getting started. There’s only Circuts and electronics course available at the moment. I’ll pass for now, but I’ll keep an eye on them.

    These are, of course, all technical. I’m a developer after all. Coursera promises to cover non-IT topics like chemistry or physics later on. For now, you can find a ton of material on diffrent topics on the aforementioned Khan academy.

    I’ll report back with my opinions about each of these courses on this blog so be sure to follow me if you’re interested.

    Disrupt – the book

    The word disrupt has lost its meaning in the recent years as thousands of tech startups are using it to look cool and hip, as if it would help them to succeed. If you look at new companies pitching their ideas at the TC Disrupt conference, only a minority of them are disruptive.

    However, finding industry-transforming ideas isn’t all that hard. In his book Disrupt: Think the unthinkable to spark transformation in your business Luke Williams introduces a solid and easy to understand framework how to come up with disruptive ideas. It is applicable to any industry or product. If you follow the steps outlined in this book, you will learn how to formulate a set of disruptive ideas, improve upon them, pick the best and most meaningful ones and test them in the real world.

    The book is suitable for entrepreneurs thinking about a new product as well as establishes companies looking for reinventing themselves. It’s a book I highly recommend.