Why I’m hooked on JavaScript!!

Now I’m apparently not even an expert at JavaScript but I’ve had some exposure to it in 1 way or another, mainly through using jQuery in my last project (which I totally dig!!). I’m still working on web development in general and that project in particular right now and my friend and I have been going back and forth between the popular languages/frameworks like Ruby on Rails, Django and NodeJS. Honestly, I’m kinda a fanboy for NodeJS… I really am. Here’s why:

Now JavaScript has been mainly used for client side in web browser. The interesting thing is that each big boss (Mozilla/Google/IE) seems to develop their own JS Compiler. The Google V8 Engine (which NodeJS is built on) seems to be the fastest one right now. I was pretty amazed when JS was used as a server side technology but if you break it down, I wouldn’t say it’s impossible.

IMHO, I guess the important thing about writing a server is to handle sockets and a few protocols (HTTP, TCP… stuff like that). Now protocols are (again, IMO) rules of how information should be positioned in a packet so you can do that with pretty much any language. Traditional server technologies like Apache Tomcat, Glassfish… have been spawning threads to handle each incoming request. That’s not necessarily a bad thing but the bottlenecks seem to come down to IO so there’s been drawbacks in terms of blocking threads when u do a long query and such. Now u can overcome that by implementing distributed systems with a load balancer on top, along with some request filtering and routing, at which point it becomes kinda costly.

NodeJS

NodeJS

NodeJS uses Event Queue which puts everything in there and does event loop and uses callback functions. So technically there’re no blocking and the app is very scalable, theoretically. With that said, a long query gets run and once it’s done the callback is invoked. Now that sounds kinda cool.

OK so it can handle HTTP request, what else? Another important thing I would say is the database, which kinda comes down to separate vendor. How does the server connects to the database? Using a driver! Java gets an advantage cause it maintains an interface for vendors to write drivers based on. RoR supports a couple of database technologies and so is Django. There’re enough database vendors and plugins out there that it’s gonna take a while for NodeJS to catch up on that front, I assume.

What else? Some process manipulations like File IO and such, cause apparently the server will need to, at some point, modify some file resources, invoke some processes and stuff like that. NodeJS does have this, although I’m not sure how stable/mature it is. But that should take care of it.

Now I’ve always thought that RoR and Django were booming due to their ability to do rapid prototyping/development really really fast. You can get started on a webapp at a reasonably good pace with those, thanks to ORM and dependency injection and all the fun stuff. Honestly, I’m kinda a purist to a degree that I don’t hate abstracting 1 language over another, but magic can be disastrous sometimes. I believe that I should hand-write SQL queries and HTML/CSS instead of using ORM and compiled HTML (such as erb/jsp/asp…) cause you get a better control over it. It gets hard to manage after a while but it’s easier to identify the bottleneck and optimize it, instead of optimizing RoR and hoping that would optimize SQL.

Besides, using compiled HTML puts more load on the server than client, which in a way provides a more stable outcome since client machines/browsers vary a lot. But again, back to mixed language kinda thing, gotta be careful.

1 of the things I found that is challenging to JavaScript is actually synchronization. Now according to my knowledge, browser JS is executed in a single thread so how come synchronization is a big deal? Because browsers render different things in a different threads (you’ve been wondering how they load part by part, right??). Now what that means is, browsers render images/HTML structure/CSS styling/JS separately in different threads so its was such a pain for me to get a consistent User Experience. I honestly haven’t dug around enough to solve this issue since the nature of callback is just like that. Putting timeout and synchronization variables don’t seem to suffice…

Wait, so what about setTimeout and setInterval and stuff, aren’t they supposed to give a better control? Well FYI, setTimeout to 1000ms doesn’t mean it’ll get executed after 1000ms. It means that’ll get executed after AT LEAST 1000ms (cause it’s a queue…) so yeah, still digging around.

Back to my project which is a CMS now might turn into an RDS, I honestly think all we need are those important features listed above. Worst case is that we write a thin layer of wrapper around the tools we want to use, then invoke shell processes for those. But anw, it comes down to a light, thin server framework cause we probably don’t need all the big guns (which can take tons of time to tune). So yeah, it’d be great to set foot on that!!!

 

Tagged , , ,

The Social Network won 4 Golden Globe awards!! Duh!

Ok so I’m definitely a BIG fan of this movie called “The Social Network”, a.k.a Facebook so I’m pretty happy that it won 4 awards at the Golden Globe. I would say the movie dramatized a lot of Facebook history but what movie doesn’t. The thing I like the most about it can be summed up to “been there done that” (well for like the 1st 5 minutes of the movie, apparently I haven’t become mad rich yet).

The Social Network

The Social Network

So I’ll spoil a lil bit here: The movie is about Mark Zuckerberg, founder of Facebook and how it became popular. It started out as him getting dumped at the bar, then running back to his dorm and do his magic hacking (which I’ll explain in later posts) to create the facemash.com site (along with some girlfriend revenge blog posts). The site totally attracted major traffic which brought him to Harvard’s Board of IT (or sth like that). After that he was approached by the Harvard twins and their friend to discuss about the idea of Facebook. They hope he would build that for them and it’s gonna be big, which it did just that its not theirs anymore.

I found the movie uber inspirational because dang, I was that kid. Actually any CS-major student (or at least the one I know) was that kid during college. In case u guys don’t know about the software industry, I feel like it’s 1 of those that doesn’t require a huge amount of capital to start with, unlike finance, manufacturing, engineering or pharmaceutical. All u need is pretty much a $1000 computer and probably a $5/month hosting service. In fact a lot of big software companies start with open-source (a.k.a free) tools. Once they got the hype, they offer premium services that start generating profits and such.

When I was in college doing open-source projects and research, I always hoped to make it big. I was often told that what I made was gonna be used by a lot of people and everything so design it that way, design the software for maintainability and extensibility. What that meant was to make something that when u leave, someone can take over easily (maintainability) and that would be extended easily (extensibility). But such things were very delusional which led me to choices I regretted later on.

One of the things I learnt while working is to quantify requirements. When I was doing work for my professors, I never asked so how many (in numbers) people do u think are gonna use this, how fast (in seconds) it should run, who (as in names/backgrounds) will take over my product. Why? Cause I was stupid and intimidated. I still am. But when it comes to product assessments, numbers rule.

But anw, after the movie, I felt like my friends and I were doing exactly what Mark was doing. Did we stay up till 4a.m coding while intoxicated? We sure did. Did we crash the CS server and wake the Dean of IT up at 4a.m? we also did that (just that we woke the CS Department Head up cause u know, he ain’t Dean. We didn’t know the Dean’s number anw). The thing is, Mark made it cause he took the risk. We didn’t (not to say that if we did we’d make it, but u got the point). Thus, the movie made me feel like that was my college life, in another direction…

I never took the risk cause I was Asian (not to be racist!) and I was raised to have the mentality of never taking risk. My parents rarely encouraged me to “go for it”. Instead, they always told me “what if u fail?”. Therefore, my whole life has been revolving around making plan B and making sure plan B works even when I have to abandon plan A. With that said, I’m gonna finance a Mini Cooper!

What do I listen to during my commute? Music Digest (01/12/11)!!!

So I just got home pretty late from work and hanging out and stuff. The commute is not too bad but it’s always nice to have some music in stock. Anyway I’ll keep it short:

1. Forget You – Glee Cast

I did start watching Glee from Season 2 and so far the music has been pretty good. I’m not a big fan of show tunes and such but Glee does cover hit songs right now and some are even better than the original. This one in particular is definitely fun and a nice start for my morning commute.

2. Run Devil Run – SNSD

Gotta leave some room for the K-pop. This is not their newest song but for some reason I always fantasize myself driving and jamming this one (Run involved?) IDK…

3. Bang – After School

Again, not a new song but hell yeah it rocks. Really energetic and catchy although the slow part is kinda awkward… After School in general is the older K-pop out there (in terms of age, not stage presence). I guess they’re 1 of those that debut then dive.

4. Rocketeer – Far East Movement ft. Ryan Tedder

Oh yeah this one has a really nice lyrics although the MV is like… wth? FM has gone a pretty far way since Like a G6 and this one is sorta like a nice other side of their music. Please don’t mind the MV -_-

5. Why are you being like this – T-ara

This song is just cute. Ofc I don’t understand the lyrics (well sorta, a lil bit). Ever since my friend showed this to me a month ago I’ve been listening to it almost everyday…

Gotta sleep now. Have fun guys!!!

Cars!!!

So I’ve been trying to get a car, well not just a car, a Mini Cooper specifically cause it handles soooo well. But anyways since I got my license a while ago and have been renting cars, I got my shot at driving different kinds and it turned out to be a pretty satisfying experience. The ones I drove were mostly subcompact to smaller sedans/coupes but I did have my favorite. This ranking is purely personal so don’t jump up fanboys.

1. Mini Cooper S 2D Hatchback

Mini Cooper S

Mini Cooper S

BEST CAR EVAR!!! Seriously it’s like a little rocket. I think Mini started to pick up its fame since BMW acquired it. The Mini Cooper S especially has the turbocharged engine that feels so good when u ram it up. I favor the hatchback with the moonroof compared to the convertible. Sounds kinda lame but going on the highway, the convertible top can become really loud and I do prefer K-pop to white noises so… The car has really good suspension and all, along with superb high mileage that makes it #1 for city car.

One stupid thing about this car is its iPod adapter doesn’t work with my iPhone 4… weird.

2. Mazda 3 Sedan

Mazda 3 Sedan

Mazda 3 Sedan

Mazda 3 makes a really good pleasure/casual car. It handles itself well but sorta lacks the kick that Mini Cooper S has. The car I drove was a semi-manual but the manual part was not very satisfying, due to the computer override. The dashboard design is decent with enough amenities to keep the fun going while I was traveling.

3. Honda Civic

Honda Civic

Honda Civic

Honda Civic has never failed to be 1 of the top consumer’s choices. I have to admit that Honda is 1 of the better car manufacturers out there that has been producing good reliable cars. The thing I don’t like about this car is its engine weakness. It literally took me a few seconds whenever I’m merging into the highway to rev up to speed. Its cruise control is decent and OK amenities.

4. Toyota Avalon

Toyota Avalon

Toyota Avalon

Toyota in general produces good cars but IMO its handle is terrible. I mean the wheel is so light I have to haul it all the way for the car to turn. Same with the accelerator and brake, I had to push it all the way for the car to start moving/stopping. The dashboard in the Avalon is surprisingly great actually, given it’s actually 1 of those higher-end cars. The Avalon has leather seats and wheel and everything, which kinda compensated for its bad performance.

5. Honda Insight Hybrid

Honda Insight

Honda Insight

As I’ve mentioned, I like Honda but this one is just plain annoying. It’s true that Hybrids in general get a superb MPG but Honda uses this Assisted Motor technology that basically turns off the engine everytime u stop… like every single time. It saves gas I get it but when I was on traffic it’s like “vrrroooom”, “fuffff”, “vrrroooom”, “fufff”… really? They made a change in their new CR-Z Sport Hybrid model that when ur on Sports mode, it doesn’t do that but it burns gas like nuts.

Anyways, I haven’t had a chance to try out the better ones that Zipcar offered like BMW and such but I will, eventually. If u guys are interested in cars try CNET Car Tech shows, it’s pretty good. Aight night time now and it’s blizzard outside, which reminds me of how lucky I am not to have a car, or not…

PC still can’t play Xbox games… WHYYY??

So it’s been a LOOOOONG time since I posted and honestly, I miss blogging. It’s pretty much the 1 motivation for me to keep up with technology (to brag about it on my blog, psh duh!! jk Smile with tongue out) while working in a company using technologies in the 70s.

Ok back to the main topic, the reasons were pretty obvious at least last year when Core i5 hasn’t come out and GTX 4 series didn’t exist. PCs weren’t strong enough to handle all those eye-candies that Xbox 360 has to offer, duh! But now that the technologies seem to be on par. I’m still wondering why this hasn’t happen.

GeForce GTX 460

GeForce GTX 460

If you don’t know the general specs of Xbox 360, it’s actually not that fancy: CPU is a custom IBM core with 3.2 clock speed having 3 cores on a single die. Each core can handle 2 threads so that makes pretty much 6 threads running consecutively. The GPU used to be pretty top notch, but not now as it’s a merely 500Mhz ATI Graphics Card with only 10Mb of embedded RAM. The system itself only has 512Mb of RAM.

Xbox 360

Xbox 360

Except the CPU, this spec is absolutely nothing compared to any decent gaming PC out there. But there’re a few things the Xbox is better at, actually MUCH better at.

  1. The custom ATI Graphics Card uses Unified Shader Architecture, which handles both Pixel Shaders and Vertex Shaders in the same pipeline. Now the card itself has 256-bit memory bandwidth which is pretty much the same as a mid-to-high end GeForce Graphics Card nowadays, yet handling 2 at 1 doubles the efficiency, which is pretty badass!! (I say “pretty” too much)
  2. Core i5 right now although uses 45nm technology with a whole bunch of other stuff, still technically can’t beat Xbox 360 core, mainly due to the dedication of architecture. Xbox core is clearly 100% for gaming and each thread is designed to handle either sound, physics engine, collision… depending on the game designer him/herself. Intel core i5 is strictly for multitasking and handling general instruction sets from the OS. Implementing the Intel HD Graphics in there doesn’t really help at all!!
  3. Although the ATI has only 10Mb of embedded RAM, its bandwidth is NASSSSTY!!! The same 256-bit in normal GPU was actually hardly optimized to its fullest potential, which comes back to point 2 (different design intentions)

Anyway this has been bugging me for a while so I gotta find out. BTW I’m using M$ Writer for the 1st time so we’ll see how that turns out. Aight have fun and keep on rolling guys!!!

Tagged ,

Music Digest strikes again!!!

Ok so my new job has been making me pretty stressed out and stuff that I hardly had time for myself but well, that’s when music kicks in as a pretty decent remedy these days. The next step would be getting a car so that I can blast my own music while driving (or cruising) to my company (which is like 15 minutes away, enough for a bit more than 3 songs). They have a similar channel to Q102 in Philly that I normally listened to, called Z104. I think it’s pretty much the same thing with different frequency. But here it goes, top 5 songs I ALWAYS blast when I wake up:

1. Ghost ‘n Stuff – deadmau5 ft. Rob Swire

This song is very likely to become my next ringtone. Awesome house-like beats and there’s a great choreography for this piece, created by dancers from Step Up 3D (if you google DanceStudio in youtube you’ll find it). The clip is weird though

2. History – Vassy ft. Gorilla Zoe

I had a hard time finding this song to download so I actually bought it from iTunes. I found this out pretty much because of the same reason as the 1st one, just youtubing around and dang… nice song

3. DJ Got Us Fallin’ In Love – Usher ft. Pitbull

This one has been around for a while but it actually sticks. Usher made a great comeback in this album, excluding that weird song Daddy’s home (like what??)

4. Teenage Dream – Katy Perry

Seriously, who doesn’t like Katy Perry!!! The weird thing is everytime I go to the gym and put my iPhone on shuffle, this song comes up quite frequently

5. Beautiful Hangover – Big Bang

Gotta give some credit to KPop, especially Big Bang. Take a shot if you haven’t tried it.

Ok peace out!!! GTG >.<

Tagged ,

iPhone 4 issues are myths!!!

Alright they’re not exactly myths, but not THAT many people experienced those problems. I guess the news just always try to criticize and sabotage pretty much any new consumer products that came out, iPhone being the worst out of them. But hey, I got myself and iPhone 4 and I didn’t get any death grip, yellow spot or anything like that. The experience is PHENOMENAL (I spelled it right, right?)

Anyway, iPhone 4 is mad fast, probably because I was using the iPhone 1st generation, which apparently could play ChaosRings at around 8fps. The iPhone 4 is just smooth with almost no lag. Facebook and Yahoo Messenger did crash on me once. The annoying thing about iPhone 4 is that now it actually doesn’t close any app. Pressing the Home button puts the app to sleep I guess, as I still saw it in the Multi-tasking interface. I’m myself a performance freak so I’m actually pretty concerned about this regarding the battery life of the product.

The retina display is off the hook, along with new camera. I took this picture with the phone’s camera and it turned out surprisingly good!!! Can’t wait for the FaceTime tryout thing with my friends 🙂

Coney Island through iPhone 4

Coney Island through iPhone 4

The battery life itself is pretty decent actually. I walked around SoHo using GPS and compass and it lasted me for almost the full day. I did dropped by Apple Store SoHo to sneakily charge the thing a bit but overall I’m pretty satisfied with the phone. I haven’t actually tried out the whole gyroscope thing (gyro = delicious lol, just FYI) cause I didn’t really know any app that utilized the feature 😛 Will definitely do in the future.

Alright now move on to the life story part, gosh I miss Hanoi soooooo much. Good things do come to an end and I guess I’m just not ready for it yet. I think I did go through the same feeling when I left high school cause Hanoi is so small, everybody lives in “walking” distances. I talked to a couple of my friends and there’re already gaps between us since I’m not physically there anymore. Anyway, once I move to Madison and establish my new life, hopefully this will be much better as I’m definitely pretty “sociable” and “co-dependent” I guess… gotta turn up that radio now!!! (I put radio on just to get background noise)

Kk guys I think I forgot to say have fun and keep on rolling last time but here it is!!! Kabooom baby!! Dang I sound kinda depressed.

Tagged ,

A month no blog!!!!

Sorry guys I was on vacation and so far this has been the best summer EVAR!!! I guess partially it’s because that I graduated from college (when my maturity shot off the sky) and got a job lined up in a month. I’m starting to forget how to blog lol since it’s been such a long time.

Anyway, I made a lot of new friends over the summer, most of whom are younger than me, a.k.a 9x generation. I actually had a lot of fun hanging out w/ them and our meetups are usually very high in energy. I felt like the 1st few days when I was back home, I missed the US the most. Most of my friends are there and I was in touch with them sooo frequently that I felt like “dang, shouldn’t have I stayed back instead?” 2 of my high school best friends weren’t home and as a result I wasn’t so satisfied with it.

However, I guess part of college maturity made me get my ass out there and start mingling, for real. I realized that I talked like an old man at first, with much conservatism and carefulness instead of the state of “che’m gio'”, which I got from kids I hung with. I admit that I sorta forgot the feeling of saying random stuff w/o caring, as part of becoming an adult is to take responsibilities in what I said. I still do though, so if I’m che’m gio’-ing w/ u, that means u’re one of my closer friends, whom I feel comfortable talking to and letting my guard down.

Anyway, here’s my awesome schedule:

  • Morning: having breakfast and coffee w/ friends
  • Afternoon: GTL!!!! Actually just gym, people got tan in Vietnam naturally by just going out
  • Night: Go out!!! Not really bars or clubs, but rather social gatherings, events or just pure conversations over some mediocre coffee (big fan of Muse Cafe btw!!!)
  • Later at night: chatting online with my friends, mostly in the US due to time difference. Everybody seems to be moving on alright and I’m so glad for that.

I also helped out with this conference called Vietabroader Conference and FINALLY made my face into the hottest TEEN magazine in Vietnam!!! I seriously read this for fun everyday (the magazine, not just the article) so I was definitely pumped.

Me on kenh14.vn

Me on kenh14.vn

Besides all the fun, I did got in some drama stuff over the summer… lol I guess it’s just life. Now that I’m back in the US, the fun is almost over. I’m visiting my best friend from high school in Boston this weekend, before getting ready for a completely new life in a completely new land… the Midwest!!!

Tagged , ,

iPhone 4?? Let’s wait for a bit

Hi guys, sorry it’s been a while since my last blog post. The Wifi in my house sucks as the previous one indicated so I was having a hard time browsing the Internet and Facebook in particular. I’m not going out tonight so I decided that I should update my awesome blog (hi-5 for awesomeness!!!)

Anyway, home has been great so far, but according to the Principle of Diminishing Return, I’m getting bored. I’m starting to miss the States and my friends there. Don’t get me wrong, I’m not turning into American or anything, just that it’s mad hot here and I have nothing to do since I’m clearly just chilling all day.

It’s been around a week and I think I’ve had way too much free time on my hands, so much that I looked up articles on gruesome beheading and cannibal incidents… complete waste of time. I’m trying to find Indian ingredients to cook some Masala (or is that Bangla?)

Well ok that aside, who’s excited for some iPhone 4 updates!!!! I know I’m not cause those updates are really bad. This is not the 1st time we’ve seen this. iPhone 4 has ISSUES!! Like some pretty severe ones. I believe this is pretty much due to the deadlines since WWDC has always been THE event that Apple does major releases and as we all know, rushing means poor testing and development. It turns out the be true cause iPhone 4 has been thoroughly tested by review parties and users.

1. Yellow dots on screen: If you recall the old old iPhone 2G, it actually had a similar issue called “dead strip”, which refers to an invisible strip on screen that doesn’t respond to touch. Yellow dot issue is not as bad, but it makes part of your screen yellowish and of course, nasty. Several reports claimed that you can get it replaced but this should have been tested.

Yellow bands and spots

2. Durability: Apple claimed that the new synthetic material is like 30 times harder than plastic, yet stress tests showed that it breaks after dropping from 1 foot just once. Again, YMMV (Your mileage may vary) since I’ve dropped my iPhone 2G so many time and it still kicks ass nowadays. However, this is still bad news. I really don’t want to buy insurance for my phone.

iPhone broken after 1-foot drop

3. SIGNAL!!! Ok this time it doesn’t sound like AT&T’s fault. Some users reported that if you hold the outer  case (the metal part, which is actually the antenna), your signal will drop. A user made a pretty convincing videos of going from 4 bars down to No Service just by holding the iPhone 4 (thus covering the antenna). If this is the case, iPhone 4 will have absolutely no case and you have to hold it differently (?!!). Not cool Apple.

Can't touch the iPhone

Aight guys that’s it for now 🙂 As much as I’m excited about getting one, I’ll really have to wait and reconsider until the cases are resolved and stability is guaranteed. Ok have fun and keep on rolling guys!!!

Tagged , ,

Home finally!!! Slow Internet though

I’M FINALLY HOME!!! Gosh that was some serious flight: 7 hours from JFK to Alaska, 10 hours from Alaska to Taipei and 3 more hours from Taipei to Hanoi and I was literally warmly welcomed by the mad heat of Hanoi. It’s constantly upper 90 degrees and it drove me insane -_-".

The 1st part wasn’t so bad since my flight was like 11:59P.M so I did sleep most of the time. I did prepare myself by buying "The girl with the dragoon tattoo", which I lost later (dang!) but that only kept me awake for like an hour or so. The plane was surprisingly empty so the seat next to me had nobody. Kudos for ticketing failure, China Airlines!!

The 2nd part was pretty much similar. One of the things I hate about China Airlines is the lack of entertainment. I mean it’s clearly a very long flight, yet the airplane didn’t have individual screen so instead we have a big projector with distorted colors. The food on the other hand of pretty good and service overall is ok. I ended up watching Family Outing all the way, well at least until my Macbook battery dies.

The last part I had a pretty suprisingly interesting conversation with a girl next to me, who happened to be studying Ph.D at UC Berkeley. She’s visiting Vietnam before going to China for an English teaching program. Her major is French Literature and she’s also a salsa dancer. That was a pretty pleasant 3-hr flight.

For some reasons I always feel different seeing foreigners in Vietnam, probably because there aren’t so many. People looked at me cause I was talking to an American and all… Besides all that, I totally burnt my Xbox 360 AC Adapter cause the electricity back home is 220v but come on! Everything else works, my Macbook, iPhone charger, even WD External Hard Drive. M$ should take a look at this.

Bonus, this is what I eat for lunch:

Bun Cua

Lol yeah guys, no need to envy cause I’m clearly enjoying the finest pleasure that my city can offer right there. The Wifi in my house is kinda unstable and no it’s not from our neighbor. I’ll try to blog as much as I can but no guarantee. Aight have fun and keep on rolling guys!!