Thursday, March 29, 2007

mySQL Error 1241

I was recently coding a PHP application that connected to and interacted with a mySQL server. One of my sql scripts was producing a mySQL Error 1421 that I had not seen before. Here is the sql that I was running, the error, the resolution, and the reason.

The SQL:
INSERT INTO my_table(
 field1, field2, field3, field4, field5
 fieldA, fieldB, 1234, NOW(), fieldC
FROM my_table_two
WHERE my_table_two.PK =1

The error:
MySQL said: Error#1241 - Operand should contain 1 column(s)

The resolution: Remove the Parentheses () around the second embedded SELECT statement so the statement is as follows.
INSERT INTO my_table(
 field1, field2, field3, field4, field5
 fieldA, fieldB, 1234, NOW(), fieldC
FROM my_table_two
WHERE my_table_two.PK =1

The reason the error occurs: When you ad parentheses () around the SELECT columns you create an ordered list of values or a tuple. The SELECT statement expects a list of individual values. Or in simpler terms you are giving it the array[1][2] when it expects the values 1 and 2. You can recreate this error by running this sql statement SELECT 1,2 which will return 1 2 amazingly. Then run SELECT (1,2) which will return ERROR #1241 - Operand should contain 1 column(s). For me it occurred because I copied and pasted code from an insert statement to not have to retype all the fields and grabbed a little too much in my copy.

The Cliff Notes Version If you get a mySQL ERROR 1241 then look for some unnecessary parentheses surrounding your SELECT statement and remove them!


Labels: ,

Automator Action to Rename Photos by Date Taken

Order Photos with Automator Screenshot
Problem: I had a directory of 115 photos which I wanted to upload to my picture gallery in the order they were taken but they were taken with three different cameras so the filenames meant nothing. With the Firefox/Apple finder you are unable to order by Date Created very easily in the dialog that pops up when you click to upload a photo to the web.

Solution: I created an Automator Action to first take Selected Finder Items then copy them just in case, then order the items by Date Taken, then rename the files in that order to 1-115.jpg. I also added a string so I could use this script for multiple directories I needed to order like this. You can download the action: Order Photos Automator Action.

To use this Automator Action, first select your photos in the finder, the double click on the Automator Script (after unpacking it from the ZIP). You will need to edit the location to save the copied items to to fit your needs and edit the filename settings if you don't want _nc in your name.

This script is nothing special or perfect but hopefully it gets you thinking about harnessing Automator to quickly perform menial tasks on your Apple.

Labels: ,

Wednesday, February 14, 2007

Share Your EVDO Wireless Broadband Connection

Here is the quick setup: (Read the entire post for why this is useful and how it could be profitable ;) )
1) Buy a Mac Laptop (sorry the MacBook Pro is the laptop I have and its OS X and Airport make this super easy)
2) Select system preferences from the Apple Menu
3) Click on Sharing from the Internet & Network subsection
4) Select the Internet tab from near the top of the screen
5) Under Share Connection From: Select your EVDO Broadband card (mine is listed as: Novatel Wireless EXP CDMA)
6) Select the AirPort checkbox under the To computers using: list
7) Configure the AirPort Options as your situation necetates (read the rest of the post for more info)
8) Click Start

Read on for my story, why this is cool, and warnings ...

Prologue: Wireless Broadband EVDO
I have had Verizon Wireless' EVDO wiereless broadband service since August of 2006 and have been very happy with the service's speed and coverage area. I have been able to get signals everywhere from in the Cascades of Oregon to Philly and nearly everywhere in between. If I have cell coverage I can pick up the EVDO wireless broadband signal. Check out a previous post for a full review of Verizon's EVDO service and my detailed setup. Cingular/AT&T and Sprint also offer EVDO mobile broadband services and this technique will work if you have service through Verizon, Sprint, Cingular/AT&T, or whomever is the provider where you reside.

Chapter 1: Jealousy and a Heart for the Un-Plugged-In
The only problem with the service is it kind of pricey and it invokes jealousy from other laptop users wherever you go. I have gotten numerous comments about how I am online [insert location here]. Recently I attended a conference at the Sheraton in Philadelphia where the card really came in handy. It seems they Sheraton folks felt it necessary to block out WIFI inside of the conference room, so if you purchased WIFI from the hotel so you could surf in your room (yep no free WIFI) you were maddened to find that WIFI would not work in the conference room and you had to sign up for additional WIFI at another cost! Then, to make things worse, that conference room only WIFI kept falling off. So here I am with a room full of web designers half with laptops checking my email etc while none of them can get online. Yes yes I felt like an internet magician but I quickly had pity on those around me and I knew I must jump into action to save the masses!

Chapter 2: Give the People their Internets
I said to my self
"Bob (not my name but what I call myself), I wonder if its possible to share your bounty of EVDO goodness with all these poor conference people. This way you will be a hero to all and Robin Hood those evil Sheraton WIFI evil dooers."
Well it took a few clicks but I found the solution and gave those people their tubes to clog.

After checking around in System Preferences Internet & Network section I stumbled up on the Sharing menu. By simply selecting my EVDO card and clicking to share it on my Mac's internal AirPort card I had done it! The crowd erupted in moderate indifference and all updated their MySpace pages in celebration.

Chapter 3: Coolness
Why would you want to share your EVDO wireless broadband connection?
  • You are traveling with a group of coworkers, family, or the circus who refuse to pay $9.95 to check their gMail or update their MySpace while waiting at the airport, bus stop, or space port. Instead they insist on bugging you to borrow your laptop and make small talk about hair products. The quicker they get online the quicker you return to the peace that is mindless surfing to pass the time.

  • Your work or school does not allow you to access say Digg or GMail and since you don't agree, are a rebel, dont' care about getting in trouble, and wish to share your good fortune you help them stick it to the man.

  • You are at a Starbucks, Barnes & Noble, or anywhere else that limits its WIFI access to TMobile and you want to prove a point about why WIFI should be free or should be bought from you not them.
    "Simply" share you EVDO connection, configure the Airport correctly, set up a required proxy page, and either collect donations or charge a reasonable buck or two for the pleasure of using your provided WIFI connection instead of TMobile's.
    Granted this could and probably get you arrested or sued as a proof of concept it could be pretty brilliant if you can pull off the technology necessary.

Remember if you are running at full EVDO speeds you can hit well over 5MBps which is plenty fast to share the wealth a bit.

Chapter 4: Bubble Bursting
All is not roses in EVDO sharing land, though. There are a couple of issues you should be aware of, though (some of which I can think of and others I am sure I am missing).
  • By doing this you set up your laptop up as a router and thus straddling it with all of the CPU, network, and management load that goes along with that not to mention the security headaches. Translation: You go slow and could get screwed.

  • Verizon and probably Sprint and Cingular closely monitors your use and if they feel you are not being reasonable with your bandwidth they shut you down. I know, I know, it says unlimited but the small print says its not so.

  • If you set up your Airport to share without a required WEP key you have NO idea who will access your connection and thus your laptop. I sure don't want to be responsible for what other people download and set myself up for some lame RIAA lawsuit ;) or worse so I suggest setting up WEP using the Airport Options button when you share your EVDO connection.

  • Security. Security. Security. I have no idea how this opens you up but I am assuming it is probably enough to make your sphincter pucker. I would never recommend this on a PC (hello Windows viruses et. al.) but even on my Mac it does worry me.

The End: Suggestions
For lawyer types from Verizon etc., hackers, and others who would chap my hide: I would never recommend anyone doing this and have and never will do this myself.

For EVDO users and normal Mac users: Just be careful that group 1 doesn't catch you since I am not totally sure if they could have a valid point. Have fun showing your Mac and EVDO goodness even if it is just to wow the throngs of lame PC'ers in your office. PS. let me know if you have any cool uses for this I didn't think of.

Labels: , , ,

Wednesday, February 07, 2007

Oregon Legislators are on YouTube. Why aren’t you?

The first thing I thought when I heard that Oregon Legislators are putting clips on YouTube is: Has YouTube "Jumped the Shark"? Just kidding. Really I thought if the group of people who are historically the most behind in technology and the most afraid of new mediums are adopting YouTube as a communication strategy, what does that say about those businesses who are either ignoring the site or who have made strategic decisions to stay away.

In the past year or two, YouTube has had a meteoric rise from quirky video sharing site to Google owned media monolith. YouTube brings millions of eyes daily to their site and is no longer limited to videos of kids being hit in the family jewels with various objects or pirated video clips of movies and TV (although, these are still very popular on the site). YouTube now has everything from recent Super Bowl commercials and educational videos, to self produced music videos and VLOGS (Video Blogs). If the notoriously ill tempered and slothy movie and television industries are adopting the video-sharing site as a marketing tool there must be a reason.

The recent movie hit "Borat: Cultural Learnings of America for Make Benefit Glorious Nation of Kazakhstan" was almost entirely driven by the buzz created by Borat clips on YouTube and their subsequent viral nature pushed by social networking sites such as Digg, thousands of blogs, and good old word of mouth. "Snakes on a Plane" is another example of a potentially bomb of a movie with huge buzz created through YouTube pre-promotion and YouTube clips placed in Blogs, message boards, and social sites.

Comedy Central was initially an unwilling star of YouTube with millions of views of their popular "Daily Show" and "The Colbert Report" clips. Initially Comedy Central chose to send YouTube a cease and desist, causing the removal of most of their clips. That is until their talent, producers, fans, and the blogosphere erupted in outrage and bafflement. It seems everybody but the TV execs realized the amazing marketing opportunity YouTube was offering the shows, all with almost zero advertising investment. Now CBS and NBC are regularly posting clips to YouTube.

If you are in a business and ignore YouTube you are not only wasting a potentially powerful, mostly free, marketing medium but you are giving the power of identity to your competitors and customers. Just because you ignore this video phenomena does not mean it doesn't exist, will go away, or you are protected from its effects. If you aren't driving the bus you might very well have abdicated that responsibility to strangers.

Driving the bus is exactly what Oregon Representative Dennis Richardson who represents Oregon House District 4 (Jackson and Josephine Counties) has decided to do. Instead of allowing the lobby machine or the press to dictate the tone and facts of the discussion he has chosen to use YouTube to get his message out. Granted the 400+ views of his two videos may not cause a groundbreaking shift in the legislation, it has other powerful implications. In the local area, this story has gotten a full day of radio and TV coverage plus write ups in various newspapers and publications. Where previously Representative Richardson couldn't have hoped to get any coverage of his positions or invaluable face time on the news outlets; by posting a few 5-minute clips on YouTube, he has achieved both with minimal effort.

I never thought I would say this but more businesses need to be like the Oregon Legislature and pull their heads out of their ancient marketing strategies, take off the Internet blinders, and embrace the Web 2.0 market. If members of one of the nation's most dysfunctional governing bodies are adopting new marketing strategies and leaving your business with its substantial marketing budget in the dust you have more problems than they do. If that doesn't scare you then you are destined to continue to spend stupid amounts of money on ads in struggling newspapers or magazines while your competitors are getting that impact and more for pennies on the dollar.

Labels: ,

Tuesday, February 06, 2007

Useless Account, Get yours now!

Useless Account

When I got wind of the newest internet fad yesterday I had to sign up to get in early. Who cares it is a useless account, no really, it a Useless Account that does nothing but allow you to edit and sign in and out. Seems like the perfect startup to sink some VC money into huh? You better hurry up and get yours or you may miss out on something truly useless.


Thursday, February 01, 2007

Contribute Disabled Connection : Unknown Error

Problem: A classic Contribute 3 Unknown Error message mysteriously disables a connection that was previously working.
"Contribute has disabled your connection to this website because an unknown error occurred. For more information contact this website's administrator."

Solution: According to Adobe's Contribute Knowledge Base (Macromedia was bought by Adobe recently which can be a bit confusing) the error is caused by a corrupt hub file that resides on the server. Nifty huh? To fix this error you need to remove that hub file.
IMPORTANT: Removing this file is necessary BUT it will remove you as an administrator and all other users from the server's master list. This is not a huge issue because all of their settings remain valid and they merely need to click "Connect" and then "Next" to reconfirm all of their settings and recreate their entry in the server's hub file. This is important to remember, though, because if you are in a larger organization; you will need to do some preemptive education so your users do not panic.

To remove this file:
1) Connect to the server (through FTP, local, etc)
2) Browse to /_mm/
3) Locate the cthubXXXXX.csi (XXXXX is a random string unique for each installation) and back it up to your local drive
4) Now that you have a safe copy, Delete the hub file

This should take care of your "Contribute has disabled your connection to this website because an unknown error occurred. For more information contact this website's administrator." Contribute error.

Labels: ,

TMobile HotSpot Vista Free Trial on a Mac

TMobile is currently offering a free trial of their HotSpot WIFI service for Windows Vista customers until April 30th. What! you say. Where is the Mac OSX love? Well it tourns out TMobile really doesn't mean their trial is for Microsoft Vista users only...

Here is how to take advantage of the TMobile Vista Free Trial on your Mac running Firefox.

First we need to make TMobile think we are on a Vista PC running IE 7 instead of on a Mac running Firefox :) Here are the steps to go incognito.

1. Download the Firefox User Agent Switcher extension.
2. Restart firefox
3. Select: Tools > User Agent Switcher > Options > Options...
3. Click "User Agents" and then "Add"
4. Fill out the window with following info:
Description: Internet Explorer 7 (Windows Vista)
User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
App Name: Microsoft Internet Explorer
App Version: 4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Platform: Win32
5. Click OK to save this new User Agent

Second lets put on our disguise and sign up for that trial.

1. Select Tools > User Agent Switcher > Internet Explorer 7 (Windows Vista)
2. Browse to
3. Sign-up at the page and enjoy your free WiFi until April while sipping a cappucino at Starbucks or browsing your favorite periodical at Barnes & Noble.

Labels: , , ,

HILLARIOUS Boston "Terrorist" Press Conference -- HAIR QUESTIONS ONLY!!!

After their marketing stunt in Boston the two Aqua Teen Hunger Force gorilla advertisers were arrested and charged with nasty nasty things. During their press conference they refused to answer any questions that were NOT HAIR RELATED. The press did not find this funny at all.

From the fox story: "Peter Berdovsky, 27, and Sean Stevens, 28, ignored a barrage of reporters' questions about their role in the botched scheme and talked, instead, about mohawks, dreadlocks, Beatle cuts and Afros as their attorney, Michael Rich, stood by with an incredulous look on his face."

Their whole point I think was to show how silly this whole thing is. The way people react does not directly implicate the seriousness of an issue. The press and politicians who went to DEFCON3 for a few flashy billboards I think are pretty embarrassed and are looking to take it out on others.

read more | digg story

Labels: , ,

Wednesday, January 10, 2007

CES web video coverage, die ads die

Since I can't fly off to Vegas to visit CES or down to San Francisco to attend Mac World, I have been catching up on all the gadgety goodness via web video. Everything was going well until I was brutalized by the advertising in these videos.

I am willing to accept some advertising for my content but this has gone too far. In particular and Gear Live's The Bleeding Edge Podcast have heinous advertising which is bound to turn off viewers.

The Offenders
Content: Reviews and information from CES and MacWorld
Offense: Stupid Windows Mobile Snakes in an Elevator commercial.
Why this is Heinous: Its not the commercial so much, although it is normal Microsoft crap, because it is livable. It is the fact that they make you watch the same flippin' commercial between every two or three clips. The clips are about thirty seconds to three minutes long and the commercial is 16 seconds. So every 60 to 4 minutes or so you are forced to watch the same clip. That means you watch that commercial over .... and over ... and over ... and over ... and over before you can get through the playlist.

Subject: Gear Live's The Bleeding Edge Podcast
Content: Tech Reviews, Interviews, and Commentary from CES
Offense: Obnoxiously long intro, double Panasonic Ads, and Microsoft Live Ad all in one short podcast
Why this is Heinous: Normally the podcast is nearly an hour, released semi weekly, which makes the ads a bit more tollerable BUT for their CES coverage they are doing 2-4, 4-15 minute shorts a day. Each of those has the same advertising. One 5:50sec podcast has a 30sec Microsoft Live ad followed by a thankfully short splash, followed by a 30sec Panasonic Ad followed by the podcast and then ending with another 40sec Panasonic Ad...If you were keeping track that is nearly 30% of the podcast is taken up with advertising! Luckly you can fast forward with iTunes but I am seriously considering unsubscribing after this abuse.

Saturday, January 06, 2007

Lightbox with always visible Prev and Next Links

The Problem: Lightbox Prev and Next Navigation being visible onMouseOver is not obvious enough

After enabling Lightbox on my picture gallery I quickly realized that the onMouseOver Prev and Next on the Lightbox were way to confusing for my viewers :) The problem with the design it the Prev and Next links on the Lightbox pop-up are mystery navigation. If you don't know to mouse over the right or left side of the image in order to get the links to appear, you don't.

The Solution: Change lightbox.css to make the navigation graphics always visible

My solution was to change the stylesheet (lightbox.css) to fix the display of the prev and next links to always be visible. I am OK with the prevLabel.gif and nextLabel.gif always showing on top of the image because it makes the navigation so much more obvious.

I know this fix is pretty obvious to the coder types but since many people who use the LightBox Library on their website are not so savvy I hope to take the mystery out of this fix. Simply:

1) Download the new Lightbox CSS File.

2) Remove the .txt from the end of the filename.

3) Make sure the nextLabel.gif and prevLabel.gif and blank.gif are pointed to in the right directory (if they are not in the ./img/ directory you need to change anywhere it says img/ to your directory name, for example images/)

4) Upload the new lightbox.css file to replace the old one

Labels: ,