Debian - Upgrade MySQL to MariaDB

After reading some good opinions about MariaDB I wanted to give it a try. Upgrade looks quite straight forward but I found some issues a little tricky. Installation Add repo and key: cat > /etc/apt/sources.list <<SRC deb http://mirrors.supportex.net/mariadb/repo/5.5/debian wheezy main deb-src http://mirrors.supportex.net/mariadb/repo/5.5/debian wheezy main SRC (find more repositories here  external link ) Now install MariaDB: sudo apt-get update sudo apt-get install mariadb-server It could be better to install mariadb-server-5.5 and mariadb-client-5.5 package instead, because of this error  external link . ...

2014-01-24 · 1 min · timor

Nginx - enabling SPDY with freeware certificate

I was thinking about allowing access to my website using SPDY protocol for better performance and security (and for fun of course 😃 ). But SPDY have one disadvantage - you need SSL certificate signed by known authority that will verfiy in common browsers. So you can’t use self signed certificates because everyone will see a warning entering your site. Certs are quite expensive so I started searching for free one and to my surprise I found such! ...

2014-01-24 · 2 min · timor

Searching for better code editor

I’ve been using different code editors for different purposes. Gedit was fine for small scripts but not for bigger projects. It lacks intelligent code completion (function/class names, etc.). I was searching for convenient editor for Python, Perl, Ruby with support for frameworks like Django, Rails, etc. I know Sublime Text - but it’s paid  external link . There is LimeText  external link - open source clone, but it’s not ready to be used on daily basics. ...

2014-01-24 · 2 min · timor

Manage Windows 8.1 and Windows Server 2012 R2 in WSUS 3.0

After connecting few computers with Windows 8.1 to domain we found that these computers are not recognized or recognized as Windows 6.3 (which is true) on WSUS 3.0 running on Windows Server 2008. The bad thing was that they can’t properly report to WSUS and get updates from it. I found that there are two updates that have to be installed (but they’re not working without additional steps): http://support.microsoft.com/kb/2720211  external link http://support.microsoft.com/kb/2734608  external link After installation of second update there are two additional steps that have to be performed to get WSUS working: ...

2014-01-16 · 1 min · timor

Regenerate thumbnails in Shotwell 0.15 (for last month)

I love Shotwell  external link for it’s simplicity and easy export to Piwigo  external link . After Christmas I added new photos to my library but after that I made some modifications to them (red eye reduction, etc…). Because Shotwell generate thumbnails only on import, all my modifications were not visible on preview. ...

2014-01-08 · 1 min · timor

Loop unlooping in Javascript

Few days ago I’ve read a book ‘Even Faster Web Sites‘ about websites optimisation and I found one thing usefuluseful, not only on websites. There was a small tip about looploop unlooping. I want to quote them for later use. First - with switch statement var iterations = Math.ceil(values.length / 8); var startAt = values.length % 8; var i = 0; do { switch(startAt) { case 0: process(values[i++]); case 7: process(values[i++]); case 6: process(values[i++]); case 5: process(values[i++]); case 4: process(values[i++]); case 3: process(values[i++]); case 2: process(values[i++]); case 1: process(values[i++]); } startAt = 0; } while(--iterations > 0); Second - without switch var iterations = Math.floor(values.length / 8); var leftover = values.length % 8; var i = 0; if(leftover > 0) { do { process(values[i++]); } while(--leftover > 0); } do { process(values[i++]); process(values[i++]); process(values[i++]); process(values[i++]); process(values[i++]); process(values[i++]); process(values[i++]); process(values[i++]); } while (--iterations > 0); I found second example more readable and I prefer it. These examples after translation could be easily used in other scripting languages. ...

2014-01-07 · 1 min · timor

Tracking users by nickname on WordPress using Google Analytics

Some time ago I write article about tracking nicknames of users (from comments) on a WordPress blog with Piwik . This time I’m doing same but for Google Analytics. I’m using Google Analytics  external link plugin for WordPress so I’ve edited googleanalytics.php file to add some additional code for user tracking: <script type="text/javascript"> var i,x,y,ARRcookies=document.cookie.split(";"); var comment_author = ""; for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x.indexOf("comment_author") != -1 && x.indexOf("comment_author_email") == -1 && x.indexOf("comment_author_url") == -1) { comment_author = unescape(y); } } var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-YOUR-UNIQ-NUMBER']); _gaq.push(['_setCustomVar', 1, 'Nickname', comment_author, 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); })(); </script> Source https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables?hl=pl  external link ...

2014-01-07 · 1 min · timor

Apache - precompressing static files with gzip

Some time ago I’ve show how to precompress js and css file with gzip to be available for Nginx’s mod_gzip. In default configuration Apache don’t have such module but similar functionality could be achieved with few custom rewirtes. Basically we will start with these rewrites to serve gzipped CSS/JS files if they exist and the client accepts gzip compression: RewriteEngine on RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s RewriteRule ^(.*)\.(js|css)$ $1\.$2\.gz [QSA] Then we need to setup proper content types for such compressed files - I know how to do this in two ways: ...

2013-12-27 · 2 min · timor

Android: Xposed + AppOps - reclaim control over installed applications permissions

I’m happy owner of Galaxy Nexus 7 and lately I updated my tablet to Android 4.4 Kitkat. One of features I most expected was ability to block some permissions of some applications. Such setting was available in 4.4 version but was removed in latest 4.4.2 - Google didn’t explain it exactly why. I don’t like when for ex. game need: camera or GPS access - for what I asked? But there is new app so called App Ops that unhides build-in interface allowing edit of application permissions. I strongly suggest to install it. ...

2013-12-17 · 1 min · timor

Generate ECDSA key with OpenSSL

After the last NSA scandal I’ve found some time to read some texts about PFS and ECDSA keys lately. I always used RSA keys but wanted to give a try to ECDSA so I wanted to give it a try (test performance, etc). Here is how I’ve done it. Firstly find your favorite curve. A short tip about bit length and complexity could be found here. From it you will now that using 256 bit ECDSA key should be enough for next 10-20 years. ...

2013-12-17 · 5 min · timor