tech
Building Bebo Apps. Part 1
by Tony Primerano on Apr.15, 2008, under bebo, tech
Last week I spent some time learning how to build Bebo applications. Their API is just like the Facebook API but it is not complete and the documentation has some holes in it. If you haven’t built a Facebook application the entire process can seem awkward.
The Bebo Developer Page makes it sound like a simple 3 step process
- Get the library
- Install the app
- Start Creating.
If you don’t know how to write web applications in PHP, Java or Ruby stop now. You need to know at least one of these systems to continue.
I downloaded the PHP library and put it on my host. Next step was to install the developer application. Why? Why do I need to install an app to build apps? Seems weird at 1st but basically this application is used to manage the keys, locations and settings for your apps.
Once you have the app launch it and click “Create new app” (way off on the right) . Give your application a name and a URL and a callback URL.
What is the callback URL? It is the URL that is hit when a user goes to the Application URL. http://apps.bebo.com/yourappname is just a proxy that adds headers and parameters to the request before it hits your application file. The bebo library uses this information.
For example. I created an app called sample with a URL of http://apps.bebo.com/sample. My callback URL is http://bebo.tonycode.com/apps/sample
Hitting http://apps.bebo.com/sample results in a call to http://bebo.tonycode.com/apps/sample where I have the following index.php
This application simply prints out all your friends.
Add the application to your page by going to the developer application, viewing the app and clicking the profile page for the app. Now go to your profile page a voila.. the app is there but not your friends.
Huh? How do I get the content to show up on my profile page? If I don’t show it on the profile page it seems pretty pointless. right?
To add content to the profile page you use profile_setFBML. Last I checked the return codes for this function are not defined. Seems to return a 1 when it works and an array when it fails. Nice. :-\
Here is the code updated to put friends on profile too.
Display_All_My_Friends_on_my_Profile
Weeks go by and you add new friends to your profile and you notice that the list of friends in your custom application aren’t changing. profile_setFBML is only called when you visit the application page. Well that stinks you say. How can I make it update each time I visit the profile? I’ll get to that in my next post.
Random Tips.
- Documentation is at http://developer.bebo.com/documentation.html
- The downloaded libraries have example code. Start there
- You may need to look at 2 different sections to piece together how a function works. For example user.getInfo has a fields parameter
- http://www.bebo.com/docs/api/UsersGetInfo.jsp
- Look at the SNQL users table to find what is available
- http://www.bebo.com/docs/snql/User.jsp
Save a tree.. use PDFCreator
by Tony Primerano on Mar.24, 2008, under green, Life, tech
I always hated printing confirmation pages from web sites. Printing a piece of paper that’ll end up in the recycle bin in a few weeks is just silly. There are also times that I’m not connected to a printer and I really need to save a copy of something I’m viewing.
My answer for the past few years has been PDFCreator, install it and whenever you print, you can print to a pdf file instead of a printer. This month alone I think I’ve printed one paper page from my printer and about 90 pages to PDF form.
I also used PDF creator to email proof pages for our daughter’s yearbook to teachers. In the past printouts would be made for each teacher, they would mark them up and send them back. I’ve easily saved a ream of paper this year by doing this via email. Not to mention its easier to manage email than paper.
Once installed, just use it like a printer. It will show up as a printer in the print dialog.

From there it will ask you for a title and then a name for your pdf. If you want to make a hardcopy later you can just print the pdf file you created.
Dumping Blockbuster online for Redbox
by Tony Primerano on Mar.12, 2008, under Life, tech
Over the past few years my Blockbuster subscription fee has increased and the number of in store exhanges allowed has decreased. At the same time my queue is running on empty. At 1st there were tons of movies I wanted to see but now I’m caught up and I don’t have the desire to rent more than 1 move a week.
What are 4 movies a month worth? If I use Redbox those 4 movies will cost me $4 (if I return them in 24 hours). With Blockbuster Online only the cost is $9 (no in store exhanges).
Sure I can keep the blockbuster movies as long as I want but I only watch them once and why not just grab one when I know I have time to watch it.
The trouble with Redbox in the past was that you never knew what was going to be in the box when you got there. They recently made my local Redbox part of their online rental system so that problem is solved.
There is a remaining issue that I hope Redbox is working on. There are frequently people browsing movies when you get to the box. You need to wait for them to finish before you can return a movie or pick up your movie, that you ordered online. They should have an online pickup and return slot on the side so those of us impatient people don’t need to pace around behind the people browsing titles.
Bye Bye Blockbuster. I suspect next year I’ll be able to dump Comcast an use Antenna and the web for my television consumption.
My sitemap notes are in the Advanced Rails Recipes Book
by Tony Primerano on Mar.08, 2008, under rails, sitemap, tech
After I blogged about building a sitemap for Rails I contacted Mike Clark and asked him if he thought it would make a good Recipe for his upcoming book, Advanced Rails Recipes. He thought it was a good fit and it is currently in the Beta version of the book.
I wrote up my notes in the Recipe format, then Mike basically rewrote it for Rails 2.0 and added some additional content. Thanks Mike! I almost feel bad being cited as the author since after editing it is drastically different from the original.
The core concepts are still there and some thoughts were dropped since Recipes should be short. So, Here are some elaborations..
The Ping Protocol
There is a warning in the book about excessively pinging to Google to have them read your sitemap. I would recommend letting search engines crawl your sitemaps at their own speed. The ping example in the book was a nice overview of when to use an Observer and also provided complete coverage on how to submit sitemaps. Please use ping sparingly, if at all.
Sitemaps with over 50,000 entries
I work on sites where we use siteindex files because we submit well over 50,000 URLs to the search engines. I didn’t provide an example on how to build these in Rails because I’m not sure they provide any value to the typical site.
My theory is that if you build a sitemap with the 50,000 pages that were most recently updated you will give the search engines all they need. If a page isn’t updated for a while and it falls off the list is that really a problem? If the page was worth anything someone externally would be linking to it before it fell off the list. Now if your site is creating millions of pages a day this may not be the case.
If your pages are islands (no links to them) and you’re afraid they won’t be found unless they are all in the sitemap, I would suggest building the sitemap via a rake task that is kicked off via a cron job. This will also give you an opportunity to gzip the files. I’ll try to writeup some example code for the this when I find some free time.
Do I really need a sitemap?
If your site has navigation to all its pages, then a sitemap will probably not benefit you. I suggest checking what pages the search engines have in their index and if key content is missing then pursue a sitemap. Even if they are finding all your pages a sitemap certainly couldn’t hurt.
Just in case you didn’t know how to find the pages Google knows about on your site you can simply type site:youdomain.com in the Google or Yahoo search box.
Example results for my site are here
Free Heat.. from your clothes dryer
by Tony Primerano on Feb.12, 2008, under green, Life, tech
Electric clothes dryers are not an efficient way to heat your home, but if you’re using it anyway, you might as well use that heat to warm and humidify your home in the winter. Not only is your dryer heating air and sending it outside, it is constantly pulling warm air out of your house when it is running. What is coming into your house is cold dry air to replace the air the dryer is expelling. There is also the issue of air coming into your dryer vent when the dryer isn’t running. If your outside vent cap doesn’t seal well this can make your laundry room very drafty.
Here’s what I do every fall to help warm my home, increase humidity and lower drafts in my laundry room.
1) I disconnect my dryer hose from the outside and stuff the hole with plastic grocery bags. These make great insulation, just don’t forget to take them out in the spring when you reconnect.
2) I connect a longer dryer hose to my dryer and run it to a lint trap. Try to get the trap as far as possible from the dryer as you want the humid air to dissipate. Depending on your existing setup you may be able to use your existing hose.
Here is my lint trap. Under the sink, next to the washer

Here is the dryer hose running from my dryer and past the washer.

Since I have kids we do a lot of laundry, which in turn results in me never having static electricity issues in the winter as my home is never too dry. These lint traps are pretty common. If you Google “lint trap” you’ll find plenty of places selling them. They are filled with water and they catch most of the lint. Warning, If you let the trap run dry you’ll end up with a linty home.
I know some people use nylon stockings over the end of the hose instead of a trap but if you didn’t clean it often you could damage your dryer or cause a fire. I also have friends who have created larger boxes to capture more lint. Please leave comments or other ideas below.
Warning #1: Only do this in the winter months as you may end up with a mildew problem from excessive humidity and this will work against your air conditioning. We want to expel heat in the summer. Also, the dryer will not be able to dry clothes as fast if it is pulling in excessively humid air. I find this to be a non-issue in the winter because the humid exhaust is quickly evaporated into the relatively dry house air. The further you can get the lint trap from the dryer the better.
Warning #2: Don’t do this if you have a natural gas dryer. You must vent this outside to prevent carbon monoxide buildup in your home.
Warning #3: If you use fabric softeners or home dry clean kits you should probably not do this as you may end up with unhealthy air.
i find that switching over from internal to external venting gives me an excuse to clean lint out of the lines and dryer twice a year. When was the last time you cleaned your vent hose?
Ruby on Rails SEO tips
by Tony Primerano on Jan.10, 2008, under tech
Recently I implemented a Rails application sitemap but once the search engines started hitting my site, I realized that I wasn’t giving them all the information they desired.
- Yahoo was doing simple HTTP head requests on my sitemap and going away
- 206.190.57.45 – - [11/Dec/2007:08:35:49 -0800] “HEAD /sitemap.xml HTTP/1.0″ 200 334 “-” “Yahoo! Slurp/Site Explorer”
- Google read my sitemap infrequently but loved to do HEAD requests on my index page
- 66.249.70.196 – - [17/Dec/2007:07:11:24 -0800] “HEAD / HTTP/1.1″ 200 372 “-” “Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)”
For those of you unfamiliar with HEAD requests, they are requests for a page that don’t actually return the page. Just information like size and date. Its a nice way for search engines and caches to decide if there are any changes they need to pull. For some examples of HTTP requests check out the wiki page I wrote on making HTTP requests via telnet.
Now what do you think Google and Yahoo were looking for? My assumption is they are looking for the Last-Modified header in the response to see if they should bother requesting the sitemap. They could compare the size of the response since they last visited but I doubt they want track this information.
The Last-Modified date is the ideal field to check.
This is all fine and good but guess what. Rails doesn’t set that header for you.
telnet ficlets.com 80 Trying 64.12.150.213... Connected to www.ficlets.com. Escape character is '^]'. HEAD / HTTP/1.0 Host: www.ficlets.com HTTP/1.1 200 OK Date: Wed, 09 Jan 2008 20:22:31 GMT Server: Mongrel 1.0.1 Status: 200 OK Cache-Control: no-cache Content-Type: text/html; charset=utf-8 Content-Length: 16355 Set-Cookie: _session_id=s322clipped; path=/ Vary: Accept-Encoding Connection: close
The good news is this is easy to add! If you look at my wiki example you’ll see that I set the header with the time of the latest entry in the sitemap.
headers["Last-Modified"] = @entries[0].updated_at.httpdate
Now it isn’t rails job to add this header for you but it would be nice if the scaffolding added this header. The standard show/1 actions are pulling a record from a database and the action knows the updated_at value.
I have added this header to my show actions as I am just pulling a record from a database and I have the modified time!
headers["Last-Modified"] = @business.updated_at.httpdate
That’s all. I’m looking forward to any comments and suggestions people may have.
Converting Ceiling Fan light from Intermediate(E17) to Medium base so you can use CFLs
by Tony Primerano on Jan.07, 2008, under green, Life, tech
Up until a few months ago, all of my bedroom ceiling fans used Compact Florescent bulbs (CFLs). Back in October I bought a Hampton Bay Ceiling fan for Dani’s room and when I installed the light fixture I noticed it had a different socket type. It used Intermediate base bulbs (also known as E17). These bulbs are rare and there is no CFL option. So I went back to Home Depot and sure enough all the manufacturers were starting to use these things. The Home Depot guy suspected it was a conspiracy between the ceiling fan companies and the bulb manufacturer. There is only a single brand of intermediate base bulbs at Home Depot so this made a little sense. They also cost as much as a CFL!
I had no desire to use these bulbs so I started looking into converting my base to use the standard medium base socket. I saw a medium base for a ceiling fan display model at Home Depot but they wouldn’t sell it to me and it was no longer going to be carried. The plot thickened. So I looked on the Lowes website and I found a medium base socket that I figured I could retrofit onto my base. While I was looking for the item at Lowes, I asked a representative of one of the lighting companies (who was restocking) about the intermediate bases and he said it was all part of the 2007 Energy Bill. Huh? How can using a base that doesn’t support CFLs be part of an energy bill? I googled around and it appears this was a loophole to get around the Bill. The bill required ceiling fan manufacturers to ship with CFLs, UNLESS they used candelabra or intermediate base bulbs.
Bastards.
Here is the conversion that I did tonight in about 15 minutes.
DISCLAIMER: Please do no do this unless you are experienced with electrical wiring. Follow these steps at your own risk. There may be typos so use common sense if you do this.
1) Unscrew the existing sockets and cut the wires. Keep track of the original wiring. Save the screws.
2) Remove the mount from the Lowes socket and attach it to the base with the screw from the intermediate base. Twist and bend to get it as close to center.
3) You’ll need to strip the existing wires that were not part of the intermediate bases.
4) Combine your whites and blacks and attach with a twist on electrical wire connector.
5) Reinstall
Since these sockets are bigger I needed to bend the socket a little before the light covers fit but overall the fixture looks great.
Pictures. yeah close ups are out of focus but hopefully helpful. ![]()
This is the bottom of the intermediate bulb base. poor focus. This is where you will find the screw to remove it.

Here is how the medium base (lleft) compares to the intermediate base (right).

The new base had 2 screws. I removed them and used the screw from the intermediate base since I knew it fit the fixture.

Old Wiring.

New Wiring

And now I have CFL joy.

PEPCO should encourage its Time of Use program
by Tony Primerano on Dec.16, 2007, under green, Life, tech
A few days ago I was having my old AC unit removed and my AC technician noticed that I had a PEPCO Kilowatchers box on my AC Unit. “You won’t be needing that on the new unit” he said. Sure enough they killed the program 3 years ago. These boxes allowed PEPCO to turn off AC units during peak hours to prevent brown outs and help them reduce expenses. In return, people who volunteered to add this box to their AC Unit would get paid each time they were turned off. I think the max was 1 hour per day. So much for trying to get by with fewer power plants.
When I moved into my house in 1998 the power meter was setup for Time of Use (TOU) billing. The off peak rate was about 1/2 the normal rate and the peak rate was a few cents higher than the normal rate. Since my wife and I worked during the day, this saved us money. I kept the AC off during the day and turned it on again when the rates dropped. A few years ago PEPCO changed the off peak rate to be almost the same as the normal rate so I dropped the program. There was no longer incentive to participate.
Just this week I heard that utilites pay 10x more for energy during peak hours. Giving me 50% off my off peak rates seems like a huge win for them and me. I don’t understand why they removed the incentive.
My guess is that since they no longer own any power plants, they are no longer concerned with having to build new plants to keep up with demand. Any increase in peak power can just be passed onto consumers and they profit regardless.
Time of Use programs have the power to reduce the need for more plants and they allow us make better use of our existing infrastructure. Perhaps the government should push for reasonable TOU programs so we can reduce our peak energy usage.
Can we kill www.?
by Tony Primerano on Dec.11, 2007, under tech
I was going to write about how much I hate December but instead I’ll attack www.
Now I love the World Wide Web but I hate typing www for web sites. I’m specifying http:// and I’m hitting port 80, i expect a web page. So why do so many sites still expect you to type www. then the domain name? My site works fine with http://tonycode.com/ or http://www.tonycode.com/ but there are still plenty of sites that just plain break if you don’t add the www. A friend of mine worked at a startup and he mentioned the company name so I entered http://companyname.com/ and I got some guys personal web page. As it turns out one of the employees was using the base domain as his personal web site. No one at the company noticed because they always typed www first. I wonder how many people like me landed on this guys page instead of the company page. Needless to say this was corrected after I brought this issue to the attention of my friend.
That was a few years ago but there are still plenty of examples today. Here is the most recent one I stumbled on
http://www.berkshirehathaway.com/ works correctly but http://berkshirehathaway.com/ returns a directory listing error. Come on Warren, surely you can get Bill Gates to fix this for you.
Any competent IT professional could fix this issue in a few minutes. Of course the site is running on Microsoft IIS so maybe this takes days. I live in an Apache world were everything is easy and free.
Ok, enough picking on Warren and Bill, I own stock in both of their companies so they have the last laugh anyway.
But please fix the www. I never type www. unless a site won’t work otherwise.
Did I mention that I hate December?
Helping businesses help themselves
by Tony Primerano on Nov.25, 2007, under tech
It all started when my uncle’s web site was redesigned with flash. EVERYTHING was done in flash. The address, the phone number, directions, etc. Basically the site was invisible to search engines. I tried explaining to my uncle that search engines would not find anything to index and people googling him would no longer get any results. I told him that he should have the people who design his site put the basic information (address, phone, business name) in plain HTML so search engines could find it.
My uncle is not a techie and didn’t fully understand what I was saying but he did contact the site designers. Apparently they didn’t understand what I was asking either. Instead of pulling out crucial information they added a new index page to his site that lets people choose between a broadband (flash) or dial up (jsp) version. What the?? The JSP version of the site was no lighter than the flash version. Obviously the designers didn’t have a clue either. At least search engines can crawl the JSP site but now there is twice as much to maintain.
Rather than try to convey technical requirements to teams unqualified to build web pages, I decided to build a site that would help other businesses like my uncles. If typing your business name and city does not give you the top result on Google, with a map to your business, your web site is not doing its job. I have a solution. I call it BizLocale.com.
Goto bizlocale.com and enter your business name, address and phone number and website address and see if your search results don’t improve in the coming weeks. The bizlocale.com domain is new and google hasn’t started crawling it actively but I hope that will change in the coming weeks. The site is still pretty rough and I have no proof that entries on this site will show with maps in google but I suspect they will.
BizLocale is also great if your name is not part of a business and people try to search for you. For example. John Doe works in a doctor’s practice called Smith and Associates. On BizLocale he can create an entry for Smith and Associates with his name as a contact. This works great for all sorts of businesses and I see it as a useful tool for people who run businesses out of their house.
The bizlocale.com entry can be your only presence on the web and it should help. In addition to entering contact information there is a text area where you can describe your business and enter keywords. This could be all web presence you need. BizLocale is about empowering local search so having a fancy web site is not a requirement.