Archive by Author

How to: MySQL “created” column default value of NOW()

MySQL is gay in a lot of ways, but no more to me than the inability to use NOW() on a “created” column.

So here’s what you do — Create 2 columns both of the TIMESTAMP data type:
modified – on update CURRENT_TIMESTAMP
created – default value CURRENT_TIMESTAMP (instead of now) and you should be good!

You can’t use NOW() for some reason, MySQL hates it. Instead slap on that sand paper condom, bend MySQL over and use CURRENT_TIMESTAMP instead.

Hopefully sometime in 2015 the jackasses fix it so you can use custom functions as default values, but until then, this will have to do.

HTML5 Cheatsheet Facts

I’m not going to write a huge article explaining why HTML5 is great, what’s planned, none of that. I’m just giving you the facts so you can reference and get the birds eye view perspective which for the busy web developer is sufficient.

Doctype declaration

<!-- HTML 4.1 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!-- HTML5 -->
<!DOCTYPE html>

Charset definition

<!-- HTML 4.1 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- HTML5 -->
<meta charset=utf-8 />

Tags that have been Removed from HTML5

<basefont>
<big>
<center>
<font>
<s>
<strike>
<tt>
<u>
<frame>
<frameset>
<noframes >

Deprecated tags that have been Removed from HTML5

<acronym>
<!-- Use abbr instead -->
<applet>
<!-- Obsoleted in favor of object -->
<isindex>
<!-- Replaced by usage of form controls -->
<dir>
<!-- Obsoleted in favor of ul -->

Attributes for positioning were Removed

align, background, bgcolor, border, clear, height

What changed in HTML5

<a>
<!-- Now it can contain block elements. Hurray! -->
<b>
<!-- Now represents text whose typical typographic presentation is emboldened -->
<hr />
<!-- Now reprensents a thematic break in paragraph-level -->
<i>
<!-- Now represents text in an alternate voice or mood -->
<menu>
<!-- Has been redefined to be usefull for toolbars and context menues -->
<small>
<!-- Is now used to represent small print in documents, generally for legal purposes -->
<b>
<!-- Now represents importance instead of strong emphasis -->

New tags in HTML5

All I have to say is: finally.

<section>
<!-- Generic document or application section -->
<article>
<!-- INDEPENDENT piece of content of a document. E.g: Blog entry, newspaper article -->
<aside>
<!-- Content slightly related to the rest of the page. *cough* side bars *cough* -->
<hgroup>
<!-- Header of a section. E.g: To include title and subtitle, or company name and slogan type of thing -->
<header>
<!-- Group of Introductory or navigational aids. Doesn't necessarily needs to be at the top of the document, it can be the header of a section of the page -->
<footer>
<!-- Footer for a section. Can contain information about the author, copyright, etc. -->
<nav>
<!-- Section of document intended for navigation. -->
<figure>
<!-- Associate a caption with some embedded content, such as graphic or video. -->
<figcaption>
<!-- Provides caption for the previous tag's embedded content -->
<video>
<!-- Video and audio multimedia content. Very exciting tag <img src="http://jorgepedret.com/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley">  -->
<mark>
<!-- Run of marked text. E.g: Can be used for marking keywords of a search in a long text -->
<progress>
<!-- Represents a completion of a task. E.g: Downloading, performing series of expensive operations -->
<meter>
<!-- Represents a measurement, such as disk usage. -->
<time>
<!-- Represents a date and/or time. Very exciting tag <img src="http://jorgepedret.com/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley">  -->
<canvas>
<!-- Rendering dynamic bitmap graphics on the fly. Very exciting tag -->
<command>
<!-- Represents a command the user can invoke -->
<details>
<!-- Additional information or controls which user can obtain on demand -->
<datalist>
<!-- Used for creating a list of options for the new 'select' tag. -->
<keygen>
<!-- Control for key pair generation. -->
<output>
<!-- Represents some type of output. E.g: Calculation result -->

Input tag’s type attribute now has the following values:

* tel
* search
* url
* email
* datetime
* date
* month
* week
* time
* datetime-local
* number
* range
* color

Depending on the device or browser used, this can prompt change the way to input the value. For example, if browsing from an iPhone, the datetime value promts the native way for the iPhone to choose a date+time.

The type attribute can also be used for automatic browser native validation purposes.

For more details on form changes, take a look at http://diveintohtml5.org/forms.html

Visit: http://www.w3.org/TR/html5-diff/#new-attributes for more new attributes in html5 that you need to know about.
New html5 API’s

Other than tags, html5 implements a bunch of new API’s (think of it like javascript libraries) that will help you develop better applications in a faster way.

* Video & Audio: API for playing of video and audio; it can be used with the new video and audio elements.
* Offline Apps: An API that enables offline Web applications.
* Editable Content: API for editing inline content; use it with the new global contenteditable attribute.
* Drag & Drop: API for drag & drop elements; use in combination with a draggable attribute.
* History: API that exposes the history and allows pages to add to it to prevent breaking the back button.
* Geolocation: API that provides scripted access to geographical location of the device that’s browsing the site
* Local Storage: API for persistent data storage of key-value pair data in Web clients (how exciting is that!?)

Examples:

Check out html5 examples here http://html5demos.com/ they have everything and more of what I’ve said here and it’ll also tell you the current browser support.

Top 11 Search Engine Optimization (SEO) Factors

I know. I said Top 11. I don’t really care. Enjoy the read. Leave your thoughts and comments!

Search engine optimization can be tricky. Where do you start? What are the factors that really make a difference? Theory is great, but practice makes perfect. I have launched several personal blog projects like –

  • A celebrity gossip blog just to see the traffic fluctuation which was anywhere from 15,000 to 50,000 hits a day based on the article and the relevancy.
  • A web development blog targeted specifically at major social networks like Facebook, Myspace, YouTube API and other related jargon that grew 24,000% in about a week.
  • An entrepreneurial blog discussing web development, ideas, funding, you name it.
  • This blog.

It’s difficult for someone who’s starting out to understand what really makes a difference and what is a worth while investment. It takes time, practice and research. Don’t forget that content is king, today, tomorrow and “forever” it always will be the primary medium of value. You can think about it like this: information is king. If you have every picture, video, tweet, etc in one place indexed you’d have alot of information that is extremely valuable. Imagine what Google understands now about the average user. What they look for, what they find, what they look for in retrospect, when they stopped searching for X because they found Y and how long they were at Y can almost (mark my words) be entirely gauged by Google Analytics. Almost every website runs Google Analytics, everyone has the same IP address on the internet for either a brief, or extended period of time; however, they all probably have Gmail accounts or the like. You get the gist.

SEO Tools

There’s a lot of tools to choose from online. These are the tools that Ihave used and trust.

  • Google Analytics – Track your website. Google Analytics is a simple Javascript include that you can place on your website’s primary template (so it’s included on every page) that will track any users session throughout their stay at your site. IP address, how they got there, where they are (in the world), how long they stayed, what page they left on, you name it Google Analytics has it.
  • Alexa – Alexa tracks web traffic across the internet, not just a certain site — it tracks all websites. You can use Alexa to find out more about where you stand in the entire internet.
  • Compete - Compete is a great website that you can compare traffic with and do research.
  • Technorati – This website is extremely valuable for back links and other forms of SEO. It’s primarily for blogs, though.
  • WordPress – You already know. There’s truckloads of plugins for WordPress and it tends to handle SEO out of the box fairly well as long as you have the right rewrite rules and clean URLs enabled. WordPress isn’t necessarily just a blog platform. A lot of successful websites run WordPress.
  • Google keyword tool – This tool lets you put in the keywords you want to target and find out what the volume of searches are (how many hits you can expect within reason if you’re in the first page) the competition and synonyms that are helpful to your business. It will help you discover that “long tail” keyword that could have huge SEO results on organic search engines versus the keyword you just happened to imagine people used to find your website or content.
  • Google Webmaster Tools – This is invaluable. It handles your Sitemap, your queries and other information about your website that you need to understand. If there were any errors, if anything like that happened it will help you find them and correct them. Oh and it’s free.

Top 11 Search Engine Optimization (SEO) Factors

  1. Choose the right domain name. If you’re trying to sell Fireworks in Austin, Texas then you might want to go with a more keyword rich domain name like: austinfireworks.com, fireworksinaustin.com, fireworksaustin.com or the like. If you’re competing with someone in your area for major search keywords it will be difficult to beat them if your domain name is irrelevant. Imagine your domain name is your business name. If your business was selling bicycles and your business was called Johns Wheels it would be confusing. Wheels could play a part, but it would be a wiser fit for someone who targeted bicycle wheels, or car rims and tires.
  2. Use your page title as a keyword preface. The page title (what you see at the top of your web browser) is extremely valuable. If you match your domain name and your title with your headers, chances are your keyword density and relevance is extremely high in Google’s eyes. Example:
    1. Domain name: www.austinfireworks.com (A sample URL, I don’t know if it’s real or not. Don’t hold me to this.)
    2. Page title: Fireworks in Austin, Texas
    3. Header 1 (h1): We sell Fireworks in Austin, Texas
    4. Header 2 (h2): All of your favorite fireworks in one place. Locations all over Austin, Texas!
    5. Header 3 (h3): Usually useful for related fact headings like: Check out our Firework locations in Austin.
    6. Body content: A 3-4 paragraph content section separated by header 3 (h3) tags: Our fireworks, our prices on fireworks, etc.
    7. Internal links: Don’t forget to link back to your website and use the proper link text and URLs to match relevancy.
      1. Examples
        1. Link URL: www.austinfireworks.com/our-fireworks
        2. Link text: Our Fireworks
        3. Link title: Check out Our Fireworks!
  3. Use proper headings (Primarily headers 1 through 3). Do not skip the header tags. Styling a span or a div with big text is NOT the same. Although search engines are getting smarter, it still doesn’t replace the proper semantics for organization of information on the internet.
  4. Organize your content. Imagine your website is like a book. You wouldn’t (shouldn’t) have content before headings and chapter titles; moreover, if you don’t have a header, a sub header, paragraphs, an index (Sitemap) and keyword dense content how will any search engine understand what you’re talking about?
  5. Use proper HTML. Don’t make a website that isn’t valid. Google uses HTML’s DOM (document object model) to traverse websites. If you’re HTML is jacked, it will most likely just penalize you for building a website incorrect rather than try to understand your shortcomings. You can use the W3C Validator (free) to check your HTML and CSS pages.
  6. Use meta tags properly. Don’t forget about meta tags. Search engines give you this one opportunity to explain from a 20,000 foot view what you’re trying to say. This isn’t your chance to spill the beans to your best friend. It’s your chance to make a short but sweet introduction to what’s about to be read. Imagine this as you explaining to someone who has no idea what you’re talking about and you only have 5 seconds. Make sure you target your keywords and make it make sense.
  7. Create a Sitemap and Submit it to Google. Google allows you to submit a Sitemap so they know which URLs to scan and how frequently. Don’t skimp out on this.
  8. Update your content and keep it fresh. Nothing sucks more than a dull website with content years ago. Keep your content in cycle. Do something new at least once a month. Search engines love websites that are constantly updated with new, fresh, original content.
  9. Get a fast web host. Google has begun beta testing a new search engine ranking factor based on web host performance and you should pay attention. Slow response times means a lower ranking in Google.
  10. Use clean URLs. Don’t waste your time with the site.com/?page_id=5 crap. It’s useless. Make sure you have the proper setup for your pages so you can actually have an About page at www.yoursite.com/about.
  11. Generate inbound links. Google will judge your websites importance and relevancy based on how many inbound links you have, the text of that link, and the URL that link goes to. It has a certain body of recursion to it as well. Imagine if they judged not only immediate links to your website or page, but from blogs along down the line linking to each other to determine their relevancy and context? They do, so don’t skimp on gathering inbound links. Inbound links are links that other websites use to link back to you for certain information. This is very popular amongst blogs and are usually easy to come by organically, however you can email authors in your same industry/topic and get referrals pretty easily.

There’s more coming, but this is just a taste for now. Happy SEO’ng.

Get good at something, before you suck at Everything.

It’s a simple phrase that is probably unoriginal and not coined by me but I’m staking my claim right now. This occurred to me this morning when I was:

  • Learning Ruby on Rails
  • Creating my brilliant Facebook application
  • Working on my company’s Craiglist ads and SEO
  • …and other things.

Not only did I realize how unfocused I was early in the morning but I had no goals, no motive, ambition for an idea but not a resolution or a result. I was passionate as ever about my craft and my abilities. However passionate or excited I was still swimming in the ocean changing directions every fourth mile. I couldn’t seem to get anywhere and it’s obvious to me. I have ADHD. Just kidding (although I probably do, but who cares).

I wanted to get good at everything. I’m usually able to focus for a solid 3-4 hours and get a lot accomplished in any given day but not this morning. It was like I had a goal to do a bunch of things with no clear ending in sight, no vision or groundbreaking revelations occurred, I just realized I was sucking at time. I was trying to get good at everything at the same time when in fact I was starting to suck at all of the above.

A long time friend of mine said once “You can’t be everywhere at one time, but you can be smart all the time.” and that’s always stuck with me.

My mantra this year is to get good at something before I start to suck at everything. I have what some would call a very impressive resume, a very impressive track record, I’m “very smart” all of that crap but when it comes down to it you can be a genius but if you never get good at anything, you’ll suck at everything. You’ll begin to measure your success by previous failures that you might have called successes. The line will begin to blend between start and finish in this almost constant “pending” phase. Everything in your life will bleed into a funnel and before you know it you only have a few things that trickle through.

Just something I’ve been thinking about.

SqueezMedia is Online

I recently partnered with a friend of mine to start a web design and application development business in Austin, Texas. We just launched our company website. Check it out, www.squeezmedia.com.

Let me know what you think.

We’re currently accepting clients so if you need help with your website or web application, let me know.