Archive for June, 2006

Get Google Ajax Search For Your Site UPDATE

June 14, 2006

If you read my recent post, How to Get Google AJAX Search For Your Site, and used it to implement the Google Ajax Search control on your blog or website, this post is for you.

When I replaced the old Google Search box with the newer Google Ajax Search for my blog, I quickly realized that there was no way to clear the search results from the screen. That’s why I wrote the function “searchControlClear()” that I described previously. Since writing that post, Google has included the clear functionality natively into the search control, so some changes could be made to make things work more smoothly.

These are the changes I made to use Google’s built in function instead of my own. In your javascript, you need to make two changes: one at the beginning and one at the end. First, move this line of code:

var searchControl = new GSearchControl();

to the line above this line of code:

function onLoad()

So the beginning of your javascript should look like this:

//<![CDATA[
var searchControl = new GSearchControl();
function onLoad()
{
function MyBlogSearch()
{
.
.
.

The second change you need to make is at the end of your javascript code. Inside the searchControlClear() function, replace everything with this:

searchControl.clearAllResults();

So your function should look like this:

function searchControlClear()
{
searchControl.clearAllResults();
}

Try this on for size!

Advertisements

Fuzzy Clock Google Gadget Has New Options

June 10, 2006

A fuzzy clock user noticed some weird behavior when using the gadget with Google Desktop. If the text were long enough, the time might be displayed on two lines (“Twenty-five to Eleven”, for example, is usually too long to fit on one line). Unfortunately, if a gadget has a specified height, Google Desktop won’t let you resize the frame after the sidebar has been minimized and restored. As a result, you would only be able to see the first line of the gadget, and the rest would be hidden. To fix the problem, I’ve created a second gadget. The only difference is that there is no specified height in the new one.

The URL for the Google Desktop version is:
http://www.cjmillisock.com/gmodules/fuzzyclock-d.xml

If you’ve run into this problem with Google Desktop, add this module to your sidebar, but you’ll want to use the original for your personalized homepage. This newly modified gadget allows you to resize the window when the text goes onto two lines, even after the sidebar has been minimized and restored.

Also, I’ve added (in both versions) the option to choose your font size. If you choose a small enough font size, you might be able to prevent the text from going on to two lines in the first place. Font size 12 should be small enough, even for lengthy times like “Twenty-five before Eleven”.

You can add the Fuzzy Clock gadget to your Google Personalized Homepage with this: Add to Google

As usual, if you have any suggestions, please don’t hesitate to ask. This stuff is fun. 🙂

Google, One Step Closer to Making the OS Obsolete

June 7, 2006

With the just-released Google Browser Sync, all of your browser settings are stored in your Google Account, and then shared across all computers that have the extension installed. This is great news for Firefox users, terrible news for Microsoft.

I can hardly wait to experiment with this thing.

This sounds an awful lot like a step towards making the computer’s operating system obsolete. Next it’ll be Google File System Sync, and I CAN’T WAIT. Come on, GDrive, hurry up already! This is an obvious pre-cursor to the GFS, which means it’s drawing closer.

How to Get Google AJAX Search For Your Site

June 5, 2006

If you want some help getting the Google AJAX search control working on your site, here’s a quick and easy summary of what I did.

UPDATE: Google has updated their search control, making some of this code redundant. If you are using the code below, I’ve written another post outlining the changes you should make. You can view the new post here.

A little HTML, a little CSS, and a little Javascript should do the trick. In my HTML, I used two divs, and a link to clear the results. One div is the search control div, and the other is a wrapper for the search control div. I put it near the bottom of my html files so it appears on top of the content on each page. Here’s how it looks:

<div id="searchControlWrapper">
<a href="#" id="clearLink"
onclick="searchControlClear();">Clear</a>
<div id="searchControl"/>
</div>

I also added an onload function to the body tag:

<body onload="onLoad();">

For the css, I styled the wrapper to have an absolute position in the top right corner of my site. You can put it anywhere you’d like. I made both the search control and the clear link float left so they’d be on the same line. I gave the clear link some padding on the right. Here are the css changes I added:

#searchControlWrapper
{
position: absolute;
top: 5px;
right: 5px;
background: #FFF;
border-left: 1px solid #CCC;
border-bottom: 1px solid #CCC;
padding-left: 5px;
padding-bottom: 5px;
}
#searchControl
{
float: left;
}
#clearLink
{
float: left;
padding-right: 10px;
}

Lastly, the Javascript. I found this “hack” from a post made to Google Groups, but I changed it slightly. This goes inside the header of your html file(s) ( you could also put it in an external javascript file). You just need to change where I have “www.cjmillisock.com” to your site’s URL.

<script language="Javascript" type="text/javascript">
//<![CDATA[
function onLoad()
{
// Create a search control
var searchControl = new GSearchControl();

function MyBlogSearch()
{
this.execute_=GblogSearch.prototype.execute;
}
MyBlogSearch.prototype=new GblogSearch();
MyBlogSearch.prototype.setBlogUrl=function(blogUrl)
{
this.blogUrl_= blogUrl;
}
MyBlogSearch.prototype.execute=function(q)
{
if(this.blogUrl_)
q+=' site:'+this.blogUrl_;
return this.execute_(q);
}
var blogSearch=new MyBlogSearch() ;
blogSearch.setBlogUrl('http://www.cjmillisock.com');
searchControl.addSearcher(blogSearch);

// Tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchControl"));
}
function searchControlClear()
{
document.getElementById( "searchControlWrapper" ).innerHTML = "<a href='#' " +
"id='clearLink' " +
"onclick='searchControlClear();'>Clear</a>" +
"<div id='searchControl'/>";
onLoad();
}
//]]>
</script>

That’s all there is to it. Now if only Digg would replace their site-search with this. . . .

Google AJAX Search API Update

June 5, 2006

I’ve replaced my site’s search with the new Google AJAX Search in the upper right. Enjoy!

Google AJAX Search API

June 4, 2006

I’m experimenting with Google’s new AJAX Search API. You’ll notice I put the search control in the upper right. I don’t quite see the usefulness for it on my site right now, but I plan on using it to replace the search control I currently use in the right sidebar.

Right now, it doesn’t search just this site. I’m assuming Google will add that functionality some time. What other uses are there for this?

Google Calendar Access By Text Messages

June 1, 2006

You can now use text messages to access Google Calendar. Simply send messages to GVENT or 48368. The following commands are available:

  • next : retrieve your next scheduled event
  • day : retrieve all of today’s events
  • nday : retrieve all of tomorrow’s events

You can also add events to your calendar by sending a message along the lines of:
Lunch with Sandra at Java Joe’s 12:30 pm Saturday

Google’s SMS service will interpret your event and add it to your calendar. To use any of these queries, you have to have your cell phone registered to your calendar. You can do that in the calendar’s settings under notifications.

I wish they provided a way to retrieve the scheduled events for a specified day. A query like get 06/15/2006 would also be very useful. Oh well! I’m happy for the three commands they did provide. I’m sure I’ll be using them some point.