May 17 2009

Google Query Syntax Explanations: Part 1

Basic Google Syntax Explanations

Ever see someone spending hours trying to find something in google and just giving up due to the enormous amount of content for any given keyword? I’m amazed at how little everyone knows about using the Google search engine. Most of the population uses google every day but are still unaware of  some very basic but extremely simple and effective syntax rules for google queries. This takes energy and bandwidth. In the following I try and outline two of the most common methods of narrowing your search results down to only what you want.

  • Basic Boolean: Use ‘AND’ and ‘OR’ in your query. The ‘AND’ will require the result to include both keywords and the ‘OR’ will allow results that have either keywords in them. You can also use the ‘|’ (pipe) character to specify ‘OR’. To make sure that none of the results include a specific word then use the ‘-‘ character in front of the word. So searching ‘cody AND taylor AND -yoyo’ will return results for cody taylor that do not include yoyo.
  • Quotes: Use quotes on a query to specify that you only want to search results that are exactly as you write them. If I google codytaylor most of my results are for cody taylor but if I google “codytaylor” then I get results only containing codytaylor without any spaces. Googles forethought in displaying results and splitting up words is very useful but a lot of the time you will want your results to be exactly as you specified. Quotes are also used to specify keyword order. If I wanted results for only the useful and not some sentence or combination of words that include those three words then I would specify “only the useful”. Try it and you’ll notice a huge difference. Try a couple queries to see how much more specific your results become.

These two basic features are surprisingly little known yet so straight forward. Save everyone some bandwidth and explain this to the people around you.

Yes, Google is a verb.

Check out Part 2

Share

Apr 28 2009

First Dojo Experience. Drag and Drop with Dojo and Ajax.

Lately I’ve been doing a large amount of web based programming for a couple of database driven websites.
This has been an great technical learning experience for me and I’ve thoroughly enjoyed most of it.
Most of my work has been server side php pages allowing customers to edit settings or print off reports.
While having a great design and a mostly self explanatory interface I’ve always felt that the pages lacked the whole web 2.0 feel.

I’ve have used basic ajax throughout my sites but it’s never been as smooth or slick as I’d like.
I’ve never used drag and drop methods on any of my pages and most of my pages reload when the customer hits submit.

I wanted to make my web pages more like a stand alone application and I have recently been playing with a javascript framework named Dojo. Since Dojo is still relatively new to me I’m sure there is a large amount of functionality that I’m missing out on when I describe my experience but here is my journey to get a drag and drop database application running with Dojo as quick as possible with hopefully only the useful steps outlined.

As I always do, I started out with a basic html template. But I’ll assume that everyone knows what that looks like so here is the html document after I put the Dojo includes in :


<html>
<head>
<style type="text/css">
  @import "includes/dojo/dijit/themes/tundra/tundra.css";
  @import "includes/dojo/dojo/resources/dojo.css";
  .target {border: 1px dotted gray; width: 100px; height: 200px;padding: 5px;}
  .source {border: 1px dotted skyblue; width: 100px;height: 200px;}
  .cody {height:50px;width:100%;background-color:skyblue}
  .taylor {height:50px;width:100%;background-color:red}
</style><script type="text/javascript" src="includes/dojo/dojo/dojo.js"
djConfig="parseOnLoad: true"></script>

<script type="text/javascript">
//Nothing here yet
</script>

<title>Cody Taylor's Dojo Test</title>
</head>
<body class="tundra">
</body>
</html>

Pretty basic right? A couple of css files for the web 2.0ish look and the dojo core javascript file.
Next we need to include the dojo.require stuff. From what I understand these statements are the framework’s “Include This Module” statements.
Which is a good idea due to the size of some of the Dojo files. I added these two statements to the page head to add the javascript drag and drop functionality module.

dojo.require("dojo.dnd.Source"); 
dojo.require("dojo.parser");

I then added the following code to the body section. Div within a div within a div twice makes up the first “source” div.
The second div provides us with a target. The odd stuff here that you should take note of, and read up on in the documentation is the dojoType, jsId, and the specific dojoDndItem class.


<table><tbody><tr>
<td>
<div dojoType="dojo.dnd.Source" jsId="cody1" class="source">
        Test Source
        <div class="dojoDndItem" dndType="blue">
                <div class="cody">Cody</div>
        </div>
        <div class="dojoDndItem" dndType="darkred">
                <div class="taylor">Taylor</div>
        </div>
</div>
</td><td>
<div dojoType="dojo.dnd.Target" jsId="cody2" class="target" accept="blue,darkred">
       Test Target
</div>
</td></tr><tbody/></table>

Now we have a working drag and drop example. Awesome right? To bad it looks like garbage. First thing that ruins the impressive effect of dragging and dropping on a web page is that silly arrow with the ‘1’ beside it. Not sure what the point of that is.
Overriding the css class should fix that.


.dojoDndAvatarHeader {
        display: none;
}

I’ll get into using custom images to drag and drop with dojo and javascript in my next blog. So far though I am very impressed by this extremely simple to use javascript framework. I hope that it is this easy to customize everything for specific applications. I guess I’ll find out when I try to put images and ajax with database driven information in the dojo app that I plan to create in the next two or three dojo examples.

-Cody Taylor

Share