Orthogonal Thought | Random musings from the creator of Cooking For Engineers and Lead Architect of Fanpop

AUTHORS

CATEGORIES

ARCHIVE

Accessing and Reading Cookies in JavaScript correctly

Posted 25 June, 2009 at 5:25pm by Michael Chu
(Filed under: Web 2.0) No comments

Recently, I've had to deal with web browser cookies a lot, and, in one case, I had to read several cookies using JavaScript. I looked up how to read cookies and JavaScript and found out there's no built in function that parses out the value of a particular cookie key - you have to write your own function or copy an already written one. I grabbed one from a popular website that provides HTML and JavaScript lessons and tutorials, but then discovered that it was providing the wrong cookie value for this one particular cookie I was trying to read. I tried another function from another website and same problem.

The cookie I was trying to read started with the same name as part of the name of another cookie already set. For example, I was looking for "targetcookie" but an earlier cookie of the name of "the_wrong_targetcookie" exists. I got the value of "the_wrong_targetcookie" instead. I looked at the functions I had grabbed and it was pretty easy to see that the string searching implemented was too simplistic to work in all cases. (Another solution could have been to change the cookie names, but I wasn't the one setting the cookies. The API I was working with dictates the cookie names and both cookies were set by that API.)

Click here to read the rest of
Accessing and Reading Cookies in JavaScript correctly

Job opportunity at Sendori

Posted 31 March, 2008 at 5:53pm by Michael Chu
(Filed under: Web 2.0) No comments

My friend Dave is looking to hire additional people for his company, Sendori (in Sunnyvale, CA). Here's the req. E-mail him if you are interested in working for a funded startup in the fast pace world of the internet economy or just want to work for someone that I have lunch with and hang out with regularly.

Keyword Editor

Click here to read the rest of
Job opportunity at Sendori

Tufte

Posted 19 July, 2007 at 2:20am by Michael Chu

The Tufte one day class was pretty interesting, but I'm not sure it was worth the money. With a bunch of people that use Mosuki, we managed to get enough people to sign up to get the 25% off discount so I ended up paying $285 for the course. Along with the course, you receive all four of Edward Tufte's books - a $185 value if you buy them from his online store (or $133 from Amazon.com). That means I paid about $100 - $152 (not counting parking and lunch) for the privilege of seeing Edward Tufte in person, chatting with him about the CFE Tabular Recipe Notation for about three minutes, and hearing him teach out of his books. At these prices, it's not too bad for about six hours of lecture, but since almsot all the material is available in his amazingly well written and beautifully designed books, I'd have to recommend others to pick up his books first and read them.
Click here to read the rest of
Tufte

I'm off to see the Wizard!

Posted 16 July, 2007 at 11:38pm by Michael Chu
(Filed under: Life, Web 2.0) No comments

photo_tufte.jpgWell, not really the Wizard (of Oz) but the Wizard of Data Visualization. Tomorrow I get to attend a full day course taught by Edward Tufte. The first time I heard of Tufte was three years ago when someone posted on Cooking For Engineers that the recipe summary tables were Tuftian. I was a bit confused by that remark until I read a little about Edward Tufte - it was a compliment! Tufte teaches about information design, clarifying complexity, interface design, and more. I've heard that people who have taken classes from him have found themselves looking at the world differently - I'm not even hoping for that much of an impact, but that would be cool.
Click here to read the rest of
I'm off to see the Wizard!

MySQL and Ruby on Rails datatypes

Posted 29 June, 2007 at 12:36pm by Michael Chu

One of the best features of Ruby on Rails is the ability to interact with database tables as objects using ActiveRecord. Sometimes documentation can be a bit spotty, but after searching for a little bit it's not hard to find the mapping from Rails Migration types to MySQL data types. I did find it more difficult to find out what happens if I already have an existing MySQL table. What Ruby class gets created with what MySQL column type? I didn't find it on the web, so I put together this list…
Click here to read the rest of
MySQL and Ruby on Rails datatypes

Ruby multi-line comments

Posted 22 May, 2007 at 12:05am by Michael Chu

For over a year now, I've been working in Ruby on Rails (mostly for Fanpop and more recently for Cooking For Engineers) and one of the things that I wished I could do in Ruby was block comments. Internet searches I performed last year didn't yield anything, so I gave up. Well, last week, I looked around again and found a solution.
Click here to read the rest of
Ruby multi-line comments

Ara's Photographs

Posted 15 May, 2007 at 11:49pm by Michael Chu

Today, I had lunch with an old Intel coworker from my first role at Intel in the Microprocessor Research Labs. Ara Nefian developed many of the applications and functions in the Open Source Computer Vision Library as well as an amazingly accurate face recognition system while I was there and who knows how many other cool and unbelievably projects he's been working on since. He's started working on a personal project - a website that catalogs his travel photographs from around the world. That in itself is not all that exciting - image galleries are a dime a dozen these days - but his site uses pattern recognition algorithms to find photos that are related based on the images themselves. The photographs are organized in two (orthogonal) classifications - location and subject. The images can be perused on either of the two axes while a related pictures search utilizes pattern recognition to pull up other images that are similar. He's hoping that the site will help people decide where they want to travel to on vacation. By looking at photographs and deciding that you like a particular view, you can use the related pictures search to find similar photos and reveal other destinations that you might also enjoy. For example, if you like beaches, then you can find a beach that you like, click on related photos and see other beaches that share visual characteristics with the one you started with. It's like a photographic brainstorm for choosing a travel destination!

http://www.anefian.com/

Mosuki

Posted 6 May, 2007 at 10:44pm by Michael Chu
(Filed under: Life, Web 2.0) No comments

My friend Jeremy (who I've known for 2/3 of my life!) had his birthday party today and I got to participate. I hadn't seen Jeremy in a couple years (in the last decade we've seen each other probably 4-5 times), but a couple years ago I signed up on his calendaring/shared event website called Mosuki. I added Jeremy as part of my network and then never returned to the website. Two years later, it paid off. As part of joining the network, I opted-in to receive periodic e-mail updates so I can see what events are going on in Jeremy's life. I never actually participate in any of them even though some seem quite interesting (and some seem just plain weird). So, I open my e-mail on Saturday and see that Jeremy is having a picnic in San Francisco followed by a private tea presentation at the Imperial Tea Court in Chinatown. I thought this was an excellent opportunity for me to see my friend again, so I logged back into Mosuki and responded that I would be going.

The tea presentation was very interesting and informative as well as relaxing as I caught up with Jeremy on what's been going on with our lives and smelled the aroma of several teas while they were dry, just rinsed, steeping, and poured into tea cups. The flavors were also quite interesting and diverse between the varieties and learning how the tea was picked and prepared added to the experience. It was good times and I owe it all to Mosuki.

Mysql database migration and special characters

Posted 5 May, 2007 at 10:12pm by Michael Chu
(Filed under: Web 2.0) 96 comments

So, I keep having all sorts of problems when moving my mysql database from one machine to another. The issue is that in text or varchar columns containing data that have special characters like smart quotes (those crazy curly quotes), accented letters, etc. result in scrambled data. For example the following phrase

it’s

results in

itâs

in the database and then renders incorrectly on the website as

it’s

This is supposed to be a popular problem when moving from mysql 4.0 to 4.1 or later, but I seem to have this problem moving data from one database to another on the same mysql installation. Moving from one maching with 4.1 to another with 4.1 also results in this crazy character problem.

Most of the solutions I found online end up with complicated find and replace functions to remove these problem characters. Unfortunately, that just not a solution that I'm okay with. After fiddling with it for most of the day (and giving up several times in the past), here's what I did that worked for me.
Click here to read the rest of
Mysql database migration and special characters

NAVIGATION

SEARCH