The Frontier Closed Area

Recenty, I have added one more check mark to my bucket list — which is not publishable, for there’s stuff that some people may disapprove of :-) BUT. One thing that the HK government would disapprove of is the fact that yesterday I went to the Frontier Closed Area without a permit. And without swimming either…

The Frontier Closed Area is a strip of land in HK, along the border with Shenzhen, which is closed off to regular folks. Only residents and farmers, along with people with a “legitimate” reason to go (like people working in the border duty free shops, the MTR station, etc; families of residents; etc etc), are allowed to go. The trains station in Lowu and Lok Ma Chau, for instance, are inside the FCA. In Lowu, you can see stairs going down, right after the exit from the MTR, with cops guarding access to it. These stairs go to the Lowu area of the FCA.

If you have family inside the FCA, you might be able to get a permit, to visit your relatives. In the Sheung Shui Police Station, in Fanling, you can apply for a temporary permit, and some tourists may even get one, if someone in the village you want to visit signs the application for you. Good luck with that though. The FCA has been getting slimmer and slimmer, and many Hongkies would love to buy real estate there for it’s cheap and bound to rise in value when the FCA gets further reduced. So the government tries to keep influx of newcomers down…

Yesterday I went to have dinner with some mates. We were supposed to go to a friend’s in Taipo. Nopesies. Dude asks us to come to Sheung Shui, and he’d pick us up. He’s a very laconic dude and he just said “We’ll have dinner at my parents’ place.” Ok Sir, thanks.

I check out the road we’re driving on, it’s going north. “Dude, looks like we’re in the FCA! That’s what the sign says! Don’t we need a permit?”. Just then he takes a quick right, up a hill, and down an unpaved path. “Yes. My house is near the river. We’re taking a shortcut.” And by shortcut he meant a smuggler’s detour in and out of the FCA. Apparently, 30 years ago, Chinese people walked across the river around there, went uphill and downhill to Sheung Shui. And the locals apparently still use this path to bring in guests without the inconvenience of applying for a permit.

We had a great dinner, and walked around the place. So quiet. A few hundred meters away the “civilization” of Shenzhen. Dozens of cats running around. A big dog that barked a lot, but offered its paw as soon as you approached it. Guard dog my ass.

We left the way we came. Didn’t see a checkpoint, a cop or anything. I felt like a righteous bandit… :-)

Aside
a=document.getElementsByClassName('js-display-url'); j=a.length; for(x in a){ b=a[x]; if (b.parentElement!=undefined) { c=b.innerText; b.parentElement.href="http://"+b.innerText } }

Drawing images on an Esplora

Arduino micro-controllers have so little Flash memory and RAM that working with them after coding for so many years on computers with more RAM than we need (innit Bill?), I feel a little cramped. And considering that in an Arduino Uno or clone you have 28KB RAM and 2KB RAM, doing anything that involves graphics on the Esplora (which has a TFT screen with an SD card slot), is going to be an impossible task.

ImageArduino’s TFTBitmapLogo tutorial uses a 48×48 BMP image that’s less than 7KB and once loaded is probably right within the RAM’s 2KB limit. But try to load any image that’s bigger than that and you’re up a tree scratching your balls with acacia bark. I know how it feels because I tried. To load a bigger image, I mean. No go.

ImageI found this sprite file “somewhere on the intartubes’ — I didn’t even try to remember where :-) — and started slicing the different sprites of Mario into separate files. They were way too big, despite their microscopic size, to be loaded with .loadImage(). So I wondered how hard it’d be to hard-code the images as Arduino code. Each image has a green background — which means you don’t need  to draw these pixels.

ImageUsing Real Studio, which changed name recently to the (ill-suited in my opinion) Xojo, I wrote a small app that writes code for me. It’s basically a bunch of Esplora-specific primitives, EsploraTFT.drawPixel(), drawing the image, pixel by pixel, line by line. This worked, and I was able to write a sketch displaying Mario anywhere I wanted on the screen. But I still ran into Flash memory issues, as the code was too long to host all the images required to make Mario run, crouch and jump.

ImageLooking at the code I noticed that adjacent pixels drawn in the same colour could be drawn with on line of code with EsploraTFT.drawLine(). The first round of dieting worked, and Mario was happily bouncing around on the screen. I even had space for a tree. Zoowie. Then, with the help of a nifty little regex, I was able to squeeze a few more bytes out of the code. I noticed that in a few cases, I had two EsploraTFT.drawLine() primitives in the same colour around other drawing code in a different colour. So if I combined the two function calls in one, and then drew the pixels in between, I could save some memory. For the record the regex is:

EsploraTFT\.drawLine\((x\+\d+), (y\+\d+), (x\+\d+), \2, (\d+)\);\rEsploraTFT.draw.+\rEsploraTFT\.drawLine\((x\+\d+), \2, (x\+\d+), \2, \4\);\r

to:

EsploraTFT.drawLine(\1, \2, \7, \2, \4);\r\5

Using slimmed-down versions of the standard libraries (Esplora, SD, TFT), I reached just under 24K, leaving me some tiny space to code the beginnings of a game. Not much left though…

Binary sketch size: 23,966 bytes (of a 28,672 byte maximum)

“You can not opt out of t.co”

I just did, though… t.co is Twitter’s way of checking on what links you post — and keeping stats, tabs on you and your neighbours, etc. Which I don’t really like. And when the posted link comes from a link shortener, it bounces all over the web before being displayed. So I decided I’d opt out of t.co. Even if Twitter doesn’t offer me this option.

javascript:a=document.getElementsByClassName('twitter-timeline-link');j=a.length;for(x=0;x<j;x++){b=a[x];b.target="_blank";c=b.getAttribute('data-expanded-url');if(c!=null){d=c.indexOf("?utm");if(d>0){c=c.substr(0,d)}b.href=c;b.innerHTML=c;}}(null)

I put this Javascript code in a bookmarklet and Bob’s now my official !tco Uncle. I click this before clicking a link (as Twitter keeps adding old tweets as I scroll down, these newly added posts need to be cleaned up). The t.co cruft is removed and the real link is reimplemented.

UPDATE

Now with 1-second interval repeats. :-)  As long as I stay on the page I don’t need to click !tco again…

javascript:setInterval(function (){a=document.getElementsByClassName('twitter-timeline-link');j=a.length;for(x=0;x<j;x++){b=a[x];b.target="_blank";c=b.getAttribute('data-expanded-url');if(c!=null){d=c.indexOf("?utm");if(d>0){c=c.substr(0,d)}b.href=c;b.innerHTML=c;}};console.log('tco');}, 1000);(null)
Image

Departed (past) on July 4, 08:35am…

Departed (past) on July 4, 08:35am...

It’s only 5:30. Has China invented a time machine???

廣東話口語

一分錢, 一分貨  jat1 fan1 cin4, jat1 fan1 fo3
You get what you pay for.

Owning a telephone in Hong Kong (and China)

I own a couple of mobile phones. Two of which have a local Hong Kong SIM card in them — others are just for testing, I just use WiFi on them, but I digress. That’s not the point. I don’t have a house phone, however. Or an office phone. Which seems to annoy, for some reason, people who think they have to have a landline number for me. Like banks, the government, and others, intent on emptying my bank account. Sorry folks, I can only be reached, if at all, through one of my mobile phones.

It just so happens that one of the phones I own, with a SIM card in it, is not really a phone. At least, I don’t see it as a phone. Hello Magritte. Ceci n’est pas un téléphone. This is a 3G-enabled micro tablet. No mi amor, sorry ah, gomen ne, not a phone. I know, it has a phone number, and technically, this number could be called. And is, by plenty of people I never heard of. Except. This old Nexus S has a nifty application called Firewall, and it is set on “Block All Calls”. Yup, all. Plus, the dial icon is hidden. As I said, not a phone. A micro tablet. Yupskies.

Now, on the subject of calling, and expecting me to answer. MWAHAHAHA! Really. Apparently my phone numbers (including the one that I never pick up because Firewall just hangs up on them) have been sold multiple times by everybody and Mrs Chan, their mother. And they’ve been sold to everybody and Mrs Lee, their Auntie. Apparently. And they think they have a right to peddle their crap to me, through calls and SMS.

The problem is compounded by the fact that I have a phone with THREE phone numbers in the SIM card: HK, China, Macau. The Macau number has not been sold to anyone apparently, for I never get any phones calls from Macau — just the usual avalanche of Casino-related SMS every time I arrive in this cesspool of gambling and prostitution. But I digress, again. On the other hand, I get a bazillion of phone calls on the HK number, and calls + SMS on the Chinese number.

Some of the Chinese SMS are hilarious: love letters from “my wife” (they call me 老公, so that’s my wives, right?); people giving me their (updated) bank account so that I don’t forget to send them the money I apparently owe them (I always feel like sending them a goatsee pic entitled “receipt.pdf” but so far I managed not to…); announcements for various exhibitions and events.

I picked up a couple of calls from China, just for kicks, but they weren’t much fun. No spweekee Engriss. And most of the time 唔識講白話 either. So now phone calls from Big6 are treated like other calls:

  • Unknown Number: nofanks.
  • Number not in my (very large) address book: nofanks.
  • Number in my address book: depends. Maybe, maybe not. Probably not, though.

Also, my phone doesn’t ring. Yeah, the one that actually accepts calls. It doesn’t vibrate either. It’s set on silent. Permanently. When I get a phone call — assuming I haven’t turned the network off and just kept WiFi on of course… — the screen display the call and info, and that’s it. No ringee. No vibree. Terima kasih.

Of course, since I spend a large fraction of my time on the phone — mostly emails and chat applications though — I miss (involuntarily) very few calls. And the ones I do miss, so what? They can call again — they’ll have to, as I don’t have voicemail, despite the fact that some people think I do: they heard some Chinese and a beep. Well, learn yerself some Chinese, buddy, for that message was not a voicemail announcement: it was telling you that I am not unavailable, and to try again later. Woopsies.