Tuesday, September 30, 2008

Guest Blog Post: You Will Have a Profitable Business By The Time You Finish Reading This Blog

[Happy New Year y'all! Thanks to the power of Blogger's post schedule ability, I'm able to queue up this article before the holiday has started. Today's guest post is brought to you buy Mike Michalowicz, who's new book The Toilet Paper Entrepreneur will be available for purchase tomorrow. Want to provide a guest post? Just ask.]

Congratulations! Your company has officially turned a profit! What? You didn’t get the memo? You thought your business was months, years away from the blessed black? Whoa! You must be thrilled to get this news. You must feel like doing a little happy dance, maybe even hopping down to the corner store for a celebratory six-pack.

Hold on, bucko. You’ve got two teeny, tiny, no-big-deal steps to take before you can count your chickens, err, cash. It will take all of five minutes, I promise. And then you can call your Mom.

  • First, open an interest-bearing escrow account online, one that even the entire Ocean’s Eleven team can’t access. You’ve got to guard those pennies from that thief in your office – YOU.
  • Next, transfer 5% of your last deposit into the account. That’s it. You’re done. (Until your next deposit, that is.)

Yeah!!! Tell all your Facebook friends, write your hometown newspaper, and stop total strangers on the street. Your business just officially turned a profit! And will do it CONSISTENTLY!

The simple truth about cultivating a profitable business is you already have a profitable business, you’re just putting the profit back in the pool to be spent on new desk chairs and late night pizza runs. You’ve got to take that profit FIRST and put it where the sun don’t shine – or in the bank. Whatever you prefer.

This system, what I refer to as the Profit First Account (PFA), allows you to make a profit off of every sale. Not bad. Not bad at all. I know, I know, you’re wondering how the heck you’re supposed to run your business when you’re skimming 5% off the top? Easy. You adjust.

Five percent is doable. After a few weeks, you won’t even notice. You will adjust your spending, planning, and even your thinking to accommodate the swelling profits in your PFA. You’ll forget about the things you thought you needed and make do with what you have. (Come on, do you really need all of those paper clips? Join Office Depot Anonymous and get on with your life!)

Better yet, you will come up with scathingly brilliant ideas about how to best use the remaining 95% of your inbound revenue. In fact, you may actually come up with a remarkable innovation, one that could, say, catapult your business into the stratosphere of success. Imagine that.

The cherry on top of the PFA? Every quarter you get to take some of the money out and distribute it – TO YOURSELF. Eventually you’ll increase your percentage, transferring 10%-20% of each deposit into your PFA (at my company, we take 20% of every deposit). Whoa! Now you’re turning a massive profit for every single sale, building a multi-million dollar business one deposit at a time. Nice.

So, are you ready to party? Or you do you need to wait a minute for that transfer to go through?

Congrats!

- Mike

Monday, September 29, 2008

Getting In The Mood For Rosh Hashanah - Something light, Something heavy

In a couple hours, Rosh Hashanah, the Jewish New year, will be upon us. Here's a couple items to get you in the mood, or if you're not observing the holiday, to learn more:

  • Something light: This is a collection of fun stories that are definitely worth a read.
  • Something heavy: OK, this isn't that heavy, but still. Rosh Hashanah starts the 10 day stretch when Jews are supposed to take a step back, examine their behavior, and improve themselves (well, technically, they are supposed to do this all year long - but this is the focus for the next 10 days). Here's an intereesting article on how to go about changing your life. This is a useful article for anyone who has an interest in dropping a bad habit, or picking up a new good habit.

A great resource to check out, if you're interested in learning more about the holiday, is Ohr Somyach's - Ask the Rabbi. It's entertaining, interesting, and educational stuff.

Happy New Year to everyone - L'shanah tovah umetukah - May you havae a good and sweet year!

You know you are getting old when...

...instead of standing in "that" isle in CVS near the pharmacy, you're standing in the hair care area, trying to pick the best nose hair trimmer.

Then you see that this one does ear hair too, and think - "oh well, I'll no doubt need that functionality soon enough."

Yep, feeling old.

Other thoughts that come to mind: Do I have to buy an assortment of items so the clerk doesn't notice my purchase? What if she calls out: 'Price check on ..."

Nobody said getting old was easy.

Sunday, September 28, 2008

More Agreement From Palin and Obama

Oy, Palin stepped in it again last night, when she gave essentially the same answer Obama did to a question about Pakistan.

This isn't the first time she's done this. She did it before with her comments on putting the government's checkbook online:

"We're going to do a few new things also," she said at a rally in Cedar Rapids. "For instance, as Alaska's governor, I put the government’s checkbook online so that people can see where their money’s going. We'll bring that kind of transparency, that responsibility, and accountability back. We’re going to bring that back to D.C."

There's just one problem with proposing to put the federal checkbook online – somebody's already done it. His name is Barack Obama.

Check out this clip of Obama talking about his efforts to create the (poorly named) Google for Government:

You can check the site out here.

A few observations about the video, the site and the concept:

  • One of the two Senators who tried to block this initiative was Ted Stevens - how perfect?
  • Obama's explanation as to why the Senators blocked the bill was remarkably generous, yet firm. It seemed to me to be the same approach he took to dealing with McCain in the most recent debate
  • This approach was all about adding accountability to the system - something we desperately need more of. I'm a bit surprised I haven't heard the Obama campaign pushing this contribution more. As in: "McCain promises to let you know who's wasting the country's money - Obama's already done this" sort of thing.
  • This tool allows the general public to police the government, which is just too cool (gotta love it, only in America!). I'm a bit surprised I haven't heard of it being used in more cases. Perhaps it is, and I'm not paying close enough attention.
  • Holy Cow! The site has an API - it's just crying out for a clever mashup.

Personally, I think it would be a bit smarter to give Palin a little more media time. That way, every little comment she mentions won't be scrutinized like some sort of precious gem. But, again, nobody's asking my opinion on this either.

Friday, September 26, 2008

Like X-Ray Vision For Flex

I seriously owe Dustin a beer. The man saved me hours of painful debugging with the Flex app I'm working on. He recommended I look into the Flex command line debugger (fdb). He's even written a nice article walking through how to set it up.

While fdb is neat, and I'm thinking it will integrate well with emacs, what I'm really in debt to Dustin for is having me enable debug mode in the Flash player.

As part of setting up fdb, I downloaded a debug version of the Flash Player, and then changed some settings in my flex config file to compile with debug mode on, and with showing stack traces. (Check out Dustin's article for how to do this)

The result is that now a runtime error in the Flash player results in a gorgeous stack trace, and not just silent failure. It really is a thing of beauty. I'd have given up on Flex some time ago if I had to debug blindly.

If you haven't taken the time to setup the debug version of Flash - do it now. You'll be glad you did.

Over these last few days, I've grown more and more fond of Flex and ActionScript 3. I love how the Array class provides map and forEach functionality, how I can use nested functions to do tail-recursion style loops, and how I can dyanmically instantiate a class trivially. Well done Adobe. This isn't just a nice GUI toolkit, it's an impressive language, too.

Review: The Toilet Paper Entrepreneur

Mike was kind enough to send me a review copy of his soon-to-be-released book, The Toilet Paper Entrepreneur. He made it quite clear to me: he wanted me to give him my honest to goodness feedback.

Well, the bottom line is, I liked the book very much. And not just because I got a free copy. Here are a handful of reasons why I enjoyed it:

  • It's an easy read. Mike takes the topic of starting a business and mixes in quite a bit of bathroom humor and other conversational tone to lighten the mood. You can almost hear him yelling at you to get off your butt and start building your company!
  • It matches up with what I know to be true. I found myself nodding as he talked about how money can cause more problems than it solves, how there are creative solutions around every corner for those who look for them and generally how the small can kick the big's butt.
  • It was more than just inspirational words. Don't get me wrong, having a book that's filled with inspirational stories, and a general can do attitude is valuable - but it'll only take you so far. To be honest, I was a bit concerned that was as deep as the TPE was going to go. Turns out, I was wrong. Mike does spend a good portion of the book talking about getting the right mindset for starting a business (which is critical), but he also goes into mechanics too. He gives concrete suggestions for avoiding the business plan, and helping improve your cash flow.

Perhaps I'm most excited about the book, because of the people I interact with on a daily basis. I meet people with great ideas, and often they aren't quite sure how to proceed. Sure, I can write their software, but there's more to a successful business than the technology. This book can help exactly this kind of person get on the right path to building a successful business.

When people ask me about starting a company from an idea, I usually suggest they write up a business story of some kind. But now, I think I'd point them to this book, and tell them reading it was the first step to take.

I give the book a 9.0/10.0 for being just the kind of resource that a new entrepreneur would find invaluable, and a more experienced entrepreneur would still learn from. Oh, and it's also a skinny book, so that earns it points as well.

This lunch is dedicated to...

My Dad.

My Dad and I are pretty similar. I'm told we look alike. I know we have
the same sense of humor, respect for the power of books and generally
blow our noses with the same fog horn like sound (to which I really have
to thank my grandpa for that trait - thanks gramps!).

But one area we strongly differ on is our ability to consume silken
tofu. He's cringing right now, as he read that last sentence.

He still can't believe I can order Ma-po Tofu at a restaraunt. I can and
I did. That was lunch today.

It even came in a sort of tortilla shell. Think tostada meets Chinese
food. And you know what? It tasted great.

I guess it's good I have *some* differences with my dad.

--Ben

2 Minutes to Nightly MySQL Backups

I've been meaning to add an extra layer of backupness to one of my server's, by explicitly dumping the database every night. Here's how I did this for MySQL on a Linux box.

Nothing Earth shattering here, but still, it's worth taking 2 minutes to do:

  1. Give root permission to run the database dump command without a password. See this article for how to do this. The very short version. Create a file named /root/.my.cnf and put:
    user=root
    password=YourSecretRootPassword
    
  2. sudo mkdir -p /var/backup/db/
  3. sudo crontab -e
  4. Enter the following in the cron tab:
    MAILTO=your@email.address
    0 3 * * * /usr/bin/mysqldump --all-databases > /var/backup/db/`date +%a`.sql
    
    This will run the backup command every morning at 3:00am.

And you're done. I love having root access on my hosting servers. Definitely don't want to abuse it, but it's really handy when you need it.

Thursday, September 25, 2008

CNN Finally Finds A Bit Of Truth

CNN has been publishing these handy little fact check articles on their political blog. They'll take an outrageous statement from one campaign or another, and look into it to decide just how accurate it is.

Whether it's reviewing Obama's claims or McCain's, the verdict usually comes back as misleading, incomplete, and every so often flat out false.

So, I was a bit surprised when CNN published a Fact Check article today that was flat out true. What a find - it must not have been easy.

If it were up to me, I'd submit every political ad to a 3rd party group to evaluate all the statements made. If they are anything other than flat out true, I say we don't run 'em.

Alas, nobody's asked my opinion on this yet. So, we continue to see misleading ads from both sides. And calling them misleading is probably me being generous.

Wednesday, September 24, 2008

If I Ignore This, Will It Go Away?

Here's a riddle: if a large tree branch falls next to your house, and you're too busy programming, does it make a sound?

This photo doesn't do this little mess justice. Apparently a fairly large limb of a neighboring tree fell next to our house. It rotted itself off.

There appears to be no damage. But, still, now I need to clean this mess up. Can I just ignore it and hope it goes away?

Argh.

--Ben

CNN Gets Into The T-shirt Business

The other day, David pointed out a little t-shirt icon that were next to top stories on cnn.com. Clicking the icon takes you to a page where you can buy that headline on a T-shirt. For example:

OK, I'll be the first to admit that I don't exactly get what they are doing here. But, I like it. I like it, because it's a novel approach to making revenue and getting your name out that isn't the same old advertising scheme. As services like cafepress.com have show, on the fly creation of goods are accessible to all.

Just think if one of these headlines were to go viral and be the next Internet sensation? They'd be all cued up to cash in on it.

Nice out of the box thinking. I give them an A for effort.

A Chilly Welcome To Wikiland

A couple weeks back I wrote up my first Wikipedia page. I did it with awe and trepidation. The last thing I wanted to do was to louse up a most excellent resource. After doing my research, and posting, I sat back, pretty proud of myself. I was part of this community - a community so generous that it's produced 2,563,484 articles. Well, 2,563,485 if you count mine.

Today, I was greeted with the cold shower of reality. Or maybe a virtual ass kicking. I'm not quite sure yet, what the right analogy is.

Yesterday, I posted another article (on the same topic as my first article. By the end of the day, the latest article had been flat out deleted, and the first article had been flagged for it's poor writing.

D'oh! So much for paying such close attention.

Actually, I'm not too surprised that my work wasn't up to snuff - I'm new at this game, so I get that. What surprised me was the remarkably chilly (and I think I'm being kind here) conversations that have ensued as I try to figure out how to resolve these issues.

The fellow who deleted my latest article is mum on the topic of why this is. I suppose it's obvious to him. Would it have cost him so much to take a few minutes to talk through this with me? (He said the book article I wrote up was an advertisement. Yet, there other book articles on Wikipedia that provide similar, if not more, information. Why was mine such a colossal disaster, and theirs are good?)

As for the guy flagged my article, well I give him credit for at least talking with me. Though the dialog was a wee bit snarky. My favorite quote being: "now I suggest again that you back off and leave it to others to decide if he is actually notable. (Just be grateful that I did not send the article to AfD [Article for Deletion]!)."

Real warm, right?

There are some really important take-aways here from this experience:

  • Wikipedia isn't for the faint of heart. You're going to have to get in and plead your case.
  • I was focusing my energy on making sure the articles I wrote had citations and didn't include my point of view (which apparently, I flopped at, but oh well). But, there's a bigger question I should have been addressing: does this article even belong in Wikipedia.

    Yes, I considered this question, but I don't think I thought about it quite enough. Just because I could find a comparable article (for example: another business book, just like the one that you're writing an article about), doesn't mean that it's automatically in. It would have been smarter for me to write up a quick entry and see if the Wiki folks bought into the article at all, rather than worrying about the content first.

This all serves to remind why I so love my blog: around here, I'm King (well, with Shira's permission, of course). Whatever I say, goes. It's a nice feeling. Still, I haven't given up on contributing to Wikipedia yet...

Tuesday, September 23, 2008

RewriteRules - A Quick Denial-of-Service Attack Solution

One of my client's boxes was absolutely dragging earlier today. The load was way higher than usual, even though nothing substantial had changed on the server. Looking at the web logs I realized that the vast majority of the traffic was coming from two unique IP addresses. I do believe, we were getting DoS attacked.

Because this was a live site, I needed a quick fix. And I needed one that wouldn't require updating firewall rules or other low level box settings. The last thing I wanted to do was to make the problem worse.

I ended up writing the following RewriteRule:

 RewriteCond %{REMOTE_HOST} 72.95.41.173 [OR]
 RewriteCond %{REMOTE_HOST} 72.78.35.231
 RewriteRule ^.* /disabled.php [L]

This rule says that if the client's IP address is either of the two listed, then send them to the disabled.php page. This page then gives them a message that tells them they've been denied access to our server.

As soon as I put this rule in place, the load on the server went back to a normal level. Of course, the web server is still getting beaten up by these IPs, but this simple rewrite rule is efficient enough that it doesn't care.

This rewrite solution is also easy for me to test - just drop my own IP in there and I can see what they're seeing.

This won't be our long term solution, but for getting the box back to a usable state in a hurry, it worked like a champ.

Understanding rewrite rules has to be among the top 10 best skills computer I've ever learned. Sure, they're a pain, but boy are they worth it.

PayPal - Hiding secret data in plain sight

I just finished doing some integration work with PayPal, and I have to say I'm impressed by the approach they've taken.

Suppose you want to sell cupcakes from your website. To do this using the standard PayPal integration, you'd log into your PayPal account, click on Merchant Services and then click on the Buy Now Button option. This will take you to a form where you would fill out the details of what you want to sell:

To finish up, you would click Create Button Now and paste the HTML on your web page. And you're done.

Here's what threw me for a loop: PayPal doesn't manage your inventory. That is, PayPal doesn't care what items you want to sell, it simply allows you to generate buttons.

I think this is brilliant (from PayPal's perspective, anyway) because it means their lives are simplified. They don't need to worry about giving tools to sellers to manage their inventory. That can all be done on the client side.

But there's a catch. Check out the button code:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
  <input type="hidden" name="cmd" value="_xclick">
  <input type="hidden" name="business" value="test-b_1221977553_per@ideas2executables.com">
  <input type="hidden" name="item_name" value="Yummy Cupcakes">
  <input type="hidden" name="amount" value="1000.00">
  <input type="hidden" name="no_shipping" value="0">
  <input type="hidden" name="no_note" value="1">
  <input type="hidden" name="currency_code" value="USD">
  <input type="hidden" name="lc" value="US">
  <input type="hidden" name="bn" value="PP-BuyNowBF">
  <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

This code would be trivial to forge - if you wanted to, you could buy my cupcakes at a price other than the $1,000 I'm selling them for. All you'd need to do this is the most basic HTML skills.

PayPal could have re-examined their approach, and decided to manage the inventory on their own site. If they had done this, then the above form would just contain an item identifier, and the price wouldn't be exposed.

But they didn't do this. Instead, they offer the ability to encrypt the form. When you do this, you end up with the exact same form as above but in a non-editable fashion:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHkQYJKoZIhvcNAQcEoIIHgjCCB34CAQExggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMA0GCSqGSIb3DQEBAQUABIGAdZ71TWBiNmn1I6SM4UpnDrnBtZ8WOmNI3XGQVNnVWmMBV7z0bkNk7o6vOWGZVCjDSe5xKXRL3myUGymabFhg7oXnE+FpAiVq+3Ne/6h6T2nIUHWaa5dnkuJdzakCUTDVd/+zVhdziZXg9iptjxBZgzS2Hrw4J0AYaNiDFs0KfQsxCzAJBgUrDgMCGgUAMIHcBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECG04zbohmaihgIG4AtCWX0EYK5Og1RmVeHL3uNQofkcQdd4GPEMY8QDklaHHp9SqA3bPNiskfQOEdXWgm0Lq2aLXXMXdLJcxeDkwRZlQCA12rFLEnE3bMpC+yg/7L69WuRH0/yrCTiRLrCUgMssW1e5bTMFav4fYGr3v+GdNKtCZQkbxv6fztE91AK0FW06UCWR3izxSJ2rNFQ9e+lf4BGxwur4tH5dGugWPvR02bLFkE9vGu+bGZwWGma75sR24NTV336CCA6UwggOhMIIDCqADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGYMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxFTATBgNVBAoTDFBheVBhbCwgSW5jLjEWMBQGA1UECxQNc2FuZGJveF9jZXJ0czEUMBIGA1UEAxQLc2FuZGJveF9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20wHhcNMDQwNDE5MDcwMjU0WhcNMzUwNDE5MDcwMjU0WjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3luO//Q3So3dOIEv7X4v8SOk7WN6o9okLV8OL5wLq3q1NtDnk53imhPzGNLM0flLjyId1mHQLsSp8TUw8JzZygmoJKkOrGY6s771BeyMdYCfHqxvp+gcemw+btaBDJSYOw3BNZPc4ZHf3wRGYHPNygvmjB/fMFKlE/Q2VNaic8wIDAQABo4H4MIH1MB0GA1UdDgQWBBSDLiLZqyqILWunkyzzUPHyd9Wp0jCBxQYDVR0jBIG9MIG6gBSDLiLZqyqILWunkyzzUPHyd9Wp0qGBnqSBmzCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAVzbzwNgZf4Zfb5Y/93B1fB+Jx/6uUb7RX0YE8llgpklDTr1b9lGRS5YVD46l3bKE+md4Z7ObDdpTbbYIat0qE6sElFFymg7cWMceZdaSqBtCoNZ0btL7+XyfVB8M+n6OlQs6tycYRRjjUiaNklPKVslDVvk8EGMaI/Q+krjxx0UxggGkMIIBoAIBATCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wODA5MjMwNjAxMjBaMCMGCSqGSIb3DQEJBDEWBBQLhPRwzZAHKp6qbbgs2TwAPIFJljANBgkqhkiG9w0BAQEFAASBgCDL36AdcruGVvfMGg59XndpbacbtjnZsIP/Kr3aCc64uSuJKC4w9+yXTvmLbtSOc1eofCep/6dFxdC7C6WysfcI3DUs9PJjfWxNosf+K9foVjMNChL96V89XYorbRQ1/eEsJo0K8wud+OzDSkvZZuaUSA5taBSaeaVzNB2Lvp+a-----END PKCS7-----
">
</form>

Along with this encryption ability, they also offer Instant Payment Notification (IPN) which is another useful tool for validating that the data you're receiving hasn't been tampered with. It also serves as a general purpose hook that PayPal can use to allow developers to integrate with them.

Why is this so exciting to me?

  • It's a novel approach to storing client state. Rather than storing it on the server, store it encrypted on the client.
  • It's an example of offering less. PayPal could have built an inventory management system (and they may do so), but for now, they've avoided quite a bit of headache by not going down this path. This is an approach that usually benefits smaller customers.
  • It's a nice example of encryption in the wild
  • I'm a strange guy and I happen to excite easily.

Monday, September 22, 2008

A Source For Cleanly Implemented Code

From what I can tell, Flex's API doesn't include a Polygon class. And on this non-existant class is the non-existant method contains(p:Point) which I also needed.

After a bit of refreshing my middle school geometry (yes boys and girls, you will need this when you grow up, so pay attention), I learned that calculating whether or not a point is inside a polygon is relatively simple.

But still, converting it to code was going to be a bit of hassle. So, I opted for an approach I've used in the past.

I checked out the Java API docs, and sure enough, there's a Polygon. And even more fortunately, there's a contains(...) method.

I then downloaded the JDK and installed it. Sitting in C:/Program Files/Java/jdk1.6.0_10/ was src.zip. I unpacked this zip file, and voila!, I had a clean implementation of the Polygon contains method.

I've used this approach in the past. Unlike a lot of code out there, the JDK code tends to be clean, efficient and well organized. Of course, knowing the algorithm for how the contains method worked was critical, as I didn't want to simply be copying code down blindly.

Next time you get hung up on an algorithm, see of our buddies at SUN have already solved it.

Gotcha Of The Day - Flex: Adding Sprites To Container

I'm puttering away with my Flex app and I ran into a strange error. I wanted to do some hand drawing using the Graphics API. This turned out to be easy, there were lots of examples like:

  var roundObject:Shape = new Shape();

  roundObject.graphics.beginFill(0x00FF00);
  roundObject.graphics.moveTo(250, 0);
  roundObject.graphics.curveTo(300, 0, 300, 50);
  roundObject.graphics.curveTo(300, 100, 250, 100);
  roundObject.graphics.curveTo(200, 100, 200, 50);
  roundObject.graphics.curveTo(200, 0, 250, 0);
  roundObject.graphics.endFill();

  someVBox.addChild(roundObject);

The highlighted line caused my Flex app to crash. For the life of me, I couldn't add a Shape or Sprite to Container

The solution took a bit of Googling, but is well described here:

this.addChild(new Sprite())

looks simple enough doesn't it? especially if you've been working solely in Flash AS3. But if you try this line within a Flex component, you'll receive the error: 'Type Coercion failed: cannot convert flash.display::Sprite@86cc0e1 to mx.core.IUIComponent.'

This is because Flex components implement a different addChild method. although addChild is described as accepting a DisplayObject as a parameter, this DisplayObject must implement the IUIComponent interface.

A solution that worked in a hurry was to change the above to:

  var roundObject:Shape = new Shape();

  roundObject.graphics.beginFill(0x00FF00);
  roundObject.graphics.moveTo(250, 0);
  roundObject.graphics.curveTo(300, 0, 300, 50);
  roundObject.graphics.curveTo(300, 100, 250, 100);
  roundObject.graphics.curveTo(200, 100, 200, 50);
  roundObject.graphics.curveTo(200, 0, 250, 0);
  roundObject.graphics.endFill();

  someVBox.rawChildren.addChild(roundObject);

I have no idea if the above is a good idea - but it certainly let me push past my gotcha, which was much appreciated.

Correcting A Coaching Misconception

Over the weekend, we officially launched 3Keys Coaching - a coaching service powered by Harry Rieckelman.

I still remember my first sit down meeting with Harry. He explained to me that he was a life coach. I have to admit, I didn't get it. I thought only the rich and famous had life coaches, but normal folks? Why would they need one?

Then he told me this one success story that changed my entire point of view. To paraphrase (in extremely vaguely terms - I don't want to share any details of the story that I'm not supposed to), he explained:

So, I was hired by this executive to help him figure out why one of his team members wasn't performing. The executive had tried everything he could think of, but regardless, the team member just wasn't clicking with the rest of the team.

After meeting with the executive, I was able to point out to him what the cause of his team member's problems were: the manager himself.
The manager changed how he acted, and the team member came around.

I thought, holy crap - this is what a coach does?! Why didn't anyone ever tell me this? At my previous jobs we should have had Harry on speed dial - as whenever you get enough people in a company, there's always conflict to be had. (I should mention, Harry does more than executive coaching like this. He'll help you work through any life change that you feel like you've hit a wall on, just like this executive did.)

What I appreciated is that a coach provides that outside perspective that you, yourself, simply can't get. It's not that the coach is some sort of spiritual master - he or she can just see things you can't, and can help you take the action you need to.

You can learn more about what Harry does at his website. Personally, I went out of my way to add some coaches to my virtual mob.

Friday, September 19, 2008

Best Response To "Tell Me Specifics" Ever.

First, watch the clip below. Did I hear what I think I just heard? Allow me to paragraphs:

Questioner: To dispell the claims you don't have foreign policy experience, can you tell me some specific examples of your skills?

Gov. Palin: I'll be ready on day 1. And if you want to ask me specific questions, go ahead, I'm ready. Next question please.

Now, maybe the video is cut off and that wasn't the end of the question...but if so, wow, that's just impressive. Politicians (on both sides) have an amazing knack to answer the question they want instead of the question you asked. What a great case in point.

I'd never make it in politics.

Rimuhosting: More Amazing Support

So, at 2:38am this morning I realize that the new server I'm setting up has version MySQL 5.0.22 instead of 5.0.51. So, I dash off an e-mail to my friends at Rimhosting, the provider of the server, asking if they can help me upgrade it. They've got all these RPMs and such, and I figured they might have an easier way to do it than my brute force approach.

At 2:53am, they respond and say they would be glad to help - for free. Keep in mind, this is a $20.00/mo server - not some incredibly fancy hosting/support plan.

The only problem is, by now I've gone ahead and removed MySQL altogether, installed it myself and now the problem is, it won't start. I've officially made the problem worse.

I send them off an e-mail at 3:11am saying I've broken things and I'm going to bed.

I get up this morning and find a message in my inbox saying that it's all fixed.

This is absolutely amazing - think about it. I've got root access to the box, I've personally made things worse, and they are going to come along and troubleshoot and fix it for me for free. And do this is record breaking time?

These Guys Rock. If you need Unix hosting, you simply have to give them a try.

Thursday, September 18, 2008

Flex: The Unix Geek's Ideal Flash Environment

For a new project I'm working on, I've decided to implement the necessary Flash code in Flex instead of the usual Flash Authoring Environment. For those who don't know, Flex allows you to write XML and JavaScript and compile it to a .swf instead of using the traditional GUI timeline based tools.

While Adobe charges money for the GUI authoring environment (for both Flash and Flex), they actually give away the Flex command line compiler for free. And best of all, folks have integrated it in nicely with Emacs.

Turns out, you can quickly and cleanly develop Flash apps using your favorite Unix tools. How cool is that?

The Flex API is huge so I'm very much wrapping my head around it. But so far, it appears to offer a complete GUI programming API, accessible by the elegant ActionScript programming language (which, of course, has deep roots with Scheme). It's an impressive combo.

Here are a few resources I've found useful to getting started:

  • The API Docs - Can't do much without these
  • Adobe's Getting Start Doc - Adobe does a great job of introducing Flex and making clear what it is and isn't.
  • Flex Compiler Shell - the very cool utility that turns the rather crude command line compiler into a rally useful tool. This now comes with Flex, you don't need to download it separately.
  • Bootstrapping an ActionScript Only App - Flex encourages you to program in both XML and ActionScript. I'd rather program in ActionScript only, which isn't really a problem. Accept, getting an app to start with just ActionScript isn't obvious. This link provides a nice recipe where you use a single .mxml file, and the rest of your code base is in ActionScript.
  • emascript-mode.el - This is a nice Emacs mode for editing ActionScript. Combine this with auto-insert mode, and you're good to go.
  • Fast Flex compilation for Emacs - this mode is a life saver. It wraps up fcsh, and allows you to recompile your project files in just a second or two. It also updates Emacs so it jumps to the write line in the file when a compilation error occurs.
  • Emacs and Flex in the wild - An actual programmer talks about using Emacs and Flex together
  • Migrating from ActionScript 2 to ActionScript 3 - This is a very useful document that will bring you up to speed on the latest and greatest ActionScript.

Did I miss any resources? Share them in the comment below - Thanks!

Wednesday, September 17, 2008

Shell scripting my way out of IDE hell

The last few days I've been fighting with a Java project I've been working on. I've inherited this project, and the original developers created it in NetBeans. When I tried to configure the project using a tool other than NetBeans, I ended up with hours of headache and so I learned my lesson. Stick with NetBeans.

Only, NetBeans isn't so easy to stick with (for me). First, it runs at a painfully slow pace on my laptop. Second, I'd get inconsistent results - one day, the app would work just fine, the next I'd get a dreaded NoClassDefFound error on a class that I'd never touched. And then today, it started freezing. Just freezing, I wouldn't do anything to cause it. Argh. My blood pressure goes up just thinking about it.

Now, this isn't all NetBeans fault by any means. The app I'm working with was designed using EJBs and a variety of Web Apps that make it way heavier-weight than it needed to be. The result of this architecture is that a redeploy appears to be necessary after every change. Why, just, why, should I have to redeploy the entire app if I want to change something as trivial as a CSS deceleration? Oh, and it was also designed by programmers who named both session beans they authored SessionBean1 (not SessionBean1 and SessionBean2, but both SessionBean1). Need I say more?

While fighting with some random exception in NetBeans (where, I'll have you note, the cause wasn't filled in. It just said: EJB5070: Exception creating stateless session bean : [{0}] - notice the {0}, where the actual message should go), my buddy suggested I manually deploy the .ear it built using Glass Fish directly. Interesting, use NetBeans to edit and build, and manually deploy outside of it - hmmm, I hadn't thought of that.

At first I used Glass Fish's web app to do the deployment, but then I remembered that it comes with a series of command line tools. Again, hmmm, that could be handy.

Then, while dealing with NetBeans freezing, I realized that it was just kicking off ant to do the build process. What would happen if I tried building from outside of NetBeans too? I gave it a try, and built flawlessly.

Then it hit me - why was I slaving through all this pain? I shut down NetBeans (whoo!) and wrote the following two scripts:

# deploy.sh
ASADMIN='/c/Program Files/glassfish-v2ur2/bin/asadmin.bat'
ANT='/c/Program Files/NetBeans 6.1/java2/ant/bin/ant'
DIST_DIR=/c/src/code/dist
BUILD_DIR=/c/src/code

cd $BUILD_DIR
"$ANT" dist

status=$?
if [ $status = 0 ] ; then
    "$ASADMIN" deploy dist/app.ear
else 
    echo "Build failed, skipping deployment"
fi


# undeploy.sh
ASADMIN='/c/Program Files/glassfish-v2ur2/bin/asadmin.bat'
ANT='/c/Program Files/NetBeans 6.1/java2/ant/bin/ant'
DIST_DIR=/c/src/code/dist

cd $DIST_DIR
"$ASADMIN" undeploy app

I then pointed Emacs to the source tree and went back to some old school coding (which isn't really that old school, considering it's how I write my php apps every day). When I wanted to deploy the app, I ran:

 undeploy.sh ; deploy.sh

When the app didn't work right, I checked server.log for an exception stack trace. Turns out, Glass Fish actually produced pretty clear errors.

At first it was a little disorienting using Emacs when I had started to grow accustomed to the many near-magical features of NetBeans. For example, I couldn't just jump around the source tree, but had to know where I wanted to look. But a remarkable thing started to happen - I began to actually wrap my head around how all the components of this app went together. Rather than just trusting the IDE to guide me, I had to find my way myself. The result: I was forced to figure stuff out, rather than hitting Undeploy and Deploy over and over again till stuff started working.

Do I think you should always code Java in Emacs and not Eclipse or NetBeans? Of course not. I just know, that in this case, Emacs got where I needed to go a whole lot faster than either of those apps. And not only that, I got a better understanding of the app at the same time.

Tuesday, September 16, 2008

Dispatch PLT-Scheme Module - Whetting My Scheme Web Dev Appetite

Today, while browsing around for DrSync, I stumbled on Dispatch: A tool for configuring controller procedures in web applications.. OK, maybe that title doesn't do it for you, but it certainly got me interested enough to check out the docs.

Dispatch allows you to configure a web apps URLs in a nice and neat little package. For example, you can say:

 (define-site blog
    ([(url "") list-posts]
     [(url "/posts/" (string-arg)) review-post]
     [(url "/archive/" (integer-arg) "/" (integer-arg))
      review-archive]))

to wire http://www.example.com/ into (list-posts request), http://www.example.com/posts/hello-world into (review-post request name), etc. Dispatch also allows you to get the URL to a particular controller, such as:.

(li (a ([href ,(controller-url review-post title)]) 
       "View " ,(format "~s" title))

This means no hard coding of controller URLs, which is handy. Finally, Dispatch supports arbitrary code as a URL:

`(li (a ([href ,(lambda (request)
                 (review-post request title))])
        "View " ,(format "~s" title)))

I think that last chunk of functionality (provided by the continuation based server, not really Dispatch) has incredibly huge potential.

So, I'm now eager to give this all a try. I think my biggest hurdle to get over now is production deployment. Two questions come to mind: (1) is the PLT-web server production ready? And (2) is there an affordable server deployment option I can make use of? If you have answers to these questions, I'd love it if you'd share them. Otherwise, I'm going to have to continue to watch from the sidelines, and that's no fun.

On a related note, I've seen some positive press for LeftParen, a web framework that builds on top of Dispatch (I believe). If you're looking around for Scheme based web stuff, check this package out too.

Website? You don't need no stinkin' website

So, I'm making my way through the Toilet Paper Entrepreneur book*, and so far I'm enjoying it. Watch any of Mike Michalowicz's videos, and you'll appreciate that he's got a bold sense of humor. However, one highlight that I really appreciated, was seeing one of the tips he offers in his first chapter:

Every business needs a web presence, right? But that doesn't mean you need a website. Those are two very different things. You can establish a web presence on Facebook.com, MySpace, Squidoo.com, or a million other social sites. Spread the word about what you are doing through these social sites and set up a free email. Supplement your network with a free blog at Blogspot. That's more than enough to get some business rolling in.

Excellent advice. This is another take on similar advice that Seth Godin once offered up (and that I continue to spread around when I have the chance).

Sure, these sites are free and often times quite powerful, but more importantly: these sites are where the people are. By putting up a MySpace page, or a writing up a Squidoo or authoring an eHow how to, you're putting your name and business on a site that gets gobs and gobs of traffic.

Mike's suggestion of using Blogspot for a sort of home base is a good suggestion as well. When you start off, you can setup <businessname>.blogspot.com (like: ebaysellingcoach.blogspot.com). Over time, you can get a little fancier and configure the system to use a custom domain name of your choice. We went from i2x.blogspot.com to www.ideas2executables.com without changing any content and spending less than $10.00.

The other reason Mike and Seth's advice works so well is the web nature of the Internet. You can wire all of these sites together with links. So go ahead, put up your company introduction on your blogspot page, your videos hosted by YouTube, your how to section on eHow, and your PR news feed on Twitter - then link it all together with the appropriate URLs. Many of these sites even support embedding content inside of each other, so you can for example, stick a YouTube video right on your site without having people go off to YouTube.com.

Is this the perfect solution? Of course not. Who wouldn't love to have a gorgeously designed website? But that's pricey and comes with its own big set of challenges. When it comes to getting things started up, I think Mike's advice is right on.

*Finally, a book that was meant to be read in the "library." Whoo!

Discovery Of The Day: Google Docs Templates

So, I'm going to create a new Google Doc, and notice a menu option I've never seen before: "New » From Template."

Sure enough, there's a Google Doc template repository. Who knew?

Want a Google Doc for business cards, figuring out when your credit cards will be paid off, or for putting together a scrap book album? They've got you covered.

While I find the Google Help Docs to be useful, having all these examples to poke around and learn from seem even more useful. Google never ceases to amaze.

A Groovetastic Mix

Turns out, my college buddy Rob, just happens to have an interest in producing just the kind of music I'm enjoying listening to these days - electronic trance/dance/techno/whatever. He published a couple of mixes on Facebook, which is where I initially made this discovery and then he pointed me to his MySpace page, for more.

Check out his work:

It's definitely worth a listen, so give it a try.

Oh, and I'm quite certain that Rob wouldn't appreciate his music being called Groovetastic - would someone please suggest a better name?

Monday, September 15, 2008

Funny Because It's True: Debugging and The Five Stages of Grief

I'd never heard it quite put this way before, but I think Kevin nailed it with his article: Debugging and the 5 Stages Of Grief. It's just so true.

I especially liked his introductory comment:

What separates good programmers from bad programmers is not only their ability to avoid bugs, but also their ability to deal with them when they arise.

This is exactly what I was trying to get at when I wrote up my comments about learning to draw. The difference between someone who's good at what they do, and great at what they do, is how they respond to errors. Programmers included.

So now I have a new goal when I find a bug in my software: get to acceptance as soon as possible. This is tricky, because anger is just so much fun.

And no discussion of the 5 stages of grief are complete without the best representation of it on TV. Ever.


via videosift.com

Sunday, September 14, 2008

Homeward Bound

After a quick brunch with the Fam, we are on the road back to DC.

The photo attached doesn't do the scenery justice. Every time we drive
through Western NY I turn to Shira and announce: "This is so
picturesque! It's perfect!"

It's hard to believe I grew up less than an hour from this gorgeous
country.

If you hadn't guessed, that's Grandpa Simon in the photo. If genetics
has anything to say about, that's what I should look like when I'm 88.
Not bad, right?

Thanks to everyone who made this a great weekend!

--Ben

A Fun Saturday Night In Rochester

We had an awesome time hanging out with Matt and Caron last night. We hit a cozy Mediterranean restaurant and then, get this, a wine bar. Who new Rochester had such things?

More photos to come when the snapshots from the *real* camera can be uploaded.

Suffice to say, we had a great time and were reminded (yet again) that the city we grew up in actually offers quite a bit.

--Ben

Update: As promised, here are the "real" photos.

Friday, September 12, 2008

Making Emacs A Little more PHP Dev Friendly

Here are two emacs file handling functions that I've been meaning to work up up to make editing PHP less painful. Specifically, I wanted to be able to work with the require statements more efficiently.

insert-relative-path-at-point: This function asks you for a path, which you can tab complete against. When you hit enter, it inserts it at the current point as a relative path. It's useful for inserting paths into expressions like:

  require_once('<path goes here>');

Here's the code:

(defun insert-relative-path-at-point (path)
  "Prompt for a path, and insert the part relative to where we currently are."
  (interactive "GPath:\n")
  (let ((current-path (abbreviate-file-name default-directory)))
    (insert (substring path (length current-path)))))

find-filename-at-point: This function will open up the current file that your cursor is pointing to. It's like find-file, but context aware. This is useful for following require statements like:

  require_once('../../lib/foo.php');

Here's the code:

(defun find-filename-at-point ()
  "Open the file the curson is pointing to."
  (interactive)
  (find-file (thing-at-point 'filename)))

And I've bound these to keys like so:

 ;; Bind to: Control-c Control-f
 (global-set-key (kbd "C-c C-f") 'find-filename-at-point)

 ;; Bind to: Control-c i
 (global-set-key (kbd "C-c i") 'insert-relative-path-at-point)

Thursday, September 11, 2008

My Family Heritage (and maybe yours?)

Dave informs me, and I believe him: this is our family heritage.

It's yours too, if you happen to be a die hard cubs fan.

The Large Hadron Collider Web Cam

Check out this "web cam" from the Large hadron Collider.

I admit it, it took me a couple loops to get it. But it's classic.

All you physicists with a sense of humor will enjoy this one.

Kwiki - A Lightweight Wiki and Document Replacement Tool

Today, I was faced with that age old problem: how do I take an idea for a web app that I have some rough notes and a vision in my head and present it to a client? I've tried a variety of approaches, from Google Docs to hand drawn diagrams and still have yet to find the perfect solution.

Today, I revisited an approach I've used in the past: don't write up a document, but create a wiki that specifies the app. This seems like a good idea, because wikis are:

  • Fast and easy to edit - I won't get stuck trying to draw some impossibly complex diagram
  • Collaborative and typically have version control - no worrying about who has the most recent version of the spec
  • Allow you to support different pages, which should in theory model a web app

One reason I haven't used this approach in the past is that setting up a private wiki, isn't always the most hassle free activity. I end up spending all my time setting up the framework (and getting it work with Apache, MySQL, etc.), and none of the time working on the document.

Discovering Kwiki

Today, while browsing the big list of wiki software options I discovered Kwiki. What caught my attention was that Kwiki was described as being a simple wiki that didn't require database support.

Turns out, if you have shell access on a Unix system, Kwiki couldn't be easier to install and get running:

> svn checkout http://svn.kwiki.org/kwiki/trunk /usr/local/kwiki
> export PATH=/usr/local/kwiki/bin:$PATH
> kwiki -new /path/to/cgi/kwiki-01

It even comes with it's own built in web server, if you want to skip setting up Apache:

 kwiki -start 8080

And you're done...the wiki is running.

If I want to setup another Wiki (for another client's document) I just have to run:

 kwiki -new /path/to/cgi/kwiki-02

And it all just works.

Kwiki out of the box is really basic - and by enabling a couple of plugins, I got a fairly nice look & feel as well as version control support. Just what I needed to write up this document.

Next Steps

I've now written up and sent off the wiki to the customer, so I'm waiting to find out if they think it's a helpful way to understand the site. If they like the approach, I'm tempted to look into creating my own plugin for Kwiki. I'd like to add some basic wiki syntax that would add buttons, input boxes, check boxes, etc. to a wiki page.

With that plugin in place, I should be able to produce quick mockups that edit as easily as a wiki, but are still expressive as to what's going on in the app. But, I don't want to get ahead of myself.

The last thing I want to do is to develop a tool that I won't be using in the future.

The Twitter API - Addictively Easy To Use

I've started flagging particularly funny Twitter comments as they come by my feed. Such as this one from an hour ago:

Reading documentation... going to need 1.21 jigawatts of caffeine to get motivated for this.

When I started doing this, I wasn't quite sure what I was going to do with this collection of quips, or how I was even going to access them programmatically. Well, I still don't know what I'm going to do with them, but I've at least solved the second part - how do I access this data from a program.

I took a quick look at the Twitter AOI docs, and within just a few minutes, I had a good sense of how you get to data on Twitter. The API is actually drop dead easy to use.

To grab my favorites, I just need to visit the URL:

  http://twitter.com/favorites/i2x.format

The cool part is that format can be either xml, json, rss, or atom. After a minute or two of playing, I had the following command line going:

  wget -O - -o /dev/null 'http://twitter.com/favorites/i2x.xml' | \
  grep '' \
  | sed 's|||' | sed 's|||' \
  | sed 's/$/\n/' | sed 's/^/\n/' \
  | fmt

Which:

  1. Grabs my favorites from twitter in XML format
  2. Filters out all lines but the text
  3. Removes the XML tags
  4. Adds a newline to the beginning and end of each line, effectively double spacing the output
  5. Wraps the text into paragraphs using fmt

The output of the command is:

Reading documentation... going to need 1.21 jigawatts of caffeine to
get motivated for this.

My fortune cookie said ... "You will maintain good health and enjoy
life". Seems a little hard to believe after eating a thing of fried
rice

Nearly time for some Vitamin B. By "B" I mean "beers". By "Vitamin" I mean
"several".                                                                                                            

From a goofing around on the command line perspective, this API is hard to beat. And I could easily see embedding this in an application using either XML or JSON.

The whole Twitter user experience is incredibly lightweight - and it's great to see that they've continued that same spirit with their API.

Now, if I could just fine someone who was interested in me building a Twitter App, I'd be all set.

Banner Ad Test

Nothing to see here folks, move along...just me testing out a banner ad for a client:

Wednesday, September 10, 2008

The Memorial Taking Shape

Here's a shot of the Pentagon, with the 9/11 flag in place. This is actually a pretty descent view of the side that was attacked.

I can still remember that day like it was yesterday - standing in one of our goof off rooms at Amazing Media, all of glued to the TV, as the second tower fell in front of our eyes.

That was the day we launched our product with eBay - it was a day full of such promise.

--Ben

Cheapest. Date night. Ever.

Tuesday nights (for who knows how long) are now $1.00 scoops at Baskin-Robbins. Now you have no (financial) excuse for not taking your sweetie out.*

I really like trips to our local BR. We have one down the street, within walking distance - so we can walk off a small portion of the calories before and after pigging out.

I especially like our BR, because not only will we be the only ones in there who speak English, but every other party will be speaking another language. Spanish, Arabic, Amharic, and others - It's a multi-cultural extravaganza. Ice cream included.

* - Note: you should never take dating or romance tips from me. Ever.

--Ben

Gotcha Of The Day - Relative Paths In Apache Rewrite Rules

I launched one of my client's sites last night, and wanted to make the old pages automatically redirect to the new ones.

I could have written a manual series of Apache Rewrite Rules to this, but the majority of the page names stayed the same, so I was hoping I could get a bit fancier than that. I worked up the following rule:

RewriteCond %{REQUEST_URI}              ^/(.*)
RewriteCond newdir/%1 -f
RewriteRule ^(.*) http://www.clientsite.com/newdir/$1 [R=301,L]

Which does the follow:

  • Grabs everything after the slash in the request URI and stores it in %1 (/foo.php stores foo.php in %1)
  • Checks for the existing of the file in newdir (does newdir/foo.php exist?)
  • If so, then redirect to that URL

Alas, this wasn't working. I figured out that the -f check was failing. The fix? To not assume the relative path newdir/foo.php would be found. Instead, use the %{DOCUMENT_ROOT} variable to build up and compare an absolute path.

RewriteCond %{REQUEST_URI}              ^/(.*)
RewriteCond %{DOCUMENT_ROOT}/newdir/%1 -f
RewriteRule ^(.*)  http://www.customersite.com/newdir/$1 [R=301,L]

Man I love Apache Rewrite Rules - they can be cryptic, but well worth getting to to know and master.

Tuesday, September 09, 2008

Useful Entrepreneur Resources

Here's a useful collection of entpreneurial resources. It's not the longest list out there, but what it lacks in quantity it makes up in quality.

Included are resources for raising money, doing your taxes, and staying connected with other entrepreneurs.

Definitely worth checking out.

Obama - Pro OLPC?

Check out a snippit of Obama's education policy speech:

Imagine a future where our children are more motivated because they aren’t just learning on blackboards but on new whiteboards with digital touch screens; where every student in a classroom has a laptop at their desk; where they don’t just do book reports but design PowerPoint presentations; where they don’t just write papers but build websites; where research isn’t done just by taking a book out of the library but by emailing experts in the field; and where teachers are less a source of knowledge than a coach for how best to use it. By fostering innovation, we can help make sure every school in America is a school of the future.

He gets points for recommending the OLPC approach. He loses points for recommending kids do PowerPoint Presentations. Overall, I like his suggestions. Read the entire transcript here, including his education plan (hosted by scribd.com, no less).

Monday, September 08, 2008

Helping By Helping Others Help

I thought this was a really clever move by Suzanne, aka eBay Selling Coach. She wrote up the eHow: How to Support Sarah Palin for Vice President of The United States.

She's showing her support, by educating others on how they can show their support - brilliant!

I'm sure this this approach would work great beyond the world of politics, too.

Best Speeches Of The 2008 RNC

OK, this is now old news. But, for the sake of history...

Love 'em or hate 'em, my pick for the two best speeches of the 08 RNC were Giuliani and Palin. They certainly had the most zing to them.

Once you watch them, you also have to watch Daily Show's commentary on them. Depending on where you stand politically, you'll either love the Daily Shows comments, or will be unphased.

Update: CNN made mention of this handy breakdown of the misstatements made during these speeches. Just like my Grandpa, apparently these speech writers didn't let the truth get in the way of a good story.

Barbie for Jewish Education

I just stumbled on this fascinating film - The Tribe. As they describe it:

An unorthodox, unauthorized film about the Jewish people and the Barbie doll...in about 15 minutes.

I've only watched about 4 minutes of it, but I'm hooked, and hope to catch the rest later.

The Trailer

The Film

Little known fact (to me, anyway): the Barbie Doll was invented by a Jew. And so was the safty razor, blue jeans, Polaroid film, the Macintosh and the Teddy Bear. Gosh, I love Wikipedia, too.

Google Maps - A Hiker's Best Friend

I'm starting to plan a fairly length hike in the Shenandoah National Park. I've got a handy book that outlines the hike I want to take (#25, Brown Mountain/Rockytop), but the map is mediocre.

While trying to get driving directions to the area, I noticed that Google was offering terrain mode for the park. I clicked it, and bam! - I had interactive topo map. And, surprisingly (to me, anyway), all the trails we need to follow are marked on it. How cool is that?


View Larger Map

I've now gone through and captured various latitude and longitude points throughout the hike. I'll plug these into my Geko, and we should have a much less reduced chance of getting lost. Here are the waypoints I selected, plotted by the always useful gpsvisualizer.com:

I love how I've been able to take a virtual tour of the area, all without having to bother tracking down specific maps or installing special software.

Google never ceases to amaze. For the record, I will bring my Geko on the trip (and will rely on it heavily), but I won't be bringing a laptop. Nope, Google will just be used in the planning stages of this trip.

Sunday, September 07, 2008

A Beautiful Sight

We had dinner with Shira's cousin Andrea and her husband Ryan. Andrea
is 8 months pregnant and looking great. And while the miracle of life
is cool and all, the real highlight was checking out Ryan's TV setup!

OK, I'm 60% joking here - this was a sweet setup. Think gigantic TV,
rigged to computer, wireless mouse and keyboard, web cam for sending the
fam live baby footage. He's even experimenting with a 3d glasses setup.

I'm so hiring him as a consultant, if ever want to pull off one of these
setups.

As parents to be, they looked so calm, cool and collected. We're so
excited for them!

--Ben

Friday, September 05, 2008

More Than A Money Maker

The other day, this link came flying by on my Twitter stream. The thought: if you want to make a few bucks online, you can write up HOWTOs for eHow.com.

That seemed like an interesting thing to pass on to folks in my blog. After all, making a few bucks online is always a good time (Shira loves selling on eBay - she'd sell me on eBay if shipping wasn't so dang expensive!). But, thinking about it a bit more, I think that writing for eHow is actually more useful than just a money maker. It actually seems like a place which could be a reputation maker - and that's way more valuable.

If you've got gobs to say and a little tech savvy, then by all means, become a blogger (it's actually really easy!). But let's say you don't have tons to say, or you don't have a lot of tech savvy. A place like eHow lets you share your knowledge with others in an easy format (who doesn't love straight forward step-by-step instructions?), and build up a little library of what you've contributed.

For example, I've never met Hank, but I get the sense that he knows a heck of a lot. If he was in the business of building decks, (which he isn't), and he sent me to his profile, I know I'd be impressed.

eHow not only gives you the tools to publish, they'll provide you with an audience (people searching eHow) and even a bit of cash back to you for your effort. Sounds like a good deal to me.

Of course, eHow isn't your only option for doing this sort of thing - Squidoo lets you do more or less the same thing, and your pages can be more sophisticated. Heck, one of my customers just launched BizBrag with the express purpose of giving folks a place where they can talk about their businesses, thereby building a reputation.

If you don't have a lot of cash, but think you should be online - starting with a site like eHow may be just the ticket.

Contributing To Mankind's Knowledge - My First Wikipedia Page

So, today I published my very first Wikipedia page. It's a short biographical entry of an entrepreneur I've recently connected with.

I've actually been looking for an excuse to dip my toe into the Wikipedia world, as it's a community and experiment I so very much admire. It's just one of those things that shouldn't work, but does. The fact that nearly anyone in the world can edit nearly any page, and the thing isn't a big 'ol spammy mess, is just amazing. It renews my hope in mankind as a species.

There was actually a whole bunch to take in before I could write anything, including:

If this all seems a bit daunting, to me, it was. But, there's one really interesting practice on Wikipedia that I find just amazing:

You do not need to read any rules before contributing to Wikipedia. If you do what seems sensible, it will usually be right, and if it's not right, don't worry. Even the worst mistakes are easy to correct: older versions of a page remain in the revision history and can be restored. If we disagree with your changes, we'll talk about it thoughtfully and politely, and we'll figure out what to do. So don't worry. Be bold, and enjoy helping to build this free encyclopedia.

In other words, it is Wikipedia policy, that you should Ignore All Rules. Remarkable, no?

Like I said at the beginning of this post - Wikipedia just restores my faith in human kind. Any project that can be so successful, yet have such an open and welcoming community - wow.

I guess I'm just glad to say I'm part of it.

Now, go fix what I've started, and make it better. Man, I love wikis!

Thursday, September 04, 2008

Forbidden Fruit

Shira's new laptop came today, and I have a single directive: touch it,
and I'm toast. I'm not even allowed to break the seal on it.

Now I know how Adam felt...that delicious Dell, just hanging
there...mmm....must resist temptation.

--Ben

A Great Way To Not Watch A Speech

My plan last night was to watch the RNC speeches this morning, instead of staying up last night. But, while Palin was talking, I couldn't resist trying a little experiment - "watching" the speech via Twitter.

Basically, I went over to search.twitter.com and entered in Palin as the search query. Up came the results. Now, here's the fun part - every few seconds, the search results would refresh and let me know there were new messages to read. (Note: the screenshot below is from the morning after her speech, not during it)

What a fun approach it turned out to be. First, using only these short snippets I started to get a sense of what was going on, real time, in her speech. Second, I got a wonderful appreciation for the different views out there - to some, Palin's speech was rocking the house, to others, she had said nothing of relevance. But, mostly, the results were down right hilarious. I mean, laugh out loud funny.

Overall, it was a fun way to take in this historic event. It's definitely worth a try. And it works not only for speeches, but anything happening real time. Keeping a pulse on the Google Chrome Launch, was made a lot easier by using Twitter's search feature.

It's like have a Nielsen Ratings Meter for any topic you're interested in.

Gotcha Of The Day - Fading Text In

I wanted to use scriptaculous to fade some text in, and out. But, for the life of me, I couldn't get the transition to be smooth.

I was using the following code to make this happen. Notice, how I'm using the Effect.Fade effect below:

<div id='quotes-contents'></div>
<script type='text/javascript'>
 var quotes = loadInQuotes();

 function showQuote(i) {
   i = i % quotes.length;
   var ts = $('quote-slot');
   var nextThunk = function() {
     ts.appendChild($E('div',{id: 'quote-contents'},  quotes[i]));
     new Effect.Fade('quote-contents', { 
                     from: 0, to: 1,
                     afterFinish: function() { setTimeout(function() { showQuote(i + 1) }, 5000); }});
   };

   if($('quote-contents')) {
     new Effect.Fade('quote-contents', {
                       afterFinish: function() { ts.removeChild(ts.firstChild); nextThunk(); }});
   } else {
     nextThunk();
   }
 }
 showQuote(Math.rrandom(1, quotes.length));
</script>

But, like I said, the transition was glitchy.

The solution? Effect.Fade is used for fading out, not in. To fade in, using Effect.Appear. D'oh. That, to make the fade in really smooth, mark the node that you're fading in with a style of display: none. Effect.Appear will automagically make the node visible.

The working code:

<div id='quotes-contents'></div>
<script type='text/javascript'>
 var quotes = loadInQuotes();

 function showQuote(i) {
   i = i % quotes.length;
   var ts = $('quote-slot');
   var nextThunk = function() {
     ts.appendChild($E('div',{id: 'quote-contents', style: 'display: none'},  quotes[i]));
     new Effect.Appear('quote-contents', { 
                     afterFinish: function() { setTimeout(function() { showQuote(i + 1) }, 5000); }});
   };

   if($('quote-contents')) {
     new Effect.Fade('quote-contents', {
                       afterFinish: function() { ts.removeChild(ts.firstChild); nextThunk(); }});
   } else {
     nextThunk();
   }
 }
 showQuote(Math.rrandom(1, quotes.length));
</script>

Ahhh, much smoother.

Thanks to this article and this article for getting me on the right track.

Wednesday, September 03, 2008

Flour Power Desserts - A Yummy Friendship

My Dad made it clear to us growing up - you don't need to marry a doctor, lawyer or beauty queen. Nope, he wasn't that superficial. Nope, you want to marry the baker's daughter. Like most of my Dad's advice, I didn't listen to him. But, I ended up with the next best thing - my brother is good friends with the family behind Flour Power Desserts.

And how is this good for me? On a couple of occasions, last night being the most recent, he arrives home with some gourmet bakery treat. The above photo just doesn't do these delicious butterscotch cookies justice. For one thing, they came neatly wrapped. And while I had every intention of photographing them before tearing into them, that just didn't happen. They were too irresistible.

My brother has told me a bit about Flour Power Desserts, and I'm really impressed. In a world where everything is mass produced, they're all about customization. And it's not just the look of the desserts, but also the ingredients. They use all Kosher ingredients, and will customize for any particular allergy requirements you might have.

Hmmmm, it's just like custom software development, only a whole lot tastier!

Note to my brother David: whatever you do, don't blow this for me! You will hold onto these friends at all costs...