Since I mostly use Hootsuite and Seesmic for reading my Twitter timeline (the other big reader, TweetDeck, won't connect to both Twitter and Facebook in either it's Chrome app or desktop versions), I've updated h8sq: the 4sq killer to work on those clients.

This also includes performance enhancements for the version.

Furthermore, if you open your Chrome Developer JavaScript console, you will see log messages for each hated on FourSquare tweet like so:

"hated on tomosaigon" 


Do you find Hootsuite's "Promoted Tweets" distracting?  I've also hacked together an ad blocker for Hootsuite.  Rather, it should be called an ad blacker, as it blacks out the ad but still makes it clear who is spamming you, and you can still read the full ad by mousing over it.

Install h8sq for Chrome

Install hootfree hootsuite ad blacker for Chrome

Are your comments getting through the spam filter?

Submitted by tomo on May 4, 2011 - 10:57pm

View from Bitexco Tower

Submitted by tomo on May 3, 2011 - 12:31am

From the top of Saigon's tallest building, the Bitexco Financial Tower. This is what the 200,000 VND ticket to reach the SkyDeck gets you. Y'all can thank me for saving you 200K! Click for higher resolution, and more photos from Mr. dEvEn.

From Saigon Skydeck with love

Drupal Views UI Filter Fields by Content Type

Submitted by tomo on April 21, 2011 - 4:18am

Late night hack:

You have a lot of fields in a lot of content types. You're creating a view with new display fields but it's a pain to find just the content type fields you want. Wouldn't it be cool if you could just select a content type from a pulldown and see content fields filtered to just the ones in that content type?

Add this bookmarklet to your bookmarks bar:
Views UI Filter

Read the rest of this article...

This is in response to a recent news article quoting an idiot Vietnamese-German "traffic expert" on a new traffic reduction proposal (read article).

Reducing traffic in Vietnam's big cities is as simple as this: limit private automobiles (cars), increase public transportation (busses and trains with grade separation). Focus on cars because:

  • Cars disproportionately increase traffic problems.
  • Compared to pedestrians, bicyclists, and motorbikes, they take up much more space per traveler.
  • They are bulky and less maneuverable, so they force everyone else to stop, slow down, be blocked, and block others.
  • Vietnam's roads are generally not wide enough for two cars to pass each other without causing traffic to slow down or stop.
  • Many roads and alleys are hardly wide enough for a car yet they are allowed to use them while blocking all other traffic.
  • Roads in Vietnam are constantly under construction which often means reduced width of lanes and more bottlenecks for cars.
  • While both bikes and cars often stop in intersections after the light turns red, a car jamming an intersection causes a much bigger traffic jam, because unlike bikes it's much harder to go around them. So one car blocking an intersection means other cars who now have the right of way can't move.
  • There is generally no parking for cars so they end up illegally parking on busy streets, reducing capacity, or they drive around idly increasing traffic.
  • Cars and bikes often use each others lanes illegally, but blockage caused by a car in a bike lane is much more severe.
  • Cars are a major culprit causing traffic jams wherever they are. The 500,000 cars in Saigon cause a lot of traffic congestion.

Clearly, taking one car off the road is more effective than many bikes for reducing traffic congestion. It's also a more equitable use of resources like land and fuel.

So-called traffic expert Nguyen Minh Dong says an odd-even license plate number scheme for keeping cars out of the city center every other day wouldn't work, mainly arguing about pollution and ignoring congestion. The problem at hand is congestion, and the corollary to his argument is that we should all buy cars in order to reduce pollution. Absurd.

Pollution would be better addressed by encouraging public transit, bicycles, walking, and affordable housing close to jobs.

But odd-even rationing has been tried many times before successfully. In nearby Guangzhou, an odd-even scheme kept 800,000 cars off the road over two months. While in other countries where cars are cheap it may make sense to buy a second car just to drive it on other days, cars are expensive here and incomes are much lower. It's ridiculous to assert that most would buy another car rather than use ways that almost all other Vietnamese take to travel, and it's ridiculous to say that an odd-even scheme would therefore not be effective.

The article argues that the "most important mission of transport police officers is to control traffic." I think that enforcing an odd-even scheme sounds a lot like controlling traffic. They then go on to argue that such a scheme "may cause" corruption. In Vietnam, enforcing any and all traffic rules causes corruption. Is that a reason to make it legal to run red lights?

There are many ways to reduce the number of cars. This reporter conveniently ignored all of them so I'll suggest a few.

  • We should restrict cars from roads that are too narrow for them and use physical barriers to stop them from entering.
  • We could make and keep roads one-way for cars but bidirectional for other traffic.
  • We can add tolls around the core.
  • We should add barriers to prevent cars from taking over bike lanes, while still making all lanes accessible to bikes.
  • We should also be considering London's congestion charging (with free routes through the city to discourage long avoidance routes) or Singapore's electronic road pricing.
  • We should NOT continue reducing fees for cars.
  • We should NOT be misled into thinking that building more highways leads to less congestion. We should learn that lesson from the US.

And finally, we should NOT just sit around and do nothing. Market forces will mean increasing car ownership in Vietnam for an infrastructure that is overloaded by them as it is. I haven't even begun to address the taxi and busses impact on traffic! That will be a future post...

Every few months, I've had remote OpenBSD servers die mysteriously, without any visible console messages, and still responding to pings, although higher level networking (http, ssh) are unresponsive. The crontab I setup to dump output from top (or systat) also stops. But before the kernel failure load was low and swap was unused.

After rebooting and checking dmesg, I see before the most recent reboot:

uvm_mapent_alloc: out of static map entries

Doing some research, it seems like it could be a problem with kmem_map fragmentation, possibly from long-running processes (like apache, which is being used more heavily now). The problem appears to have been fixed in recent releases of OpenBSD which dynamically increase kmem, but upgrading the server right now isn't feasible.

So the solution is to compile a custom kernel with an increased MAX_KMAPENT added to GENERIC config:

Read the rest of this article...

Using Nokia's PC Suite, one can export SMS messages from one's phone (maybe only their smartphones with USB). The format is CSV but the output is basically unreadable due to PC Suite bugs. Only a phone number is exported per message, no contact name. But more importantly, the CSV output is broken -- double quotes aren't properly escaped.

I think it's useful to be able to browse old messages online, say in a Google spreadsheet. But to do that, we need to rewrite PC Suite's output a bit.

[I didn't know anything about scripting Excel (or Google's spreadsheet which is basically Excel) but I did want to look up some old messages because I couldn't remember somebody's birthday. After importing messages from a year ago to Google docs, I could read messages between my friend and I around that day to find out exactly.]

Read the rest of this article...

Drupal Add Comment Form Above Comments

Submitted by tomo on March 24, 2011 - 12:57am

Drupal 6 allows you to either display the comment form below saved comments or on a separate page. There's surprisingly no way to configure the form to appear above the comments. It's hard-coded at the bottom of comment_render to either append the form, or not at all.

There's a micro-module aptly titled 'Comment form above comments' which does the job but does so using string replaces on resulting html so it's not the ideal or elegant solution.

It turns out to be simple to get the same effect in code.

First, we need to "configure" the form to appear on a separate page, but only because we're going to manually show it. You can ensure this configuration with the line:

variable_set('comment_form_location_'.$node->type, COMMENT_FORM_SEPARATE_PAGE);

You could even variable_get and re-variable_set after printing the form if you really wanted to.

Next, output the following where you want to display comments, whether in a PHP code block or node template:

$edit = array('nid' => $node->nid);
print comment_form_box($edit) . comment_render($node);

Another recent discovery was that the comment form is hard-coded to redirect to /node after submitting. This hack, as a module, will get you back to the page you submitted from:

function noredirect_comment_form_submit(&$form, &$form_state) {
    $form_state['redirect'] = ltrim($form['#action'], '/');

function noredirect_form_alter(&$form, $form_state, $form_id) {
    if ($form_id == 'comment_form') {
       $form['#action'] = request_uri();
        $form['#submit'][] = 'noredirect_comment_form_submit';

Improved Google Spam Filter?

Submitted by tomo on February 26, 2011 - 10:08pm

Google, in response to the flood of recent concern about spam/content farms showing up in their results, have just announced a big change in their system of algorithms which calculate page rankings. They had previously published a Chrome plugin that lets you manually block results, and Google says the new algorithm blocks some 84% of the same sites that people were blocking with the plugin. I guess some people were controversially blocking non-spammy sites, rather than guess that Google's algorithm isn't good enough. Or isn't it?

Matt Cutts, the main anti-spam guy at Google, says the new algorithm change affects 11.8% of queries. Since the change is only effective in the US right now and I can browse from both Vietnam and the US, we can compare results and some one in eight queries should be improved.

So I tested "dog shampoo" out of the blue. I have never had a dog because I think they smell.

In Vietnam, high ranking results included which had a low quality page of filler about dog shampoo and which is clearly a made-for-adsense site. In the US, the drnaturalvet link is much lower, but maintains the same high position. A link to content farm is also lower now. And a link to, a made-for-adsense site with nothing about dog shampoo at the time of indexing (see cache) is now gone too.

A search for winrar came up with fairly similar results in either country, and both maintained links to spam sites like

A search for "tightvnc server authentication successful closed connection" punished duplicate content site slightly but another duplicate/copy site maintained its position in the top 20. Both copy the StackExchange site

So it seems that the new algorithm change is an improvement, but I don't think it goes far enough to filter spammy results. While it may be a slight setback for those guys, they are still in the running and will be emboldened to try to rank higher.

There may still be a need for users to crowdsource a database of filtered spam sites until further algorithm improvements.

Note: The Atlantic did a similar test from India on "is botox safe" and "drywall dust" and found their results to be much improved.

After months of disparity between the official Vietnam dong/US dollar exchange rate and the rate commanded by the black market, the State Bank of Vietnam has weakened the local currency to a range surrounding 20693. This is the fourth decrease in 15 months, the sixth in two years. The move by the central bank came expectedly as there had been great pressure to devalue in the months leading up to Tet with a promise from the government not to do so before Tet.

This won't be the last devaluation for 2011.

For one, the new rate is still below the 21000+ the black market had been demanding before the change. Previously, the dollar would fetch up to 21300 VND at jewelry shops.

Secondly, the pressure on the dong due to rising inflation and the trade deficit remains -- and foreign currency reserves are still low, limiting how much the central bank can artificially support the currency. Inflation remains in the double-digit range after a lull from the global economic crisis and crash in oil prices. Gasoline prices will either continue to increase, contributing to imported inflation, or the government will continue to deplete its reserves to subsidize gas. The trade deficit, still high although there are signs of it lowering, is also dependent on now officially higher import prices as most manufactured exports rely heavily on imported materials. However, high prices will also discourage imports. High inflation will force rises in wages, making manufacturing in Vietnam less competitive, and adding to pressure to weaken the dong to make exports cheaper especially in a stalling glocal economic growth situation.

Economic consultant Bui Kien Thanh predicts a CPI increase of 0.15% for every 1% drop in the value of the dong, or a 1.4% increase in the CPI due to just the latest dong drop.

Third, Vietnamese people still lack confidence in their local currency and no plan has been announced to address any of these issues or for delaying further devaluations for any time. After a period of dollar scarcity it's now possible again to buy dollars from banks. Concerned about rising inflation and expecting continued high inflation, Vietnamese will continue to rely on assets they view as inflation hedges such as gold, real estate, and the dollar. These large one-off devaluations do nothing to increase people's confidence in the dong and the focus appears to be on rapid economic growth rather than macroeconomic stability. The central bank has stated they will adjust the official rate more frequently and flexibly, which should increase confidence in the local currency.

As a fourth factor, 12-month non-deliverable forwards for the currency had been in the 21000-22000 range for the previous 12 months but have shot up to the 23700s as of February 11th when the new rate was announced. One interpretation is that the dong will remain steady for the next 12 months, but as this latest devaluation isn't baked into past future predictions another interpretation is for the dong to drop another 11% in value by this time next year. The 12-month non-deliverable forwards have not always accurately predicted when devaluations would occur and the size of that market is small, allowing a small number of traders to have a large impact on the price, but they have been an indicator.

So what steps should Vietnam take? I think primarily we need to stabilize inflation with the important side effect of increasing confidence in the dong even at the expense of faster short term growth. Part of inflation is based on worldwide oil prices out of Vietnam's control, but we can try to be less dependent on oil and shift some responsibility to the Vietnamese free market by reducing subsidies for transportation fuel and we should be developing public transportation. Luxury imports could be discouraged. As a nation highly susceptible to prices on imported goods we should encourage export industries that are less dependent on imports and particularly encourage lending to these sectors while otherwise raising interest rates relatively to cool down other parts of the economy. We should consider the increase in food prices such as rice, which we are actively exporting to other countries, and we should be cognizant of the renewed housing boom which is making housing more expensive for everyone.

Syndicate content
© 2010-2014 Saigonist.