2005-04-20

Cagayan de Oro online phone directory

I had to get phone numbers for some Cagayan de Oro hotels so that friends who were going there could query prices and book (they still don't have web sites, or the web sites don't come up early enough in google) and I remember that there's a handy site for searching for CDO phone numbers. CDO-ID is a searchable site for numbers.

Now, the front page hasn't been modified since around 2001, so possibly the phone numbers aren't the latest either, but most of the numbers will still work.

I remember that when I used to work for an internet provider in CDO I wanted to do something like CDO-ID too. Years before that I'd gotten hold of the Misortel phone data and had a searchable site (long gone now, hosted by weblink i think). Well, I tried to get the data out of the telcos, but they were incredibly unimaginative and I never really could get the data out on a regular basis so that I could have a reasonably up-to-date directory. Eventually I gave up trying, particularly when I found out that CDO-ID already had a site.

This resistance to putting up phone numbers on the internet is a major stupidity for any telco. After all, if the phone numbers are online, people can search for them and they're then likely to make long distance landline calls. The cellular telcos should probably also do something similar, at least for their postpaid accounts, and maybe some sort of interactive prepaid directory too (aliases allowed, but maybe filtered for obscenity and illegal names). That would probably drive up voice traffic.

But I don't see the celco's doing that either. They don't like change, despite their business being founded on technology, where change is so fast, it's essential to embrace it.

2005-04-19

Istana Bali

I was with sol at Club 650 (Libis, near Shopwise and Eastwood) yesterday for badminton with friends. After the games we went up to Istana Bali, a new restaurant there. The food was OK. A bit overpriced, but that's just me, newly in from the provinces and eternally afflicted with sticker shock. Except for the draft beer. A mug of draft is only PHP 25. That's cheaper than the Pale Pilsen, SM Light, Super Dry and Strong Ice! In fact, it's almost half the cost, since the other beers are either 45 or 55 (i wasn't paying enough attention to remember exactly).

I'm going back there. Not just because of the draft (although that's a big deal) but also because it's pleasant, cool, the restaurant is new, so the owner and the staff are doing their best to make a good impression. We ordered one item and changed it to a lower priced item, but the bill came back with the original item on it. It was certainly an understandable mistake, I'm glad I caught it, but I'm sure it wasn't intentional. But because of that we got another (small) item taken off the bill and the owner apologized for the mistake and was very nice about it. That's not something I see a lot and I appreciated it.

one letter passwords

I was listening in on a conversation on passwords the other day. One of the people in the conversation mentioned that they knew someone whose password was "A". Just the one letter. And there was a conjecture that maybe that was a really hard password to guess since, most people would think 3 was short and no one would think that anyone would use a one letter password. This was for windows login passwords, so it's not something that would normally be attacked via brute force somehow, although in an organization with lax password controls, the same password might also be used for email, file shares, etc. In which case the situation suddenly becomes worse.

Anyway,I thought about that a bit, and yesterday the refutation came to me. A one letter password is a dead giveaway because it's so easy to shoulder surf. It's not even necessary for the shoulder surfer to actually see what's being typed. It's sufficient to see that only one character was being pressed. After that, it would be trivial (in the lax organization, more security conscious organizations would have failed password limits and timeouts) to try all the one character printable characters on the keyboard and log in.

2005-04-11

usb thumbkey svn repository speed

I store (most of) my source code in a USB flash drive. Originally it was ext2 (because my previous thumbdrive was ext2, because i couldn't put reiser on it, at 32MB the old drive was too small and reiser wouldn't mkfs on it). Yesterday I got frustrated because commits were taking too long (small commits, but they were taking 2 minutes or more). So I did an svnadmin dump and also tar-gzipped the repository and rebuilt the filesystem as reiser.

Reiser said how much of the disk it would eat, and then proceeded to make the filesystem. After the load, checkouts, commits and updates are very much faster. I think I'll stay with this. I'm not sure what the problem was though. It might just have been that svn was trying to update too much data there (maybe the strings file, which is 6MB) and was just slow yesterday. Or it might be that reiser is just doing something good and it's a better match for SubVersion. I'll keep track of when it gets slow again. If it never does, then I'll stick with svn, but if it does get slow, I'll try xfs and jfs for svn, just for fun :).

long time

The older I get the more memories recede into a haze. But some things stick. One event I particularly remember had me with my face being pushed in the grass by some neighbors. I'd probably been snotty or something, and so these two kids (they were smaller than me, so it was only fair that they gang up) started beating on me. I put up a good fight, but eventually the sum of their masses began to tell and they had me on the ground eating grass.

My brother was at home, maybe 200 meters away, but he seems to have noticed the commotion. Instead of going out the front gate, he climbed the back fence, ran over, and took the boys off me. He didn't go and fight them himself (he probably knew that I'd been snotty :), but it was cool that he took them off me so I could get up.

Then we went home. No fuss, just a regular day.

boost regex!

I posted on the PLUG mailing list about regex libraries in C/C++. Matt Baluyos pointed me at PCRE and paolo falcone pointed me at Boost. I decided to go with boost because I couldn't stand the PCRE library.

That's not to denigrate the quality of the library, it works, very well. I use PCRE implicitly in PHP and it's a great help and is incredibly easy to use there. But C is now just too low level for me and while I can work there, I don't like it much. If I can, I work in PHP (perl is far too ugly for me, although that could change if i were to work in it instead of just reading it). I'll be working in java soon, but I tend to have a bias against it for small projects. I'm sure it's great for large projects, but even there, the libraries and frameworks seem over-engineered. But that's probably just a function of the fact that they're large enough that I can't get my brain around them in a week.

For anything lower level that I can't do in java or php, i like C++. And that's where I use the boost regex libraries. I've written utility functions that hide some of the details of the boost implementation (just pass string pattern, string data, vectormatches, and internally it does everything else). there's also a similar set of utility functions that passes the pattern as a regex const reference instead (so that patterns that are used all the time aren't re-compiled).

it's very nice to be able to say:

vector matches;

if ( re_search(pat, line, matches) )
{
for (int ctr=0; ctr < matches.size(); ctr++)
do_something_with_match(matches[ctr]);
}

2005-04-07

php, popen, stream_set_blocking(...,false)

So I thought that I could make a "multi-threaded" (but not really) program in php by using stream_set_blocking. Well, the things I need to do simultaneously involve calling popen on external programs and then reading the data and doing something with them.

Well, popen doesn't work with stream_set_blocking(..., false), so I can't do things that way. Unfortunately, I've spent a week or two setting up the framework for all this (so it would be easy and convenient) but now I find it can't be done.

Oh well, time to give up on trying to do that in PHP then, and just buckle down to doing it in C++ (the original version is in C++, but frankly, I just don't want to maintain that code anymore, no choice now though).

2005-03-20

The American Empire and the End of Freedom

One should, of course, take what is said with a grain of salt, given the
source. The guardian is consistently anti-american.

On the other hand, there is no doubt that much of the article is true.

As a practical matter, the US government, and, in fact, most (but not
all) of the americans on the ground care far too little about the rights
and welfare of the people they walk over. They are too focused on their
own needs. As far as that goes, so is everyone else, focused on their
own needs.

But the U.S. does itself a disservice by hewing closely to the theory
that the rights enshrined in their constitution apply only to their
own citizens, and apparently, only to those who are convenient and
are actually on their own soil.

http://www.guardian.co.uk/afghanistan/story/0,1284,1440836,00.html

For myself, well, i watch, mildly amused, while U.S. policy, and many
of their "heroes" (they're not heroes, they're kids put into warzones,
defending themselves, and all too often brutalizing the population
because they don't understand the local culture and because their
american pride [and those attack helicopters, bradleys, tanks, humvees
and overall military superiority] make them accept without questioning
the importance of their own survival as opposed to the trivial needs
and rights of the populace) descend into the natural depravity of
absolute power and empire.

Probably, many americans would vote against their own government
instantly if they understood what their government is doing to
non-americans, and to the american ideal. But most of those americans
are too comfortable and are unwilling to risk the difficulties that
would come of trying, vigorously, of changing their government's
policy. For those few, I wish them luck. For the rest, well, I wish
them luck too. It's going to be a difficult century, or longer. The
descent into depravity from power is long and fun for a bit, and then
it gets worse.

2005-03-14

So you want to be a consultant?

I saw So you want to be a consultant? long ago. I'm looking at it again since someone on a mailing list pointed at it.

I'm learning again. Some of those lessons I haven't internalized yet. It'll take a while, a lot of things do. I'll get there yet :).

2005-03-10

Rsync and compressed files

I did some testing and I find that generally, it is better to rsync uncompressed files rather than the corresponding compressed files or archives. at any rate, tar.gz archives are bad for rsync. tar files are OK.


  1. i took a directory of source code and test data, around 9MB.

  2. copied it to a remote box

  3. tar cvzf on both sides to one file and also tar cvf to another file.

  4. on the source box, edit one source file, insert only one line.

  5. tar cvzf and tar cvf on the source box. the source box should have sources, tar and .tgz which vary in only one line in only one internal file.

  6. rsync of the source gives a speedup of 450 (14K sent, 94 received), rsync of the tar file gives a speedup of 85000+ (78 bytes received, 20 bytes sent), rsync of the .tgz gives a speedup of 1.48, (2.4MB sent, 12K or so received).

so rsync of a tar file is best (because only one file needs to be analyzed to see where the differences are). rsync of a compressed file (at any rate of .tgz, but probably of any compressor) is bad. not sure why, but i wouldn't be surprised if the compressed representation of a lot of data depends on what has come before, and there may be other effects like that which
confound the difference finder since too much is found to be different.

2005-03-09

Sagada Mountain Tea

I'm almost out of Sagada mountain tea. This is not good. Sol and I are going to have to go back there and bring more back. Maybe ten bags instead of the measly two bags we brought back last time :).

I've been googling for the tea and I can't find anything that says it's for sale in manila. There's got to be somewhere that has it. I just can't find it. Maybe it's time to ask the mailing lists. That might save a trip to sagada. It would be good to go, but I need to save money for the wedding in May.

Saisaki music

I was at Saisaki megamall the other night. I would have a link there, but I don't since i don't see an official saisaki web site on the first or second page in google. these people need to hire an SEO :). the one link i clicked on was some whining about a "saisaki trap", which is, i suppose, bad enough, but... if that comes up ahead of the real saisaki web site, well, they need to hire an SEO.

Sol and I met francis, my brother. He's in from the U.S. and is nuts about japanese food. Sol asked me what francis looks like and I couldn't answer. I'm just no good with faces. When francis arrived however, it struck me. he looks like Ming Tsai! :).

Anyway, the food is always wonderful there. I always love the salmon sashimi. Sol ordered the uni for us, my first time, and it was incredibly good.

but the music sucks. I mean, country muzak is really, really bad. Whose damn fault is that?

2005-03-03

corporate peer to peer

is almost always a mistake. at any rate, it is anywhere where bandwidth is expensive.


I was just talking to someone at a company I do some consulting with. I was working remotely, and the link was ridiculously slow. Ping times were at around 1 second, and sometimes 1.5 seconds. I could still work (i've got some techniques involving rsync, for very bandwidth starved links, and i just type ahead), but I could work better if the bandwidth weren't so slow.


So I talked about the serious need in corporations to take steps to block p2p, and then, since it's impossible to block it completely, probably, to do as much as it can to monitor p2p and then to have a policy about p2p use (probably that it should not be allowed at all, and that it would be blocked and monitored, and violation would affect performance reviews).


That may sound draconian, but it's necessary.


  1. bandwidth costs money. even if it were cheap, if peer to peer didn't soak bandwidth the company wouldn't need that much bandwidth and could contract for less, thus paying less every month. That's money that goes straight to the bottom line.

  2. the company i'm using for my example runs its own publicly accessible mail and web servers and therefore their bandwidth is all fixed IP. That's a bit of a bug on the part of IT management, they could go with 80% dynamic IP bandwidth and then 20% fixed IP for mail and web. They would save quite a bit of money right there since fixed IP bandwidth carries a very high premium in the philippines. they would save more money just by buying dynamic bandwidth for staff time-wasting surfing and buying less fixed IP bandwidth for those services that require the bandwidth.

  3. in a litigious world, it's for the company's good that peer to peer is blocked and violations monitored and punished. The same company has received a warning letter from a RIAA/MPAA related agency, apparently someone had left their bittorrent client on and had been downloading and serving enough files that they attracted someone's notice.


Naturally, this sort of thinking won't sit well with employees. But frankly, I don't think it matters. The staff aren't being monitored for wasteful surfing (of which, perhaps half of all surfing at the office is wasteful and not work related or only very peripherally work related), so their surfing for entertainment is a free benefit of employment. It's only fair that those online activities which might be damaging to the company be disabled so that other online activities of neutral or only mildly negative value may be allowed.

2005-01-27

Battad

Back in the middle of October 2004, Sol and I went to Battad (I'd link to something there, but I don't see anything good in the first few links in Google, and there aren't that many hits). I'd been there before (in 1997, with danilo and kim, if they develop websites or blogs I'll have to come back here and link to them) and had been raving to her about how great it is there. Of course, this was in hindsight, and years after the difficulty of the hike up the mountain had receded into a pleasant memory.

This trip, we took the overnight bus to banaue, had breakfast there, took an overpriced (PHP 300) tricycle to the jump off point at Battad (long ago, we took a jeepney to I forget where, maybe Bangaan, got off at the junction and walked up the mountain). They've been building a road so the hike is much nearer if you jump off from the end of the road, and much nicer if you start walking from the junction. Here's a view


of the walk from somewhere around the end of the road down to the ridge that has the hostels where tourists can stay (click on the image for a larger version).

From the end of the road, it's still something like 45 minutes or more to battad itself. It's mostly downhill (and you can shave some time off that by taking the much steeper route, we didn't though since it was drizzling and slippery when we got there).

When you get to the ridge with the hostels, there are a whole range of choices. Most of them are about the same. There are slight differences in hostel "personality", but they're generally all good. This trip, we stayed at Simon's. We were going to stay somewhere else, but there were other guests there. Simon's is a bit out of the way (only a really little bit, it's just beyond Rita's I think it was, and beyond Simon's there aren't any more hostels). The rooms are basic. There are no 3 star hotel amenities here (although the bathrooms are very good, much better than they were during our last trip). There's not even any electricity in Battad (maybe in a few years there will be, there isn't now though, although I think one of the other hostels had solar power or similar, not sure what they used it for though). The room was very comfortable though. Everything at Simon's was great. I'm sure at the other hostels it's much the same.




I artistically disarranged the pillows there :). It's neater than that.

Here are views of Battad from Simon's. Click on the images to view larger versions.


a view of the village of battad from Simon's dining area
Battad from our bedroom window


The food in Battad is nutritious and good, but there's not that much choice. For the
sake of adventure, we had the pinikpikan chicken. It's interesting to think about, but I'm not having that again. It's not just because of what they do to the chicken, but also the fact that the soup is bathed in the smoke of the chicken's feathers. That gives the whole thing a strange bitter taste that I don't much enjoy. Last time I went to Banaue, Battad and Sagada, I had a lot of omelette. You can still get omelette wherever you go, that's probably the safest food choice for most people. You can work off the cholesterol walking up and down the mountains.

Simon's has reasonable pizza and pita (well, actually, they use the same flat bread for both).

We thoroughly enjoyed our stay. To be honest, the walk down wasn't that much fun. And the problem with staying in Battad is that one should leave early in the morning

to walk back up the mountain to the junction point. There are always great sights

along the way though.

We had contracted with our tricycle driver to pick us up at 9. We were a bit late, he waited for us and told us that he had some other passengers but he arranged for us to take a jeepney back to Battad instead.


2005-01-25

normal distribution

I had to write a program that needed to simulate random data that was normally distributed (bell curve distribution).

Fortunately, I was able to grab a copy of Numerical Recipes in C and found some code on p. 217. The code produces a normal distribution in the range -1.0 to 1.0 with a standard deviation of 1.

My program was PHP, so i translated it from C (K&R!, boy that's old :)

The PHP source is here

Unfortunately, I'm not a mathematician and I'll need to find ways to adapt that code or find some other code where I can adjust kurtosis, standard deviation, etc.

I'd look in Knuth's Seminumerical algorithms, but it might not be there. And anyway, my copy is in Mindanao. I won't be able to refer to that until I go in May.

2005-01-20

Email from idiots is spam

I use gmail, and the spam marking feature, and the fact that it's so easy to use, is very nice.

Every once in a while I see vacation messages posted to mailing lists. Every single one of those I mark as spam in gmail. Partly I do that because people who don't know enough to set selective filters on their vacation messages are too dumb to listen to.

The gmail filter will learn from vacation messages which words score high as spam and perhaps future vacation messages will be marked spam and I'll see less of them. Also, the authors may start to score higher as spammers. That's a good thing too, for me. I'll see less of their mail since their mail will automatically go to the spam mailbox, and when I go in there to confirm which emails are spam, I get a chance to despam those emails which are important.

I don't think I've seen gmail do that yet though (filter mainly on the sender's email address), I've seen Bob Reyes' spams about his hosting service end up in the spam mailbox, but that's just because the email was spam, not because the emails were from him.

2005-01-09

Lucky

Sol and I were lucky enough to go on CamiguinAction's Katibawasan Rapelling and Canyoning tour. She was supposed to do her confined water exercises and open water diver qualifying dives. That didn't happen though because of the weather. She did all that when we came back after New Years day instead.


On the 31st though, we were supposed to go back to Cagayan de Oro on an earlier boat, but we took the last boat instead (and lucky to have made it :) because Diggi had some guests who wanted to do the rapelling tour and it was a great opportunity for Sol to go on the same tour. I've done the tour several times, it's neat,


The tour is composed of a hike up to a point above the main falls, walking along the stream to the first wall, and rapelling down the first wall.







She slipped once, but the ropes and harness and the safety setup were excellent and she didn't fall. She just got back up and walked down the wall until she got to the ledge, disconnected the rope and jumped the five feet or so to the water below.







The second (or third,stage, I forget exactly) is a slide. The water wasn't very strong this time, even though it had rained the previous two days or so, but the slide was cool anyway. Everyone else did the slide, except me. I preferred walking down the wall :).










There's another wall, and some walking down the stream and finally we got to the top of the main waterfall. That's too high to rapell down, at any rate, it is for non-professionals. So we just enjoyed the view (there was a slight drizzle, making for a beautiful cool day) and Sol looked over the edge.







After walking down walls and sliding down canyons, of course, we had to do everything in reverse :). So we walked up the walls and back down the mountain.










At the end of the tour, everyone is exhausted, exhilarated, glowing.