Tomer Gabel's annoying spot on the 'net RSS 2.0
# Tuesday, September 12, 2006

Write a program that compiles under both C and C++ compilers, and outputs "0" for C and "1" for C++ (or whatever, the actual numbers are not the point). You obviously may not use compiler-dependant macros, __CPLUSPLUS__-type macros or anything of the sort.

Once again, I'll post the solution in a couple of days.

Tuesday, September 12, 2006 3:40:55 PM (Jerusalem Standard Time, UTC+02:00)  #    -

Here's one possible solution for the riddle I posted a few days ago:

  1. Replace i < N with -i < N
  2. Replace i-- with N--
  3. Replace i < N with i + N

This isn't a particularly hard riddle - it took me about 10 minutes to come up with the solution, although I imagine a developer with more recent C experience will be much quicker. Regardless it's a pretty good way to tone those C muscles.

Tuesday, September 12, 2006 3:23:00 PM (Jerusalem Standard Time, UTC+02:00)  #    -
# Monday, September 11, 2006

These last few months have been some of the busiest of my life. Back in May I decided to postpone my studies in the Technion to resume working for Monfort full-time, and in the interim managed to complete several projects, visit several countries (besides China, which I already wrote about, I visited Japan, Hong Kong and Korea).

The net result was very little free time, which reflects in the post count:

(if you can't see this, you need glasses)

I want to get back on the horse, as it were, but I would also like to avoid ridiculous pledges that I have no idea whether or not I'll be able to hold up ("I pledge to write at least two major posts a week! No no, lets aim for something more feasible. I pledge to establish contact with an alien civilization by the end of the year!"), I'll make whomever is reading this a trade: I'll do my best to write more and more content, and you'll do your best to let me know what interests you.

Just to get the taste buds going, here are the current posts in the pipeline (i.e. open draft in Live Writer I'm trying to consistently work on):

  • Some free power tools (gnuplot, SVG, other GNU tools)
  • A comprehensive post about wikis, specifically MediaWiki and how our organization uses it to our advantage
  • A post about my two trips to Tokyo
  • Thorough review of the new audio equipment I've been buying lately
  • Occasional music/movie recommendation

If there are any specific points of interest, give me a holler...

Monday, September 11, 2006 4:32:01 PM (Jerusalem Standard Time, UTC+02:00)  #    -
# Sunday, September 10, 2006

Virtual PC is free, which is good. It is reasonably fast and functional, which is also good.

It has some bugs, which - surprisingly - isn't good. One of those is an apparently ubiquitous "Network adapter... failed to initialize because the address is a null address." A solution can be found via this blogpost. Weird, but works:

  1. Examine the key value at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\<nnnn>\DriverDesc to locate the desired host adapter where <nnnn> is a four digit number.
  2. Look at the GUID value for the NetCfgInstanceId key value.
  3. Add the DWORD key at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VPCNetS2\Parameters\Adapters\<guid>\Flags and set the value to 0 where <guid> is the GUID found in step 2.
  4. Restart the computer.
Sunday, September 10, 2006 5:38:59 PM (Jerusalem Standard Time, UTC+02:00)  #    -
# Friday, September 8, 2006

A friend sent me this riddle (which I imagine isn't his, but nevermind) via mail, and I thought it cute enough to share:

Find three ways to change/insert/delete a single character in the following code, so that the resulting code will print 20 star characters (*). Remember, for each solution you can only change one character, and there are at least three different solutions.

#include <stdio.h>

int main()
    int i, N = 20;
    for ( i = 0 ; i < N ; i-- )
        printf( "*" );
    return 0;

I'll post the solution in a few days, feel free to yell "eureka" in the comment section or whatever.

Friday, September 8, 2006 6:26:24 PM (Jerusalem Standard Time, UTC+02:00)  #    -
# Tuesday, August 22, 2006

Microsoft has done a stellar job on Windows Live Writer. Even at beta it already supports (out of the box, no less!) a vast number of blogging engines, including dasBlog. It also supports a blog autodiscovery feature called RSD, which according to Omar will be featured in the upcoming dasBlog 1.9.

The draft feature is simply awesome: open up Writer, start typing and you never have to worry about your text going to hell (there is also an autosave feature). The WYSIWYG editor is extremely robust, lets you edit your posts using your own blog's stylesheet and has excellent picture embedding features. Although I could easily go into HTML editing mode and edit the HTML directly, I no longer see any point doing it, which saves a hell of a lot of hassle and time!

Never a sucker for web applications (AJAX or otherwise), this is a positive boon for me. Good job, Microsofties!

Tuesday, August 22, 2006 1:49:20 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Personal | Software
# Sunday, August 20, 2006

After my foray into the world of IBM Model M keyboards, followed by a few months using the impressive Microsoft Natural Ergo 4000 I eventually came to the conclusion that the Model M was the better keyboard of the two. The tactile response of the Model M is unmatched on any keyboard I've ever used, however the lack of Windows keys (and misbehaving Shift key - that was one old keyboard!) was a real pain in the ass.

I was anxious to try out two keyboards: the elitist Das Keyboard (the original version - there was no Das Keyboard II at the time) and the Unicomp Customizer, which is based on the original Model M technology. The possibility of a brand new Model M with Windows keys was simply too difficult to pass up and I opted for a black, 104-key USB Customizer (which looks wicked cool, check out the image on the right!)

Although I've only been using this keyboard for a few hours I can safely say that it's the best keyboard I've ever used. The tactile response is simply astounding -- basically everything I've said before about the Model M is equally true for this keyboard. Unfortunately this also includes the fact that it's a very large keyboard, which can sometimes mean too large; the finger travel for some of the keystrokes is a little much for my really small fingers (particularly when I have to right-shift or use one of the function keys). I guess the best thing ever would be a Microsoft Natural-style ergonomic keyboard with buckling spring keys (a la Model M). Maybe even one with blank caps... one can only hope :-)

As an aside, the Israeli tax is murder. Aside from exorbitant shipping price (not PCKeyboard's fault, it's just the way things are...), the Israeli customs laws dicatate a 15.5% VAT on every package whose value is higher than $50 (the tax can be higher, depending on the content), but they include shipping in the tax calculation!

Sunday, August 20, 2006 6:53:53 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Development | Personal
# Monday, July 31, 2006
From a newsgroup post, I particularly liked this reply by Hans-Bernhard Broeker:
> Luckily, it was the only bug introduced this way.

... the only one you've *found* so far.  Absence of evidence is not evidence of absence.

Monday, July 31, 2006 6:30:39 PM (Jerusalem Standard Time, UTC+02:00)  #    -
# Friday, July 21, 2006

Despite having a lot to write about, the current state in Israel doesn't lend very well to my writing habit. I need to be in a specific mood to write properly, and my mood this past week could hardly have been further away.

I'm still up north; Monfort is situated in Kibbutz Sa'ar, just north of Nahariya. It means that when I'm at work I can hear everything - the Israeli artillery attacks, the choppers and planes constantly flying to and from Lebanon, and the Hezbollah-fired Katyusha rockets crashing down on most Israeli cities and settlements up north. When I go home, be it to my parents in Qiryat Haim or my own apartment in Haifa, the rockets follow. There are air-raid sirens every few hours, and explosions to complement the waiting.

Ironically it's not the rockets that really scare me; the air-raid sirens are the ones that really give me a fright, a throwback to yet another conflict that had absolutely nothing to do with us. Even wrose, there is nothing quite as jarring as walking the streets of Nahariya or Haifa; the usually busy streets and packed shops are shut down, closed, devoid of life. I make it a point to support whatever businesses that choose to remain open despite the situation (such as my own company). There is solidarity, and there is also exasperation.

Lebanon has no claim in Israel. There is no Israeli-Lebanese dispute. Two nations which could under other circumstances live happily in peace are now actively busy with survival because a bunch of freaking lunatics claiming to act under the volition of a nonexistant deity decided the time was ripe to kill. So here you are, assholes: the killing has begun, on both sides. I hope you're fucking happy.

Friday, July 21, 2006 10:50:55 PM (Jerusalem Standard Time, UTC+02:00)  #    -
# Thursday, July 6, 2006

Seeing as I had quite a few hours to spend in Beijing and no agenda what-so-ever, I figured I'd just go with a guided tour. While a good idea in concept this proved to be impractical because the guided tours provided by the hotel require a reservation at least one day in advance. I suppose I could try and look up a different guided tour, but as hardly anyone speaks English in Beijing it didn't seem worth the time.

I took my luggage on me and started walking around Jianguomen district; although the area directly near the hotel is strictly geared to tourists it was still a fascinating walk. For starters, DVD shops are rampant (I saw at least 7 different stores in a two-street block) - I wouldn't be half-surprised to find out that these were mostly pirated/fake DVDs, particularly considering the kind of people who were attempting to lure me inside. In fact, just about everywhere salespeople were practically dragging me inside their stores to look at their merchandise; I suppose it's a good thing that I'm about 10cm taller than the average Chinese, and an annoyed look was usually enough to make them back off. It wasn't nearly as easy with the beggars and street urchins though, firstly because they're much more persistent and second because it's a lot harder to ignore a child and/or give him/her an angry look. The day before one of my Japanese associates made the mistake of giving a kid some change, and we were busy fending off other kids for the rest of the way.

Tiananmen East Station (source)

Just walking about Jianguomen got old after a couple of hours, and I was looking for something more intelligent to do, at which point I decided to do some sightseeing. Tiananmen Square seemed like the right place to visit, and since I was already in tourist mode I figured I'd take the subway instead of a taxi. This turned out to have been a very good idea for two reasons: first, the Beijing subway is quite efficient, with two stations directly on either side of Tiananmen Square (not to mention saving quite a bit of time and money on the cab ride); second, it provided a fantastic opportunity to witness Chinese culture firsthand. I was the only European anywhere in sight on the subway both on the way there and the way back and the train was packed. At one point I was standing near one of the doors and a women came in - the Chinese are an amazingly small people, this particular woman was probably around 1.45m tall - and almost ran into me. She looked up and, to my utter amusement, gave an incredibly fearful look and practically ran away to the other side of the subway car.

This would be a good opportunity to mention that the Chinese women are absolutely beautiful. Besides the fact that they are an apparently slim people (I saw ridiculously few obese, or even mildly fat, people during my time there), the percentage of good looking women in China is amazingly high, as is just how beautiful they are. Going back to Israel was something of a downer in this respect...

Beautiful drawing on rice paper

Anyway, 3 Yuen and about 10 minutes later I was standing at the outskirts of Tiananmen Square. I walked the perimeter to get a good look around (and was surprised at how serious the looks on the honour guard's faces were). The National Museum of China is located directly in front of the square; I realized this when a woman (who spoke very good English) addressed me and tried to get me to go to an art exhibition just above the museum entrance where "some of her work is shown." Regardless of my artistic inclinations - or, more to the point, lack thereof - I was completely put off by her tendency to shower me with ridiculous compliments to get my attention. I do not appreciate a compliment from someone who doesn't know me at all and has an agenda. I did, however, consider going into the museum when a young art student who also spoke very good English approached me. Where the previous woman failed due to dishonest praise, this kid won my attention with sheer enthusiasm and happy disposition. I followed him to the art gallery (which, as he promised, was air conditioned - a very good thing when you're walking around with 15kg of luggage and it's 35 degrees centigrade!) and spent the next hour looking at various drawings while the art student explained the various techniques. His own work was (to my untrained eye) techincally impressive but didn't really inspire me; a series of four drawings on rice paper depicting the four seasons really impressed me, though. The drawings had several details in common (house, boat and birds) but were completely different in spirit. For a short while there I actually considered buying all four, as they were so engaging, but the cost was prohibitive (starting price of 400 Yuen - over $50 - per painting). I eventually bought the drawing for autumn (picture on the left) for my mom and after a bit of haggling got the price down to 250 Yuen. I was probably ripped off, but my negotiation skills are still rather lacking and, frankly, the kid was really doing his best and deserved his commission.

Tiananmen Square (source)

After leaving the art gallery I strolled around Tiananmen Square for almost an hour. It is huge, packed with tourists and duly impressive irrespective of its history. I didn't have the time to go the Forbidden City (according to people I spoke with, this alone can take an entire day) and didn't have any other reasonable plans, so I eventually took the subway back to Yonganli station (near the hotel) and headed to a local massage parlor for another hour of rest and relaxation. Although not nearly up to the standards of the hotel masseur (and significantly cheaper at that) it was still very pleasant. After a shower and a rest I still had almost five hours before I was to leave for the airport. Deciding to avoid exerting myself again - spending 10 hours on a plane in a drenched shirt is not my idea of fun - I searched for a local internet café. A local Starbucks was supposed to have wireless internet access, but apparently didn't - no-one could tell me why; I settled on a small ice-cream parlor which had wired access and spent almost an hour there.

I was trying to decide what to do next when my brother reminded me he's looking for a new pair of headphones. I googled a bit and three minutes later had a couple of speciality shops to visit. The sites were completely in Chinese, so I asked the owner of the establishment I was sitting in to copy down the address of one of the stores (whose name I can't even pronounce) onto a note. Not only was he willing to do this, but he called the store directly to make sure that they'll still be open by the time I got there; I've come to the conclusion that the Chinese people are amazingly curteous and helpful if you can get over the language barrier. The shopowner explained that the shop is located about 20km away so I decided to take a cab; it was a smart move in that I would have gotten completely lost had it not been for the taxi, and a less-than-smart move in that it turned out to be a fairly expensive (in Chinese terms) 45 minute ride. I had no idea what to expect when I got there, and was completely dumbfounded to find that I've just entered a huge mall (almost as large as the biggest general-purpose mall in Israel) completely dedicated to electronics! It would've been heaven had it not been for the fact that I arrived just minutes before closing time. The shop numbering scheme didn't make a whole lot of sense and I was getting extremely anxious, thinking that when I find the shop it'll be past closing time. I also got a lot of curious stares from the completely Chinese shopkeepers and customers, apparently not used to having a European guy moving purposefully about their mall with a large bag...

New hi-end toys

When I finally found the shop, its owners were apparently just preparing to close down. After all the effort it took to get there I wasn't about to let them close down before I've had my fill; I asked (using mostly sign language, as the shopowner didn't know a word of English, nor did any member of her family - which were all present by the way) to hear the Beyerdynamic DT880 headphones. I've been reading about these cans for a while and they've been said to compare favorably to my aging Sennheiser HD600; it seemed to be a good time to replace the latter, and I was interested in what Beyerdynamic had to offer. I'll leave the detailed review for a later post, but suffice to say I was extremely impressed with these cans. I then requested to listen to headphone amplifiers; I spent about five minutes each with amps from G&W Tsinghua University (a Chinese manufacturer of hi-end audio equipment which was previously unknown to me), including AT-F100 and the (apparently very popular) TW-J1. Neither one really struck a chord with me, so I gestured to the shopowner that I'm interested in other equipment; she then pulled a brand new box from a storage cabinet and took out a T-2.6F headphone amplifier from the same manufacturer. I was so utterly blown away that I took out my credit card on the spot and bought two pairs of DT880 and the T-2.6F: about $260 for each can - not cheap compared to the US, but about 30% lower than the price in Israel - and an additional $350 or so for the amp.

When I was done with the shop I took a cab back to the airport, which took over an hour but still cost only 100 Yuen ($14 or so) including the 10 Yuen for the expressway toll. The cabby apparently didn't know precisely where to go because although he did get me to the airport, he dropped me off quite far away from the terminal entrance; this was especially annoying with all the luggage I was carrying (a couple of plastic bags, my laptop, the large side bag and now also the relatively heavy headphone amp in a cardboard box). I made it through customs and check-in to find one of the smallest but best-kept lounges I've yet been to; it was very clean, very quiet and very comfortable. I spent a couple of hours there before the flight back and had a very pleasant time (despite a spotty wireless internet connection) before it was time to get on the flight to Istanbul. The flight back was almost exactly the same as the flight to Beijing, so if you're interested in the details you can check out the previous post.

Thursday, July 6, 2006 2:23:34 PM (Jerusalem Standard Time, UTC+02:00)  #    -
Send mail to the author(s) Be afraid.
<September 2006>
All Content © 2022, Tomer Gabel
Based on the Business theme for dasBlog created by Christoph De Baene (delarou)