Great resources on web performance optimization

Both from Ilya Grigorik:

1. Optimizing Performance fundamentals on Google Developers site
2. High Performance Browser Networking book, free to read online

Advertisements

Build vs Buy: Appcelerator Cloud API Case Study

A lot of times a project at hand has some components that can either be built from scratch, or a ready-to-use solution can be bought from a 3rd-party vendor. For example, there’s lots of ways to build a blog or a CMS, but most likely you will just use one of the many solutions already available on the market (such as WordPress).

One of the projects I have at work has a star rating component, and we had a vendor in mind – Poll Daddy (interestingly enough owned by Automattic – the creators of WordPress). It’s a super quick and easy JavaScript-based solution, that allows users to give a rating from 1 to 5 stars. It costs about $900/year for unlimited ratings, and requires virtually no development effort (aside from copying&pasting the script code).

Then, someone suggested we user a “cheaper” option – a rating component built on top of Appcelerator cloud services. Usage of the API is apparently free for up to a certain call volume (and who doesn’t like free?). I’m not opposed to using a better solution, so I decided to look deeper into this platform and what it offers.

Here’s essentially what it is: Appcelerator Cloud Services provides a back-end infrastructure mostly targeted towards mobile apps that use its Titanium development platform. The API provides a layer of methods and services that allows developers to build apps without worrying about server-side infrastructure. There are pre-built components that can allow for faster development, one of the components is Ratings and Reviews.

However, it’s not a plug-and-play deal. In order to achieve the star ratings functionality that we need, there are multiple implementation steps and gotchas:

  • We would need to create a list of products we want to be rated as Custom Object type in the API
  • To submit reviews we’ll have to know which product they apply to, so we’d have to map Custom Objects to products, probably performing a “GET” call to fetch Custom Object data and map it to products
  • We’d need to create a mechanism to prevent duplicate submissions (session or cookie or IP-based). Appcelerator asks for a user_id value to be specified whenever a rating is submitted, so it means we would have to create and work with a User object as well
  • Submitting a rating requires the user to be logged in – another API call
  • It also turns out that PUT and DELETE API methods trigger an XHR error from 3rd-party domains. This is resolvable by adding headers (Access-Control-Allow-Origin per CORS specifications), but will require additional settings adjustment on the server-side
  • And finally, any custom development will need to be thoroughly QA’d – which adds effort and time

I’m sure the Appcelerator cloud API is a great solution for certain cases, but for a super-simple component in my scenario it is much quicker and easier to go with a pre-built solution that satisfies all of my requirements.

Funny enough, we had another “build vs buy” discussion at lunch with Mike today, and thought that 80/20 rule can be applied to this problem: if spending 20% of the effort yields you 80% of result, that’s what you should go for.

Curious to hear about other build vs buy examples, so leave your notes in the comments!

PyCon 2015 tutorials at home

Last week, due to awesomeness of the internet, I learned that PyCon 2015 conference is happening in April in Montreal. This got me super excited, even though I don’t quite get to use Python as much as I’d love to. The conference seems to be organized so well, in the beautiful city of Montreal, with amazing workshop options, hotel share options, AND on-site childcare!

So there I am, excited and trying to plan how I can swing it, looking up flights (bonus post for you on saving over 50% on flights) and emailing this girl about sharing a hotel room… Then bummer! Not only the conference was sold out, but also most of the workshops! (I was only hoping to attend tutorial days) But to re-phrase that old saying: if you can’t go to a conference, let a conference come to you!

I made a list of the workshops I would take if I could go, and started looking online for authors and their past presentations. Luckily, all of them had prep materials and some even had videos!

Here is the list focused on machine learning and data analysis for all of you, fellow curious Python lovers. Thank you so much to speakers for sharing these amazing study materials.

  1. Machine learning with Python, basics

    Hands-on data analysis with Python by Sarah Guido
    Description
    Python is quickly becoming the go-to language for data analysis. However, it can be difficult to figure out which tools are good to use. In this workshop, we’ll work through in-depth examples of tools for data wrangling, machine learning, and data visualization. I’ll show you how to work through a data analysis workflow, and how to deal with different kinds of data.

  2. Hadoop with Python (video) by Donald Miner
    Description
    In this tutorial, students will learn how to use Python with Apache Hadoop to store, process, and analyze incredibly large data sets. Hadoop has become the standard in distributed data processing, but has mostly required Java in the past. Today, there are a numerous open source projects that support Hadoop in Python and this tutorial will show students how to use them.

  3. Learning Pandas by Brandon Rhodes
    Description
    The typical Pandas user learns one dataframe method at a time, slowly scraping features together through trial and error until they can solve the task in front of them. In this tutorial you will re-learn how to think about dataframes from the ground up, and discover how to select intelligently from their abilities to solve your data processing problems through direct and deliberately-chosen steps.

  4. Bayesian statistics made simple (video) by Allen Downey
    Description
    An introduction to Bayesian statistics using Python. Bayesian statistics are usually presented mathematically, but many of the ideas are easier to understand computationally. People who know Python can get started quickly and use Bayesian analysis to solve real problems. This tutorial is based on material and case studies from Think Bayes (O’Reilly Media).

  5. Building a recommendation engine with Python (video) by Diego Maniloff, Christian Fricke, Zach Howard
    Description
    In this tutorial we’ll set ourselves the goal of building a minimal recommendation engine, and in the process learn about Python’s excellent Pydata and related projects and tools: NumPy, pandas, and the IPython Notebook.

This post begs a follow-up on takeaways from each class. To be continued…

How to save on flight tickets with Skiplagged, real example

A lot of you heard of Skiplagged, the site that saves you money on air tickets, created by this awesome guy, who is not backing down from the United lawsuit and continues to help people find cheap flight options.

I decided to give it a try, when my search for a R/T flight from New York to Montreal jumped to $475 (from $350 a day before). Because who is paying that for a 2-day trip, when you can get that same direct flight for half the price!

What does Skiplagged do?

  • It takes your destination airport, and searches for flights where that airport would be a stop-over. The 2nd leg of the trip would be somewhere else.
  • You, obviously, won’t need to take the 2nd leg. As long as you don’t check your luggage, you get off the plane and walk away.
  • And this way the trip is cheaper, because of some shady airline pricing tricks they play on consumers. Skiplagged to the rescue!
  • So here is my example (today tickets even more expensive, as we get closer to the travel date):

    New York (LGA) to Montreal (YUL), non stop flight: $607 round trip if you search on Orbitz, Kayak, Google flights, etc. OUCH!

    Go to Skiplagged, and type in your search. And WOW! $236, that’s savings of 61%, ladies and gents!

    You can’t book those flights directly on Skiplagged site, but just do another search on any site, knowing what your “new destination” would be, and book away.

    If someone tells me that it’s not a genius travel idea, I don’t know what is. Thank you Aktarer for this awesome service!

    Book recommendations: March 2015

    Millionaire Fast Lane

    Verdict: must read. If this was easy, then majority of people who bought this book would be millionaires. However, one bit to take away from the book: “time is your most valuable resource”. I’m planning a summary post on this one.

    The girls guide to hunting and fishing by Melissa Banks
    Excellent read. Short stories beautifully describing life of a woman from adolescence to death.

    The Fortune Cookie Principle by Bernadette Jiwa
    Mostly case studies on brilliant marketing. Worth a read, but if you’re in marketing already, you know most of them.

    The Magic of Tidying Up by Marie Kondo
    OK, everyone is reading this book right now. I finished it a couple of months ago, and actually went ahead, got rid of all old clothing, and learned to fold things and stack them on the side. It feels incredible to be able to see all the things you love to wear, displayed neatly in your drawer. Recommend!

    The Humans, by Matt Haig
    I was so happy when I found this book, it’s in my favorite category of well-written humorous fiction that is not chick-lit.

    The Rosie Project by Graeme Simsion
    Another witty, funny work of fiction. Loved it, and even Bill Gates recommends it! So definitely get it and read it :)

    15 minute DIY welcome banner

    Here’s how you can make a quick “Welcome Home” banner for your favorite person, who’s coming back from the airport in less than an hour.

    Supplies needed:
    – MTA subway map (available for free at any subway kiosk)
    – Black Sharpie
    – Scotch tape (or glue, but I find tape way quicker and easier)
    – String, about 1.5 – 2 meters long
    – Pencil (or pen, crayon, anything), scissors

    Step 1.

    The MTA map is folded trifold, which is perfect. Open up the map until you have 3 folds, and draw zig zag lines from top to bottom, so you have triangular flag shapes

    Step 2.

    Cut the map into triangular flags

    Step 3.

    Use Sharpie to write “Welcome Home” letters, or any other message you want


    Step 4.

    Fold top of flags about an inch, so you can put the string in that fold. Wrap around the string and tape it (or glue it)

    Step 5.

    Repeat so all flags are stringed together. Tip: since you’ll be taping on the back of the flags, you’ll want to string them in reverse order. So for “welcome home” you’ll want to start with the last E in the word “home” (e-m-o-h e-m-o-c-l-e-w)


    Bonus tip: I had some extra space so I added the name (and who doesn’t love hearing/seeing their name!), and an exclamation point at the end.

    Tada! All done! Hang this pretty sucker up high somewhere, and pat yourself on the back on the quick, but impressive job well done!