ClickAider
You are currently browsing the Bogle’s Blog weblog archives.

How to add Google AdSense for Mobile to your Ruby on Rails site

In September, Google announced AdSense for Mobile, which allows the monetization of mobile sites through AdSense ads.

However, AdSense for Mobile currently only officially supports PHP, CGI, JSP, and ASP web pages, not for any deep technical reason but because Google doesn’t supply code snippets for other languages.

To address this shortcoming in the case of Rails, I’ve translated the code to create _adsense.rhtml.

To use AdSense for Mobile with your Rails site, do the following:

  1. Copy_adsense.rhtml into one of your view subdirectories in your Rails tree.
  2. Edit the value of client_id on line 8 of _adsense.rhtml to include your actual client ID.  Your client ID can be copied from line 4 of the PHP script provided by Google.
  3. Insert this line to include the adsense partial in one of your views:  <%= render :partial => "adsense" %>
  4. Sit back and watch the money pour in.

Note that by default Adsense for Mobile will return a HTTP 400 error if you attempt to display ads on a non-mobile browser. To bypass this check for testing purposes, you can pass in a user_agent query string parameter to pretend to be a particular mobile browser; e.g. http://example.com/controller/action?user_agent=Blackberry8800

 

image 
Sample AdSense for Mobile Ad

Beyond411 awarded PinStack’s Five Star Award

image  I am honored to note that Beyond411 was just included in PinStack’s picks of the best Blackberry applications.  

Lots of other good applications in PinStack’s list, which I am attaching below.  (In particular, I have been enjoying the RSS reader functionality of Viigo.)

  • JiveTalk - Multi-client instant messaging application for BlackBerry.
  • eOffice - Professional wireless document management solution.
  • Ascendo Money - Manage accounts, checkbooks, investments, savings, loans & more.
  • BBSmart Email Viewer - Advanced email client for your BlackBerry.
  • Beyond411 - Instant access to Yahoo Local Yellow pages, maps, and driving directions.
  • SplashID - Password & confidential information manager.
  • Empower BES MailBox - Separate your Work & Personal Emails.
  • Sudoku - The brainteaser that’s taking the world by storm, on BlackBerry.
  • KaGlom - a high-pressure game of falling blocks.
  • Telenav - GPS navigator, also find restaurants, shops, hotels, & more.
  • Viigo - Fast and feature filled RSS content reader.
  • WorldMate Live - Mobile manager for Travel activities.

Free My Phone: Wireless operators block Facebook app?

Imagine if ISPS could block users from Facebook to suit their own business interests.

This kind of situation would be unimaginable bitterly protested [*] in the PC world, but happens routinely in the mobile space.

It’s exactly the situation I found myself in when I tried to install the just announced Facebook app for the RIM Blackberry. Having seen it on a friends phone, I know that it’s a fast, native app that gives a significantly better experience than their site for mobile browsers. 

(For more on the app, see Facebook teams with RIM for Web 2.0 on-the-go; Facebook already claims 4 million unique active mobile users and 300 million mobile page views a month.)

No joy– I got an error saying "Sorry, your wireless carrier doesn’t allow the mobile Facebook app to be used on your phone." 

Walt Mossberg has it exactly right in his column Free My Phone:

A shortsighted and often just plain stupid federal government has allowed itself to be bullied and fooled by a handful of big wireless phone operators for decades now. And the result has been a mobile phone system that is the direct opposite of the PC model.

It severely limits consumer choice, stifles innovation, crushes entrepreneurship, and has made the U.S. the laughingstock of the mobile-technology world, just as the cellphone is morphing into a powerful hand-held computer.

As Walt says, the status quo is stifling innovation, limiting consumer choice, and hurting US competitiveness.


[*] Update: DennisG correctly notes in the comments below that Comcast is behaving a bit like a wireless provider in the way they are blocking/throttling BitTorrent. Walt Mossberg’s essay can be read as a commentary of the importance of net neutraility. I believe or at least hope that internet ISPs won’t be able to go too far down that road.

New Venture

Yes, I have in fact joined a new startup. Very little I can say right now except that I’m excited about the new venture and about returning to my mobile roots.

If you happen to know of a good space for 4 people to sublet in Seattle please let me know!

Running Office Professional on multiple PCs

The Home and Student editions of Office 2007 allow installation on up to three PCs. However, Office Professional, which is quite a bit more expensive, is vague on how many PCs you are allowed/able to install it on.

My attempts to google for an answer to this question were unsuccessful, so I’m writing this down for the benefit of those following in my footsteps.

I was able to successfully install and activate Office Professional on a second PC (my notebook) without any special steps. The second install reads “non-commercial use” on the title bar but otherwise functions exactly like the first install.

Faster Wifi on the Blackberry:

I wrote earlier on the paradoxical benchmark results showing that Edge connections beats Wifi on the new 8320 Curve. I’m in the market for a new phone and data plan, so this is of more than academic interest to me.

Further research reveals possible sources of the problem and workarounds. 

First, users consistently report (see here and here and here for instance) that wifi speed on the 8820 is consistently better than on the 8320 and better than EDGE. 

Why the difference?

Many have speculated that the processor on the 8320 lacks the speed to fully exploit WIFI and/or the OS has bottlenecks/bugs.   For example, engadget writes:

The Curve is armed with a 312MHz Intel processor which seems to under-power the device, especially during times of intense multitasking. In addition, while using WiFi to browse the internet, we experienced bottleneck issues with page loading times. Time and time again, the 8320 using WiFi was slower that the 8800 using T-Mobile’s EDGE network. With all things being equal, the loading time was approximately three seconds quicker on the 8800. Coincidence? Doubt it.

However, the 8820 is also running a 312 Mhz processor, so it’s not clear this explanation is complete.

Blackberry Forums also reports that by default all Wifi traffic on the 8320 is proxied through slow blackberry.net servers, and that much better results can be obtained by forcing the 8320 to be wifi only.

Some mystery remains, but the short summary appears to be that you’re much better going with the 8820 than 8320. You’ll give up the camera, but in return you’ll get GPS and better wifi speeds. 

The Vegetarian Grill

I made a fall assortment of grilled recipes from The Vegetarian Grill: 200 Recipes for Inspired Flame-Kissed Meals and was quite pleased with the results.

Sweet potatoes in lime-maple marinade consisted of 1/4 inch slices of sweet potatoes marinated in maple syrup, lime juice, minced garlic, a little soy sauce, and a little bit of mustard.  Extremely flavorful! (I tossed the finished sweet potatoes in the leftover marinade for added potency.)

Grilled Roma tomatoes with pesto and parmesan were good and extremely easy to fix, as was the grilled leek drizzled with a little bit of balsamic vinegar. 

I never would have thought to grill cauliflower (marinated in a little italian dressing), but this too was delicious. 

I definitely recommend the book and look forward to future experiments.

More on Content-Aware Image Resizing: Resizr and Liquid Rescale

Thanks to Mark Maunder for picking this up: the content aware image resizing algorithm I wrote up has been productized as a website called RSizr.com and as a Gimp plugin called Liquid Rescale.

Below are some screenshots showing Rsizr.com in action.

I took a shot of some elephants and painted them with the proection brush in Resizr to discourage the algorithm from eliminating them in the seams– it turns out that the algorithm thinks that dull grey elephants are pretty “uninteresting” compared with the speckled water.

 Here is a before and after shot showing the retargeted picture, the algorithm did a good job. All essential details are preserved with no visible seams, with only a small amount of manual effort to protect the elephants. (Cropping would not have worked well here because the elephants fill the frame.)

 

Rsizr can also remove pieces of the picture do you don’t want, treating them as regions of no energy in the seam finding algorithm.  Here I retargeted the image to remove the middle elephant.  Close inspection shows a visible seam in the water but it’s still pretty impressive.

Embedding Web Docs in any web page

Web office suites such as Google Docs are enjoying growing popularity.

But there’s a problem: Google Docs and similar sites force readers to go their own site to view or edit a document, rather than viewing the document in a more natural context. For example, there are many calendars, spreadsheets, or charts that you would naturally want to embed into a corporate wiki, but instead must appear divorced of context on a different site.

There is prior evidence on the value of creating embeddable content: YouTube became a smash success in part because it allowed videos to be embedded in any web page, rather than jealously forcing users to go to a destination site to view the content.

Thus– and I shudder to say this– we need to have something like OLE for the web, keeping the good and throwing out all the bad (complexity and poor performance) from OLE.

When I’m writing a Wiki page or a blog entry, I ought be able to easily insert a chart, spreadsheet, or presentation and have it appear in live, interactive form on my site. Mind you, we wouldn’t want to expose a full-blown authoring UI around an embedded document. That was too complex for the PC with OLE and definitely too complex for the web. But a live view on the data with simple interactivity would be really valuable.

The first step to achieving this goal would be for web office providers to generate markup that could be pasted into any web page. (This can be hard to do reliably for HTML based applications but is easy to do for Flash.)

The next stage would be building knowledge into authoring apps about the sources of external content that can be inserted and building simple user experiences to do that. (These ideas also overlap with the notion of a live web clipboard that could share structured data across web sites.)

I believe rich support for embedding documents in the web is part of what it means to fully embrace the web, and is a necessary step to compete with traditional office suites.