Monday, December 22, 2008

A Nice Way to Show Power

So, I'm writing on a snowy day. December wasn't as cold last year and this year delighted my wife with ice falling out of the sky. A first for her.

China in general has another "first" going on. They are taking part of the international anti-piracy operation off the coast of Somalia. You might recall a news item a little while back where pirates captured a cargo ship loaded with tanks, spare parts and ammunition. The ransom demand was in millions of dollars and they still hold the ship captive. The Russians sent the Sovremenny missile destroyer to the area, but so far the ship has yet to be released. A little later and now the Chinese are also going in.

They aren't going in for the Russian tanks, of course. They are doing it because the Gulf of Aden is an important shipping route and because the international effort already rescued the Chinese merchant Zhenhua 4 last Wednesday. It's most likely a tacit show of force as well. Nothing threathening, but a quiet reminder that yes, China has a modern navy and is capable of deploying it outside of local waters. Unfortunately the news in English haven't stated which ships China is going to send. The People' Liberation Army Navy has quite a few modern ships to show off, including the two 1996 bought Sovremenny's and the two improved models of the same, bought in 2001. I'm hoping of course they send the destroyer Taizhou (it's the latter, an 956EM Sovremenny.) I wouldn't be surprised if the group of three ships being sent includes one of the newer domestic destroyers too.

The Chinese have said they will play nice, according to Foreign Ministry spokesman Liu Jianchao: "Chinese naval vessels will strictly follow U.N. Security Council resolutions and international laws. They are willing to work with other countries and to take part in humanitarian relief tasks." I'm not even joking when I say there's no reason to doubt this. The Chinese only showed interest in the operation after the U.N. Security Council unanimously approved of the action and the Chinese merchants have had pirate trouble.

Yes, to be honest I expected to see more cool warship pics in the news. If you share a bit of similar interest, here's a link to the news item and to the Sovremenny.
http://news.yahoo.com/s/nm/20081220/wl_nm/us_somalia_piracy_china
http://www.fas.org/man/dod-101/sys/ship/row/rus/956.htm

OP Out.

Sunday, December 14, 2008

Music, on the road.

There is something to be said for music which is not ashamed to sound
whatever it sounds like. On this the same token I can accept music I
don't like in many cases. Who wants to hear of those?

I once thought it might be possible to make a computer program to
which you insert hits, snippets of successful songs and other bits of
sound in mass quantities; the program would then create an average
value. The resulting generated song would certainly be a huge success.
It would also be the ultimate mediocrity, while selling millions.
Guess what? Coldplay came and beat me to the punch in making soulless
crap.

I can't blame Coldplay for selling out - there was nothing there to
begin with. Now don't get me wrong, it's not an injustice they've sold
millions of records, there is a huge group of people who answer "a
little bit of everything" when you ask what do they listen to. It's
not as bad an answer you'd initially think if you know what albums
they buy.

Want another? Go listen to Panic at the Disco. As an experiment, play
through a whole album and rest a little. You will feel as something is
missing, but you cannot say what. It's a small piece of your essence.
The machine that spits out averages like Panic made something so
horrible it became a void trying to fill itself. H.P. Lovecraft writes
of a color out of space - not really a thing unto itself, something
not tangible, but something which spreads and sucks the life out of
anything it comes near. The album Pretty Odd is the Lovecraftian sound
out of space. It is not really music, but something alien and
inexplicably terrible, weakening and using you only to spread. As the
victims of horror stories I cannot offer you a way to kill it, I can
but flee from it. In Color Out of Space the victims die or retreat to
the relative safety of insanity. The latter must have happened with
the first Panic album, it's the only way to explain how the second
album sold so well.

OP Out.

Friday, December 12, 2008

For Notepad

Here you go, Pekka.









Oh, if you don't get it, read
Pekka's post on web editing

Thursday, December 11, 2008

#download a.download{ font: 14px "Arial, Helvetica, sans-serif; color: #fff; }

Hi,

My apologies for being so delayed from regular posting. It's been a painful few weeks in coding for me, and time passes by extremely fast.

Now, if you're at all familiar with creating a website, you know it can be super fun to make one. If you're an expert, what you're going to read in this post will look stupid. If you're not an expert, you'll think website-making is a terrible world best left for professionals.

The thing is, to further expand my adventurous life as an entrepreneur, me and my business partner decided we could make an online shop for stuff we could sell cheap from China to Finland and elsewhere in Europe possibly. Not consumer goods, but stuff businesses need. Not like industrial components, but practical things. I won't give futher details, though, as it is still not ready and giving away details of my business to our millions of readers would probably end up in an idea-theft. Anyway, to get such a business going, we need a website.

I'm the only one of us who actually knows anything about making a website. So I got that winning ticket. I have a good understanding of HTML code and a bit experience in CSS. That's it. And I write everything in Notepad. I'm that old-school (or unskilled).

So, with those skills of mine, I had a task of creating a fully operational website that can provide a kind of online shopping function (not a real webstore, but with plenty of online forms to fill).

The first week went really well. I was creating the main graphic layout and the CSS to support it - albeit the visual image has changed about 3 times since, everytime to the better. I managed to put in a basic ordering system and some contents.

Second week I was working 14-15 hours a day (sleeping 5-6 hours) to get stuff into the website, and finally started having those rookie mistakes that make pros cry.

It's easy to put text into a website, but it's not easy to make them look super-cool and have them behave as you want them. Especially when you're using a frameless CSS layout. It's a magical thing what one misplaced comma or a missing '>' can do. With one small typo your whole website might ceace to exist the way you knew it. It might take a life of its own. The worst is if you don't exactly remember what you changed in the code just before - or if it takes you a long time to notice you've made a mistake (the changes are, you might have to go through everything to find that missing comma).

I had that. I missed one > after closing a bold text command. Took me two hours to find where I went wrong.

Also took me around two hours to find out why some pictures didn't open in Internet Explorer while opening perfectly normally in Mozilla. I thought it's my code and I went through it over and over again. No mistakes there - simple code - why isn't the damned thing working?! Oh, turned out some of the pictures were saved in CMYK-colours which, it turns out, IE doesn't open but Mozilla does. I converted the pictures to RGB and the thing worked like a charm again.

For the online forms, I also added a CAPCHA-security field so that visitors have to type in those funky characters to designate themselves as humans and not as spambots. For this I had to venture a completely new world of coding: PHP and Java - both which I had no experience from before. After working zealously to get CAPCHA working, my form stopped working. It worked almost, but it had one flaw: the emails that I received from the process.php protocol didn't have any of the '+' signs in the contact information (as in, someone would put in country code for a phone number). Turns out PHP code considers '+' as a space-character. Took me god knows how many hours to figure out how to fix that.

Today, I've had my favourite code-glitch of them all! Didn't take me as long to find the problem since it's in my familiar CSS code, but it's quite amusing.

At a location of the CSS code file, I have: #download a.download{ font: 14px "Arial, Helvetica, sans-serif; color: #fff; }. This means that in Div type="download" if there is a link class="download" it'll have font size 14px in Arial and black colour. I used to have a html file that used that Div Type but I didn't need it in the end so I've deleted the html file a long while ago. However, I forgot to take out this line from the CSS file, but then, usually it shouldn't be a problem. The important thing is, it's a kind of leftover in the code that nothing uses.

Or so I thought.

Internet Explorer uses it. Internet Explorer needs this particular piece of code to make the website work. Mozilla doesn't, nor does any other browser. IE, for some reason, can't make my right side window and footer work if there is no code that would tell IE that in Div type="download" if there is a link class="download" it'll have font size 14px in Arial and black colour. I can change the font size and nothing happens, I can change the colour of the font and nothing happens. But if I take out the code all hell breaks loose! So, I'll leave the code there.

I'm quite sure this kind of leftover code is what will eventually make real Artificial Intelligence - or a kind of a real intelligence for machines. By wilfully creating AI ourselves, humans can only aspire for intelligence similar to our own intelligence. However, true intelligence has freedom and it cannot be dictated. Hence, only from true randomness and chaos can it be born!

I know a missing comma doesn't sound very intelligent. But look at it this way: I wanted it to work - I made in a way it should work and it looked smart enough - however, through a small mistake, I lost control of the beast and it took a life of its own!

Geeks are the lion tamers of today.

Friday, December 5, 2008

Locks

Locks are a smaller topic for a change, but let's go over some basics.

In China, whenever I've seen anyone move in to a new apartment, the first order of business is to change the locks. The occupants usually change the front door lock which is often a more expensive model to begin with and has easily interchangeable internals. These are nice locks and I would have no idea where to start picking them. Take for example the new lock in my apartment - it was changed in to the old housing and came with 6+2+1 keys. The first six are the regular keys to open the door. The second two are for maintenance people and such, who you will want to give a temporary key. The last key is a special key to allow or deny the two maintenance keys. Turn once to allow the two extra keys, turn again to disable. That's what you get for 100 RMB.

The second type of lock is the one for show. And no, I don't mean it's a pretty lock. It's the kind that says "I'm locked, kinda." My electric scooter has such a lock for the helmet case. You can open it with they key intended for it by pushing the key all the way in and turning. No surprise there. The joke is, you can also push the key halfway in and turn, it'll unlock.

So my new apartment complex has motorbike charging boxes available downstairs. We moved in and took our scooter there. I tried charging the bike and noticed that you need to unlock the box to get electricity. (You see where this is going, right?) I almost contacted the management office and asked how much a key would be, but I decided to try my motorbike key. I inserted the tip in the lock and turned. You guessed right, it unlocked. No forcing or picking, just like the key was meant for it.

That lock is similar to the one I had in my mailbox, except that instead of opening with any key, it didn't open at all. I had to change it and that, labor included cost me 6 RMB at the old apartment. You very much get what you pay for. Most people use additional tube locks for their motorbikes, hitching them to posts and supports like you would a bicycle. I don't, but that seems like a bad idea more and more.

OP out.