<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>

  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-10827258-1’]);
  _gaq.push([‘_trackPageview’]);

  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  })();</description><title>Backward compatible</title><generator>Tumblr (3.0; @babuskov)</generator><link>http://www.backwardcompatible.net/</link><item><title>New way of spamming: taking over free e-mail accounts</title><description>&lt;p&gt;&lt;div class="aju"&gt;&lt;img class="ajn" id=":0_46-e" name=":0" src="https://ssl.gstatic.com/ui/v1/icons/mail/profile_mask2.png"/&gt;&lt;/div&gt;
&lt;div class="iw"&gt;&lt;span class="gD"&gt;Today I found out something really interesting. I send an e-mail newsletter to some 380.000+ subscribers. Suddenly, I got a flood of auto-reply messages, coming from various Yahoo mail users. The auto-reply message contains different spammy content with links, all written in a very personalized manner. Looks like spammers were able to hack into user accounts, most probably using easy to guess passwords or password recovery questions, and then set up a nice auto-reply.&lt;/span&gt;&lt;/div&gt;
&lt;div class="iw"&gt;&lt;/div&gt;
&lt;div class="iw"&gt;&lt;span class="gD"&gt;I applaud Yahoo for not allowing the change of the subject line. They all start with Auto-reply so it’s very easy to see through the scam. Nevertheless, if you have same auto-reply for thousands of users, it should really ring some alarm in Yahoo mail team, shouldn’t it?&lt;br/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/17546349716</link><guid>http://www.backwardcompatible.net/post/17546349716</guid><pubDate>Mon, 13 Feb 2012 11:23:43 +0100</pubDate><category>yahoo</category><category>mail</category><category>spam</category></item><item><title>How to use IDB files of Quicken Home Inventory on 64 bit Windows?</title><description>&lt;p&gt;Directly load your IDB file from Quicken Home Inventory on any 64 bit Windows system. It works on 32 bit as well, of course. Today, a new version of Attic Manager is released, version 3.00. This version is able to load data directly from IDB files, there is no need to install any additional software. You don’t even have to have Quicken installed. This also means that you can run this option on 64 bit Windows 7 for example, or even on Linux.&lt;/p&gt;
&lt;p&gt;Attic Manager can also load the inventory data from QHI and MDF files. QHI files are also loaded without any additional software.&lt;/p&gt;
&lt;p&gt;For MDF files you need to have Microsoft SQL Server Express Edition installed. This is a freeware from Microsoft that comes with QHIM, so if you already have Quicken installed on the same computer, you don’t need to install anything.&lt;/p&gt;
&lt;p&gt;In any case, Attic Manager is now unique software on the market, being able to load all Quicken Home Inventory formats and allowing you to keep track of your items on any PC.&lt;/p&gt;
&lt;p&gt;There are even hints of Mac version coming soon.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/15584192485</link><guid>http://www.backwardcompatible.net/post/15584192485</guid><pubDate>Mon, 09 Jan 2012 23:17:17 +0100</pubDate><category>quicken</category><category>quicken home inventory</category><category>qhim</category><category>Windows7</category></item><item><title>Why aren't you using InnoDB instead of MyISAM?</title><description>&lt;p&gt;For this particular application, I simply cannot afford it. MyISAM is able to cache index and data separately, using it I can keep the whole index in RAM and website works great. I tried to convert to InnoDB, the result was 4x larger database and 20 times worse performance, mostly due to the fast that index and data gets the same priority for caching so it was killed by disk I/O. If this website was earning enough money to buy at least 4 x more RAM it might not be a bad idea. However, it this case I’d rather use Firebird - it has a similar memory footprint as InnoDB, but has much more features (*real* stored procedures and triggers that work without problems, ability to use table aliases in delete statements, database events functionality, better resistance to system crashes, etc.)&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/15300704893</link><guid>http://www.backwardcompatible.net/post/15300704893</guid><pubDate>Wed, 04 Jan 2012 19:07:40 +0100</pubDate></item><item><title>Why is MySQL still a toy database</title><description>&lt;p&gt;I have been using MySQL for a very intensive read-write web application (averaging 102 queries per second) for more than two years. I had ups and downs with it, like crazy MyISAM behavior that readers can block writers AND OTHER READERS. Basically, a table level lock is issued for read. I have 100+ records in a table, so it takes a while to find anything that is not indexed. In the meantime, users are pondering (102qps, remember) and load goes up so much because of web server processes queuing like crazy. Ok, I learned not to do that anymore. I now use binary logging, restore to a different server and query there. Maybe a switch to InnoDB would be a good idea, but in this case I’d rather use a serious MVCC database like Firebird. Why, you might ask… well, here’s one of many reasons, the one that prompted my to write this:&lt;/p&gt;
&lt;p&gt;In Firebird, I can happily do this:&lt;/p&gt;
&lt;pre&gt;delete from atable a1 &lt;br/&gt;where exists ( &lt;br/&gt;select 1 from atable a2 where a1.data = a2.data and a1.id &lt;&gt; a2.id );&lt;/pre&gt;
&lt;p&gt;It just does it, and fast, because index on primary key field ID is used.  In MySQL, to quote the manual:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;“Currently, you cannot delete from a table and select from the same table in a subquery.”&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Come on, this is one of the most basic database operation. So, what am I now to do? Waste my time dumping the list of IDs to delete to some temporary location, and then iterating that list to delete. :(&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/15237592490</link><guid>http://www.backwardcompatible.net/post/15237592490</guid><pubDate>Tue, 03 Jan 2012 12:53:59 +0100</pubDate><category>mysql</category><category>firebird</category></item><item><title>Scrolling back in screen</title><description>&lt;p&gt;A few years ago I discovered screen, a nice Linux tool that enables you to detached from terminal with commands running and all in the background. You can even connect later from a different computer and continue where you left off. I initially used it for rtorrent, but now I also use it to administer remote computers, for example when I start to do something that might take more than a day, I can log back in tomorrow. Also loggin in from home/work to complete some task, etc. Another use is administering remote computers on dial-up (yes, there are some) or slow and unstable 3G connections. Even if connection breaks down, I can log in later and pick up where it stopped.&lt;/p&gt;
&lt;p&gt;One of the annoying “problems” with screen is that shift+page up/down does not scroll the buffer. This is due to the fact that screen has its own buffers. To work with them you need to enter the “copy mode” using &lt;strong&gt;Ctrl+a followed by [&lt;/strong&gt;. Since I use non-English keyboard that’s Ctrl+a, AltGr+f. Hard to remember when you don’t use it often.&lt;/p&gt;
&lt;p&gt;I use Konsole, and I found a way to make it work by adding the following lines to .screenrc (in my home directory):&lt;/p&gt;
&lt;pre&gt;termcapinfo xterm|xterms|xs|rxvt ti@:te@&lt;/pre&gt;</description><link>http://www.backwardcompatible.net/post/15023657993</link><guid>http://www.backwardcompatible.net/post/15023657993</guid><pubDate>Fri, 30 Dec 2011 13:26:43 +0100</pubDate><category>screen</category><category>linux</category><category>konsole</category><category>kde</category><category>remote administration</category><category>dialup</category></item><item><title>Why is Firebird better DBMS than Oracle?</title><description>&lt;p&gt;Beside being free (both as beer and also open source), you don’t need 24x7 DBA and there are generally less headaches. Here’s a nice example explained by Norman Dumbar in a mailing-list post. Norman administers over 600 Oracle databases and about 40 Firebird ones:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Oracle uses log files for REDO and has ROLLBACK_SEGMENTS or UNDO Segments (depending on Oracle version) for UNDO. It never uses log files for UNDO - and UNDO is what provides Read Consistency/MVCC in an Oracle database.&lt;br/&gt;&lt;br/&gt;Changes are written to the LOG_BUFFER (n memory) and periodically - on commit, every 3 seconds max, or when the buffer is 33% full - flushed to the REDO logs. These REDO logs might be archived to disc when they fill up. That Depends on the database archive log mode though.&lt;br/&gt;&lt;br/&gt;These logs are used when a database is restored and rolled forward (using the RECOVER DATABASE command, for example).&lt;br/&gt;&lt;br/&gt;In order to roll back changes and to ensure read consistency, UNDO is used. These do live on disc - as tablespace files - but remain in memory in the buffer cache alongside data blocks etc.&lt;br/&gt;&lt;br/&gt;When a SELECT is started, the data returned are the data from the data blocks. Each row in a block has an indicator that tells when it was last updated. If a pending update is taking place (currently uncommitted) or if a commit has taken place since this SELECT started then the data read from that data block has changed - and is not consistent with the start time of this SELECT transaction.&lt;br/&gt;&lt;br/&gt;When this is detected, Oracle “rolls back” the changes to the start time of the SELECT taking place by looking for the UNDO block(s) associated with the transaction that made the changes. If that results in the correct (consistent) data, that’s what you get.&lt;br/&gt;&lt;br/&gt;If it turns out that there were other transactions that also changed the data, they too will be detected and undone.&lt;br/&gt;&lt;br/&gt;In this way you only ever see data that was consistent at the start of your own transaction.&lt;br/&gt;&lt;br/&gt;As long as the DBA correctly sizes the UNDO tablespace and correctly sets the UNDO_RETENTION parameter to a decent enough value, data changes are able to be rolled back happily all the time.&lt;br/&gt;&lt;br/&gt;If the DBA failed miserably in his/her duties, the ORA-01555 Snapshot too old” errors are the result. And are most irritating. Long running SELECTS - batch reports for example - tend to show up this error mostly.&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Of course, you would never see such problems with Firebird, because the old record versions are stored in database and not the log files. You don’t have to care if system crashes - after reboot it simply works.&lt;/p&gt;
&lt;p&gt;You might think that engineers who build Firebird are smarter than Oracle’s but sometimes I think Oracle is deliberately made so complicated to require DBA and also offer them job security. And also makes sure nobody can complain it’s too easy to use.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/14304762777</link><guid>http://www.backwardcompatible.net/post/14304762777</guid><pubDate>Fri, 16 Dec 2011 12:07:33 +0100</pubDate><category>firebird</category><category>oracle</category><category>dmbs</category></item><item><title>Using Quicken Home Inventory Manager on 64bit systems [FINALLY]</title><description>&lt;p&gt;No, Quicken does not support 64bit Windows 7 yet. And there are no plans to do so. A few months back, GuacoSoft has released a new version of Attic Manager that is able to load data from Quicken directly. You can then export it into csv, excel, whatever OR simply use Attic Manager to manage the inventory.&lt;/p&gt;
&lt;p&gt;Initial version of Attic Manager with this support (2.03) was only able to load data from .MDF files. However, a new version (2.50) is out now that supports .QHI files as well. It can load all data from .MDF. For files with .QHI extension, it loads all the data except image thumbnails. However, if you still keep your original images on the disk in same location where they were when you loaded them into QHIM, the Attic Manager will pick them up while importing and create thumbnails automatically. Not only that, but it will store a copy of each image into it’s database, so that you never lose it in the future.&lt;/p&gt;
&lt;p&gt;So far, this is the only way to extract data from Quicken, and it’s really the only Home Inventory program on the market that enables you to transfer all your data before migrating to a new program.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/13643162676</link><guid>http://www.backwardcompatible.net/post/13643162676</guid><pubDate>Fri, 02 Dec 2011 20:59:17 +0100</pubDate><category>quicken home inventory</category><category>quicken</category><category>qhim</category><category>qhi</category><category>export</category></item><item><title>YouTube bug report bug LOL</title><description>&lt;p&gt;Looking for a way to report a problem with YouTube software I found a link “Report a bug” a the bottom of the page. However, when I clicked it, I got redirected to:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.google.com/tools/feedback/intl/en/error.html"&gt;http://www.google.com/tools/feedback/intl/en/error.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Which says:&lt;/p&gt;
&lt;blockquote&gt;
&lt;h2&gt;An error has occurred&lt;/h2&gt;
&lt;p&gt;We are sorry but we were not able to capture your feedback.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://www.backwardcompatible.net/post/12522915887</link><guid>http://www.backwardcompatible.net/post/12522915887</guid><pubDate>Tue, 08 Nov 2011 21:29:22 +0100</pubDate><category>google</category><category>youtube</category><category>bugreport</category></item><item><title>Stuck SSH session</title><description>&lt;p&gt;When logging from my laptop to remote SSH servers I had a strange problem. Whenever a big chunk of text needs to be returned, my SSH session would stuck and completely stop working. It would not disconnect, but just stay there doing nothing. I would have to log in again. By “big chunk” I mean something like 20+ lines. Output of “ps ax” for example.&lt;/p&gt;
&lt;p&gt;This mad me so mad, because if was working on server for a few minutes making sure that I “head” and “tail” every command to reduce output and then I would forget that some command might output more. For example, using “vi” or “mcedit” was completely impossible.&lt;/p&gt;
&lt;p&gt;My Internet connection goes through PPPoE. Websites work fine, HTTP works really well, but SSH… no go. The server on the other side is behind a firewall, so tunneling and port forwarding are here.&lt;/p&gt;
&lt;p&gt;I searched around, and found that TCP/IP packet size might be the problem, so I tried different MTU values for my PPPoE connection, but without much luck. I was able to get a little bit more before it would stuck again.&lt;/p&gt;
&lt;p&gt;And then I landed on this Debian bug report from 2005:&lt;/p&gt;
&lt;p&gt;&lt;a title="Stuck SSH session" target="_blank" href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=296811"&gt;&lt;a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=296811"&gt;http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=296811&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Apparently still valid. It looks like it only relates to some D-Link routers, although I have no clue what’s at the other end where the server is connected. The solution is to reduce MTU server-side. Luckily, I can still run a one-liner command, and so I did:&lt;/p&gt;
&lt;pre class="message"&gt;/sbin/ifconfig eth0 mtu 1000&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Everything runs fine now. I just wonder if this would decrease server through-output on the local LAN where it runs.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/12465645267</link><guid>http://www.backwardcompatible.net/post/12465645267</guid><pubDate>Mon, 07 Nov 2011 12:58:03 +0100</pubDate></item><item><title>Reducing dentry (slab) usage on machines with a lot of...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_ltxw09px2w1r1vk9bo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;strong&gt;Reducing dentry (slab) usage on machines with a lot of RAM&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Recently I switched my main website from 2-core AMD 4GB RAM machine to 8-core 16GB RAM Intel i7 one. I also switched from CentOS 5 to CentOS 6. I set up everything the same, but suddenly the system was using much more RAM than before. And I’m not talking about filesystem cache here. I thought that increasing RAM would only increase filesystem cache, but something else was occupying RAM like crazy. Looking at output of “free”, “top” and “ps” I simply could not determine what eats RAM because running processes were fine.&lt;/p&gt;
&lt;p&gt;So, I googled a little bit, and found that problem was in dentry cache used by Linux kernel. You can see the kernel memory usage with “slabtop” command, and my dentry was crazy, something like 5GB and growing. Googling even more, I found horror stories about servers going down, OOM killing vital processes like Apache or MySQL, etc. So I wanted to stop this.&lt;/p&gt;
&lt;p&gt;Quick fix is to clear the cache manually. Some people even “solved” this problem by adding the command to cron job.&lt;/p&gt;
&lt;pre class="html"&gt;echo 2 &gt; /proc/sys/vm/drop_caches&lt;/pre&gt;
&lt;p&gt;On the MRTG screenshot you can see the dentry cache size in megabytes marked as a blue line. 4000 means 4GB of cache. I have 16GB, remember. When you run the drop_caches command above, you get the effect marked by the red arrow.&lt;/p&gt;
&lt;p&gt;I did not like the approach of adding this to crontab, so I investigated further, asked at mailing lists, learned that Linus himself says that “unused memory is dead memory” and that’s why kernel is hungry. Still, I decided to reduce the hunger and added this to /etc/sysctl.conf&lt;/p&gt;
&lt;pre&gt;vm.vfs_cache_pressure=10000&lt;/pre&gt;
&lt;p&gt;That did slow it down, but it was still growing. You can run sysctl -p to apply changes to the running kernel without restarting. Next I added these as well:&lt;/p&gt;
&lt;pre&gt;vm.overcommit_ratio=2&lt;br/&gt;vm.dirty_background_ratio=5&lt;br/&gt;vm.dirty_ratio=20&lt;/pre&gt;
&lt;p&gt;However, it was still growing, and I decided to leave it be and see what happens. Is my server going to crash, become unavailable, or something. 24 hours later, dentry was again going up like crazy and suddenly it dropped. By itself. See the blue arrow in the screenshot. It seems like kernel figure out that RAM is going to be exhausted, filesystem cache would be reduced, etc. After this point, everything went back to normal.&lt;/p&gt;
&lt;p&gt;I tried this experiment again, about a week later, with same results. High-rise, drop and things going back to normal. So, if you’re worried your dentry cache is growing like crazy, don’t. Just tweak those settings in sysctl and wait for at least 48 hours before drawing any conclusions.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/12164037212</link><guid>http://www.backwardcompatible.net/post/12164037212</guid><pubDate>Mon, 31 Oct 2011 17:48:00 +0100</pubDate><category>linux</category><category>kernel</category><category>slabtop</category><category>dentry</category></item><item><title>Disabling alerts stops JavaScript execution in #Firefox</title><description>&lt;p&gt;Today I learned about interesting issue with newer versions of Firefox (I use FF7). It has a nice web developer-friendly feature to disable alerts. This is really useful when you place alert() by mistake in some loop and you can’t get out because as soon as you click OK, you get another one.&lt;/p&gt;
&lt;p&gt;New Firefox has a checkbox to disable future alerts. And this is great. So, what’s the problem? Once you disable alerts, and javascript code is executed that would display it, it does not keep running, but rather throws an exception. This does not look like correct behavior to me.&lt;/p&gt;
&lt;p&gt;Imagine a web application that alerts user about something and then keeps running to finish the job. If user disabled alerts because he was in a hurry and clicked fast on different message boxes, the script would not keep going but stop. And there is no way to revert that short of reloading the page (yikes!).&lt;/p&gt;
&lt;p&gt;I found a workaround, I created a function called tryalert that wraps the alert in try..catch block. It looks like this:&lt;/p&gt;
&lt;pre&gt;function tryalert(message) &lt;br/&gt;{ &lt;br/&gt;    try { alert(message); } catch(e) {} &lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;This is a fine workaround. Now instead of alert() I call tryalert() and although the alert is not displayed anymore, the code keeps going as if user has been alerted.&lt;/p&gt;
&lt;p&gt;The problem is introducing tryalert to ALL applications I’ve written so far. It’s impossible. I hope Firefox team changes this.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/12122119174</link><guid>http://www.backwardcompatible.net/post/12122119174</guid><pubDate>Sun, 30 Oct 2011 18:34:00 +0100</pubDate><category>firefox</category><category>javascript</category><category>alert</category></item><item><title>How to export data from QHI?</title><description>&lt;a href="http://www.guacosoft.com/attic"&gt;How to export data from QHI?&lt;/a&gt;: &lt;p&gt;Unfortunately, Quicken Home Inventory does not work on Windows 7, and you might have a hard time switching to another program because QHI does not have an option to export the data.&lt;/p&gt;
&lt;p&gt;However, there’s a way to work around this. A program called Attic Manager, can import the data directly from Quicken database, even if you don’t have Quicken installed. It even works on 64bit Windows. You just need to have your QHI.MDF database backup file.&lt;/p&gt;
&lt;p&gt;Once data is in &lt;a title="Export data from Quicken Home Inventory" href="http://www.guacosoft.com/attic"&gt;Attic Manager&lt;/a&gt; you can export it to CSV format which can be imported into Excel, OpenOffice and almost all the other Home Inventory software. Or, maybe once you try it, you would stick to using Attic Manager.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/12075765945</link><guid>http://www.backwardcompatible.net/post/12075765945</guid><pubDate>Sat, 29 Oct 2011 17:58:20 +0200</pubDate><category>quicken</category><category>quicken home inventory</category><category>inventory</category><category>export</category></item><item><title>How to use Quicken Home Inventory on Windows 7 [SOLVED]</title><description>&lt;p&gt;If you are looking for a way to use all the data you have already entered on Windows 7 box, you came to the right place. Although the short answer is: “you really can’t do that with QHI”, there is an easy solution to this problem…&lt;/p&gt;
&lt;p&gt;There is a nice inexpensive replacement called &lt;a title="Home Inventory Software" href="http://www.guacosoft.com/attic"&gt;Attic Manager&lt;/a&gt;, which is able to &lt;a title="Load QHI data on Windows 7" href="http://www.guacosoft.com/qhi"&gt;load data from QHI even on Windows 7&lt;/a&gt; computer without Quicken instalation.&lt;/p&gt;
&lt;p&gt;It can load locations, categories, items and images (photos) of items.&lt;/p&gt;
&lt;p&gt;Most importantly, it runs on all modern operating systems including Windows 7 and various Linux distributions.&lt;/p&gt;
&lt;p&gt;If you don’t have access to your old copy of QHI or Quicken Classic, it does not really matter, because Attic Manager can load the data directly from QHI database.&lt;/p&gt;
&lt;p&gt;P.S. If you decide to buy it, use the coupon code CNVRT4 to get 40% discount off the price.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/11949519719</link><guid>http://www.backwardcompatible.net/post/11949519719</guid><pubDate>Wed, 26 Oct 2011 16:20:10 +0200</pubDate><category>quicken home inventory</category><category>windows7</category><category>qhi</category><category>home inventory</category></item><item><title>Building wxWidgets 2.8.12 on old MinGW with GCC 3.2</title><description>&lt;p&gt;I had a application using wxWidgets 2.8.0 and then 2.8.8 in production. There were some bugs in earlier wxWidgets versions on Linux, so printing was not working properly. I decided to upgrade wx and that fixed it. Now I wanted to use the same version for Windows version of my application. I originally used some (now old) MinGW version and just wanted to rebuild and be done. But, I got build errors instead. I don’t really last time wxWidgets failed to build so I asked at mailing list and finally dug into the source code myself.&lt;/p&gt;
&lt;p&gt;It looks like wx code is all fine, but there are problems in MinGW headers. I particular, you need to edit the file C:\MinGW\include\winspool.h and change DocumentPropertiesW function’s signature from:&lt;/p&gt;
&lt;pre&gt;LONG WINAPI DocumentPropertiesW(HWND,HANDLE,LPWSTR,PDEVMODEA,PDEVMODEA,DWORD);&lt;/pre&gt;
&lt;p&gt;to:&lt;/p&gt;
&lt;pre&gt;LONG WINAPI  DocumentPropertiesW(HWND,HANDLE,LPWSTR,PDEVMODEW,PDEVMODEW,DWORD);&lt;/pre&gt;
&lt;p&gt;It seems to be already fixed in newer MinGW versions.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/11945765836</link><guid>http://www.backwardcompatible.net/post/11945765836</guid><pubDate>Wed, 26 Oct 2011 12:48:00 +0200</pubDate><category>wxWidget</category><category>mingw</category><category>gcc</category></item><item><title>nginx hogs cpu when proxying large files</title><description>&lt;p&gt;I have a server where nginx is used as frontend for Apache. nginx serves static content and Apache serves PHP pages. This is a common setup.&lt;/p&gt;
&lt;p&gt;Today I migrated stuff to a new server and needed to copy a 7GB database file to another server. I figured HTTP would be fastest way to do it. Unfortunatelly, DNS change already went thought so I could not serve the file on the static domain nginx was configured for.&lt;/p&gt;
&lt;p&gt;I thought “nevermind”, placed file under one of those domains handled by Apache and started the download. It was going fine at 11MB/s for some time. However, soon it started to crawl at 850KB/s. I suspected network problems, but everything else was running fine. I looked at process list and whoa, nginx using 99% of CPU. Because of this single download, the server was brought to its knees and no other client could even get a simple “Hello World” page.&lt;/p&gt;
&lt;p&gt;I stopped the download at the client side and nginx soon recovered (not restart needed). Then I edited /etc/hosts and place the old IP address of static domain and continued the download (wget -c). It finished few minutes later with 11MB/s average.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/11103742058</link><guid>http://www.backwardcompatible.net/post/11103742058</guid><pubDate>Thu, 06 Oct 2011 18:46:45 +0200</pubDate><category>nginx</category><category>slow</category></item><item><title>Merging a huge git conflict</title><description>&lt;p&gt;Both me and my colleague work separately working on same git tree while being offline for a couple of days. Result: following “git pull” I got a huge conflict spanning about 100 of files.&lt;/p&gt;
&lt;p&gt;This meant that manual resolution is out of question. Enter “git mergetool” and “kdiff3”. I installed kdiff3 from linuxpackages.net (version is for old Slackware 11.0, and I had to symlink /opt/kde/kdiff3 to /usr/bin/kdiff3 so that git finds it).&lt;/p&gt;
&lt;p&gt;git-mergetool calls kdiff3 for each file, you merge and save. Job done very quickly.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/10972834146</link><guid>http://www.backwardcompatible.net/post/10972834146</guid><pubDate>Mon, 03 Oct 2011 08:16:23 +0200</pubDate><category>git</category><category>merge</category><category>kdiff3</category></item><item><title>Google Apps problems</title><description>&lt;p&gt;Seems to be a fine day at Google today, perhaps engineers are pulling hair.&lt;/p&gt;
&lt;p&gt;This morning, I was looking at a spreadsheet in Google Docs and suddenly some 20 values simply vanished right before my eyes. I wasn’t even working anywhere near that part of the sheet. I was inserting new values at bottom and somewhere in top-right corner the values were gone. I tried undo and to scroll around (big sheet) and only when I switched to another sheet and came back the values showed up again. Phew. From now on I’m doing export and download to my computer every time I finish editing.&lt;/p&gt;
&lt;p&gt;Few hours later, a new issue. Looking at a spreadsheet I selected Save from the menu. It said that it’s ok. I did some changes, clicked Save, got no error but the screen read “Last saved 2 minutes ago”. Ok, maybe it’s just a minor glitch. 15 minutes later I tried to save again. Once again, no errors, but it still says “saved 17 minutes ago”. At this point I was confused whether save is not possible or the message is simply wrong. I exported the document to xls format, checked in OpenOffice and then closed the browser tab.&lt;/p&gt;
&lt;p&gt;Three strikes and &lt;em&gt;blog post&lt;/em&gt; is out. I just had another issue, now with GMail, so I guess it’s time to make all this public. I wrote an e-mail message and it said “Your connection to GMail has expired. Please log in again.” Ok, it’s not like I haven’t seen that one before, but it’s been almost a month. I though they had it fixed. I logged out, logged back in and… it still does not allow me to send an e-mail. I can read messages fine, but as soon as I try to post, I get a warning that “Your connection to GMail has expired. Please log in again.”.&lt;/p&gt;
&lt;p&gt;Oh well, I guess we get as much as we payed for it ;)&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/10520935904</link><guid>http://www.backwardcompatible.net/post/10520935904</guid><pubDate>Thu, 22 Sep 2011 18:08:00 +0200</pubDate><category>google</category></item><item><title>Stackoverflow.com scaling problem</title><description>&lt;p&gt;I have been stackoverflow user almost from the very start of the website. I recall reading some Jeff Atwood’s blog posts and thinking how naive he is. He has a classic case of Microsoft fanboy-ism. He swears by .net and MSSQL server and spits on Linux, PHP and… well… entire LAMP stack.&lt;/p&gt;
&lt;p&gt;When stack became popular the website started to get a lot of traffic and Jeff was all like “Oh we don’t need all the scaling technology that all the web companies have developed since web 1.0 till today. We’re smarter, we use the all-powerful Microsoft stack, we’ll just buy more RAM, more CPU and keep it all on single machine. Machines are so powerful these days and cost almost nothing”. How little did he know.&lt;/p&gt;
&lt;p&gt;As more and more people use the website it seems that they reached the limit of what is possible. Stack website is now inaccessible for days. By inaccessible, I don’t mean that the site does not open. It just open waaaay too slow to be usable. I sometimes wait 5 minutes to get the home page.&lt;/p&gt;
&lt;p&gt;What I really regret is all those dumb readers on Jeff’s codinghorror blog, and all those fanboys on stack website. Some people tried to tell Jeff that this would happen, but he would not listen. He was very arrogant and dismissed all that as LAMP-crap. All his followers blindly followed his thoughts as if they really wanted that to be true. Psychology of a herd, I’d say.&lt;/p&gt;
&lt;p&gt;Oh well, too bad that public access to such valuable resource is now limited because of stubborn owners. Maybe it’s time for a real competitor to step up, with a simple slogan: “just like stackoverflow, except that it really works”.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/10354700087</link><guid>http://www.backwardcompatible.net/post/10354700087</guid><pubDate>Sun, 18 Sep 2011 13:33:00 +0200</pubDate></item><item><title>Performance of PHP if, switch, arrays... using "B-tree-if" as solution</title><description>&lt;p&gt;For the game I’m making I have a bunch of array which represent a puzzle player needs to solve. Ensuring puzzle is solvable is CPU intensive, so I pre-calculated a couple of thousands of puzzles and select one randomly. Since puzzles are static data which is not going to change, I decided not to burden the database with this because DBMS is always overloaded with other stuff anyway.&lt;/p&gt;
&lt;p&gt;My first thought was to build a big array and fetch a random element. I found some benchmark showing that this is faster than “if” or “switch”, however benchmarks excluded time needed to parse/create the array itself. Since every player is a new HTTP request, this huge array would have to be constructed each time. I am using APC, but I failed to find if arrays in precompiled PHP source file are stored “structured” as well.&lt;/p&gt;
&lt;p&gt;Dropping the array idea, I though about “switch”, foolishly thinking that it would use some kind of jump-table and run the desired return statement. Something like this:&lt;/p&gt;
&lt;pre&gt;function get_puzzle($id)
{
    switch ($id)
    {
        case 0: return array (...first puzzle...);
        case 1: return array (...second puzzle...);
        case 2: return array (...etc.
&lt;/pre&gt;
&lt;p&gt;However, researching this I find out that switch performs similar to series of “if” statements… variable is compared with each “case”.&lt;/p&gt;
&lt;p&gt;So I decided to roll my own solution using “if” statements, but not linear. I used a B-tree approach. Split by two until only one is left. This means it would take only 11 comparisons to reach a puzzle from a set of 2048. Here’s an example with set of 256 puzzles.&lt;/p&gt;
&lt;pre&gt;function get_puzzle_btree($id)
{
  if ($id &lt; 128)
    if ($id &lt; 64)
      if ($id &lt; 32)
        if ($id &lt; 16)
          if ($id &lt; 8)
            if ($id &lt; 4)
              if ($id &lt; 2)
                if ($id &lt; 1)
                  return array (...first puzzle...);
                else
                  return array (...second puzzle...); 
...etc.&lt;/pre&gt;
&lt;p&gt;Of course, I did not write this “if” behemoth by hand. A simple 20-line recursive function spits out the PHP code.&lt;/p&gt;
&lt;p&gt;In the end, I wrote a simple comparison loop that tries to get all the puzzles and compares whether the old “switch” and new “btree” function return the same values.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/9676388730</link><guid>http://www.backwardcompatible.net/post/9676388730</guid><pubDate>Thu, 01 Sep 2011 22:23:16 +0200</pubDate><category>php</category><category>recursion</category><category>switch</category><category>performance</category><category>static_data</category></item><item><title>Safe way to dual-boot Linux and Windows 7</title><description>&lt;p&gt;I had a client’s machine installed with Windows 7 and some free hard disk space for Linux. I decided not to install the Linux boot loader because:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;I did not have Windows install/rescue CD at hand&lt;/li&gt;
&lt;li&gt;in case something goes wrong I could not boot into Windows&lt;/li&gt;
&lt;li&gt;I had some experience in the past with Windows XP where it simply did not work&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Since re-installing Windows or even fixing Windows if it became unbootable was not an option, I decided to play safe: use Windows’ boot loader to boot up Linux.&lt;/p&gt;
&lt;p&gt;I did this in past with Windows XP. Basically, you save Linux boot loader into some file (it’s only 512 bytes) and then tell Windows’ boot loader to load it. On WindowsXP this means editing boot.ini file in C:. To create the linux boot loader file, install linux boot loader into root partition (for example, with LILO, if you installed Linux in /dev/sda4, then lilo.conf should read boot=/dev/sda4) and then read the first sector into a file:&lt;/p&gt;
&lt;pre&gt;dd if=/dev/sda4 of=linux.boot bs=512 count=1&lt;/pre&gt;
&lt;p&gt;This will create file named linux.boot which you need to copy to C:\ disk of your Windows machine (use the USB stick or network for this).&lt;/p&gt;
&lt;p&gt;On Windows7 there is no boot.ini, you have to use Microsoft’s tool, named BCDEdit. BCD stands for Boot Configuration Data. You need to run BCDedit as administrator. Hit the Start button, then go to &lt;strong&gt;All programs&lt;/strong&gt; and then to &lt;strong&gt;Accessories&lt;/strong&gt;. Right-click the &lt;strong&gt;Command prompt&lt;/strong&gt; and “Run as administrator”.&lt;/p&gt;
&lt;p&gt;Now, we need to enter a couple of commands:&lt;/p&gt;
&lt;pre&gt;bcdedit /create /d "Linux" /application BOOTSECTOR&lt;/pre&gt;
&lt;p&gt;If will show something like&lt;br/&gt;&lt;br/&gt;The entry {12345678-0000-1111-9999-112233445566} was successfully created.&lt;br/&gt;&lt;br/&gt;That number is a unique identifier for boot menu entry. You need to use it in subsequent commands:&lt;/p&gt;
&lt;pre&gt;bcdedit /set {12345678-0000-1111-9999-112233445566} device boot&lt;br/&gt;bcdedit /set {12345678-0000-1111-9999-112233445566} device partition=c:&lt;br/&gt;bcdedit /set {12345678-0000-1111-9999-112233445566} PATH \linux.boot&lt;br/&gt;bcdedit /displayorder {12345678-0000-1111-9999-112233445566} /addlast&lt;/pre&gt;
&lt;p&gt;You might need to prepend C: in the second line if it does not work this way.&lt;/p&gt;
&lt;p&gt;Reboot and enjoy.&lt;/p&gt;</description><link>http://www.backwardcompatible.net/post/9661733246</link><guid>http://www.backwardcompatible.net/post/9661733246</guid><pubDate>Thu, 01 Sep 2011 11:44:45 +0200</pubDate><category>linux</category><category>windows7</category><category>boot</category><category>lilo</category></item></channel></rss>

