Posts

Showing posts from 2007

Lavish in praise

I make it a point to reinforce others by highlighting the good things about them. In doing so, I hope to make their days a little brighter and bring out the best in them. But, as usual, there exists a gap between idealism and practical reality. I am a man of few words, which usually means I can stay out of trouble, but I've found that more words are usually better when giving quality encouragement. For example, I could say, "I like your painting." What actually goes through my head when I'm thinking that up is, "I like your use of high contrast. I know you went out of your comfort zone here since low contrast colors are your usual fare, and this turned out well. I noticed the attention to detail you put in the left section where the fence is. How did you manage to pull off those shadows?" But I somehow can't put it into words quickly enough. Or, I could tell someone, "You don't have to worry. You have what it takes to succeed." If my buddy

You mean you can't read my mind?

Once again, I've had it hammered into my head that communication is important. The problem always boils down to me thinking that people can read my mind. In my traditional step-wise approach to problem solving, I hunted for a first step to take. For this first step, I chose to answer the question, "Who needs to know what I'm thinking and doing?" At this point in my life, it seems that I've got to communicate with a lot of people. It's far from an isolated time. At the very minimum, I've got to communicate with my girlfriend, my family, my housemates, my co-workers, and my customers. That's a lot of communicating to do — and this is just the bare minimum to get by. It's hard to even address this bare minimum. Now for the second step: given this narrowed down set of people to communicate with, what potential problems are there? The answer to this is different for each party concerned. For example, with my girlfriend, I've got to pick the right wo

My change-the-world money

Money makes the world go 'round. No matter how many of these heart-breaking letters Doctors without Borders, the Grameen Bank, or Amnesty International send me, I won't have anywhere near enough in the foreseeable future to send much to all of them. I can only pick one at a time. I once read that good entrepreneurs are inherently insecure people — that they're insecure about their material wealth and status, and so they work hard to acquire more, and are never satisfied. In this sense, I worry about my own effectiveness as an entrepreneur, because if that greed is what has to serve as the driving force or the fire or the motivation — whatever you wish to call it — then I am severely lacking it. It's commonly accepted that the most powerful force that can drive a man is self-interest. Now, the only reason I see for amassing billions in personal wealth is to make the world a better place. I'm a little embarrassed to admit such a touchy-feely motivation — I like to thi

China Import and Export Fair in Guangzhou

Image
Last week, I went to Guangzhou, China for the 101st China Import and Export Fair (中国进出口商品交易会) . Here's the view from our 18th floor hotel room. We got a better deal on our hotel than most of the other visitors because my father's friend is from Guangzhou. This friend's sister-in-law is a hotel manager. Everything in China just has to be huge. The big heavy machinery was necessarily outside. Here's a forklift company with shiny forklifts. I have no idea what this power company does, but they had a nice booth. Because of the immense size of the fair and all the heavy catalogs I was carrying around, I had to step outside to rest my feet and my shoulders for a bit. This is the place right by the street where people were allowed to step outside for a quick smoke. The following is a large expanse that they were just preparing for the second phase of the trade fair. Inside the complex, there were even more displays, but the booths were far smaller. Here's my father at the

Ethanol can be made from corn or sugarcane

For as long as I can remember, I've been excited about environmentally-friendly solutions. For energy, my dream for clean energy centered around solar and wind power. For barren soil, it was composting. For everyday fuel, I thought of renewable sources such as ethanol or hydrogen. Now I'm glad it's becoming more widely adopted; I thought I'd never see the day when such things would actually become economically feasible. There's an ethanol craze sweeping America at the moment, and I hadn't bothered to read much about it until this week's Economist leader, "Castro was right," pointed out that there are two main ways of producing ethanol on an industrial scale: corn and sugar. Ethanol advocates often point to Brazil as a shining example of a large country that uses ethanol on a large scale. Knowing that Brazil is doing fine with massive ethanol deployment made me more excited about having it in the United States, until I found out that their ethanol i

JavaScript syntax highlighters

I'm really into writing documentation, and very often, this documentation must include code samples. I wanted a JavaScript syntax highlighter that: involved very little hassle in setting up, worked like a real parser using parse trees to ensure accurate highlighting, and provided decent coverage of the most common programming languages in use today. Obviously, by opting to go with a JavaScript syntax highlighter, I chose to forgo the option of doing my syntax highlighting on the server side. Doing it on the server side still interests me, but for immediate and practical reasons, the quickest way to get syntax highlighting in my documentation would be to do it on the client side. I went searching around for JavaScript syntax highlighters, and these are the top three that met my criteria. Javascript code prettifier . This was the first decent one that I found. It's pretty basic but I got up and running very quickly. The documentation is sparse and the tone of the README quite ter

Where the rubber meets the road

Back when I was writing software that ran on HP LaserJet printers, I hated having to wait 45 minutes for one-line changes to compile (in a ClearCase build system) and then burn to flash memory. Sometimes, a problem with the printer's behavior wouldn't even be a problem with my software. It would sometimes be caused by an obscure bug in the hardware. Because of time to market pressures, the team would have to work with prototype hardware, the design of which wasn't even finalized yet. The guys who wrote the low-level code had to write some registers and hack their way around hardware defects. Somehow, it seemed wrong to me that I should constantly be worrying about the integrity of the underlying hardware or the operating system on which my software ran. I should have been able to take it for granted. I longed for the day when I could instead work on web applications, where I could safely assume that the hardware was fine and that there were no major defects with the platfo

Physical media and bit rot

Last night, I played some of my old classical music CDs — good music to program to. The songs skipped every other second because of the scratches on the discs. It appeared that my careless handling of CDs over the years eventually caught up with me. Tonight, I ripped some of these to Ogg Vorbis (an open and royalty-free file format similar to MP3) to see if I could listen to my songs without the skipping. Sure enough, they were all smooth! Now, none of this is stuff that I'm terribly surprised about, but it just served as a reminder to me that relying only on physical media to store data is a little dangerous, especially when the medium goes bad or acts flaky. The lifetime of information on the network is short, but as long as it's out there, stored and accessed frequently, it's constantly being duplicated and refreshed. Information that's alive and circulating is healthy information.

HBR: "Leading Clever People"

This month's Harvard Business Review contains an apt and timely article, "Leading Clever People." Rob Goffee and Gareth Jones define clever people as "the handful of employees whose ideas, knowledge, and skills give them the potential to produce disproportionate value from the resources their organizations make available to them." Still, this doesn't mean that they're better off working on their own. One of the people they quoted, the head of development for a global accounting firm, stated that clever people "can be sources of great ideas, but unless they have systems and discipline they may deliver very little." One good point they made about managing clever folks is the importance of demonstrating that you're an expert in your own right. This is to establish credibility and respect. At the same time, one mustn't be so above-and-beyond or in-your-face so as to discourage the real talent. Read "Leading Clever People" at HBR.

Parsing lists of e-mail addresses

I came across a situation where I had to parse a list of e-mail addresses. E-mail clients these days take e-mail addresses in two forms: one showing the name of the individual as well as their e-mail address, and one with only the e-mail address. When multiple e-mail addresses are listed, they are separated by commas, whether they're of the full form or of the simple form. When I had to extract the list of e-mail addresses initially, I assumed only that I could separate them using commas. This would capture a list such as the following. "Joshua Go" <joshua.go@playpure.com>, joshuago@gmail.com It would capture two e-mail addresses: "Joshua Go" <joshua.go@playpure.com> and joshuago@gmail.com . A problem arose when I came across one form of the full e-mail address that threw off my simple parsing technique: the occurence of e-mail addresses such as "Go, Joshua" <go.joshua@yahoo.com> . Since I am no master of regular expressions, and wor

Strained relationships and great undertakings

Last night, I picked up a book and read the preface at the beginning of the book, and the "Special Thanks" section caught my attention. The author thanked his wife and daughter for "putting up" with the authoring process. This isn't the first time I've seen that kind of thing written in a preface. Does writing a book necessarily have to put a strain on the author's family?

Arrays in Visual Basic and classic ASP

For the programmer who is used to C-like syntax, working with arrays in Visual Basic or classic ASP can be aggravating. In this post, I will briefly go over declaring single- and multi-dimensional arrays, then iterating through them — the basic operations that make arrays useful. One-dimensional arrays Let's declare an array with six elements. Dim OneDimArray(5) Yes, that says "5", but it has six elements. When we're going through the elements of this array, we'll start counting from zero and end at five. Iterating through one-dimensional arrays For i = 0 to UBound(OneDimArray) Response.Write(i) Next There will be six elements iterated through. General notes about arrays in Visual Basic So far, we're left with the impression that Visual Basic is a strange language. When we declare arrays in VB, the real size is the declared array size plus 1. If you're used to programming in a C-like programming language such as C++ or Java, it's the declared array

Accented characters with a US keyboard in X11

I've always been too busy to figure out how to map the useless Windows flag keys on my keyboard to do something useful in Linux/X11. On traditional Unix systems, there's a Compose key . According to Wikipedia, "On some computer systems, a compose key is a key which is designated to signal the software to interpret the next keystrokes as a combination in order to produce a character not found on the keyboard." To see what the Windows flag and menu keys are mapped to, I ran the following. xmodmap -pk | grep 11{5,6,7} This resulted in the following output: 115 0xff20 (Super_L) 116 0xff20 (Super_R) 117 0xffcc (Menu) This output told me that the flag keys (left and right) were free to map to Multi_key . I figured I would leave the menu alone. Next, I had to perform the remapping. I created a file, .Xmodmap , which is sometimes already there in a user's home directory. For me, it wasn't, so I went ahead and created .Xmodmap with

Goals are good for people who tinker

I like to tinker so that I know how every little bit works. I also like the feeling of knowing I've achieved something. I'm sure it's already apparent to the reader that these tendencies sometimes come into conflict with each other. My tinkering leads to more extensive knowledge. Undoubtedly, it has helped me many times in the past, and I continue to reap the benefits of my past fiddling. Still, I hold myself to strict standards of productivity, and I become frustrated when I can't do enough in one day. Setting clear and reasonable goals for myself allows me to satisfy both my hankering to tamper and my drive to have something to show.

Separate user for each webapp's MySQL database

The following commands will create a separate user for each MySQL database. > GRANT ALL PRIVILEGES ON PureExample.* TO 'pureuser'@'localhost' IDENTIFIED BY 'purepassword' WITH GRANT OPTION; > FLUSH PRIVILEGES; This is good practice when writing web applications, so that each web application has its own database user.

PDF bookmarks with LaTeX

After the mail fiasco was taken care of, I decided to pursue one of the things I've been wondering about: how to make PDF files have bookmarks (those links on the side pane that let you jump to well-defined sections of the document). For my setup, all I had to do was add this in my document: \usepackage[pdftex,bookmarks=true]{hyperref} Since I use Ubuntu, I had to install the tetex-extras package, which contains hyperref.sty for running pdflatex.

Thunderbird's "too many connections" message and Courier IMAP

When we use Mozilla Thunderbird at my workplace for our IMAP mail, Thunderbird often tells us that we have too many connections. It makes going through my folders impossible. This article explains that it's because Courier IMAP (which is used by Plesk) limits the number of connections from a single IP address to something like 4. Since we're all behind a firewall, we're all considered to be one user, as far as the server is concerned. I just had to change the values of MAXDAEMONS and MAXPERIP in /etc/courier-imap/imapd to allow more connections. Mozilla Thunderbird caches something like 5 connections by default, so even one user will put the IP past the limit. While I was figuring my way around this problem, I set up another server to copy my mail over. It's an Ubuntu machine and I just used the distribution's Courier IMAP, but since I've been using UW-IMAP all these years, the configuration process for getting a system user up and running was completely for

Iteration produced the Constitution

The other day, I was in a meeting with a potential customer. I explained that when I'm faced with the daunting task of having to build something complicated, I take what's called an iterative approach. Taking an iterative approach starts with an early phase of exploring the problem by creating a quick, throw-away prototype that works. It gives a sense of what's possible and what's not, and quickly pokes holes in any weak spots in the overall idea. Sometimes, I think I'm crazy for taking this approach, but it works wonders for me. It helps that people like the folks at 37signals and Fred Brooks have written explanations of the methodology more thoroughly and eloquently than I could possibly write, but I was doubly reassured during my reading lately when I read about how the United States Constitution came about. In particular, the odd setup of our legislative branch is due to an iterative approach the Founding Fathers took at the Constitutional Convention in 1787.

A cheap and nutritious lunch

I remember when I first tried ugali during my trip to Kenya last May. It didn't taste like it had much nutritional value, but it made me full very quickly. It's been a slow month at the company, so we've been saving some money on food. I have stopped going out to lunch, and instead I go home to my apartment and cook myself some pasta. I treat myself to parmesan cheese on top, but no meat. The trouble with this is, it has been tough to get full, even after a lot of pasta. Today I was impatient and ate two bowls of cereal while my pasta was cooking. I ended up having room for only one bowl of pasta, and I was stuffed. Normally, I'd eat four bowls of pasta and still be a little hungry. I guess I accidentally stumbled upon a solution to staying full. I'm writing this down for my own reference: for cheap eats, have two bowls of cereal and a bowl of pasta.

Helping the rich world keep its livelihood

This week's Economist cover story, " Rich man, poor man ", about globalisation's winners and losers, offers three categories of solutions to help out those who lose out. Education in rich countries must equip people with general skills that make them more mobile in the workforce. Detach health care and pensions from employment, so people who move jobs don't have to worry about much else. Beef up assistance for those who lose their jobs, in the form of generous training and policies to help them find new work. These all sound good, but as the editorial acknowledges, these will take years to implement, and it won't be easy. I've also got my own reasons to be skeptical about the effectiveness of these general measures. People who are part of the educational system in rich countries will see these "general skills" as irrelevant because they want something that's very close to practical. It's difficult to learn something if you're not real