Custom laptop/messenger bag

October 2nd, 2008

Timbuk2 has an awesome build your own laptop bag application.  When building your bag you can choose multiple styles such as a regular messenger bag, laptop messenger bag, lex pack, and a few more.  The next few steps let you customize items on the bag such as the inner liner and design on the outside.  Bags start out at around $150 which is kind of steep but for a pretty cool custom bag I think it’s worth it.

Besides the custom bag builder you can also browse through some of their already created designs and pick up one of those instead.

Has anyone purchased one of these? How’s the quality?

Google helping to increase voter turnout

October 2nd, 2008

Google just released their “2008 US Voter info” section on google maps.  You can see it at http://maps.google.com/vote.

Basically what it does is gives the user a visual reference of various voting information items and provides links to the following items:

  • Where a user can register to vote closest to their home
  • Instructions on how to register in their area
  • How to get an absentee ballot
  • The main election site if there is one for your location

The new tool also provides useful information such as:

  • How many days there are left to register by mail in their state
  • The voter hotline number for their area

By mid-October the site should have voting locations in there as well so that you can find the closest voting booth to your house.

Also head over to the Google election page for more information about the elections.

HTML 5: active validation, date pickers, and local storage mechanisms

September 27th, 2008

Just watched Ian Hickson’s demo of html 5 and since it’s over an hour thought it would be helpful to just type these out.

Video Tag
It’s been known for a while that there will be a video tag now instead of working with an embed and object tag.  Below is a possible use of using a video tag.  Notice that the keyword “controls” is what puts the controls on the video to control playback.  They aren’t very pretty at the moment but very cool to have video controls already on top of a movie rather than having to skin it with a player.  Another one is the autoplay where previously it would have been autoplay=true it is now just the keyword autoplay.

Another nice addition to the video tag is that once we can stop/start/pause etc a video by just referencing that html element.  See Below.

$('video').play()
$('video').stop()
$('video').pause()

Local Storage
Can save and open data locally. Think of a multipage form where you are normally storing data as you go but it is stored server side typically.  This is a way to store everything client side with easy access to your data.   Data is saved amongst pages, similar to cookies or session data. Local storage is more similar to a cookie while session storage is very similar to session data in that the data only lasts as long as the browser’s session.

localStorage.setItem(key,value);
localStorage.openItem(key);
localStorage.myvar; <!--Accessing directly by key-->

Drag and Drop
Drag and drop is now built into html.  You can utilize functions drag and drop. Ian mentioned that the API wasn’t that great yet but very cool to see this kind of behavior included already.

Actions on hash change
Can fire scripts on hash change. Hash meaning the anchor tag of a link.  So when you click a link that references page.html#first you can now act on it.

Modifications to inputs

There’s now an input type=”range” which gives you a slider bar. You use the oninput attribute to take action on anything that is happening with the slider bar.

There’s also now an input type=date! Once you set this it gives you a calendar date picker. Very similar to all of the javascript date pickers that are currently used. This will be very beneficial when having date fields.

Output tags
You can create output tags and give it a name and print your output to there instead of doing document.getElementById(’output’).  It would be nice to see a $() implementation to access elements to compliment the very archaic document.getElementById();.  It sounded like currently this is only supported within forms.

<output name=”main”></output>
main.value = “my new value”;

Validation
input type=email can now be automatically validated as an email address.  The css style :validated can used to style what invalid input looks like such as a red background or border. It uses active validation too so as you type it validates the email and lets the user know when it is valid.  Typically we have to code this in js and attach an observer to the field for this same behavior.

To validate a required field in a form the keyword required just needs to be specified within the input tag. The autofocus keyword is also used to focus on load, this is put in the input tag.

DataLists
New input type <datalist> lets you set predefined values that the user can select from but the user can then also enter their own value.  The field displays as a textbox and upon click or typing it shows the available options, if the user doesn’t want to use those then they can type their own option.

  • ondrop, ondrag, ondragover added as event handler for objects. Some of those have been supported previously in safari and IE.
  • URL fields pull urls straight from your history.
  • The script and style tag no longer needs language or type.  Not a huge improvement but nice to get rid of it.
  • Can interact with content within frames such as passing variables and other actions needed.

Google webmaster robots.txt only updated every 24 hours

September 26th, 2008

Recently had a problem where the old web guy for a site decided to restrict all search engines in the robots.txt.  This obviously isn’t very helpful when you are trying to grow a client’s business.

So I updated to the robots.txt to allow everyone but still google webmaster was telling me that the robots.txt file was not allowing access.  I thought this was weird since it had been changed to allow all.  Turns out that google only downloads a new robots.txt file about once a day.  So even if you request to add the sitemap in google webmaster it will still use the old one.

A good way to check that your robots file is ok is to go to the tools section while in google webmaster and analyze robots.txt .  This will let you know about any problems with your robots.txt and show you the current version that google has cached.  You can also make temporary changes to the cached version to ensure what you are doing is what you would like to happen with spiders.  None of the changes made in that form will changed the cached version, that can only be downloaded by google from the site. Modifying the cached version though and retesting it ensures that you have made the correct changes.

Magento run sales report error “headers already sent”

September 26th, 2008

Open this file ‘/app/code/core/Mage/Reports/Totals.php’

Remove all of the extra space before the opening php tag.

Not sure how Magento could f that up but they did.

Happy 10th Birthday Google

September 26th, 2008

Happy 10th Birthday google! Go check out their timeline to see how they have grown, new applications launched, and logo changes.  The original name of the compmany was “backrub” not google, funny name.  Good to see Android is finally out and sort of in celebration of your 10 year but probably not related.  Also check out their new $10 million dollar contest that just wants to hear your good ideas to help the world. While you’re at it you might as well check out their crazy google patent to float data centers in the ocean.  With this patent the servers will be self cooling and reduce latency to other countries.  Servers in water is still a pretty scary thought for me.

Free Pass to MerbCamp

September 24th, 2008

I just won a free pass to MerbCamp from Engine Yard!  See everyone in San Diego!

Google Reader Subscriptions With OPML File For Web Development Articles

September 23rd, 2008

Recently I have become pretty addicted to google reader as my primary source of news for all things in the web world, more specifically web development.  Out of my subscriptions my 3 most read blogs are consistently Lifehacker, Engadget, and DZone.  Below is a basic list of all my subscriptions with a downloadable version that can be imported into google reader. Feel free to download the full version and import them into your google reader and then delete the ones you don’t like or add on from there.  Thought this would be a good start for someone new to google reader.

A List Apart, Adaptive Path, Ajaxian, AppleInsider, Design Float, Design Reviver, Digital Web Magazine, DZone, Engadget, Gizmodo, John Resig (wrote Jquery), Lifehacker, Macworld, Rails Envy, Railscasts, Ruby Programming Language, Sharebrain, Slashdot, Smashing Magazine, Springwise, Techdirt, Technology, Vitamin, Wake Up Later, Web Designer Wall, Wired News, Woork, Woot, A design and usibility blog, WebAppers, Web Resources Depot, Happy Coder’s Daily Digest, Nuby on Rails, PSDTUTS, Rails Inside, Riding Rails, Ruby on Rails Workshops, Style Grind, The Pragmatic Bookshelf, Kevin Rose, NETTUTS.

Related Document: google-reader-subscriptions

Remember the Milk Keyboard Shortcuts Cheat Sheet

September 23rd, 2008

Remember the Milk has all of their keyboard shortcuts listed on their site but not in a visual form.  I went ahead and created a very basic keyboard shortcut cheat sheet with the commands on top of task panel in rememeber the milk.

Remember the milk printable keyboard shortcut guide

Michael Moore’s Slacker Uprising Not His Greatest Work

September 23rd, 2008

Michael’s passion for getting young voters to vote is stronger than anyone else out there at the moment.  Well maybe MySpace wins with it’s new My Debates section of their site. The best part of the film is when he plays his fake Bush ads, they joke about all of the past Kerry/Bush  political events.  The rest of the movie is very repetitive as he goes around to various universities across the country and speaks to large crowds of students.  He was criticized at one point for bribing young voters with free underwear and top ramen, guaranteeing they would get one or the other if they promised to vote.

Download the full Slacker Uprising movie for free

Don’t forget to vote :)

Application Roll

September 23rd, 2008

I use quite a few applications on a daily basis, thought I’d put them out there and see what else is out there.  I didn’t include all of the standard apps such as creative suite or gmail.

Windows


Web Based


Firefox Plugins

OS X

I know I’m missing quite a few OS X apps, didn’t have my macbook in front of me at the moment.

What else am I missing?

Ruby server monitoring script

June 17th, 2008

I wrote this script as a basic fix to monitor if certain sites are up. The script needs to be on a different server than where the sites exist for the best results and obviously with a cron job running every 5-10 minutes or more often if needed.

The ruby server monitoring script could also be expanded to ssh into another box and run the command needed to boot the server back up.

First let’s go over what the db looks like…
Sites

  • id
  • domain (url to curl)
  • active (turn monitoring on/off for sites)

Reports

  • id
  • sent_at (time when report was sent)
  • down (count of how many sites were down)
  • fixed (report has been marked as fixed)

Ruby monitoring script

#!/usr/bin/ruby
#change line above to reference your ruby location
 
require 'rubygems'
require 'net/smtp'
require 'mysql'
require 'time'
require 'curb'
 
def check
     @time = nil
 
    # Connect to db that stores all of our sites to monitor
     db = Mysql::new("localhost","user","pass","database")
 
	# Make sure we are only looking at sites that are active
    sites = db.query("SELECT * FROM sites WHERE active = 1")
	# Getting the most recent report since we only want to run the script to send a report every 2 hours
    last_report = db.query("SELECT * FROM reports WHERE fixed = 0 ORDER BY sent_at DESC Limit 0,1")
    last_report.each {|r| @time = r[1]}
		# If there isn't a report in the database yet it sets the time to greater than 2 hours so the script will run and report if needed.
        if @time.nil?
         @diff = 7201
        else
		# Calculating the difference in time
         @report = Time.parse(@time)
         @now = Time.now
         @diff = @now - @report
        end
			# Change this number to whatever you woudl prefer in seconds. Currently it is 2 hours
        unless @diff.to_i &lt; 7200
            body = ""
            sites_down = 0
 
            sites.each do |s|
				# Prints the site name to the user
                print s[1]
				# need a begin/rescue in case the domain can't be curled
                begin
				# Uses curb to curl the domain
                 c = Curl::Easy.perform(s[1])
                puts " - #{c.response_code}"
 
			   # check http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for examples of response codes
                unless c.response_code &lt; 399
					# reports to the screen when manually ran that the site is down
                      puts "--DOWN--"
					  #increments the number of sites down and writes to the body of the email
                      sites_down = sites_down + 1
                      body = body + "DOWN - #{s[1]}\n"
               end
 
                rescue
				# if the script is unable to curl the site we still mark it as down since we want to make sure we are in good shape
                    sites_down = sites_down + 1
                    body = body + s[1] + " unable to curl, check record in db and ensure that it is being pointed\n"
                        puts "--DOWN--"
                end
 
                #only send if sites are down
 
            end
 
            if sites_down &gt; 0
                #send text and email
                record_report = db.query("INSERT INTO reports(down) VALUES(#{sites_down})")
				# I use this one for a text message.
                send_email("A server needs help! #{sites_down} down!","destination_address")
				# this is for an inbox since it provides more details to aid in troubleshooting later
                send_email(body,"myemail@blah.com")
            end
         else
			# Since there is still a report that is in the db that was recorded less than 2 hours ago we just want to notify the user if running it from shell.
            puts "Please run 'up.rb' first and then 'mon.rb' again to curl all sites."
            puts "You are seeing this message because there is a report that hasn't been marked as fixed within the past 2 hours."
         end
end
 
def send_email(body,to)
    msg = &lt;
To: Admin 
Subject: Some sites are down
#{body}
END_OF_MESSAGE
 
    Net::SMTP.start('localhost') do |smtp|
        smtp.send_message msg, "from_address", to
    end
end
#need to run the function
check

Script to update reports table so regular monitoring can continue (up.rb)

#!/usr/bin/ruby
 
require 'mysql'
 
db = Mysql::new("localhost","user","pass","database")
up = db.query("UPDATE reports SET fixed = 1 WHERE fixed = 0")
 
puts "Reports marked as fixed, resuming normal monitoring."

You should also set up a crontab such as….

This one runs every 5 minutes.

MAILTO=”"
*/5 * * * * sh -c $’/usr/bin/ruby /home/username/mon.rb’


WordPress Loves AJAX