tomo's blog

Daily Twitter Posts - 12/09/2011 - 12/16/2011

Submitted by tomo on December 16, 2011 - 12:45pm

12/15 04:07 @jon7b Discouraged but allowed. We could also just all pay for our own lunches, etc. but it's actually just a small part of the budget. #
12/15 03:47 @MienHPham Last night I was blown away by a girl waxing nostalgic about a counterculture in one country arising from war in her home country #
12/15 02:37 @TylerWatts @caligarn @barcampsaigon Actually @dynamicscholar was planning one in conjunction w/ BarCamp, then our plans faltered. Restart? #
12/15 00:35 Introspecting #barcampsaigon Winter 2011. Barcamping is easy and 3 other ideas: #
12/14 01:28 @caligarn Yes. I'm reporting you -right now- #
12/14 01:25 @saigonsean I am against waterboarding because it isn't considered torture. Prefer more recognized forms, like Vietnamese @home karaoke #
12/14 00:32 @saigonsean Twitter (or a 3rd party) could warn you before you tweeted about keywords that would attract spammers... or just kill spammers #
12/14 00:02 @natalie470 @caligarn @Vietnam720 Don't worry. Soon spammers will discover you and you will get a new spam follower every day! #
12/13 23:45 @fisheggtree An idea.. create a forum for posting crowdsourced translations of deserving Vietnamese news articles (and vice versa) #
12/13 23:39 What's wrong with an SUV honking at a wheelchair to get out of the way? #
12/13 01:46 In hindsight, my favorite part of #BarCampSaigon was hundreds of people QUEUEING to register #
12/12 09:36 Swoon. RT @barijoe: My wife knows the difference between a Klingon Bird Of Prey and a Romulan Warbird #
12/10 18:24 Heading to RMIT for #BarCampSaigon on this crispy morning #
12/10 04:29 Late Reminder: #BarCampSaigon preparty at 90 Bui Vien, D1 tonight. All are welcome. I'm there from 7pm. #
12/10 03:11 We need a stamp to stamp lunch vouchers for BarCamp. anyone have one to lend? #
12/09 12:25 Not actually a headline from The Onio: 'California Cuts Budget Transparency Website From Budget' #
12/09 12:15 Law enforcement via example,right model for VN? RT @tuoitrenewsvn: China sentences woman to death in tainted milk case #
12/09 03:59 Something like 2.5 days without a proper cigarette. I might yell at you. #

Barcamping is easy and 3 other ideas

Submitted by tomo on December 15, 2011 - 12:32pm

BarCampSaigon Winter 2011 was a success by most measures, comparable to the previous one. There were a lot of registrations, a lot of attendees, and a lot of sessions. We fed, clothed, and caffeinated hundreds of people and found sponsors willing to pay for it all. We didn't lose money (making money isn't possible, but losing money is). Yet something about it has been bothering me since last Sunday.

Barcamping is easy; Easy to attend; Even easy to organize.

Yes, it can be easy to organize a BarCamp. But, I think, it's really difficult to organize BarCamps (plural).

For one, most people who like the idea of organizing a BarCamp like the idea exactly once. It's hard to keep the fire going. The first BarCamp Saigon flame nearly died out - some embers turned into a second generation. But BarCamp Hanoi's flame has already disappeared. These are unrecognized failures.

The problem, as I see it, is that this BarCamp didn't necessarily ensure that another BarCamp would happen, and I think just continued to fuel the myth among people that BarCamps will happen magically and automatically, that they will get a free meal and t-shirt again. After some thought, these three distillations occurred to me:

1. barcamp should beget barcamp.
2. barcamp should be the beginning - not the end.
3. barcamp should be the exception - not the rule.

So let me explain.

1. BarCampSaigon should be the genesis of the next BarCampSaigon, and also BarCamps in other Vietnamese cities - BarCampCanTho, BarCampDaNang, BarCampDaLat. People should understand what a BarCamp is enough to organize simple ones in their hometowns, and do it without worrying about significant funding or caring how many people will show up. Clothing and caffeination optional.

2. Things should start at BarCamp. Ideas should be formed and relationships forged out of discussions among people who should have been meeting more regularly but hadn't. It shouldn't be a place to launch or announce your finished product, although if you started from a previous BarCamp that would be thrilling news. Sessions should not just lead to greater understanding, but cause new questions and avenues of inquiry to be developed.

3. BarCamp is the unconference. But it's also become the premier tech conference in Saigon. I think there should be large tech conferences here covering the major topics that are presented on at BarCampSaigon. And BarCampSaigon should be the place for importing new foreign and emerging ideas, which should then one day get full conferences of their own, so that BCSG can be a platform for further more ideas which need sharing.

These three goals aren't officially BarCamp's raison d'etre, nor are they the only important ingredients in a BarCamp. The meat of the camp does matter: the number and quality of sessions and people leading them so that people buzz about the next BarCamp; food and coffee and beer to get people to sit down communally; design of t-shirts and other assets to make the event come off professional; and convincing sponsors to make it all happen. I would like to have more thoughts about how those ingredients can coincide with the above three ideas.

StartupWeekend Ho Chi Minh

Submitted by tomo on December 3, 2011 - 4:13am

UPDATE: Startup Weekend Ho Chi Minh City 2012 is happening this weekend, starting tonight (Friday September 14) and commencing on Sunday the 16th. The "hacking" venue is The START Center For Entrepreneurs on Nguyen Thi Minh Khai, and final presentations and judging will be at Intercontinental Hotel. This year again I'll be a coach/mentor for the aspiring young entrepreneurs.

If you missed it, a few weeks ago the global Startup Weekend competition came to Ho Chi Minh City (which we all know is Saigon). There have been a number of such startup idea pitching competitions in both Saigon and Hanoi recently. I was able to take part in StartupWeekend here in the capacity of a mentor. This meant I could walk around to each team while they were working on their ideas and give suggestions. Suggestions were not so much about the core idea, which was already set, or how to legally incorporate, which was too early, but how to strengthen the business case for the idea, improve implementation, create a better presentation (presentation is seriously important), and suggest alternative markets and competitors which they may not have been aware of.

The event takes place over 54 hours (a weekend starting from Friday night) in which first ideas are pitched, then filtered into the most popular ones. In the end there were about a dozen ideas which the initiators could then gather team members from those whose ideas weren't chosen or came just to join a team.

In the end, these teams gave presentations before a live audience (including representatives from the media). I didn't see much coverage of the actual pitches of the event so I'd like to record them here.

Read the rest of this article...

This post comes out of a conversation I had with my friend Prithvi, who has years of experience in the outsourcing industry both here and in China and other countries.

Outsourcing is a huge industry here in Vietnam. It solves several problems for Vietnam. First, it brings in much needed income. Second, it does so without requiring a high ratio of expensive imported inputs (compare this to making shoes which are exported for a cheap price, but most of the costs come from materials which must be imported). Third, it helps advance domestic use of technology, which should make all industries more efficient.

Read the rest of this article...

Daily Twitter Posts - 11/25/2011 - 12/02/2011

Submitted by tomo on December 2, 2011 - 12:45pm

12/01 04:32 @tamkaizen Didn't know you were a fan of Cleveland thugs haha #
11/30 10:43 'Like', retweet is a crime RT @RichardBarrow: Foreign Tourists warned they could be arrested for lese majeste #
11/29 01:26 @barijoe Any new Miyazaki film would be good. I always thought Nausicaa was already an allegory to the awesome power of splitting atoms #
11/28 07:26 Ken Schwaber is going over scrum with us over Skype. Pretty cool! #
11/28 02:45 @saigonnezumi What exactly are we doing? Volunteering to organize an event that benefits the local community? Shame on us. #
11/28 02:42 @playingwithsid If @barcampSaigon became Mozilla Reps, there would be outrage in the Twitter community for siding with one browser :) #
11/28 02:34 @saigonnezumi All of a sudden you're throwing out accusations that simply aren't true. Half of organizers came from open request at last BC #
11/27 07:36 @exposilver Thanks for the tip. Ended up at a no-name place near me called Kim Thuy and got it replaced for a good price, $36 #
11/27 03:51 Tricky people. Putting salt in the salt shaker leaving me with a handful of salt. #onlyinvietnam #
11/26 06:51 A few days late and sans turkey, still thankful to be celebrating #
11/25 04:47 Any shops in Saigon that fix Macbook Pro power adapters/cables? Regular shops on NTMK now only replace - for over 2 million! #

Daily Twitter Posts - 11/18/2011 - 11/25/2011

Submitted by tomo on November 25, 2011 - 12:45pm

11/24 04:41 Waiting for this. RT @barijoe: Paramount's 'Star Trek' Sequel to Open May 17, 2013 #
11/23 03:03 RT @AsCorrespondent: Bombs defused near Philippine massacre site on 2nd anniversity of atrocity. Tensions high. #
11/22 02:08 @caligarn Both China and Japan want to create SEA rail infrastructure. But this is freight rail. Japan wants to build passenger w/in VN #
11/22 02:03 @caligarn @hendrikbeck Let's resume world domination talks. Tomorrow or Friday. #

Drupal Views hook_views_query_substitutions

Submitted by tomo on November 19, 2011 - 12:48am

Drupal's Views module has a lot of hooks that can be used to modify the behavior of a hook, from building the query to putting together the output. Hooks are also used by modules which want to add to the Views building interface, even the basic node-based Views.

Views supports a number of hooks which aren't documented. One I came across recently was hook_views_query_substitutions. This is potentially a powerful hook, one which the module Views arguments in filters (currently a sandbox module only for developers) takes advantage of to allow filter value substitution from the Views UI.

Hook hook_views_query_substitutions is pretty basic. By implementing the hook, you return an array of values you want to substitute with the keys you want to substitute for. This is how the magic values like ***ADMINISTER_NODES*** which you see in the Views query preview get turned into valid SQL.

For example:

function user_views_query_substitutions($view) {
  global $user;
  return array('***CURRENT_USER***' => intval($user->uid));

After this hook is called, Views will then run str_replace with the keys of the substitutions array and its values and apply it to the breadcrumb, title, and views arguments, as well as the query string that has been built so far.

Hook hook_views_query_substitutions gets called in the execute() call of Views. The first thing execute() does is build(), which you can hook into with hook_views_pre_build, hook_views_query_alter, and views_post_build (in that order), then you can hook into hook_views_pre_execute and hook_views_post_execute (the latter happens after the views query is executed and shows an unsubstituted query, there is no hook where one can see the substituted query). You also have a chance to hook into the db_rewrite_sql call.

Module "Views arguments in filters" is pretty basic and only allows substitution in filters which allow you to enter open text (so that you can set a value like '%1'). But by doing something similar, we can use a string passed in as a Null argument to command a Drupal module to do even more, like string substitution on any part of the query. I have a module in development now that does exactly that.

Daily Twitter Posts - 11/11/2011 - 11/18/2011

Submitted by tomo on November 18, 2011 - 12:45pm

11/17 10:47 66% of Chinese use their smartphones at home and 59% while traveling #
11/16 06:07 @jobnomade There is a slight chance Dries will come here for the next FOSSASIA! Wanna check out Drupal community in India. Yes to DrupalCamp #
11/16 05:26 @saigonnezumi @jkthng I've long thought about having a mini DrupalCamp at BarCampSaigon, but need to focus on just BC now. FOSSAsia too. #
11/14 09:15 @Vietnam720 I mean thanks BEN :-) #
11/14 09:15 @Vietnam720 Haha! Thanks Be :-) #
11/14 08:28 @caligarn Honestly, I thought you did a fine job emceeing in Vietnamese. Better than my emceeing at a wedding on Saturday in English! #
11/14 05:56 @caligarn Why didn't you join a team with a good idea and MC their presentation? #
11/14 03:33 Not opposed to this in areas: As of 11 December 2008, every street corner in Johannesburg central is under high-tech CCTV surveillance #
11/14 03:24 @saigonnezumi Yes, we have Boost with Drupal. What are you doing? #
11/14 03:23 I'd like to thank this past weekend's sponsor, Ibuprofen, for making it bearable #
11/14 00:58 @saigonnezumi Yes, I run Drupal on OpenBSD and various Linux (and OSX), Apache, and Nginx. Why? #
11/14 00:57 Simple but interesting idea from Hacka2thon: all upcoming local events (or perhaps sales?) on a map: (test with 48104) #
11/13 04:15 RIP My yellow parakeet. Even after being rescued, you were never a very cheerful one. #
11/13 03:32 @ericburdette Was in Can Tho for a wedding. Nice that it only takes 3 hours to get there! #
11/11 06:07 I think most of Can Tho City is under water right now. Traffic jams everywhere #

Find Friends of a Friend on Facebook

Submitted by tomo on November 18, 2011 - 1:08am

Today I was playing around with Facebook's where you can test out their API.

First, you may want to logout of Facebook using the button there and log back in in order to get the "FB.login callback" Log message on the sidebar. Inside that, you'll see something like:

   "authResponse": {
      "accessToken": "AAAAAKvQdWksBAG8yLhVwqWyvgF2uu2eUahBQTZCPD5y2ilo2qZBbyjJ3DJRXDn4UONrVqAK28ZCSlouAtvdbxCc0ZAzQ0e8VbZBZCsdHmzUQZDZD",
      "userID": "12463924",
      "expiresIn": 5200,
      "signedRequest": "_ltfzUYHjPHyFZH6JnlbzVa-oejnPTud9aHK24eIWOc.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUUR2WU4tcTk4cW04X2xwbkg0LVU4Rk9YMUoxYVBmOUNMQkJPeEhlSGowQUZ3a2V6akRNWDlPNGExbkhkREZxT2laQVhWZW50aDRfd19EUk5uWm95NFlDYXFqWktweDZ1MDA5U2Fkc2hSUjQtWUdfUi05S21zY3F5RXlPTC1zbGRaVHBqZkRZS0lvdzFxYnJ2SjJteWxXYkd1dWFhY1h6U1FUWW8tc1V2Rm1oTU5fLV9xZzNxOXRadHJTSi1WdFRpUWciLCJpc3N1ZWRfYXQiOjEzMjE1NDc2MDAsInVzZXJfaWQiOiIxMjQ2MzkyNCJ9"
   "status": "connected"

You should copy the accessToken in order to do further testing which requires a token. Most of the new API calls can be tested right in your browser. For example:

That searches my account for users with the name 'Tomo', while using my token to authenticate. The token doesn't last very long and has definitely expired by the time you read this.

Now plug this code into the textarea.

<div id="profile_pics">
Profile pics here

// From an example

var profilePicsDiv = document.getElementById('profile_pics');
FB.getLoginStatus(function(response) {
  if (response.status != 'connected') {
    profilePicsDiv.innerHTML = '<em>You are not connected</em>';

// JSON output from
var people = {
   "data": [
         "name": "Tomo Coffee",
         "id": "100001851101897"
         "name": "Tomo Kiku",
         "id": "626405318"
         "name": "Tomomi Shiho",
         "id": "1755956208"
         "name": "Tomoman Bkk",
         "id": "1674446551"
         "name": "Tomori Moore",
         "id": "511540368"
         "name": "Tomomi Takihara",
         "id": "100001600551550"
         "name": "Tomohiro Morinaga",
         "id": "713242010"
         "name": "Onda Tomoyuki",
         "id": "100001455563427"
         "name": "Tomoko Okawara",
         "id": "100001514576923"
         "name": "Tomonari Kino",
         "id": "804330331"
   "paging": {
      "next": ""

var searchid = '1218273364';
var markup = '';

function genfn(i) {
    var fn = function(result) {
        //console.log(i); console.log(result); 
        for (var j = 0; j < result.length; j++) {
            if (result[j] == searchid) {
      'foaf search match',[i]);
                markup = (
                  '<fb:profile-pic size="square" ' +
                          'uid="' +[i].id + '" ' +
                          'facebook-logo="true"' +
                var profilePicsDiv = document.getElementById('profile_pics');
                profilePicsDiv.innerHTML += markup;
    return fn;

for (var i = 0; i <; i++) {
    person =[i];
    FB.api({method: 'friends.getMutualFriends', target_uid :}, genfn(i));



As you can see, I prefetched the results from searching "Tomo" and I set the id of a friend whose "Tomo" friends I wanted to find. This searches the results and filters for people who have the mutual friend 1218273364.

To go further, one should have controls for choosing the search term, automatically fetch search results and page through them to find more results, and have a control for choosing the mutual friend. This will allow you to search for mutual friends even if you don't have permission to view a friend's friends. Turning this into an app or Chrome extension is left as an exercise to the reader. :)

Daily Twitter Posts - 11/04/2011 - 11/11/2011

Submitted by tomo on November 11, 2011 - 12:45pm

11/09 03:38 @shilkytouch I still haven't been able to figure out if Vietnamese play by Japanese Go rules, or possibly Chinese. #
11/09 00:52 Links fixed: Our entry and experience competing at Saigon MobileDevCamp 2011: #
11/08 23:36 @jon7b Thanks for the heads up. 'Click to expand' should now be working. :) #
11/08 21:45 Our entry and experience competing at Saigon MobileDevCamp 2011: #
11/06 03:55 @ChristophK2003 Still at the camp but it's taking a really long time to judge each submission. A lot of groups competing. #
11/06 03:52 TIL that the game Go in Vietnamese is 'Co vay'. They have a club that plays at Bach Khoa University. #
11/05 11:26 Hosting my team for Saigon MobileDevCamp hackathon tonight at my house, hoping to have an app running by noon. Social, Mobile, Local. #
11/04 23:23 At Bach Khoa University for MobileDevCamp #
11/04 03:23 @dynamicscholar Haha, those were direct quotes from @tuoitrenews and still not sure if it was subtle, yet deliberate Engrish. #
11/04 03:03 @dynamicscholar Vietnamese people prefer fat, older dong, which is not so bad once you peel back the skin and wash off the fishy smell #
11/04 03:00 So who thinks there will be a Steve Jobs movie next year? #

Syndicate content
© 2010-2014 Saigonist.