Monday night was a big night for us. Most notably, we started encrypting all data sent between our users' computers and the WebNotes server. In a perfect world, encryption would not affect the user experience at all; just make using WebNotes more secure. Privacy FTW!
Alas, this isn't a perfect world yet.
The encryption algorithms must not only be implemented, but made very efficient. In algorithm terms (thanks, 6.046) that means they should run in O(n) time. With that goal in front of me, I started researching speedy yet still relatively secure encryption algorithms. I found the best candidate and went about implementing it in both JavaScript and C# so that our server and the user's browser will be "talking" with the exact same encryption scheme. Implementation was a surprisingly smooth process. Turns out that Ron Rivest (of RSA fame) et al. really know how to make simple yet elegant algorithms! After messages were encrypting & decrypting without any problems in a reasonable amount of time (~100ms in JavaScript to encrypt 30,000 characters), I patted myself on the back and ran it on the presses. After the new code went live, I made sure WebNotes still worked (it did) and called it a night.
Then, when I got to work this morning, things started to smell fishy. Our error logs were showing large numbers of request timeouts. Something was slowing down our server significantly. Requests were taking 10-30 seconds to process rather than the pre-encryption 200ms. As you could guess, server-side encryption was the culprit. Needless to say, I was very embarrassed that it was my code that was causing our users to endure 20+ second delays. That being said, I was also very confused as to why encryption was taking so much longer on the server when my tests had shown that a lengthy message could be encrypted in tens of milliseconds. Something was afoot.
Thirty minutes of detective work later, I discovered that problem. The good news is that my encryption algorithm wasn't guilty; it was the way I was constructing the string of encrypted characters. I was adding each encrypted character to my output string one-by-one using standard string concatenation, i.e. encryptedMessage += nextCharacter. As it turns out, doing that tens of thousands of times is a rather slow process. The technical reasons being that 1) a new string object is created on each iteration, and 2) object instantiation is an expensive operation. I instantly remembered the powerful StringBuilder class I had been introduced to back in 6.831. Since building up a long string one character at a time is basically the poster child for "uses of the StringBuilder class", it sped up the process dramatically. How dramatic was the speed up? I asked myself the same question and, like a true engineer, took the time to write up a short benchmarking test to compare string concatenation and StringBuilder. Drum roll please...

WOW! I don't know if I've even seen a smoother exponential curve made from non-fudged test data. Unfortunately it's an exponential curve of the slowness that is string concatenation. Building a 60,000 character string using StringBuilder was three orders of magnitude faster than string concatenation...1,000x faster. Also, although it difficult to tell from the graph, the StringBuilder curve is almost exactly linear while the string concatenation curve is clearly exponential.
Now, a bunch of you are probably saying, "But, Matt, you said you ran tests that showed encrypting AND constructing a string of 30,000 chars took just 100ms. What gives?" Well, I ran those tests in JavaScript with a mindset of "There's no way C# could be slower than JavaScript. If it's fast in JavaScript, it'll be even faster in C#.
" Well I was wrong. Not just wrong...exponentially wrong.
So the morals of the story? 1) StringBuilder >> concatenation, 2) Never assume that C is always faster, and 3) You'll always make mistakes...just make sure you learn from them.
We’re very excited to announce two major updates that just went live today: new versions of our IE and Firefox toolbars, which are substantially faster when loading WebNotes in your browser, and a new Beta invite system that allows any user to invite up to 10 others to join WebNotes.
We hope that these updates will make it even easier to use WebNotes and to invite your friends and colleagues to try us out. These updates were based on your feedback, so keep the comments and suggestions coming!
Last night was my first (of hopefully many) meetups at Resolve Nations Entrepreneur Meetup. It was great to meet a lot of passionate business owners who really loved what they do. Plus I got a lot of good/interesting advice.
Among the topics covered:
1) Marketing during the holiday season
2) Business Ethics (which I'll comment more on in my personal blog)
3) How to do business during an economic turndown.
If you are in Boston and want to meet up with some other entrepreneurs, come to the next meeting!
This guy took up residence on Ryan's monitor over the weekend. He's been helping us track down and kill our bugs. We're thinking maybe we can patent this new tech, and license it out to other startups.
He also helps us with our web crawling efforts.
Thank you folks, thank you. I'll be here all week. Try the veal. And be sure to tip your waitress.
A while back we went to the MIT career fair. I took some pictures but neglected to put them on the site! Here are the handsome mugs of Matt Long and Ryan Damico.
Unfortunately, once again this was taken with my camera phone. They are far less distorted in real life.
One of my favorite things to do is swing by Wikipedia for some good ol' fashioned random web surfing. And though it may feel like procrastination at times, it's quite educational. In effect, it's like watching the Discovery chanel. You may be watching TV but you have become infinitely smarter than anyone who chose instead to watch reality TV.
After a stimulating conversation with my colleague, Bennett, my quest for today was to research Ray Kurzweil (you can find my annotations here). Ray is an interesting guy who wrote his first computer program at 15 (which was actually used by IBM). He's then had his hand in all sorts of different technologies ranging from OCR to speech synth to pattern recognition. He's widely regarded as a leading "futurist" and has a crazy dietary program to boot. Enjoy your procrastination!
Thanks again to all of our users who have been submitting bugs and providing us with valuable feedback on how we can improve WebNotes. We’ve been spending a lot of time lately making adjustments to our
toolbars,
bookmarklet and
"My WebNotes" site to address the issues you’ve brought up, and today we rolled out a major update that takes care of many of them.
If you’re using the WebNotes toolbar for IE or Firefox, you should be notified of the update automatically, and if you’re using the WebNotes bookmarklet, these changes will take effect the next time you run it.
Keep the feedback coming!
I was just reading Seth Godin's blog where there was a little cartoon quote saying "the market for something to believe in is infinite". Some of you might know that I was in Vegas for the weekend, and nowhere else is this philosophy more evident. We all want the big lotto ticket to hit, we want to believe that betting our 401k on the 40 to 1 odds is the right thing to do, but it almost never works out. Heck, Casino War (or alternatively "high card") is even offered, where your odds are exactly 50/50 in the long run and effectively zero in the short run (unless you have excessive amounts of cash to ride out the streaks of bad luck). Now, there is nothing wrong with having the big dream as long as it comes with the understanding that to get there, 90% of the time you have to grind it out.
An apt poker quote from the movie Rounders:
"Guys around here will tell ya...you play for a living. It's like any other job. You don't gamble. You grind it out. Your goal is to win one big bet an hour, that's it. Get your money in when you have the best of it, and protect it when you don't. Don't give anything away."
The same applies to product development, startups, etc. There is chasm between you and the big dream and hard work lays in between. Of course, Mike McDermott goes on to say:
"But finally, I've learned this...If you're too careful, your whole life can become a grind"
Grinding is a good way to get you inch by inch to your goal, but there comes a time when you need to take a risk, double up when the odds are in your favor and hope for the best :-)
As a side note, it probably helped that I won a bit this trip. My attitude could've been very different had I lost big!
A few weeks ago I met up with Gopal Shenoy, Director of Product Management at salary.com, after he saw us present at this summer’s Web Innovator’s Group. Gopal runs a great blog about product management best practices, and recently posted a review of WebNotes (along with a video interview with me) on his site. Check us out!
Forbes and Gartner recently published a study called "Day in the Life of C Level Executives" where they studied how lower level executives get their information. OVERWHELMINGLY, executives found their information from the Web. Not actual newspapers, not actual magazines or trade journals. The web is considered to be their most important source of information. 60% + of those surveyed consistently use the web for research and over 80% will utilize a search engine.
My question is, what do you do with all this information? How do these executives organize their thoughts? WebNotes certainly will help 100% of the businesses and executives become more efficient in their day to day struggles with information overload, and it will certainly help the 50% + of the executives who youtube consistently to watch more online video in their free time. :-)