Manipulating 0 byte or empty files in Linux

There are a surprising amount of times I’ve had to manipulate empty files dispersed amongst a large group of variously sized other files.

A long time ago I remember using some convoluted shell script on my Sun Workstation 3/80 (SunOS baby, none of that fancy Solaris whippersnapper!)

Later when I was using Debian, I wrote little TCL (and even later Python) scripts.

Now I’m using Ubuntu on most of my Desktop (or development I s’pose) machines and it seems things just keep getting easier.

Now I found a method that borders on the rediculous easy, using the find command.


find . -type f -size 0 | xargs command

So lets say we just want to list the files MMmkay?


find . -type f -size 0 | xargs ls -l

Or say we want to remove/delete the files


find . -type f -size 0 | xargs rm -f

Of course I know that this isn’t an Ubuntu specific solution (this should obviously work even on older versions of find and pick-your-unix-flavor or even some inferior operating system (*cough*) where you’ve ported over your unix tools to.

Resolving Prototype Scriptaculous jQuery Conflictions with noConflict() Example

There is a good chance if you are reading this, you were under the same problem I myself had a short while ago…

You’re using Scriptaculous or something else built on top of Prototype and everything works fine when one fine day or hour, you decide you want to incorporate a widget or some code that uses jQuery.

So you do what I did, search around only to have people mention with a high and mighty, auspicious sounding response that the answer to all your problems, the magical cure-all for your what ails ya:

jQuery.noConflict();

Of course they mention that all you have to do is “call this code” after importing the jquery script.. and possibly that you should call it like this ‘$.noConflict();’ or perhaps ‘jQuery.noConflict();’ or laughingly ‘$jQuery.noConflict();’

Some of the smarter (but no more helpful) ones tell you correctly to use assign the noConflict to a variable

like so:
$var = jQuery.noConflict();

Yet they then expect you to just know what to do from there. Great. Thanks. So you spend a couple hours thinking that maybe if you call the statement before the script is imported or right after or before that one or after that one, and then you start to change some of the references in your code.

No luck?

The thing is that all references to $ need to be changed.

Let’s go over an example. I was using a script for a neat little widget on a site that I was working on and it sat on top of Scriptaculous (and of course Prototype). When I dropped in the jQuery code… things went all to hell.

Courage Wolf Says its Better to Have Tried and Failed than to Never Try At All
He may be right, but we're not going to fail this time!

The Scriptaculous is not important, we do not have to make any changes to any of that code at all to get your new jQuery code to work. In my example I dropped in a modalbox, one of my favorites called “Sexylightbox“.

I placed my new modalbox code after my old code.

It required these lines to work:


Import/Src these scripts:


jquery.js
jquery.easing.js
sexylightbox.v2.3.jquery.js

Then it also needed to be initialized:

<script type=”text/javascript>

$(document).ready(function(){

SexyLightbox.initialize({color:’black‘, dir: ‘../../images/sexyimages‘});

});
</script>

Then I had to decide what to name my noConflict variable.. in this case I decided to go with $sexy.

So I changed

 

<script type=”text/javascript>

$(document).ready(function(){

SexyLightbox.initialize({color:’black‘, dir: ‘../../images/sexyimages‘});

});
</script>

to

 

<script type=”text/javascript>

$sexy(document).ready(function(){

SexyLightbox.initialize({color:’black‘, dir: ‘../../images/sexyimages‘});

});
</script>

This is just the first step! I made sure to edit sexylightbox.v2.3.jquery.js and I added in this line to the top of the file:


$sexy = jQuery.noConflict();

Then, I completed it with my finish move and in my editor VI I replaced every instance of the $ character with the $sexy string using a global search and replace command while in Escape mode. If you’re more of the GUI type and using BlueFish or SlickEdit or something else, then you should have a “Replace” and then “Replace All Instances of” option under the Find menubar option.

Then as crazy as it may sound, everything just started working perfectly.

The important thing to keep in mind is that every single instance of where jQuery code is using the $, you have to replace it with the new variable you’ve created with the noConflict function. I wish someone had spelled it out that simply for me.. would have saved me hours of wasted time and frustration.

Converting XML to Associative Array in PHP

Sometimes there are situations where I have had code that is expecting an Associative Array with its corresponding values to deal with. However, as can often stand the case when propagating over to XML, sometimes its not possible (or digitally healthy) to convert everything all at once and I end up in a situation where I have all my data in single layer XML objects but need to interact with it on an associate array level.

So, as a quick to fix I wrote this small function entitled xml2AssArray() to deal with the children of a single layer XML object and turn it into an array with the children’s names used as the key-names of the array.

function xml2AssArray($xmlobj)
{
    $assarray = array(); // Initialize the Array
    // Loop through the XML object's children
    foreach ($xmlobj->children() as $child)
    {
        // Assign the childs name as the key for the next entry while assigning the value itself as well
        $assarray[$child->getName()] = $child;
    }
    return $assarray; // Return the new Array
}

Let’s take this XML object (called $myxml which we create using SimpleXML) for example:

<?xml version="1.0"?>
<Lead>
    <ID>1213</ID>
    <SSN>123450000</SSN>
    <FullName>Israel Smith</FullName>
</Lead>

When we run it through our new function, the array that is returned, is now an associate array:

> $myarray = xml2AssArray($myxml);
> echo $myarray['FullName'];
Israel Smith
>

Huzzah!

An example of a web 2.0 pinwheel gradient

HOWTO: Web 2.0 Pinwheel Background Effect made in GIMP

You’ve seen these effects before on peoples websites in the background. I myself wanted to create a large image for this site that I am setting up in a few weeks. We’ll start with creating the gradient, laying it down, applying the correct filters, the final result, as well as some conjecture on making the process more interesting, easier or possibly advancing it.

I wanted to create a particularly large image for this example, so I made a new image with decently size proportions (in this case: 1600×1200 – your own mileage while you create your first test one should probably be smaller)

Create a New Image in GIMP
Creating a new 1600x1200 image in GIMP

Next I created a new gradient by going to the Layers/Channels/Paths/ window, going down to the Brushes / Patterns / Gradients section at the bottom and selecting “New Gradient”.

Create a New Gradient in GIMP
Selecting a New Gradient in GIMP

We now have the Gradient Editor display. We can title the gradient, we can manipulate the gradient by creating & diving sections, we can see what the result will be, zoom-in, zoom-out and save.

GIMP Gradient Editor
A fresh new gradient inside the GIMP gradient editor

The basic original gradient is split up into one Segment which has a left “section” and a “right” section.

When just working with two colors, I set my foreground and background colors in the color tools area as the two respective colors I will be using in my gradient.

Since I want more out of my Gradient than a natual 1 part gradient, we will need to use the “Split Segment at Midpoint” action. Most of the actions inside GIMPs Gradient Editor (and very powerful ones at that) are all accessible by right clicking on the area you want to manipulate.

I begin by right-clicking on the left part of the 2-part segement underneath the gradient, where you can see the white delimiter triangle and its two accompanying black division triangles. Then I select “Split Segment at Midpoint”.

Splitting Segment at Midpoint in GIMP
Selecting the Split Segment at Midpoint option in the GIMP Gradient Editor

We now should have something that looks like the following image, where the gradient now effectively has two segments. A left segment and a right segment (both of which each have a left point and a right point).

A GIMP Gradient with 2 Segments
Inside the GIMP Gradient Editor with a gradient that has 2 Segments

Feel Free to Move the White and Black Triangle Segment Pieces in this Example to Match mine or to create your own original Look

Now that we have our doublly segmented gradient, lets start on changing the colors on the first segment (the left one) by clicking ON that segment, as you can see I am on this next image.

Selecting a GIMP Gradient's Section
Selecting the First (Left) Segment on this GIMP Gradient

You’ll remember that I had chosen my gradient’s two colors ahead of time and setting them as the Foreground and Background colors. So my colors look like this:

Foreground and Background Colors picked in GIMP
I am using an annoying Red and a Depressingly Sick Blue as my Foreground and Background colors respectively for my pinwheel.

So now lets right-click again on the left segment and select “Left Color Type” and choose “Foreground Color”

Then right-click on the left segment once more and select “Right Color Type” and choose “Background Color”.

We’ll do the right (second) segment next but your gradient should now look like the following:

Left Segment in GIMP Gradient has Colors Set
I set the first segment to have its left color be red, and its right color be blue. The right segment stays the same.

To complete setting the colors, we have now clicked (chosen) the second (or right segment) of the gradient and likewise right-clicked to set the Left point as the Background (blue) color and the Right point as the Foreground (red) color.

GIMP Gradient with 2 Segments has both Colors set
The gradient's 2 segments now have their respective end-point colors set.

This makes sure our gradient’s colors have a good flow when they are repeated later in this tutorial. However, I don’t want my pinwheel to have such a soft edge between colors. So we’re going to create a third YES A THIRD segment that will go in the middle of the gradient. So we go ahead and right-click to “Split Segment at Middle Point” again.

GIMP Gradient in Gradient Editor with 3 Segments
Our gradient now has 3 total segment for further manipulation on the gradient's look.

To give the gradient a “harder edge” I begin to move the white and dark triangle segments closer together.

3 Segment Gradient in GIMP with Harder Edged Gradients
The segment pieces in the middle have been moved closer together for a harder look.

Now I am going to go a little more extreme and give blue the most amount of space and take away most of the gradient. After that we’ll be done and can save our new gradient.

A 3-part Segmented Gradient in GIMP is Finished and to be Saved
We are now have the finished three part gradient with two colors and a hard look.

If I were you, I would leave both sides a little more equal, and even allow one segment to have a softer edge/look.

We will now select our fresh spanking new gradient and choose the “Sawtooth wave” repeat option.

Choosing the new custom-made GIMP Gradient

Now lets apply the Gradient to our image by starting at X-coordinate 0 and holding down the Ctrl key so that our gradient line is straight.

Selecting the Area to Lay down the New GIMP Gradient
I've selected just a small portion as I want to the effect to re-peat many times

We should end up with something looking similar to the following:

Newly Minted Background with new Gradient

Then to initiate the Pinwheel Effect we make use of the Polar Coordinates filter.

Polar Coordinates Filter in GIMP

We now have the final product.

Web 2.0 Pinwheel Background
A couple layers of transparent gradient lines later and Voila!

Lastly, I’d like to make mention of a couple different things. First that giving an even harder edge to one side and a slightly (but not so much more) softer gradient look to another when creating your gradient will help give you that look you are seeking. As well increasing/decreasing the size of gradient area or introducing an extremely sharp third color to act as a semi-border between the two major colors.

Another idea would be to make use of the “Transparent” option in the Gradient Editor and using a flat color background in the back.

Either way, enjoy!

Here’s an example of a soft gradient that has more of an equal space for the two color and I’ve overlayed the light color-transparency gradient to run through the middle and the darker color->transparency to run through the top and bottom creating the effect we all know and love.
An example of a web 2.0 pinwheel gradient

PHP Simple Outbound Email API Library

On occasion I find it necessary on a project to setup my mini library for outbound email. I may not need a full set of functionality like the super large libraries (nor do I want the bloat), however, I do have some basic (semi-advanced) features as a requirement.

1. Sending an E-mail should be as Simple as 1 function call
2. Normal Text Mail Support
3. HTML Mail Support
4. Attachment Support

My “email” function which I’ve aptly named “email” can be used like thus:

For a simple E-mail Message:
email($to, $subject, $text_message);

For an E-Mail with both Text and HTML:
email($to, $subject, $text_message, $html_message);

For an E-Mail with just text and an Attachment:

email($to, $subject, $text_message, NULL, $attachment);

Lets go over the lib_email.inc file in 3 separate parts, the global variables/definitions whatever you’d like to call them, support function, and the main function.

Global Variables:


//////////////////////////////////////
// Globals
$__FROM_NAME__ = "Company Name";
$__FROM_ADDR__ = "israel@company.com";

//////////////////////////////////////
// MIME Types
$MediaTypes = array();
// Application Types
$MediaTypes['js']  = 'application/javascript';
$MediaTypes['ogg'] = 'application/ogg';
$MediaTypes['pdf'] = 'application/pdf';
$MediaTypes['ps']  = 'application/postscript';
$MediaTypes['zip'] = 'application/zip';
// Audio
$MediaTypes['mp3'] = 'audio/mpeg';
$MediaTypes['wma'] = 'audio/x-ms-wma';
$MediaTypes['wax'] = 'audio/x-ms-wax';
$MediaTypes['wav'] = 'audio/vnd.wave';
// Image
$MediaTypes['gif']  = 'image/gif';
$MediaTypes['jpg']  = 'image/jpeg';
$MediaTypes['jpeg'] = 'image/jpeg';
$MediaTypes['png']  = 'image/png';
$MediaTypes['svg']  = 'image/svg+xml';
$MediaTypes['tiff'] = 'image/tiff';
$MediaTypes['ico']  = 'image/vnd.microsoft.icon';
// Text
$MediaTypes['css']  = 'text/css';
$MediaTypes['csv']  = 'text/javasccsvript';
$MediaTypes['html'] = 'text/html';
$MediaTypes['txt']  = 'text/plain';
$MediaTypes['xml']  = 'text/xml';
// Video
$MediaTypes['mpg']  = 'video/mpeg';
$MediaTypes['mp4']  = 'video/mp4';
$MediaTypes['qt']   = 'video/quicktime';
$MediaTypes['wmv']  = 'video/x-ms-wmv';
// Other
$MediaTypes['rar']  = 'application/x-rar-compressed';
$MediaTypes['gz']   = 'application/x-gzip-compressed';

You should change __FROM_ADDR__ and __FROM_NAME__ to whatever fits into your project. Also, feel free to add to the MediaTypes array with any and all mime types you think you’ll be using / running across on your project.

We’ll move onto the only support function which I’m calling “createAttachment”. It takes filepath (e.g. /www/whatever/file.exa or ./file.exa) and then determines the filename, filetype and after reading in the file, stores all three bits of information into an associate array that we can use when we call the email() function.

Support Function

//////////////////////////////////////////////////////////////////////////////
// Function: createAttachment()
//////////////////////////////////////////////////////////////////////////////
// Description:
//        Takes a string which points at the file location and creates an
// array to be used by the email() function's $attachment parameter.
//////////////////////////////////////////////////////////////////////////////
// Returns: Array (3 parts; name of the file, mime type, and file contents)
//////////////////////////////////////////////////////////////////////////////
function createAttachment($filename)
{
    global $MediaTypes;
    
    $attachment = array();
    $filelocation   = explode('/', $filename);
    $attachment['filename'] = $filelocation[sizeof($filelocation) - 1];
    $filenameparts  = explode('.', $filename);
    $extension      = $filenameparts[sizeof($filenameparts) - 1];
    if ($MediaTypes[$extension])
    {
        $attachment['filetype'] = $MediaTypes[$extension];
    }
    $attachment['file'] = file_get_contents($filename);

    return $attachment;
}

Simple enough for my purposes, haven’t run across any problems yet.

Now we move onto the main function: email(). it will automatically generate the boundary types and set all of the appropriate headers for an e-mail. I know there are other header(s), and types, however in all my project I’ve never come across the need to use anything other than what this function produces.

If a message (of any type) or an attachment has been passed along, it will appropriately use them respectively and send out the e-mail using your hosts default PHP associated sendmail program/server.

Main Function

//////////////////////////////////////////////////////////////////////////////
// Function: email()
//////////////////////////////////////////////////////////////////////////////
// Description:
//        Takes self-explanatory parameters in order to send an email.
//
//        $to           - String (An email address)
//        $subject      - String (The Subject line)
//        $text_message - String (The body of the E-Mail Message)
//        $html_message - String (The body of the HTML E-Mail Message)
//        $attachment   - Non-Alphanumeric String (File contents)
//////////////////////////////////////////////////////////////////////////////
// See also: createAttachment()
//////////////////////////////////////////////////////////////////////////////
// Returns: Boolean (Based on Success)
//////////////////////////////////////////////////////////////////////////////
function email($to, $subject, $text_message = NULL, $html_message = NULL, $attachment = NULL)
{
    //////////////////////////////////////////
    // Initialize Message String
    $message = '';

    //////////////////////////////////////////
    // Boundary Section
    //////////////////////////////////////////
    // So we know where to look for the start of the data
    //////////////////////////////////////////
    $boundary = uniqid("Part_"); 
    $boundary = '----=_'.$boundary;

    //////////////////////////////////////////
    // Headers Section
    //////////////////////////////////////////
    $headers  = 'To: ' . $to . "rn";
    $headers .= 'From: "'.$__FROM_NAME__.'" <'.$__FROM_ADDR__.'>' . "rn";
    $headers .= 'MIME-Version: 1.0' . "rn";
    $headers .= "Content-Type: multipart/alternative;rn".
            "        boundary="$boundary"rnrn";

    //////////////////////////////////////////
    // Plain Text Message
    //////////////////////////////////////////
    if ($message)
    {
        $message .= "--$boundaryrn".
                "Content-Type: text/plain; charset=UTF-8rn".
                "Content-Transfer-Encoding: 7bitrnrn";
        $message .= $text_message;
        $message .= "rnrnrnrn";
    }

    //////////////////////////////////////////
    // HTML Message
    //////////////////////////////////////////
    if ($html_message)
    {
        $message .= "--$boundaryrn".
                    "Content-Type: text/html; charset=UTF-8rn".
                    "Content-Transfer-Encoding: 7bitrnrn";
        $message .= $html_message;
        $message .= "rn";
    }

    //////////////////////////////////////////
    // Attachment
    //////////////////////////////////////////
    // $attachment should be an array with the
    // filename, filetype, and file entries.
    ////////////////////////////////////////// 
    if ($attachment)
    {
         $message .= "--$boundaryrn".
                     "Content-Type: ".$attachment['filetype']."; name=".$attachment['filename']."rn".
                     "Content-Disposition: attachment; filename=".$attachment['filename']."rn".
                     "Content-Transfer-Encoding: base64rnrn";
         $message .= chunk_split(base64_encode($attachment['file']));
         $message .= "rnrnrnrn";
    }

    if (@mail($to, $subject, $message, $headers))
    {
        return true;
    }
    else 
    {
        return false;
    }
    return true;
}

In theory you should be able to plug this code in and use right away, although having a general understanding of email construction and also on subjects like the 5-point SPAM detection scale (usually dictated by advanced anti-spam products like spamassassin) would be good.

Likewise, you'll notice there isn't much in the way of error-catching, nor multiple attachments.. go ahead and add that in if you please. (If you do, please feel free to share them on here or with me!)

Code Snippets: PHP Function secs2human_time

On one project I was working on, it was driving someone crazy that the amount of time that had passed since an action occurred was being displayed in seconds (which was fine if the event had occurred 15 seconds ago, but not so much when 16,540 had).

I couldn’t find a builtin function (no wonder) that would do what I needed, which was to basically take the seconds and display the time in a human readable format. I set out to do that and came up with what I think works fairly well.

Here’s the code:

//////////////////////////////////////////////////////////
// FUNCTION: secs2human_time
// ///////////////////////////////////////////////////////
// Description:
// 
// This function takes seconds and converts them into a
// human readable format.
//
// If a string is passed it will be converted into an int
//
// ///////////////////////////////////////////////////////
// Parameters:
//     $total      - Amount of time in seconds
// ///////////////////////////////////////////////////////
// Example:
//     write_time_exact(604927);
//     returns: '1 week 2 minutes 7 seconds'
// ///////////////////////////////////////////////////////
// Returns: string - Human readable length of time from seconds
//////////////////////////////////////////////////////////
function secs2human_time($total)
{
    $secsMinute = 60;
    $secsHour   = 3600;
    $secsDay    = 86400;
    $secsWeek   = 604800;
    $secsMonth  = 2592000;
    $secsYear   = 31104000;

    $result = '';

    $seconds = 0;
    $minutes = 0;
    $hours   = 0;
    $days    = 0;
    $weeks   = 0;
    $months  = 0;
    $years   = 0;

    $total = intval($total);

    if (!$total || $total < 0)
        return FALSE;

    if ($total >= $secsYear)
    {
        $years = floor($total / $secsYear);
        $total -= $secsYear * $years;
    }
    if ($total >= $secsMonth)
    {
        $months = floor($total / $secsMonth);
        $total -= $secsMonth * $months;
    }
    if ($total >= $secsWeek)
    {
        $weeks = floor($total / $secsWeek);
        $total -= $secsWeek * $weeks;
    }
    if ($total >= $secsDay)
    {
        $days = floor($total / $secsDay);
        $total -= $secsDay * $days;
    }
    if ($total >= $secsHour)
    {
        $hours = floor($total / $secsHour);
        $total -= $secsHour * $hours;
    }
    if ($total >= $secsMinute)
    {
        $minutes = floor($total / $secsMinute);
        $total -= $secsMinute * $minutes;
    }
    $seconds = $total;

    if ($years)  { $result = $years.' years '; }
    if ($months) { $result = $result.$months.' months '; }
    if ($weeks) { $result = $result.$weeks.' weeks '; }
    if ($days) { $result = $result.$days.' days '; }
    if ($hours) { $result = $result.$hours.' hours '; }
    if ($minutes) { $result = $result.$minutes.' minutes '; }
    if ($seconds) { $result = $result.$seconds.' seconds '; }

    return $result;
}

Now I toyed with the idea of adding in decades, centuries, millenniums, ages, and eons… but I doubt my code will survive long enough to warrant that.

Code Snippets: PHP Function sqldate2timestamp

There are times when I have Dates variables which I’ve retrieved through SQL and they need manipulation sometimes later on in rare circumstances. In an environment where pulling too much data from the SQL DB (extra variations of a field) is bad, but pulling the data in its most basic form (timestamp from the start) costs too many CPU cycles (nobody ever said scripting languages were fast), a function like this comes in handy.

An example:

$my_ts = sqldate2timestamp($sql_date);
echo $my_ts;
1989348943830 (or whatever ;-)

Here’s the Code:

//////////////////////////////////////////////////////////
// FUNCTION: sqldate2timestamp
// ///////////////////////////////////////////////////////
// Description:
// 
// This function takes an SQL date (e.g. 12/31/2001) and
// converts it into a timestamp.
//
// Note: None
// ///////////////////////////////////////////////////////
// Returns: long integer
//////////////////////////////////////////////////////////
function sqldate2timestamp($date)
{
    return mktime(1, 1, 1,
                  substr($date, 0, 2),
                  substr($date, 3, 2),
                  substr($date, 6, 4));
}

Disgustingly simple, but elegant at the same time. (Like all code should be IMHO)

Code Snippets: PHP Function random_string_generator

In some of my actual codebases I refer to this incorrectly as my hash generation function, which is grossly inaccurate – but I so do love the expression “Hash Code” for some reason. I do find, however, that I have nothing I could rightly use for one-way encoding to mark something with a unique string identifer, but still have the need for unique string identification.

For that reason I put together this simple PHP function which takes one variable (an integer) which determines the length of the string. The string to be generated is an Alpha-Numeric one.

Example:


$hash_code = random_string_generator(13);
echo $hash_code;
0sDf52jNfd98h

Here is the code:

//////////////////////////////////////////////////////////
// FUNCTION: random_string_generator
// ///////////////////////////////////////////////////////
// Description:
//
// This function generates a random "hash" alpha-numeric string (made of
// normal characters and numbers).
//
// If a string is passed it will be converted into an integer.
//
// The minimum size of a hash must be 1, otherwise a "hash" string
// that is one character in length will be returned.
//
// ///////////////////////////////////////////////////////
// Parameters:
//
// $length        - Length of the "hash" to be generated
//
// ///////////////////////////////////////////////////////
// Returns: string - The "hash" string
//////////////////////////////////////////////////////////
function random_string_generator($length)
{
    $charset = array('q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M');   // a-z, A-Z, 0-9

    $hash    = '';
    $index   = 0;
    $length  = intval($length);
    if (!$length || $length < 0)
    {
        $length = 1;
    }
    while ($index < $length)
    {
        $hash  = $hash . $charset[mt_rand(0, (sizeof($charset) - 1))];
        $index++;
    }

    return $hash;
}

As you can see, the character set is stored into a simple array so that characters can easily be removed and added.

Top 5 Stupid Mistakes Travelers Make When Visiting Las Vegas

Preface

In my efforts to help out for a campaign at a particular Vegas resort, I put together an article for them to use with their mailing list. However, when I was writing the article I found myself actually thinking more in personal terms as to how I wish my own friends could / would / should experience this incredible city.

So I’ve gone ahead and attached below the article I made for them. Enjoy..

After living in Las Vegas for a while (and having worked in the Travel & Resort industry), there are so many things that I find I take for granted.

Having had friends come for vacation or business (or both) – I keep finding out (too late) that they’ve already ruined their chances of really getting the best out of their “Vegasperience”.

I wouldn’t say that they don’t have a good time (far from it!) – however, they definitely could’ve enjoyed their time more  (and far more cheaply) if they had just asked me or done a little research on their own.

Let’s do a quick-over on these common mistakes:

  1. Not Planning Ahead of Time
  2. Staying at a Hotel instead of a Resort
  3. Going to Familiar, Popular, or Fast-Food Restaurants Instead of the Hidden Treats.
  4. Not Taking Advantage of the Deals
  5. Missing Out on the (Unique) Vegas Offerings

Let’s go over exactly what I am talking about…

#1 Not Planning Ahead of Time

This includes all of the essentials that you have control over. Some things may not apply if you are going for scheduled event like a convention or birthday or bachelor(ette) party, etc. Or, if for example, your trip is paid for by your company or a friend. What you do have control over, however, you should take control of.

When Are You Traveling?

The summer months can be brutal if you aren’t used to the desert heat, likewise it can actually get surprisingly nippy during the winter. However, the best shopping on the strip happens during the cold season (Thanksgiving Day and Christmas Eve). We’re not talking about 40% savings at Kohl’s either. We’re talking about 50%-80% off of items that usually sell for hundreds to thousands of dollars. I remember buying a jacket that I had wanted badly for years, but cost $6000. No waaaaay I was going to spend that. Then, they had an 80% off sale on Thanksgiving Day and I walked out of there wearing it for a little over a grand. Awesome, right?

How Are You Getting There?

Like most people you are likely traveling by ground or air. If you are renting a car, consider looking for special programs, codes, offers that give you an upgrade. A good example is Hertz. If you just go straight to the site and sign-up – you’ll end up with a standard membership. If you want to upgrade to Gold Membership for example, it’ll cost you. If you do a little research however, you should be able to find yourself a FREE Gold Membership. (I just googled: free hertz gold membership and got several usable results.)

For Air, check non-major airports and airlines. They not only may be closer than the major airport (or not much further away), but offer cheaper parking, cheaper flights, and more options. One of my personal favorites is Allegiant Air. Sometimes even their last minute deals are hundreds of dollars cheaper than normal flight reservations. Once I flew from Arizona to Chicago and booked a (one-way) flight for only $53 that was flying out the following weekend. If that isn’t a great deal, I don’t know what is.

Where Are You Staying?

Nothing could be worse than staying at normal hotel or run down resort when you stay here. Las Vegas has some of the best accommodations in the entire world, and they dry up fast too. Why would you come here and stay in the same kind of place you’d stay at in your home town? Which leads us to #2…

#2 Staying at a Hotel Instead of a Resort

If you spend time looking at the resorts, you’ll find deals where you can stay at actual Resorts for the price that you would pay for a regular Hotel. People always tell me “Israel, I don’t care about where I’m going to sleep – I’m going to spend all my time out enjoying the city“. Believe me, where you stay in Vegas can make the difference between a good stay and an amazing one. It just doesn’t make sense to stay at a hotel when you can stay at a Resort for the same prices.

Hotel VS Resort
Nawww who cares where you sleep at night, right?

Lets look at the Hooters Resort. I just checked their online site (mind you getting prices directly from a resort’s site is usually the worst price you can possibly get). So, when you see that their site shows that you can stay in one of their nice bungalows for only $29 per night, or if you want to get nuts and stay in the tower where you are decked out for $53 per night.. that Holiday Inn for $89 or that weird resort that has a weird name that sounds familiar but its not right on the strip and charges over $120 per night for one room and two beds starts to sound pretty silly. Scratch that. It sounds downright stupid.

I’d love it if you contacted me directly so I could hook you up with an awesome stay for on the super cheap – but even if you decide to go with someone else, please, please.. don’t stay at some horrible (and usually more expensive)  hotel or *shudder* motel. When you stop at your place to relax, sleep, wake up, whatever: you’ll be happy you’re staying in a place that really makes you feel like you’re on a vacation and not couch-surfing at some distant, estranged relative’s who, for some reason, is charging you money for the (dis)pleasure of having a roof over your head.

#3 Going to Normal Restaurants Instead of the Hidden Treats.

This probably makes me angrier than anything else. Why are you going to McDonalds when you are in Vegas? Or even the Hard Rock Cafe and other restaurants that you can go to anytime in any major city? It’s just so inane. Let’s check out a few places.

For an amazing lunch (actually, the best in the entire city) I used to go to the Vintner Grill. The name doesn’t say much. From the outside it looks like an office building. The inside, makes it look like a high-end place from the 60′s. This place is never empty, but being a secret of Vegas, also never too full. The food is so good, you’ll be shocked when you see the bill. I used to eat here every day for lunch. Instead of paying $60 – $100 (as you would expect from meals with this high a quality), you’ll be paying the same as if you had gone to a Chile’s or TGIF.

The Vintner Grill is rated 4.5 out of 5 stars if you wont take my word for it and can be found at 10100 West Charleston Boulevard Las Vegas, Nevada 89135 and can be reached at (702) 214-5590. (You probably will never need to reserve a table, but just in case you do…)

For seafood the best place in possibly the entire world (and I’d be willing to bet everything I own that nothing in Louisiana would be able to touch it) is the world famous Oyster Bar at the Palace Station.

A Bowl of the House Gumbo
Ambrosia, thy name is Oyster Bar Gumbo

Now before you skip reading if you don’t like seafood – let me be blunt. I don’t enjoy eating seafood – I do eat the occasional fish or lobster or crab cakes, Spanish tapas, and various sushi rolls and fried fish sandwiches or sticks – however, I don’t really enjoy eating that kind of food at all. Notwithstanding all that, even I was unable to deny the amazing savory flavour of their world famous combo pan. A roast which has lobster, shrimp, crab in a cream based sauce and put on two different scales of spice and hot that range from 1 – 10. Personally I always order an 8 / 10 respectively. Everyone I know, seafood lovers and haters alike agree that this dish is ambrosia itself. They only have like 5-8 seats though, so you can expect to wait up to an hour or more if you go during the wrong time of day. However, it is worth the wait.

The Palace Station is located at 2411 W Sahara Ave. Las Vegas, NV – it is located downstairs by the machines in the casino area.. it can actually be easy to miss – so if you cant spot the stand with little round stools with a large green sign above that says “Oyster Bar”, then I suggest you ask one of the staff to direct you. (Or just look for the like, crazy long line if you come during the busy part of the day)

For Mexican food, prepare to be impressed on authenticity and you can’t beat the fact that its a 24-hour establishment. I’m talking about Tacos Mexico. Now it may not appear like much from the outside (white building with peeling paint and red reliefs) – and it doesn’t appear like much from the inside either – but the food is anything but totally authentic and totally awesome.

A Street View of the Tacos Mexico Restaurant
Eat like a Mexican Drug Lord but affordable by even the poorest Mariachi

The broths, the tacos, the burritos, the chile’s relleno’s.. wow. There’s not much seating space, so maybe be prepared to eat in your car if its lunchtime. However, late at night you can usually nab a table. I recommend anything really (especially what I listed above if you like it authentic), however, I really, truly do recommend you try out their orange salsa. That right I said orange. It’s actually a Roasted Chimichurri Salsa. They usually have 2 or 3 salsas (the regular red or green), but their Chimichurri is the absolute best I’ve ever had in a restaurant. Its even better than many homemade authentic versions and you are definitely in for a treat when you use that with some lime juice on your tacos. (Al pastor por favor!)

Tacos Mexico is located on 3820 W Sahara Ave near the S Valley View Blvd intersection in Las Vegas, NV – If you can speak Spanish and would want to call ahead of time the number is (702) 444-1171 . It can be easy to miss, however, it has a large white sign – a terrible and scarily small drive-thru.

If you absolutely must try a fast-food restaurant.. then look no further

Jollibee is considered the Filipino McDonalds
Jollibee is Dangerously Popular

than the world famous “Jollibee”. It not that famous in the United States (hence why you’ve probably never heard of it) .. but think of it as the Filipino version of McDonalds. It’s very well known abroad (particularly in the Philippines of course) – but be prepared for a surprisingly delicious and different tasting fast food meal in a cute package.Now my father was a man who loved his corn beef hash. Everyone else in my house dreaded the moment he would cook it as we hated the smell and would lock ourselves into our rooms whenever you ate the wretched stuff. I vowed to never eat or taste that vile concoction. A vow I broke when I came across their delicious corn beef hash burger that came with mayo. As for their cute little bit of spaghetti or cheeseburgers, etc. etc. Well, I sure wouldn’t turn it away.

There are two Jollibee’s so far as I know in the Las Vegas area, the one I used to live close to on 3890 S Maryland Parkway and another one on 9430 W Sahara Ave.

Sure, there’s a lot of great restaurants with great food on the Strip. However, the one I particularly like, that happens to be Italian and has what I consider to be the coolest show / experience while eating lunch or dinner, is Olive’s at the Bellagio. The coffee’s and unique dipping breads are good, the food is great, but the water show you will enjoy on the outside terrace (you have to get a table outside on the terrace) is one of the quintessential moments in your life that you will recall decades after you go, even if you never return to Vegas again. I won’t say anything more other than, to not go would be very sad. I diddn’t go often, but I remember every single time I went.

Olive’s Restaurant is located in the Bellagio on the Vegas Strip.

I could go on and on, but I could not stop this list without mentioning the Thanksgiving Buffet at the Valle Verde Casino Resort. Available obviously only on Thanksgiving – it the considered to be the best Thanksgiving Buffet experience in the world. A secret all the locals in the area (the southern part of Vegas known as Henderson) descend on like a mad house.

The inside of the Casino Area at the Valle Verde Resort
Otherwise known as the Green Valley Casino

The line stretches through the bottom floor of the casino so far, that your party can expect to wait more than 4 hours just to to the “waiting area”. Now, if you are even lucky enough to know about this – what many people dont know and you are very lucky now that I am going to tell you is that you can cut 3 or 4 hours easily out of your wait (so you wait maybe 20-40 minutes instead) is if you stay at the Resort as a guest, you can get a speed pass to cut straight to the purchase line. Viola. Even if you do decide to wait – do so.. it is definitely worth the wait.

The Casino Valle Verde is located just southeast of the Strip at 697 North Valle Verde Drive Henderson, Nevada 89014 and you can call them at (702) 454-9200.

#4 Not Taking Advantage of the Deals

Vegas has casinos right? Did you know you can get hundreds and hundreds of free dollars (worth of slot / play) ? Most people apparently do not. In a land where even when I walk into a gas station or Walgreens at night to buy myself a handle of Jim Beam and a 2-liter of cherry cola – I inevitably always see some poor misfit just sitting there at some poker machine dropping their last 20-dollar bills from their weekend paycheck. Well, all of the major casinos offer Casino Memberships or Membership Cards. You don’t have to sign a bunch of forms or get a background check or anything. You just present any legal form of identification, sign your name, pay nothing, and get a free card printed out – with money already on it! These range anywhere from places like the Red Rock Casino where you get $5 initially and a $5 bump just randomly every few weeks or months. If that isn’t exciting enough for you – Hooters gives you $100 right off the bat. If you win big on this free money – you keep it all.

There’s also the coupon books, discount cards, Internet offers & discounts for shows like the Cirque du Soleil. Why pay full price when you can pay so much less so easily? Now instead of just hearing about the show thats hundreds of dollars, you can see it and know its less than you’re going to blow on cocktails afterwards.

Remember too, open containers (of alcohol) in public is a commonplace thing. Why spend $6 on that beer inside the club you passed by, when you can stop at the liquor store and walk around with a beer-filled camelbak? Or pint of hard liquor.. or whatever your poison may be.

#5 Missing Out on the (Unique) Vegas Offerings

I was recently on a flight going from Chicago to Phoenix and ended up having a great conversation with the gentleman in the seat next to mine. (Hit or miss, I know, thank goodness) While we were talking, we ended up talking about Sin City. In particular, he told me he had gone to Vegas many times, but I was shocked to find that he apparently knew nothing about some of the best experiences.

Red Rock Mountain Canyon

Sure there are mountains. Sure there are lots of mountains in Nevada. However, the Red Rock National Park which is in the western outskirts of Las Vegas (just find the Red Rock Casino, which by the way is an awesome place to stay &/or eat at, and head west from there) is really one of the most amazing and exciting places to go mountain hiking / climbing.

On the Road towards the Red Rock Canyon Range
Impressive in the distance, even moreso at the Peak

You can go to the park, pay $3 for a day pass (one per vehicle) and really see some of the greatest mountain range sights in the United States. Second, if you are into climbing like me (not the hardcore rappelling kind) then be prepared for not just an awesome workout and climb, but some truly breathtaking sights. Even better (and free) for climbing purposes (not hiking) is the Calico Canyon which lies just east (or before) the Red Rock Park.

Mount Charleston

Lying on the northern skirts of Las Vegas, this mountain range reaches higher than 3,500 meters. That means snowlots of it. I don’t like to Ski or Snowboard myself – but I really did enjoy being able to quickly shoot up to one of the Ski Lodges during lunchtime and enjoy a few cocktails before heading back down into the warm bowels of Las Vegas. Hiking, camping, picnic grounds. Wonderful place to visit.

Let’s not forget the Grand Canyon or the Hoover Dam either!


I’d like to finish by pointing out that I understand that you can’t enjoy or see it all in one trip (or two or three or etc. ..) However, I hope you can see why it really boggles me when I see hear from a buddy that all they did was go to the Bellagio, look at some shops, drink at a few clubs, and end up eating chicken wings from room service. I believe them when they say they had fun – but they could’ve done the same thing at their local city for the same or possibly less.

If you have anything to add yourself – please feel free to comment!

eSATA Flash Drive – The Kanguru e-Flash

Farewell Floppy

As with many of my predictions in the past years, most come true. None more pleasant than the death-knell tolling of USB 2.0 flash drives. I am sure anyone reading this owns or at least has used one at some point.

Although useful for moving small files (and definitely having exterminated the last vestiges of floppy disks and total failures such as the Zip Disk fiasco *shudder*), anyone who owns a USB stick over 2 GB has quickly realized the same thing… moving large amounts of data quickly becomes a painfully long process.

As I stated back in early 2009, the advent of faster connection technologies such as the much-anticipated USB 3.0 or the snazzy eSATA meant that soon we could move beyond these USB 2.0 devices and truly have useful, portable, fast drives.

eSATAsfaction

eSATA beat out USB 3.0 to the punch and we have the Kanguru e-Flash which is not only an eSATA stick (the very first of its kind) but retains the legacy USB connection on the opposite side.

The Kanguru e-Flash
The Kanguru e-Flash USB/eSATA Flash Drive

Though it has been out for a while now, the prices have dropped (a little) and I bought the 32GB verison for $99 at Tiger Direct and found the 64GB stick for around $180 on pricewatch.com

Testing

As many sites have already written reviews long ago on the Windows use (which doesnt sound all to appealing for several reasons) I’ve decided to direct attention towards my having used it on a Linux system. Apparently on windows, there is a strange situation where Windows is too stupid to realize the drive is a removable stick (instead recognizing it as an internal drive), so Kanguru had to ship Hot Swapping software to emulate the same effect.

In Linux, the use of the drive is as seamless as anything else; Automounting and un-mounting work the same regardless of which technology is being employed.

I did manage to connect the eSATA to my computer and the USB side to my laptop which I was able to get working (I have no idea under what situation this would be useful) but I had a very bad feeling about possible ramifications to the data on the stick. (I should note I had created two separate partitions to mount).

Benchmarking

Although I imagine the speeds may vary depending on your Operating System and the quality of your eSATA or USB cards, the results were frankly unsurprising.. a massive speed increase when using eSATA – Almost 2x the write speed.. where I was able to get a sustained transfer rate just shy of 30MB/s. The read speed was less impressive only coming in slightly over 30MB/s (30-32) for reading.

What was a little strange, however, is that the USB on the stick actually seemed faster than my other USB sticks, which seems to support what other reviewers have said when talking about the e-Flash.

Conclusion

This stick is a little pricey, however, it retains the portability of other Flash drives, has backwards-compatibility for legacy USB inputs, and is definitely faster. I had no problems whatsoever reading Blu-Ray ISO rips from the e-Flash when I had it connected through eSATA into my O! Play Media Player. I am now a very happy camper. Hopefully soon we will see some more competition so we can enjoy price drops to a more reasonable level.