Next Image
Make the current image sticky.
Previous Image
randys.org - randys.org

Posts Tagged ‘google’

Google Chrome: Second Impression

After a couple of days with Chrome, I’ve decided to abandon it. Why? Every time I used it, I always experienced some kind of slowness, delay, or complete freezing. And not just with Chrome. It would lock up my entire machine for several seconds at a time. Now, I’m not working on the latest and greatest hardware, and it’s been several years since this particular machine had a fresh install of XP so it could be something else causing the conflict with Chrome. Nonetheless, it was painful to use on a regular basis.

Does this mean it’s a bad browser. Absolutely not. It’s certainly better than Internet Exploder and when it was working, it seemed to render a little faster than Firefox (perceptual, no hard evidence of this). Chrome’s UI is far better than IE and even a leg up on Firefox (at least the default theme for the Windows version). It will definitely take some wind out of Firefox’s usage numbers.

Until I get a new machine and/or fresh install of the OS, I’m going to stick with Firefox for everyday use. Waiting for my machine to wake up from a Chrome coma while shopping at the Gap is seriously hindering my productivity at work!

Update 1: I just got around to installing Chrome at home and there must be something on my work machine conflicting with Chrome. It’s considerably faster on this machine (AMD Athlon 64×2 4200+ / 2GB Ram / XP SP3) and doesn’t experience the hangs like my work machine does. Very queer. I wish my work machine wasn’t such a turd.

Update 2: I don’t know what exactly Chrome does behind the scenes, but I hear an awful lot hard drive activity when it’s the only application running. Interesting.

• • •

Google Chrome: First impressions

I must be really busy these days. I wouldn’t call my self a complete nerd, but I try to stay up on recent web trends and technologies related to such things. I just found out about Google Chrome, the new web browser for Windows. It appears to be using WebKit, the same rendering engine as Apple’s Safari web browser. I had heard recently that Google’s Android was rumored to be using WebKit for its browser so this sounds logical to me.

I use a Mac at home, so I’m used to Safari. In fact, until I recently started a side job, I used Safari exclusively for about a year. It’s fast to start up and fast to render. It has some developer tools built in so figuring out which styles apply to which elements is easy to decipher. Safari on Windows isn’t quite as quick as Safari on Mac. At least, it’s not on my work machine; an aging Pentium 4 with a measly 2GB of memory. This is the one thing kills Safari for Windows for me. I tried using it as a daily browser, but it was painfully slow on this machine. I think what kills it is Apple’s desire to make the application look like OS X and not Windows. Yes, it looks one million times better than windows, but at what cost? I’d rather it run fast on this machine than look pretty. It’s funny how Apple is somewhat hypocritical in this respect as they have strict guidelines for applications built for their own OS.

I digress…

So far (and this is a very short testing period) it’s a very fast and responsive application. It starts right up and renders quickly too. Its interface is minimal and clean yet functional (like most Google apps). It looks like it’s kind of modeled after IE7′s interface in that it does’t have a menu bar like most Windows applications. There are two icons to the right of the “OmniBox” (Chrome’s URL/search box all rolled into a single field); one to handle things like cut/copy/paste, new tab/window, etc and one for global features like options, history, and downloads. Of course there’s the obligatory back, forward and reload buttons and a place for your bookmarks, standard with any browser.

Tabs can be moved around easily for ordering and can be dragged completely out of the current container to create it’s own new Chrome window (a handy feature Firefox doesn’t support out of the box).

For developers, it has the same developer tools found in Safari. You can view source, debug JavaScript, monitor the JavaScript console, inspect elements on a page (which brings up a similar window to Safari’s). You can also view a Task Manager related to Chrome and it’s tabs that shows you how much memory and CPU are being used for each tab/window you have open. It even tells you how much memory is being used for any installed plugins. The Task Manager allows you to kill specific tabs if they are misbehaving as well.

I’m going to use it as my default for a while to see how it stacks up on a daily basis. I am optimistic at the moment, but I did notice some system hangs though those could be related to this massive pile of Java code running under Weblogic 8… which is an entirely different story.

• • •

Google Friendly URLs with PHP and Apache

Dynamic websites are essential for content heavy sites and chances are, you’re not going to create one static page for every single page/article/product item you have stored in a database. This means you’re going to need to pass parameters to your script to pull the right content from your database. Up until recently, most people didn’t give much thought to those nasty URLs with all those ampersands (&) and equal signs and how they affect spidering by search engines. While these URLs are perfectly valid, they tend not to get indexed by Google (and other search engines) unless you submit each URL for indexing (which can cost you money). And these days, if you’re not in Google, you’re not being found.

Enter PHP and Apache

<p><p>If you&#8217;re using <span class="caps">PHP</span> and Apache, you can still be dynamic and be spidered by all the popular search engines fairly easily. Of course, this depends on your hosting provider and how much control they let you have in terms of htaccess. <span style="font-style: italic;">.htaccess </span>files let you manipulate some Apache settings on a per host/per folder basis. Have a look at the <a href="http://httpd.apache.org/docs/">Apache manual</a> for a full listing of configuration settings for Apache web server.</p></p>


<p><p>Now for the goods. Here&#8217;s a basic rundown of how search engine friendly URLs can be used in a dynamic way. Let&#8217;s say you have a catalog of items, and your script takes 3 parameters: &#8216;section&#8217; , &#8216;action&#8217;, and &#8216;item.&#8217; Normally, when passing parameters to a script, your url will look something like this:</p></p>


<p><pre><code>/index.php?section=widgets&#38;action=view&amp;amp;item=327</code></pre></p>


<p><p>With the proper directives in an Apache .htaccess file and some simple <span class="caps">PHP</span> scripting, you can turn that <span class="caps">URL</span> into something like this:</p></p>


<p><pre><code>/catalog/section/widgets/action/view/item/327</code></pre></p>


<p><p>Looks like a bunch of folders, but it&#8217;s not. &#8216;catalog&#8217; is actually a file (a <span class="caps">PHP</span> file) without the extention, and with the help of a <span style="font-style: italic;">.htaccess</span> file,  Apache treats it like a <span class="caps">PHP</span> script.  Here&#8217;s what the <span style="font-style: italic;">.htaccess</span> file looks like:</p></p>

ForceType application/x-httpd-php

That’s it. Nothing too complicated. Now for the trickier part, grabbing those parameters from the URL with PHP.

<p><p>There&#8217;s a server variable that gets passed to the script calle &#8216;PATH_INFO&#8217; which contains the entire string after the catalog file (including that first slash). To grab it in a <span class="caps">PHP</span> script, you&#8217;d use the <a href="http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.server">$_SERVER</a> global variable (a la $_SERVER[&#8216;PATH_INFO&#8217;]). The idea is to <a href="http://us2.php.net/manual/en/function.explode.php">explode</a> the string into an array and loop through them to get the parameters. Here&#8217;s a small function to do so:</p></p>


<p><pre><code>&lt; ?php

function getArgs() { $params = explode(“/”, $_SERVER['PATH_INFO']); } ?>

<p><pre><code>for($i = 1; $i &lt; sizeof($params); $i = $i + 2)

{ $args[$params[$i]] = $params[$i+1]; } return $args;

<p><p>When used on the above example, this function will return an array like so:</p></p>


<p><pre><code>Array (
 [section] =&gt; widgets
 [action] =&gt; view
 [item] =&gt; 327

)

<p><p>Implimenting this into a current site shouldn&#8217;t be too hard. The &#8216;catalog&#8217; script would simply be a wraper script where you can pass the required values into existing code.</p></p>


<p><p>If you find that your web host doesn&#8217;t allow use of .htaccess files, or they don&#8217;t allow the &lt;Files&gt; directive to be used, you can do one of two things (and I highly recommend the first).</p></p>


<p><p>1) Change hosts! I use <a href="http://www.dreamhost.com/rewards.cgi?sesser">Dreamhost</a> and they are extremely flexible, have an awsome support team and have a <a href="http://www.dreamhost.com/rewards.cgi?sesser/shared/comparison.html">very good deal for $9.95/mo</a>.</p></p>


<p><p>2) Just use a normal <span class="caps">PHP</span> script (i.e. catalog.php) and use the same function. While this method works, I&#8217;ve read that some search engines see this as a hack/cheat and might not spider the pages anyway. However, if you are a reputable business, you can usually contact them and get your pages indexed.</p></p>

Other Web Servers

<p>If you&#8217;re running <span class="caps">IIS</span> (god forbid), there is hope for you. There is at least one product (ISAPI) available that mimics the Apache mod_rewrite module. This <span class="caps">ISAPI</span> can help do the same thing (although it won&#8217;t be quite as easy). But the drawbacks are that a) the <span class="caps">ISAPI</span> isn&#8217;t free and b) if you&#8217;re in a shared environment, you can&#8217;t use it. There are other ways to manipulate your <span class="caps">IIS</span> settings to use search engine friendly URLs, but they all have their downsides. Bottom line: stop using <span class="caps">IIS</span>.</p>


<p>As for other servers, I can&#8217;t really say. Chances are there are some tweaks that can be made to the configuration and/or scripts. If you know of any, please drop me a line and I&#8217;ll try to get it posted.</p>
• • •

All content Copyright © 1999 — 2010 Randy Sesser | Happily Hosted by WebFaction
Entries (RSS) | Comments (RSS)