Archive

Archive for the ‘Google’ Category

Cr-48 : The First Twenty Four

December 18, 2010 7 comments
I was shocked to see the Cr-48 sitting out on the front porch last night.  I tend to pre-order things and forget–so I figured that’d it’d happened again.  Instead, Silicon Valley Santa came early. Apparently the first group of testers weren’t notified as they wanted to see how wacky we went on the web. I’m a good little lemming–hence the blog post. 🙂 

After a full day of use, I wanted to join the thousands blogging about the Cr-48 and jot down some of my impressions–how it worked, what DID work, and what didn’t work. I’ve made an effort to do most everything on the Cr-48 today–including this blog post. Man, I miss Live Writer. 😛

Unboxing and Initial Setup

Out of the box, the machine just ‘starts’.  Fantastic. That’s how unboxing a new device should be. Unfortunately, I hit a brick wall immediately after. My network is locked down pretty tight and one of those security measures only allows authorized MAC addresses to attempt to authenticate.

“How the heck do I get the MAC address on this thing?”

It wasn’t on the screen, so I looked all over the unit. Nothing. Yanked the battery… nothing. Seriously?

DIDN’T WORK: There needs to be a way to spit out the network ifconfig information on startup. If the device is appealing to geeks, then give the geeks some love.

After hacking my own network, resetting the security schema, logging in, and resetting it, I was golden. The out-of-box-experience (OOBE) for the Cr-48 is actually a lot better than most the netbooks I’ve worked with if nothing else for it’s single ‘environment/task’ configuration. I guess that’s both a pro and con of having low expectations for the device (e.g. I don’t expect it to be it more than a glorified web browser).

WORKS: Instant update to the new version of ChromeOS, restart, sync everything, and ready-to-go perfection.

DIDN’T WORK: When the Cr-48 asks to take your picture, do it–even if you just hold up something or take a photo of empty air. Why?  Because ChromeOS doesn’t have a mechanism built in to MODIFY the photo afterwards if the initial picture wasn’t taken. You have to totally format and restart if you want to have a snazzy photo.

Rooting to Developer Mode

Now that I’m logged in and see my data, I want power. *insert evil laugh here*

Thankfully, swapping to developer mode is a FEATURE of the system.  You can’t do it ala software, it’s a physical switch near the battery. The only thing I don’t like is the sad computer screen when you start.  Seriously Google? My computer doesn’t need to be sad, it needs to have a magic wand or a hoverboard when it’s in root mode.

As the instructions explain, you should do this immediately as it wipes user partition (takes a few minutes). After that, you’re good to go.

At this point, you can swap to console windows just like a regular Linux device. Hit up VT2 by hitting Ctrl-Alt- -> (the forward button at the top, like where F2 would be). Log in and hack away or, as the prompt says, “have fun and send patches!”

NOTE: Hit Ctrl-Alt- Speaker Mute Button (LOL). It takes you to the console where the kernel messages are being spewed out. Interesting if you’re a bit geeky.

WORKS: Empowering users who WANT to root the unit is fantastic. I didn’t have to stand on one hand to control my device.

Using the Device

It’s hard to not like the package.  It’s a bit plain, but that’s expected for a prototype device created on a budget (they sent out ~60k of these for free… I’m sure Silicon Valley Santa’s elves made it ‘good enough’).

Screen: The 12.1” screen is crazy bright on full brightness. A couple of notches down from max is fine in a bright room. It’s clear and clean as well. Nice.

Keyboard: I actually love the keyboard. The search button in place of CAPS lock is brillant. When does anyone actually USE CAPS lock these days (except for the trolls on forum posts)? The search button doubles as a ‘new window’ when you think about it which really speeds up navigation once you get used to it.

Touchpad: No, this is a touchbad. I hope the real units either fix this or do away with it. Want to right click in Google Docs and fix your typos? Not a chance. Right-click is a mythical beast that only works when you don’t want it to. Have larger, warm hands (me!)? You’ll be rocketing your cursor all around the screen while you type. Know where to ‘click’? I sure didn’t. There’s no clue that the bottom of the pad is the buttons. I guess MacBooks are the same way–maybe this is a PC user snafu. For now, this is easily solved by a itty bitty Targus mouse I use for traveling.

DIDN’T WORK: The touchbad gets a DIDN’T WORK all of it’s own.

Sound: I have Pandora constantly running (ala Extension) and it’s not too bad. This bad boy isn’t running Bose or Klipsch, but it’s good enough for sitting and surfing. The headphone port has a nice range, no background static (which my Dell laptop is notorious for having).

Battery: Since my last ‘plug-in’, which was about 5 hours ago, the meter says I have 1:23 hours left on the clock. That includes having a USB mouse plugged in, 6 polling tabs open, Pandora constantly playing, and writing this post in Google Docs.  So if things go to plan, the life will be about 6.5 hours. For netbooks, that’s not unheard of; however, l’m sure having the monitor a bit brighter, streaming music, and having HootSuite, Mail, StackOverflow, Groups, Reader, Docs, and four search tabs all running for that time is a bit more than a normal netbook operates with. It’s far more than my normal laptop would survive–and it has two high capacity batteries.

Performance: Honestly? Considering it’s the backbone of the entire system, It’s kinda slow.  Considering it’s running a 1.66GHz Atom, has 2GB of memory, and an SSD hard drive, it FEELS slow–which is really all that matters.  Opening a tab shouldn’t take a few seconds. Page rendering on Amazon.com shouldn’t load one little image at a time.

I’m wondering if that’s because the AR928X card is stuck in 802.11g mode instead of 802.11n mode (Google search is filled with posts about the cards not kicking up to N-mode on Linux). Hopefully this will be addressed in time with patches.

WORKS: For normal operation, once you get used to the flow of the device, isn’t not bad though. Learning the keyboard commands is REQUIRED–if you’re a mouser, even with an external mouse, you’re going to weep at how slow it can be to get around.

UX: Using the Cr-48

The user experience of the device is … different. There’s no other way to put it. That’s not a bad thing either. I spend a majority of my computer time either coding, gaming, or “all other tasks”. I still have my desktop for coding (VS2010 brings my powerhouse computer to it’s knees–I have no expectations a mobile device could run it) and gaming; however, this little computer fits the “all other tasks” category well.

To do that, however, requires a bit of change. Here are a few of the things I’ve discovered to help me use the Cr-48.

Do not try to use tabs for everything. Using tabs is great–we love tab-based browsing, but think outside that. Remember that you can open new windows (Ctrl-N). Think of these new windows as multiple ‘desktops’. For example, I’m running Google Docs in one, my standard ‘browsing’ in another, and my ‘communication’ apps (HootSuite, Mail, Groups, Reader) in another. It allows me to easily Alt-Tab between work environments while still keeping each separate.

Become a keyboard junkie. Press Ctrl-Alt-/ on the keyboard to pop up a SWEET interactive keyboard map (every app should have this).  These are the keys for the ChromeOS. On top of that, learn the keyboard shortcuts of Mail, Groups, Reader, your twitter application, whatever other site you use (e.g. github.com has some pretty slick keyboard shortcuts to move around their site totally mouseless). This really speeds things up.

Some good ChromeOS keys to get started:

  • Alt-Up/Alt-Down : Page Up/Page Down
  • Alt-Tab : Switch between windows
  • Ctrl-Tab : Switch between tabs
  • Alt-D : Focus on Location bar (and select so you can start typing)
  • Alt-Backspace : Delete

Remember the built-in hard keys. Since the Cr-48 is missing function (F-key) keys, it has a row of hard keys built-in. Back, forward, refresh, full screen, swap window, brightness, and sound controls right at your fingertips (literally if you’re hands are on home row). Full screen and back/forward are pretty snazzy once you get used to them there.

Find the app or extension that fits your requirements. I’ll talk more about extensions and apps here in a moment; however, use the Chrome Web Store and explore. There are a few cases where your application may offer BOTH an extension and app. Try both. One may work better than the other for your use.

Extensions

Since the launch of the Chrome Web Store, there’s been a lot of discussion about what an extension is… and what an app is… and why we shouldn’t all just use bookmarks like we have been.

Since ChromeOS syncs to your Chrome profile, anything you already sync shows up automatically. I had my Goo.gl Shortener, Web Developer, Mail, Evernote, glee, and Pandora extensions right OOBE.

DIDN’T WORK: The only extension that’s been a bit wonky has been glee.  It doesn’t seem to properly detect input areas–so pressing the gleeKey (‘g’) at any time pops up the box. Bummer ‘cause glee would be rockin’ on a netbook considering how keyboard-oriented it is.

WORKS: This is more of a recommendation than a works, but still. If you use Pandora, use the extension, not the app. Why? Because the Pandora app just loads up pandora.com. On a normal computer, that’s fine, but this is a Linux-based platform. What happens when Flash starts up on a Linux-based platform? Kittens are killed. The app also requires a full tab to operate while the extension sits happily in the extension bar, blaring your tunes.

Apps

I’ll admit, my initial response to the Chrome Web apps was “wut”? Why would I want fancy bookmarks? With the Cr-48, that’s still pretty much the case. There are a few apps which seem to run as actual applications, like TweetDeck’s ChromeDeck. Everything else seems to just be a bookmark to a site. That is a huge bummer. I’m hoping as the Cr-48 and other ChromeOS systems are released that this changes.

An example. As I discussed above, the Pandora application is tragic. It loads Pandora.com which promptly dies due to Flash.  The extension is rockin’, but there’s room for improvement.  ChromeOS supports panels (little pop-ups at the bottom of the screen). That’d be a great place for some Pandora action.

Random Thoughts

Multimedia is sorta meh. Flash sucks on here. I expect that on a Linux device, but I’d assume the owners of YouTube would have worked out SOMETHING magical. No, sir.  That means poor performance for YouTube and Hulu and, well, 90% of the rest of the web. Unfortunately, since this is a Linux box, Silverlight doesn’t natively work either (I haven’t tried installing Moonlight yet… though I don’t have high hopes). That counts out Netflix. It’s a bit of a letdown because the Atom processors are toted for being able to do multimedia on-the-go. I honestly think this machine COULD do it if it wasn’t for the Flash/Silverlight limitation on Linux and that really hurts to say.

WORKS: For some reason, the Flash player (using FlowPlayer) on Tekpub.com is BRILLANT and works like a champ. I don’t know enough about how the compression/streaming/playback works on FlowPlayer to say why–though it’s something I’m going to look into for a few sites I have using Flash movies.

The window switching animation is confusing. Okay, I’ll accept that I may be dense, but it just doesn’t feel natural. Rather than looping left-to-right through your windows, when you get to the end, you slingshot back to the first… so if you have three, you see left-left-right-left-left-right. That’s fine once you get used to it, but the right (the one that’s going from last to first) LOOKS like it’s going BACK. Just an odd UX thing.

Mounting storage is… awkward. I’m assuming this is a prototype issue and won’t affect the production devices, but the device is SO LOCKED DOWN that using the SD card slot is a real pain. I’m thinking this is to encourage cloud storage, which is fine, but if that’s the case, why is the SD card slot there? I can download files in Chrome, but moving them onto the removable device requires some magic.

But I want something from {device}… For this article, figuring out how the heck to get photos on here was a REAL pain. I have a phone that can take snazzy widescreen photos, but getting them to the web is a bit of a pain outside of TwitPic. I have a Sony digital camera, but plugging it into the USB port on here was futile. I wasn’t going to swap the front web cam around to snap photos–that was just silly. So how can a blogger use this and attach photos? I’m still working that out–note the lack of photos in this stream of text post.

Give us a right-click keyboard button! If right-clicking is going to be such a pain, give us the ‘properties’ right-click key that we’ve gotten used to on Windows keyboards for so long. I’ve REALLY been missing that (especially while typing this post to fix typos–I guess I should be less lazy and spell the words right the first time).

That’s it for the first twenty-four hours and see, all this cloud computing talk and I haven’t once said “to the cloud!”… oh, damn.

Advertisements

Comparing Google and Bing

June 1, 2009 Comments off

Bing, the latest iteration of Windows Live Search, is now available for use and has been getting quite a few rave reviews.  Miguel Carrasco wrote a lengthy post discussing the benefits of Bing over Google; however, maybe I’m old fashioned, but I see a lot of the hype as overhead.

Not to nitpick, but searching DIRECTLY for product names will return advertisements and sponsored sales information—no matter the search engine.  Miguel’s post (searching for a Nikon D60 camera).  Using my new fanboy item, the Palm Pre, as an example, I can see that the Google page actually has FEWER (real estate) “advertisements” than the Bing search.

Bing has a whopping 6 sponsored links… along with something called Bing cashback that I haven’t really read up on yet.  That along witht he lost space on the left seems like a lot of waste.

Bing

Google drops off a bit of space for the 3 sponsored links, but keeps it thin and uses it’s integration with YouTube to show previews and group the video results to the top.

BUT… how much does that matter?  If Google’s page takes a moment more to load, do the background graphics, fancy headers, and AJAX postbacks on the Bing page make up that difference?

“Previews” in Google and Bing

An exciting point with Bing is the content previews.  Hover over a search result and it provides a bit more information.  This, however, has been in Google’s search for quite a while if you turn on the functionality.

I’ll admit, I like the hover effect.  Clean, renders relatively quickly (noticed a bit of delay on some pages, but not too bad), and seems to parse content well.  But is it ground breaking?  Nah, not really.

Google’s had it for a while, though I’ll admit, I rarely use it (I used it more while doing heavy research in school).

The difference is that Google’s requires you to turn it on… For those who don’t use it, the dynamic filtering is FANTASTIC (and provides that handy “left side bar” that Bing is raving about).  Remember—Google was originally focused on extremely streamlined results—”more text” and AJAX postbacks would be considered evil. 😉

If you really do need more images, using Google’s “Images on the page” provides a cool look at what graphics are on the page.

Are product searches always what we do?  Nah!

How often do we actually search for a product name—especially in the workplace?  When I’m looking for my Pre, sure, but 90% of the day is spent searching for error messages, code snippets, and forum messages.  Face it, I JFGI it all day long. I encourage coworkers to JFGI. Etc.

So how does Bing and Google stack up when searching for a less commercial, more technical request?  I’ve recently dug into db40 and needed to dig up some ideas for id generation.  I remember reading a blog post recently about it, but couldn’t remember who wrote it.

Bing returned an interesting result set… but didn’t turn up (in the first 10) what I was looking for…

Nearly all of the results were root domains or directories—nothing real specific (blog posts, forum posts, etc) from the titles.  Since the cool Bing “sorting and grouping” doesn’t appear to apply to everything quiet yet (not sure if that’s context-based or a newness/lack of indexing), I was left with “all results”.

On the other hand, Google appears to put more priority on the title of the page.  Notice on the Bing search results, “Id Generation” didn’t appear in ANY of the page titles whereas they’re in all of the titles of the Google results.

The title doesn’t mean these are the BEST results; however, with news stories, blog posts, etc—the takeaway point will usually be in the title. 

The blog post I was wanting showed up second in the Google results.  The Bing results referenced Tuna’s blog a few places; however, didn’t actually reference the post for “Id Generation in db4o”.  The one time it WAS mentioned (the 4th result of Bing), it was a stale link to the front page of Tuna’s blog—not the actual post.

Conclusion

The selling point to Google for many years now has been two fold:

1) Extremely clean, fast user interface
2) Reliable and relevant results

I moved away from AltaVista, Yahoo, and other engines years ago because they wanted to be ‘cute’ and while Bing has potential, it’s already too cute for my tastes without any real benefit.

It’ll be interesting to see how Bing grows—and how it affects Google.  It’s too early, however, to say that Bing is this saving grace—especially if you’ve never dug into all of the features of Google.

Review: MSDN Enhanced Search

For the past week and a half, I’ve been using, and evaluating, the new MSDN Enhanced Search.

The task?  For Microsoft-based queries, use the MSDN search for a week (rather than google.com with site:msdn.microsoft.com) and compare expectations, results, and usability.

For the review, I’ll use a single query to provide comparison.

Search:  “Sys.Application.add_init()”

Likes

1. I really like the RSS feeds.  I can think of several ways, especially by product or technology, to consume those RSS feeds on our technical portals at the office and on my blog.

2. The autocomplete feature is very useful if you’re unsure of how something is spelt or want to browse through a namespace.  For example, if you knew what you were looking for was in System.Web.Caching, you could type that in to the search box and let autocomplete simply return what falls under there.  I’m not sure if this was the intended use, but it works quite nicely.

Auto complete functionality for namespaces

In addition, for those who know exactly what they’re looking for, the delay is enough that it doesn’t hinder a quick search.

Dislikes

1. I wish I could pre-refine my topics from the initial search page.  Searching and THEN refining requires two steps, two page reloads, and, in it’s current build, about 15–20 seconds in page loads.  If I’m searching for a query and know ahead of time that I just want to look at the MSDN Documentation, let me set that. 🙂

2. Filtering by Language sometimes filters out “correct” results.  After our discussions, this appears to be less of a matter of the search engine and more to how articles and posts are tagged within the libraries.  With this in mind, filtering by a specific version of language is almost useless.

3. Not being able to use the autocomplete functionality with FireFox is a real drag.  I’m honestly not sure if this is an issue with FF3 or the MSDN search site, but from Firebug’s POV, I get a 400 error when I try to query.

Firefox Snafu with AutoComplete

UPDATE: 4–5 refreshes of the page in FireFox and it seems to work. Why?  I’m not really sure.  It seems the 400 error is more of a timeout than an actual error, but the GET request is only 200ms each time it fails.  Odd.

4. Not so much a “dislike” as an “hmm”—I use the browser built-in search bars a lot.  I rarely open up to a “search page” because of it.  Unfortunately, the cool features of MSDN Enhanced Search (autocomplete, refinements, etc) require you to be on the page to use them.  Perhaps a new searcher toolbar that adds these features into IE and FireFox could be made available OR a search bar (similar to Desktop Search) for Windows that I could toss down and always have access to MSDN resources.

Suggestions

1. Work on reducing the number of requests and load times (already discussions about this in the forums, but adding it to the list).  We’re on a dedicated OC-3 line here at the office, but I’m impatient. 🙂

For example, the Google query requires 5 requests and 948 B for the first result page to come up (905 B of that from cache). 

Google Page Loads

The MSDN Enhanced search requires 30 requests, 183 KB, and almost 5 seconds to download. 

MSDN Enhanced Page Loads

Repeating the same query over again narrows it down to only 7 requests (65 KB), but doesn’t seem to speed up the returns.

Repeated MSDN Enhanced Page Loads

2. It’d be great if “Refine By’s” allowed you to toggle them on and off.  In the current build, refining is an all or nothing.  You can’t refine by “Blogs and Forums” by checking each one—you have to refine by Blogs, check the results, go back, refine by Forums, check the results.  Time consuming and painful.  On the forums, they’ve already noted that they’re checking into this—and I’m excited to see the results.

Refinements on MSDN Enhanced Search

3. Work with the MSDN Documetation groups—if I parse out and am searching just for C# results, then have those preslugged as the language settings on the MSDN documentation.  That’d be great!  Per #2 in Dislikes, it’d be nice if I searched for “Func<T>” and filtered by C# 2008, that I’d get the C# 2008 (or .net 3.5) documentation for Func<T>.

4. It’d be great if, in future versions of MSDN, that searching for help in Visual Studio and other Microsoft products worked similar to Enhanced Search.  Currently, the “help” in most Microsoft products leaves much to be desired and, like VS2008, is simply redirecting to msdn.microsoft.com anyway.

5. Different versions of documents are hard to disseminate unless you look at the URLs—which gets painfully slow if looking for a quick answer.  In the example below, both documents point to information on System.Net.Mail; however, the first is for VS2008/.net 3.5 and the second is for VS2005/.net 2.0.  You can only tell by the URL.

Conclusions

On a matter of scope—I see MSDN Enhanced Search as a means of searching MSDN documentation and, to a degree, forums.  If I need to know what methods are part of an object or a specific syntax, this will be the place to come.  I really do like the Enhanced Search over all other existing Microsoft searches.

Unfortunately, 9/10 of the information I search for tends to come from sources outside Microsoft (non-MSFT blogs, forums, etc)—non usage/technique queries.  It’s hard to justify using MSDN Enhanced Search to JUST search Microsoft materials and then go “oh, well, didn’t find it, guess I’ll hit Google”—and then have to wade through those same Microsoft materials as well as the rest of the world.  Just food for thought.

I want to thank Chris Slemp for the opportunity to provide feedback and test out the new functionality for the MSDN Enhanced Search.  While I’m a Googler to the core, I look forward to seeing how the MSDN search evolves and improves—and how I can integrate it into my searches.

Lost in translation…

April 18, 2008 Comments off

Michael sent me this line of text in German yesterday…

Auslieferung oder Würfel!

Now, me knowing absolutely ZERO German (except swear words, of course), hit up Google Translate. Google returned:

Extradition or cubes!
Uhhh.. meh?  Come to find out, he originally used Babel to translate “Surrender or die!” from English to German.  Now, extradition is a legal term for surrendering (basically being taken from one jurisdiction to another for trial), but… cubes?
 
If you’ve seen Google’s headquarters, they are anything but “cube farms,” so maybe this is a bit of their influences… cubes == death.
 
Also, tossing the phrase back into Babel is just as odd…
Distribution or cube!
For some odd reason, this continues to make me laugh as I sit back in my chair and look around at the 8’ cold, gray prison cube walls.

Gmail – Odd Filtering Request…

March 27, 2008 Comments off

I love Gmail—in my Archives, I still have my “Welcome!” email (because, I wanted to “save it all” since I had unlimited space) dated back to August ‘04 and I haven’t looked back since. 

It’s fast, has a great interface, and has become recognized and supported by dozens of vendors.  It’s also available EVERYWHERE—home, work, on the road, my cell phone, wireless devices, just everywhere.  I don’t have to worry about syncronizing and it connects to GoogleDocs, Calendar, and the other services extremely well.  If I could find a good way (without a client) to sync my cell phone to Google Calendar, I’d happily kick Exchange to the curb (for personal stuff).

I’m on several mailing lists too… various ones for both work and personal such as altdotnet.  As these groups have grown and conversation sometimes staggers, Gmail has been my saving grace by automagically keeping the hierarchy in a single “thread” to make the conversations easy to follow.

Unfortunately, Gmail can’t “autoforward” to folders—because there are no folders.  Labels and filters are great, but if I go a few hours without reading my email (you laugh… but seriously), I find I have 200+ in my box and can’t see the “real” mail from the list servers.

If I was using Outlook, I’d autoforward emails to a folder and be happy.

So, to get around this with Gmail, I tried something and over the next few days, I’ll see how it works.

  1. Setup a new filter that matches a common criterium of all the emails on a particular list, e.g. all altdotnet emails come from altdotnet@yahoogroups.com.
  2. Next, select “Apply the label” and create a new label for the group AND select “Skip the inbox”. 
  3. Save/Update the filter and, optionally, apply it to the discovered conversations (recommended to be sure you don’t have strays).

Gmail Labels

This applies a label, which is clickable from the Labels section on the left AND gets them out of the inbox, leaving it tidy.  You can see below, at a quick glance, that I have 41 unread “threads” in altdotnet and no outstanding jotts (I ❤ Jott).

You also can create hyperlinks DIRECTLY to the individual labels (if you wanted to add them to your favorites, etc) by adding #label/{label name} to the end of your google mail URL. Here’s an example:

http://mail.google.com/#label/altdotnet

Since I use the Google Homepage and Gmail web part, I have a little list of links as well and have added this in there for “quick access” to that label.

Give it a try for a few days and see how it works—hopefully it’ll help tame my information overloaded inbox.

Custom Searches in Internet Explorer 7.0

January 30, 2008 Comments off

I do quite a bit of “Googling” and searching in general throughout my day.  One of the coolest features that not many seem to use is IE 7.0’s ability to create custom searches in the search bar.

Several sites, like WikiPedia, are setup to automatically offer a search engine provider using an OpenSearch provider.

Wikipedia Search Provider

Some sites, however, do not have a provider pre-configured.  This blog, for example, doesn’t (yet).  I can, however, add a custom provider.  Here’s how:

1. Do a search using the search provider you wish to add with the words TEST.

2. Copy/paste the generated “TEST” url.  For this blog, it looks like:

https://tiredblogger.wordpress.com/?s=TEST

3. In the search bar drop down, click “Find More Providers…”

4. Enter the URL and a friendly name in the “Create Your Own” box.

Create Your Own

5. Click the “Install” button and then “Add Provider”.

Now, when we look at our available providers, we see this blog listed.

blog.tiredstudent.com search engine.

Do a search now, for something like “facebook” and all posts I’ve written with facebook in them will appear.

You can do this with most any on-site search engine or forum software.  Here’s a few I’ve added:

  1. www.whois.net for looking up domain registration information
  2. www.ffxiah.com for looking up FFXI auction information
  3. Wikipedia (built-in) for all purpose anythings
  4. FFXI and EQ2 Wikia (built-in) for quick access to items/quests
  5. www.eq2llinks.com for EQ2 items and information
  6. Gmail for quick access to emails

 

Creating a Google AJAX Search Control in .NET

October 30, 2007 13 comments

As I discussed yesterday, the current non-SOAP Google approach is to use 100% JavaScript and their own custom UIs.  That really annoys me that I can’t take the service, call it, pass along some values, and get search results back.

My next thought was, if nothing else, encapsulate all the odd options and such into a nice little control.  This isn’t necessary for the Yahoo! search, as it’s SDK has it’s own controls, result objects, etc.  For the full list of Google AJAX Search options, check out the class reference.

Download .net 3.5 Complete Project [updated 30 Oct 07/10:55]

Our control has five properties:

  • The Google AJAX Search API Key: this string property is for the key specific to this particular instance and is URL aware, so you’ll need one per application (or directory).
  • Four “Enable” properties: EnableWebSearch, EnableImageSearch, EnableVideoSearch, EnableBlogSearch.  These are booleans are true by default and toggle the searchers applied to the control.  I made these toggleable because in some environments, like at my office, Google’s Image and Video searches are blocked, and others may not want those results. 🙂

The only method to override in our custom control is CreateChildControls; we’ll use it to populate the page with our JavaScripts.

protected override void CreateChildControls()

{

base.Page.ClientScript.RegisterClientScriptInclude(“apiScript”,

http://www.google.com/jsapi?key=&#8221; + this.Key);

StringBuilder searchers = new StringBuilder();

       searchers.AppendLine(“google.load(‘search’, ‘1’);”);

       searchers.AppendLine(“function initialize() {“);

searchers.AppendLine(“\tvar searchControl = new

google.search.SearchControl();”);

       if (EnableWebSearch)

searchers.AppendLine(“\tsearchControl.addSearcher(new

google.search.WebSearch());”);

if (EnableImageSearch)

searchers.AppendLine(“\tsearchControl.addSearcher(new

google.search.ImageSearch());”);

if (EnableVideoSearch)

searchers.AppendLine(“\tsearchControl.addSearcher(new

google.search.VideoSearch());”);

if (EnableBlogSearch)

searchers.AppendLine(“\tsearchControl.addSearcher(new

google.search.BlogSearch());”);

searchers.AppendLine(“\tsearchControl.draw(document.getElementById(‘” +

this.ClientID + “‘));”);

searchers.AppendLine(“}”);

       searchers.AppendLine(“google.setOnLoadCallback(initialize);”);

 

       base.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),

“searchers”,

             searchers.ToString(), true);

}

The apiScript provides the link to the Google JavaScript objects (and passed along the unique key).  The searchers is the guts of the search component and generates a JavaScript block wherever you place your control. 

Notice on the .draw method of the searchControl, it’s drawing back to itself (the control, by default, generates a span tag; we’re simply returning the “drawing” of the control back to that.  It’s possible to add another property, something like TargetControlId, and use that to separate out the search logic and the actual location the search UI is presented.

To place the control on your page, drop and drag it from the toolbar, or code.  Here’s an example with the VideoSearch disabled.

<googleControls:GoogleSearch

ID=”GoogleSearch1″

runat=”server”

EnableVideoSearch=”false”

Key=”KEYHERE” />

Unfortunately, this still doesn’t resolve using the Search API for non-web interfaces. 😦