JeanCarl's Adventures

Batched API calls

April 01, 2010 | API

Developers make API calls to get data and submit data to web services. Usually, a POST or GET to a url is made, using a web library in most languages. This data is returned in the response and is then parsed by the application.

This works for the most part. Calls to the API are simple, short, and don’t usually occur too frequently. So when thousands of applications are requesting data, the server can handle it like visitors to the main website.

If you do have to make a bunch of calls to the API to get similar data (like the names of a set of users), some APIs allow you to batch them up to help reduce the number of connections. Resources are used more extensively with individual connections and additional data wraps the desired data, which can lead to a higher load on the server and more bandwidth being used.  A batched API call usually returns all the data wrapped in one wrapper and in one connection.

One would think batching would be easy to implement and better than individual calls to the API. This isn’t always the case.  Sometimes the service wants to restrict the number of requests made or you could get all their data in a matter of (milli)seconds. Other times, the API isn’t a high priority and the main website is given more of the resources.

Batching also complicates the interface of the API. Are you getting a single user’s data back, or data from a number of users. Understanding the varying response is critical to getting the right data.

The amount of data returned is reduced with a batch call, but can also present too much data at one time. If you have to download all this data at once, the connection must remain open. Making more calls may be slower, but can also help even out requests overall. If a server is hit with 10 requests for 10 users at one time versus 20 requests for 5 requests in twice the time, the data tubes aren’t filled as much all at once. It all depends on the load.  With more requests, you can determine how often a request should be made and can choose to pause or stop after each request.

Web video

March 30, 2010 | Web 2.0

Cable broadcast and DVD boxsets of shows are so oldschool. Why wait for the exact time the show starts or use up the valuable Tivo space when you can open your laptop anywhere there is an internet connection and start watching a show for free.

Many broadcast networks have started posting full episodes of shows on their website for people to watch. No iTunes or special software is needed. A browser and Adobe Flash, along with a highspeed connection is all that is required.

You may even luck out after seeing a show and want to watch the whole season. ABC had past seasons of Lost available for those who got lost. There are commercials but they tend to be under 30 seconds per segment and cannot be skipped which could be annoying to some viewers.

The networks have more control of the shows they post because they don’t have to deal with a third party distributor. iTunes takes a cut on each download (which you have to pay for, but are commercial free), whereas the network website can control the commercials and other content displayed on the free content.

Some shows are split up into segments and are offered to the viewer in smaller chunks. Rather than have the viewer watch two hours of a show, each topic discussed is a separate video. No need to scan through the whole show looking for what they discussed, or where a particular topic is that you desire.

There are even web-only videos like extras and alternate endings similar to what DVD boxsets often come with.  Networks can offer more insight on character profiles and show clips of upcoming episodes or seasons that would be limited to 30 seconds on television.

And free is good too. You don’t have to chip in a couple of bucks hoping that the show will be entertaining to you. If you don’t like the show, skip it and continue viewing other shows.

Donating with a click

March 25, 2010 | Web 2.0

Most people want to donate to special causes. From saving animals that are picked up off the streets to feeding people in third world countries, we as human beings feel for those less fortunate and in need of a little help. We have a sense of what it feels to be less fortunate and hope we never have to experience it first hand.

While we wish we could help, other things prevent us from following through with such assistance. When budgets are already busting at the seams, donating money to organizations may help someone else, but will cause difficulties for ourselves. Finding the time out of a busy schedule to donate can be nearly impossible. Weekdays can be packed with job responsibilities and weekends filled with things that didn’t get done during the week.

So what does one do to help out? Donate with something simple but very big when combined with others. Everywun provides a conduit for you to benefit an organization. The website gives you a “badge” to place on your website similar to an ad. When visitors click on this, a certain amount is donated to the organization. The more clicks, the more donated. It only takes a few minutes to get the badge and place it on your website, the same amount of time it takes to check whether you got any new email within the last five minutes.

This simple yet powerful tool makes you, as well as your visitors feel good. Your visitors, who are also very busy and feel the same will be happy to click on the badge and donate to a good cause. It can be viral as well, where they add a badge to their own blog or social network profile.

It may seem like a small step. A few cents here and there doesn’t make much difference, one might think. But if there are enough clicks, the few cents can add up to a big difference for people or animals.

Using a code repository

March 23, 2010 | Programming

Using a code repository can save a lot of time during development and deployment to a staging or production server.  Commonly used among many developers working on a codebase, each developer can work on different parts of the code, and when finished, commit to a central repository.  Subversion and CVS take away the pain and frustration of merging the different files and code among developers and makes resolving conflicts less painful.

Though it works well in a team environment, using a repository for your own projects is beneficial.  Everyone is reminded frequently to backup their files often, yet the task is avoided because it can take time and cause frustration trying to figure out what version is which and what files have been changed.  Having a “one-click button” that does it for you is rarely frustrating and makes backing up code quick.

Once you commit code, reverting back to a previous version is easy.  This makes experimenting with code a little less challenging if you change your mind midway through a change.  When something completely breaks and you don’t know where, going back to a version where you know it worked can save a lot of time.

Every developer has made a foolish mistake and has written over a file by accident.  The second this mistake is made, the developer realizes it and head banging can occur.  If there is no undo in an editor, the file is pretty much gone for good.  If the file is in the repository, a simple revert will get it back.

A repository is also very helpful in deploying an application.  When you know you have a working version, you can check out a copy and release it on a staging or production server.  Pushing out new updates only requires an update.  Again, no more trying to figure out which files were changed or added and missing that one critical file.

While there are more advanced issues with repositories that come up when working with a team or branches for example, repositories allow you to keep track of changes without manually tracking each change when you make it.

User generated content

March 20, 2010 | Web 2.0

What better way to get content for a website than from the users themselves? There are many benefits to this reversal of roles for both sides.

Users who supply content have the power to mold what kind of content they want to read on the websites they frequently visit. The more content users vote to the top, the more interesting and useful content will be displayed to new visitors. Those topics that are the least popular will be left behind and forgotten.

Owners of websites featuring user content only have to worry about supporting the operations behind the scenes. Making sure the servers are running and that no illegal or questionable content is posted can be easier than planning for and posting interesting and useful content. There is no guesswork at what users want. They make it for you.

Free user content doesn’t cost anything. Royalities and other payments don’t exist. Collaborations between users of a  website can further strengthen and correct content that would take a writer more time.  Users have a variety of backgrounds and have knowledge of different things that together can represent an overall picture of specific topics.

In video and audio webcasts, borrowing from talk shows, viewers and listeners are often invited to call in and share their opinions or events that happen in their own lives. This time wasting but fascinating content can make boring shows more interesting and fun. You don’t need a production staff or expensive equipment.  A simple VoIP program like Skype can make it possible.

Stale content is a major issue with many websites. Providing new outlets for user content can keep fresh content in front of viewers and entice them to come back both to read and contribute.

What doesn’t cost much can lead to many visitors and an audience which you can advertise products and services to.