Coding, coding, coding....

Blogs

The day like today...

I am generally happy with the Mac OS X installed on my Macbook. It is quite a good system and in most cases it works as expected.

Sometimes however it drives my crazy. I don't think this is a system created for software developers. At least not for software developers who work on the networking software.

I tried to do final tests over my Tigase Jabber/XMPP Server server and just couldn't do what I needed. One of the tests, called performance test, require sending 1000 messages over concurrent 1000 network connections between the Testsuite and the Tigase server.  Whatever I did, I couldn't successfully open more than 900 concurrent connections. I tried to play with numerous setting, like maximum opened files, file descriptors, tweaking TCP/IP settings, nothing helped.

On Linux I can easily manage to open 60k connections and all works fine without failure. I wonder whether this is kind of a hidden configuration parameter or maybe it is a desktop version of the Mac OS X feature and to open more connections I have to have server version...

Any suggestion or help with forcing Mac OS X to handle more network connections would be very much appreciated. Otherwise I will probably replace the nice system with the system which works...

Number of CPU cores does really matter

I always wondered if the multi-core or hyper-threading technology is only marketing thing or ot really gives you a significant performance boost in your system. I mean home based system not in enterprise servers. Are all those core really used and given that you have a shared memory and a shared hard drive can you make use of all those cores.

I had to replace my old server which hosts all tigase.org services (websites, e-mails, Jabber/XMPP, SVN, project tracking....) as it couldn't cope with the load and it had too little memory. And as usually upgrading memory in old systems is much more expensive that buying memory for the new machine.

At the end I decided to build a new server from scratch. 64bits, 4GB RAM, 500GB HDD in Raid-1 and a CPU. I wasn't really convinced for multi-core so I thought for a moment about buying multi-cpu motherboard. I coulnd't, however find any non-Xeon multi CPU motherboards and XEON motherboards were quite expensive, don't even mention about CPUs.

Ok, I turned back to multi-core. Quad core was not so much more than Dual then I gave it a go.

Gentoo installation was quite smooth and suprisingly fast. Even though I've put -j5 option just in case to the make command didn't believe too much in it.

The compilation was so quick so I wanted to see what is the real gain from the multicore system. The best test as usual is the kernel compilation. I ran compilation with a single thread and then two threads, three, four, five and six. Below are results:

time make all -j1 make all -j2 make all -j3 make all -j4 make all -j5 make all -j6
real 12m58.898s 6m46.075s 4m44.324s 3m56.030s 3m48.276s 3m46.681s
user 11m42.690s 11m48.650s 11m53.350s 11m59.490s 12m7.560s 12m11.010s

 Hm, colcusion: Number of CPU cores does really matter. Even in home based systems...

Unbelievable bad and frustrating support - a single customer doesn't count....

I have just experienced 2 weeks of Internet connection outage. That is really bad experience for a person who bases his work on the Internet technologies. But that was not the worse part of all.

The worse part was the support from the Internet provider side.

I called them every day to hear about the progress. For a few first days they were telling me different stories of what could happen. They tries to push the problem towards BT and asked me to do some phone line testing and so on...

After a few days one of the person from the technical team said: "Ah, there is some maintenance carried on in your exchange box. It may take up to 5 days...." Hm. First of all why they didn't tell me that on the first day? Actually there is a point in the "Terms & Conditions" document that in case of longer outages customer should be notified ahead of time of that event.

Of course nobody cared to notify me so just in case I called the technical support the next day. I was told that, indeed there is a maintenance carried on but usually customers doesn't get disconnected. A short connection drop may happen only. So I could be accidentally disconnected by the engineer and from now on my connection is flagged as faulty and engineer will looks at it in a few coming days. When? Maybe tomorrow but they have 6 days to respond for the issue.

I called again for next 2 days to hear exactly the same story. So at this point I stopped to believe anything would change in acceptable time. I ordered a business class Internet connection from a different provider on a second phone line and sent complaints to the old provider customer service and customer care. I have also sent an e-mail to the technical service in this provider.

In meantime I noticed the old provider charged my bank account for the next month of "their service". After 2 weeks I had enough. Nothing has changed. Every day the same story. I called this time customer care department to cancel my account and terminate the contract. It wasn't easy to get to them by the way. I was sent from one phone number to another 5 times before I could talk to somebody about canceling my account. I asked also for a refund for the time the service was not available to me and for the next month they already charged my account.....

This is the most "funny" part. They were very happy to process cancelation of my account but then... They said they won't refund me any money because I have just cancelled my account and I haven't given them a chance to fix the problem!

I have send a few complaints and I haven't received any response to them so far.... I have only received response from their technical service that the problem is now fixed. And indeed. Next day after I called to cancel my account the old connection started to work mysteriously. On the same day the new phone line has been installed and Internet connection from the other provider has been activated though.

I have written this story with all the details to warn you to keep away as much as possible from the Pipex Internet provider which has been just bought by Tiscali. Their technical support is a disaster. I wouldn't recommend it to my enemy. And the story is not over yet. I am still waiting for a response to my complaints....

Sorting in SQL statements 2.0

 A few weeks ago I wrote an article about custom sorting order in SQL statement.

Today I tried to do the same in MS SQL Server. Obviously the solution described there didn't work as SQL Server has it's own ways to do things. It uses 'case' statement to define custom order. The query for SQL Server should look like this:

select Animal from animals 
order by case id
  when 3 then 1
  when 4 then 2
  when 10 then 3
  when 7 then 4
  when 9 then 5
  when 5 then 6
  when 6 then 7
  when 1 then 8
  when 2 then 9
  when 8 then 10
end;

The question which now arises is what happens if the 'id' is different from all possible values specified in the case statement? Well, the order for such a value is unspecified therefore the result is the same as if you specified else null after the last when. You can control it however and put there else 1000 after the last when. In such a case all cases not enumerated in the case will go to the end of the result lists and you can filter them out with top instruction:

select top 10 Animal from animals 
order by case id
  when 3 then 1
  when 4 then 2
  when 10 then 3
  when 7 then 4
  when 9 then 5
  when 5 then 6
  when 6 then 7
  when 1 then 8
  when 2 then 9
  when 8 then 10
  else 11
end;

Black spots on the Sun or what?

Today it was like a disaster. All the computer equipment was dead when I woke up in the morning. The iPhone and the Macbook was in a sleep and I couldn't wake them up. Hard reset was the only way to bring them back to live.

The tigase.org server was dead too - hard reset brought it back to live. I have no idea what happened last night. Was it something like a short electricity interruption? That could explain why the server was not responding but the Macbook has it's own batteries so that should not affect the laptop. It could be something like electricity spike which could affect all equipment plugged into a socket but the iPhone hasn't been connected to anything.

Black spots on the Sun or something like this might be a good explanation but I couldn't find anything on the news boards too. Probably it was just a bad luck....

From Linux to Mac OSX - 2

After a few hours I was able to use the new machine quite comfortably. I got used to the application menu in a different location and the fact that everything just worked made the playing with the machine a great fun. Of course I had those small problems with almost everything initially. E-mail account and iChat account haven been setup at the initial configuration time but it took me a couple of minutes to figure it out how to add more e-mail accounts and more IM accounts.

So far it was nice and pleasant experience. And to be honest I was very hesitant before starting this article as I really didn't want to write an article full of complaints. In fact there are very few complaints for the quality and comfort of the overall usage and when we have to talk about quality and comfort it is much more fair to talk about the hardware separately from talking about the software.

I have no single complaint for the hardware. This is top quality product. High resolution 17" screen gives you a plenty of space for comfortable work. I can easily put 3 emacs windows side by side and edit one file while seeing content of 2 other files. The picture is sharp and stable. No dead pixels and no darker/brighter areas.

Another very important element - keyboard. Very comfortable to use. You can very well feel when the key is pressed and when you eventually get used to a different MacOSX layout you will feel like at home in quite short time.

Speakers - the best I have ever seen (heard) in laptop. Loud and clear voice. Just excellent.

Mousepad - well, I hate mousepads, all of them. And this is not multi-touch like in Macbook Air. My impression it is still better then in other laptops I used to use but I grab real mouse whenever possible anyway.

When we speak of a real mouse then we can talk about either USB or Bluetooth. I tried both and both worked very well. Thus I can also say that Bluetooth is working very well. I have Bluetooth mouse and keyboard connected at the same time. No problems so far.

WiFi - well it works, just works. My impression, however is that it is not very stable. I guess the software might be a cause but still I can not say too much good about it. You can of course easily find all available networks and easily connect to a selected network. It works for most of the time but sometimes it stops and I had 2 OS hangs which might be related to the WiFi network usage. I try to use ethernet whenever possible which works just fine and I haven't had any problems with it.

All other stuff like built-in camera, USB and Firewire ports work and I haven't had any problems with them. Even though I have many devices connected at the same time: external HDD on Firewire 800Mbit/sec, external digital video camera on USB2 and I am importing video clips from the camera to the external HDD.

Now we can talk about software installed.

From Linux to Mac OSX - 1

The package This article begins a series of articles about migration from the Linux system to the Mac OSX system. Well, maybe not a complete migration. I still have 2 laptops and a server running Gentoo Linux at home. So I am not going to get rid of Linux at all. The Mac OSX will be however my main development platform just to make sure I can learn about it as much as possible.

The goal of the series is to "prove" that the Mac OSX is a really good (or bad) development platform and what to do to adjust it to our needs and habits.

CD for "all" systems

By all systems I mean Linux, Mac OSX, Mac OS9 and Windows.

At home we try to work on our English all the time and we buy books to help us improve our language skills. Ideally the book should have a CD included with interactive exercises and pronunciation. All the CDs I bought before worked only on Windows systems and sometimes I was able to run them under Wine.

We bought today "Cutting Edge" Student's Book with CD included. To my big surprise when I looked at system requirements I saw: Windows 98/2000/ME/XP, Mac OSX and Linux GNU/Linux Kernel 2.6.

Client denied by server configuration error in Apache.

Just in case if somebody else has a similar problem and can't get the Apache server working as expected.

I have tried to setup proxy_mod under apache to forward HTTP traffic from AJAX Jabber client to the Bosh component running on Tigase server. It was working fine for a long time on my Gentoo server. I have recently wanted to run more tests on a separate machine and had this problem. It was a system based on the Debian distribution and the proxy_mod didn't want to work at all displaying the error message in a log file:

[error] [client ::1] client denied by server configuration: proxy:http://127.0.0.1:5280/xmpp/
, referer: http://localhost/F5A379CEC35AEBCC5FFA11BA8A33CD02.cache.html

All you need to do is to modify proxy.conf file for your Apache2 installation and setup proper permissions. By default the proxy is disabled for all. In my case I had to enable it just for a localhost.

Example configuration from my vim mods-enabled/proxy.conf file:

<IfModule mod_proxy.c>
  ProxyRequests Off
  <Proxy *>
    Order deny,allow
    Deny from all
    Allow from localhost
  </Proxy>
  ProxyVia On
</IfModule>

iPhone crash?

Today I connected iPhone to the computer. iTunes started as usual and after a while it asked me whether I allow it to send a iPhone crash report to Apple.

Hm, interesting and kind of a relief to see that the best also have problems sometimes.

Of course I didn't see any crash in my iPhone. Everything worked normally all the time. Like always from Apple - good usability hint - hide problems from the end-user...