I just diagnosed myself, BAM!: Ulnar Nerve Entrapment
If you work with computers very much, like me, I have an advice for you. Do not rest your elbows (on the desk or chair). This eventually causes some numbness in the little finger. See the perfect explanation here.
gnuplot performance on windows
gnuplot is an unbelievably good tool, if you don’t know it yet, check it out. Though the gnuplot Windows package has performance problems. No matter how much I tweaked the parameters and tried different rendering engines (terminal in gnuplot jargon), I couldn’t fix it. It was taking more than 5 seconds to render 350k data points.
Cygwin is a part of my toolchain. Today I figured I might give gnuplot with Cygwin/X11 a shot. Cygwin also has a gnuplot package which is built for Cygwin environment. Cygwin also has a X11 package, so that you can run a X11 server on your Windows box. Actually there are several other X11 server implementations for Windows out there, even commercial ones. Anyway, I’ve tried to plot my graphs using Cygwin gnuplot and X11. And voila! It was about 5 times faster.
So, having gnuplot performance problems on Windows ? If you don’t mind installing Cygwin (which is simply a double click and next, next, next) you can enjoy a faster gnuplot experience.
Free virtualization on headless hosts; vmware-server2 and virtualbox (vboxheadless)
Virtualization is cool. It gives you the ability to:
- Deploy nodes into your cluster in minutes
- Get the most out of your hardware, even if your software is not very efficient. i.e. it is proven that multiple instances of MS IIS running on a host in separate VMs are more efficient than a single MS IIS instance on the host. Which implies that MS IIS is not engineered to utulize hardware very well.
vmware-server 2
In short:
- Installation: very easy.
- Management: Web access did not work. VMWare Infrastructure Client did not work.
- Stability: Crashes on guest OS update.
First of all, I want to say that I’ve used this a couple of years ago and I was very pleased with it. Now I tried to install it on CentOS 5.5 host to install a Windows 2003 guest OS. Installation was a breeze but managing the virtual machines turned into a nightmare. I couldn’t reliably access to the web interface no matter what I tried. According to logs there was an error in SSL handshaking, tried to solve the issue by trying a few workarounds presented in forums, with no luck.
Then, I recalled that there was a native desktop application called VMWare Infrastructure Client which I used previously. It was previously located on https://host:8333/clients/ but now it is not there for some reason. It is not even in the docroot directory on the host. It simply is not there.
Then, with the help of google I found the executable and installed it. I connected to the host but the console was always blank (white). Then I googled a bit more to find out that VIC has some problems if it co-exists with the new VIC (VMWare sphere client). Then I removed the new client and installed the v2.5 again. This time it worked. I installed the Windows 2003 server. Mind that I occasionally lost connection to the console during this process.
After the initial boot, I tried to update the server through Windows Update. One of the child processes of VMWare consistently crashed at this point, rendering whole VMWare unusable. I tried a few times, it always crashed at this point with a core dump and backtrace in the logs.
At this point, I give up giving any more chances to vmware-server 2 on CentOS 5.5.
VirtualBox
Then I started looking around if VirtualBox had support for headless hosts, it turned out it has some basic support — with decent documentation.
First install VirtualBox for your platform. I simply added repo to /etc/yum/repo.d and installed via yum. Then install extension packs. Which basically boils down to this;
[root@tr ~]# wget http://download.virtualbox.org/virtualbox/4.0.0/Oracle_VM_VirtualBox_Extension_Pack-4.0.0-69151.vbox-extpack [root@tr ~]# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.0-69151.vbox-extpack
See Installing Guest OS on a headless VirtalBox host.
Notes:
- In the example, it is using NAT as networking, you probably want bridged;
- At first, I tried –cpus 4, but it gave me “Error: failed to start machine. Error message: Unknown error creating VM (VERR_VMX_MSR_LOCKED_OR_DISABLED)”. I simply fell back to –cpus 1, and it is working fine.
I’ve used:
[root@tr ~]# VBoxManage modifyvm "Win2003E" --memory 2048 --acpi on --boot1 dvd --nic1 bridged --cpus 1 --bridgeadapter1 eth0
Then, of course we need Guest Additions. It is a matter of clicking on traditional VirtualBox installation, but this is a headless installation. I just mounted the VBoxGuestAdditions.iso myself.
[root@tr ~]# VBoxManage storageattach "Win2003E" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium /usr/share/virtualbox/VBoxGuestAdditions.iso
It automatically starts the setup, just follow the wizard and you’ll be on your way.
At this point, you should have Windows 2003 server up and running with VirtualBox Guest additions. I’d also recommend taking snapshots along the way.[root@tr ~]# VBoxManage snapshot "Win2003E" take "VBox guest additions installed"Nice.
Grooveshark Downloader
I’ve spent the previous night studying (sniffing) how grooveshark works and today I’ve coded this downloader. It has no error handling and it is full of bugs. But it kinda works. You can try it.

Java Gotcha: Executing code via Timer vs ScheduledExecutorService
A customer called to report that he cannot read values of two of his devices from the server. In fact, he was not able to read any values of any devices, but since he is served with the most up to date cache results for the other devices, he was not aware of that part of the problem. I connected to the server via remote debugging of Java, which kicks ass by the way, only to find out that the Timer is not executing my code which update the values of the devices currently being watched. It was weird, because the server has been running for weeks and it just stop functioning. It turned out that if an exception occurs in the code Timer is calling, Timer stops executing the code all together in the future. Which, in practice, means that one of your threads is not functioning anymore. Then I learned about ScheduledExecutorService, it is specifically designed to run code. It handles exceptions much more gracefully. So, long story short, use ScheduledExecutorService instead of Timer when you want to execute code. The good thing is, it is quite easy to port your code to use ScheduledExecutorService.
Recover Missing Android Market and YouTube App in Samsung Galaxy S
Why does it happen ?
- Most likely you are in a region where vendor does not add these apps (or operator does not want, who knows)
How to fix it ?
I think the best fix would be to use a stock firmware where these apps are available, this is the cleanest and healthiest approach imho. To do that;
- Get necessary tools “ODIN + PIT” and a firmware (I picked I9000XXJPY) from http://forum.xda-developers.com/showthread.php?t=846913
- Follow the instructions about how to use odin here http://android.modaco.com/content/samsung-galaxy-s-s-modaco-com/311349/flash-now-your-samsung-galaxy-s/
At this point you should have Android Market and Youtube apps working, but market has a region restriction, for instance you might not see Skype in the market. A workaround is to root your device and install MarketAccess. Here’s how.
- Root your device by following the instructions at http://forum.xda-developers.com/showthread.php?t=803682
- Install MarketAccess from http://amip.tools-for.net/wiki/android/marketaccess
Now you can pretend that you are on other operator (i.e. T-Mobile USA) and do stuff.
I might write a review about android platform in another post, if I do it, it will be nasty.
TX FIFO clear problem solved
I’ve mentioned a problem earlier; Expansion Module Architecture Design Experiences of ENDA Devices. It turned out that the API function provided by the MCU vendor SysCtlPeripheralReset() fixes the issue. The slight problem was that, this function blocks for a moment and causes a performance penalty if you use it in a hot spot (such as in my example, which is called my a hardware timer with a high frequency). So I ended issuing the peripheral reset, do business logic, start the peripheral again. It is working like a charm now.
// Issue reset HWREG(SYSCTL_SRCR1) |= SYSCTL_PERIPH_MASK(SYSCTL_PERIPH_SSI0); // Do business logic // Release reset HWREG(SYSCTL_SRCR1) &= ~SYSCTL_PERIPH_MASK(SYSCTL_PERIPH_SSI0)
Online Advertisement Performance – Facebook Ads vs Google Ads vs Local Ads
I was planning to write on this topic for a long time. Long story short:
| Ad network | CTR (Click through rate) | Cost per click (cent) | Conversion rate | Throughput (registration/day) | Cost per sign-up (USD) |
| 0.074 | 6 | 40 | 35 | 0.15 | |
| 1.68 | 44 | 38 | 50 | 1.15 | |
| A Turkish ad agency | 0.24 | 13 | 10 | 500* | 1.3 |
Cost per signup (CPS)
Obviously, this is one of the most, if not the only, important things to consider. This is the actual cost you are paying for each potential customer.
Considering that
- paying customer ratio (P) is 0.02
- average transaction (T) is $16
- cost per signup (C) is $0.15
For 100 signups, you’ll earn $32 and your cost would be $15. So PT/C is your profitability.
CTR
CTR heavily depends on the platform.
Facebook: CTR of this platform is the lowest. This is not your concern obviously, since you don’t pay for it anyway. That is Facebook’s job to improve it, for their own sake. I believe the reason is that the ads are really really far away from the real content and not intrusive. I believe this improves the Facebook users’ experience.
Though, it is a bit surprising. Facebook ads are highly targeted, you select who you want to show your ad to. So they should be interested in your ad, right ? Well, looks like that’s not the case.
Google is a big surprise is here, the CTR there is a whooping 1.68. Google also offers targeted ads, like Facebook. But there’s a difference. Google shows the relevant ads only when the user is searching for exactly that content whereas Facebook shows the ads to the relevant audience, but just not when they are actively looking for that particular service. Of course, this is just my observation, not a scientific conclusion in anyway but I believe this is the key difference.
Local ad agency’s ads are insanely intrusive, unbelievable. They are also loosely targeted, only relevant sites display the ad. Though, their CTR is not very high either, 0.24. They say this is above the industry standard for their market.
Throughput
This is an interesting factor to consider. Even though, a “maths only” view suggest that sole CPS value is the most important one, I’m sure people with knowledge about economy could name 10 theories about the importance of this factor too. A high, but costly, throughput can give you early market penetration and that can change everything, or not, I don’t know :)
Imagine an always increasing revenue graph, like a triangle. Your revenue is X at T1, and 2X at T2. Now if you shift that triangle to left (earlier market penetration), your revenues increase substantially at each T point.
Among the three ad platforms mentioned above, Facebook provided a very stable throughput each day, almost the same everyday. After I applied my filters of the target audience, it was something like 340k people of 600M Facebook population. So if we add multilingual support to our service, our target audience will go up to 3.5M. Which I expect to bring a 10-time fold to the Facebook throughput.
Google’s performance was not stable, I believe it is a living social entity.
Local ad network drove high traffic during social events and when their ad pool is smaller (meaning that we get more share of the page views — impressions).
Note
Above mentioned costs might apply only for the target audience we were interested in. So it might be a bit misleading. If competition is harder for the target audience, the costs might go up.
PHP 5.3 is bitching about insecure authentication with MySQL 4.1+
Looks like quite some stuff has changed, since I stopped coding PHP :)
Here’s what I got when I try to connect to a mysql server.
Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2000): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file in C:\Users\Engin\Code\PHP\beenshard\beenshard\shards\shard2.php on line 10
Solution;
SET old_passwords = 0;
UPDATE mysql.user SET Password = PASSWORD('testpass') WHERE User = 'testuser' limit 1;
SELECT LENGTH(Password) FROM mysql.user WHERE User = 'testuser';
FLUSH PRIVILEGES;
Third query is just to make sure everything is fine, you should see 41 there.
Jeez.




