tomo's blog

Sorting broken after upgrading Pligg

Submitted by tomo on January 6, 2011 - 7:36am

If, after upgrading from an old version of Pligg to 1.1.2, you notice that the front page is sorted completely backwards and you can't change the sorting even by fiddling with the sort-query code in index.php, it may be because of the new Groups feature. A new groups table has been added and all queries join this table but the Pligg upgrader only creates the table and sets the new link_group_id to 0 for all rows in links. The solution is to populate the groups table. An easy way is to head to groups/submit/ and create a generic catchall group. Then in your database, change the group_id for the newly created row in groups to 0 (if it's 1).

If the Pligg group submitter is broken (as Pligg is prone to be buggy) then just:
INSERT INTO groups (group_id) VALUES (1);

Now those queries like:

SELECT link_id FROM links LEFT JOIN groups ON links.link_group_id = groups.group_id WHERE link_status='published' AND (groups.group_privacy!='private' OR ISNULL(groups.group_privacy) OR groups.group_id IN(1)) GROUP BY link_id ORDER BY link_published_date DESC, link_date DESC LIMIT 0,10

will work again!

LifeHack: Abuse Tinyurl for Any Info

Submitted by tomo on January 5, 2011 - 9:08pm

Here's a trick for storing and compressing information in a pinch.

Let's say you have an address or a set of directions or maybe a shopping list.

Example: "Calle de la Magdalena N8, 5D Floor, Madrid, Spain 28012"

Stick it into http://bit.ly but prepend "http://" to the text, to make it look like a URL: "http://Calle de la Magdalena N8, 5D Floor, Madrid, Spain 28012 "

When we go to the resulting shortened URL http://bit.ly/dL9MXS we get an error, but Chrome displays back:
"Oops! Google Chrome could not find calle de la magdalena n8, 5d floor, madrid, spain 28012" and voila! we have the text we wanted.

All we have to write on our hands, remember, or pass around via text message is the string "dL9MXS". It takes less work than using a pastebin and the resulting URL is shorter anyways.

Any other practical uses for this trick? Leave a comment!

For some time now, ISPs in Vietnam have been blocking a small number of websites, particularly Facebook. Fortunately, the number of blocked sites was really small (in China hundreds of sites are blocked) and the method of blocking traffic to Facebook was very weak. The Vietnamese ISPs simply stopped returning DNS queries for the Facebook domain. So everyone soon figured out they could simply change their computer's DNS settings to use a non-blocking DNS server, such as Google's (8.8.8.8).

I'm hearing rumors now, while I'm traveling in Europe, that Vietnamese ISPs have really cracked down on access to Facebook and that the DNS trick no longer works.

So here are some more foolproof ways to get around the Facebook block in Vietnam which will also work for any website that is blocked in any country. For example, the Great Firewall of China blocks access to an ever-changing list of sites by more than just DNS. But these methods should work there too.

An added advantage is that you may also be able to access US sites that block all non-US computers like Hulu and certain YouTube videos.

1. Pay for VPN access outside of Vietnam. This is essentially what I do by renting a server in the US, but I only tunnel my web traffic over an ssh connection. If anyone wants a shell on my server for tunneling purposes (and not downloading porn) contact me.

Setting up SSH is a bit quirky so most people are better off with a true VPN solution.

One that comes recommended is StrongVPN. By going with them you'll get full support and they show you how to set it all up.

2. Install free but ad-supported Hotspot Shield

From their site:

Secure your web session, data, online shopping, and personal information online with HTTPS encryption.
Protect yourself from identity theft online.
Hide your IP address for your privacy online.
Access all content privately without censorship; bypass firewalls.
Protect yourself from snoopers at Wi-Fi hotspots, hotels, airports, corporate offices.

You may want to install ad blockers if you go this route. They will also track information about you to sell to advertisers.

3. Proxy servers.

Pick a proxy server from http://www.xroxy.com/ and set your browser to use it without needing to buy or install anything. You don't need to use a proxy server in Vietnam, in fact it's probably better not to.

In a pinch you can browse through a "CGI proxy" like http://12345proxy.com/ without having to set up anything.

Using a proxy server could slow down access to some websites, especially ones in Vietnam. You can install some browser add-ons so that you only go through a proxy for the sites that are blocked, like Facebook.

For Google Chrome:
Proxy Switchy: https://chrome.google.com/extensions/detail/caehdcpeofiiigpdhbabniblemipncjj

For FireFox:
FoxyProxy: https://addons.mozilla.org/en-US/firefox/addon/2464/

4. Just for watching videos on sites like Hulu, Amazon Video on Demand, Pandora, or YouTube, you can try http://www.usvideo.ca/ although it costs $5.25/month.

Drupal Administration Menu Missing Links

Submitted by tomo on December 7, 2010 - 5:30pm

Working on a Drupal site that's already half-way started, I noticed that after installing the admin_menu module many links I expected were missing, such as the refresh cache links and several content types under the Content Types menu.

First, I tried clearing out all caches manually via the Performance page.

Next, I tried truncating all cache tables in case cache_menu or another table was corrupted.

Still no go, so I tried disabling, uninstalling, and reinstalling the admin_menu module which should rebuild the admin_menu links in the menu router.

In the end it turned out to be a Wampserver problem as it (as well as Xampp) use PHP 5.3, which Drupal has a lot of problems with. PHP 5.3 has a change from earlier versions in that function declarations like:

function admin_menu_admin_menu(&$deleted)

no longer work. Normally, you'd see that in your error messages.

The solution is to remove the & before $deleted on line 107 in admin_menu.inc in the admin_menu module. This will also make the related PHP warnings go away.

Running 5.2 and 5.3 on one computer using XAMPP (on OSX) is easy by following these instructions: https://gist.github.com/1012774

Simple Way to Download YouTube HTML5 Videos

Submitted by tomo on November 24, 2010 - 3:52am

A lot of the existing YouTube video download scripts don't work today as YouTube have changed their "API" so those hacks no longer work. Programs that simple detect whatever media files get downloaded should still work.

Here's a dead simple way to download HTML5 videos from YouTube. Drag the following link to your bookmark bar. In Chrome, you have to set "Always show bookmark bar" for this to make sense.

Tubelet

Read the rest of this article...

4stalk: A Beneficial Location-Based Service

Submitted by tomo on November 20, 2010 - 3:05pm

Location-based services, FourSquare and its clones are everywhere. China (where I guess 4sq is blocked anyways) has already produced a number of 4sq clones. I know of at least two 4sq clones or location-based services operating in Vietnam (shout out to friends at go100). And earlier this year Koprol, an Indonesian FourSquare-ish LBS was acquired by Yahoo.

But the number of stores and restaurants offering actual benefits to users repeatedly checking in... is less than the number of competing websites where you can check-in to them.

Read the rest of this article...

Future For Foursquare

Submitted by tomo on November 14, 2010 - 1:26pm

Foursquare is a way for people to advertise to advertisers, Twitter "friends", and everyone else the fact that you're willing to be advertised to. That is, you spam to be spammed. It's basically awesome for marketers.

Read the rest of this article...

h8sq: The 4sq Killer for Twitter

Submitted by tomo on October 10, 2010 - 10:22pm

Tired of Foursquare, Inc. spamming your Twitter? Could you care less that someone goes somewhere so often they become its "mayor"?

Take back your Twitter feed with h8sq, a plugin/extension for the Google Chrome
browser which will:

Remove annoying tweets like "I'm at McDonalds. http://4sq.com/stupid
Remove annoying tweets like "I just became the mayor of McDonalds! http://4sq.com/stupid"
Remove annoying tweets like "I just unlocked the Douche badge! http://4sq.com/stupid"
Remove annoying tweets like "I just ousted So-and-so ..." (new)

It will leave alone tweets that have been personalized or merely mention 4sq.

If you run chrome just install the attached script, which should also work with Opera and with Firefox via Greasemonkey.

Install h8sq for Chrome (and maybe other browsers)

UPDATE: Now works on Twitter.com, Seesmic.com, and Hootsuite.com!

Paying with a tweet

Submitted by tomo on October 7, 2010 - 3:16am

I've been thinking about this idea of "pay with a tweet" where you can buy a product, say an ebook, mp3, or module, not what cash but with a tweet, or a Facebook "like". If a successful you end up with great free word-of-mouth marketing.

It could be used on the Detroit Institute of Techno to give access to special DJ sets, or on Needanym.com to create naming projects or as a reward for a contest winner.

There's a website that makes it easy for everyone (http://www.paywithatweet.com) but the concept is simple enough that any web developer could implement it. All you need is a special URL that links to whatever digital media you're "selling" and a Twitter/oath or Facebook app that tweets/likes from the buyers account, or some way to verify that the buyer has spread the word.

So maybe this will spread to other social bookmarking sites and social news sites. A Web startup could exchange access to their site for a vote on Hacker News, for example.

I think it's a great idea. Maybe a good candidate for a Drupal module?

Read the rest of this article...

UPDATE April 29, 2012! If you have a question about moving to Vietnam, working in Vietnam, or otherwise related to being a Vietnamese expat, please write your question on the forum instead.

UPDATE July 17, 2012! Follow-up article Finding affordable housing in Vietnam - How much should it cost? has been posted
---

So there's been a lot of chatter in the Saigon twitter community lately about the average income of Ho Chi Minh City and whether $600/month can get you a decent middle-class lifestyle here.

This is what it costs to live in Saigon, Vietnam's (and all of French Indochina's) largest, busiest city and commercial center:

Read the rest of this article...
Syndicate content
© 2010-2014 Saigonist.