Habaritag:dasourcerer.net,2024-03-19:atom/8e9f0919e686bbb5c85e1690e5c6adfed00e451aDa:Sourcerer's BlogCaffeine induced coding frenzy2013-11-28T08:42:16+00:00RedHat Enterprise Linux 6.5 Released, CentOS 6.5 En RouteDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2013:red-hat-enterprise-linux-65-released-centos-65-en-route/13851286682013-11-28T08:42:16+00:002013-11-28T08:42:58+00:002013-11-22T13:44:07+00:00<p>Following the <a href="http://www.redhat.com/about/news/press-archive/2013/11/red-hat-launches-latest-version-of-red-hat-enterprise-linux-6" title="Red Hat | Red Hat Launches Latest Version of Red Hat Enterprise Linux 6">release of RHEL 6.5</a> (featuring some <a href="https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/6.5_Technical_Notes/index.html#openssl" title="6.5 Technical Notes - Red Hat Customer Portal">nice changes</a> involving OpenSSL), the builds for CentOS 6.5 are <a href="https://www.centos.org/forums/viewtopic.php?f=41&t=42964" title="CentOS • View topic - 6.5 Builds Underway">on their way</a>.</p><p>While it might take some time for 6.5 to ship, the upgraded packages are already available through the <a href="http://wiki.centos.org/AdditionalResources/Repositories/CR">Continuous Release</a> repository.</p>MariaDB and jemalloc on CentOSDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2013:mariadb-and-jemalloc-on-centos/13843785572013-11-13T21:53:27+00:002013-11-13T21:53:27+00:002013-11-13T21:23:57+00:00<p>I felt like trying out <a href="http://www.canonware.com/jemalloc/">jemalloc</a>, an alternative malloc(3) implementation, which is promising improved performance for both, <a href="http://www.mysql.com" title="MySQL :: The world's most popular open source database">MySQL</a> and <a href="http://www.mariadb.org">MariaDB</a>.</p><p>Being reluctant to compile MariaDB (which is quite time-consuming), I were looking for a way to facilitate jemalloc via <abbr title="RedHat Package Manager">RPM</abbr> only. Luckily, jemalloc is available from the <a href="http://fedoraproject.org/wiki/EPEL" title="Extra Packages for Enterprise Linux">EPEL</a> repository, so the compiled .so has only been a <kbd>yum install jemalloc</kbd> away. Now here's the hard part: How to get the MariaDB mysqld to actually load jemalloc? In the Linux world, this is usually accomplished through the <kbd>LD_PRELOAD</kbd> environmental variable. But with a service started through init.d? Hm … No luck finding a file in <kbd>/etc/sysconfig</kbd> that were of any help. A somewhat heavy-hitting solution were to add <kbd>libjemalloc.so.1</kbd> to <kbd>/etc/ld.so.preload</kbd>. <strong>But:</strong> This would make <strong>every</strong> process start with jemalloc, which comes with quite a big memory penalty. In addition to that, only multi-threaded processes are truely benefiting from jemalloc, so this is no good solution.</p><p>So here's the trick: <kbd>/usr/bin/mysqld_safe</kbd> is actually a configurable shellscript, bootstrapping mysqld. Pretty close to the start, there is a variable manipulating <kbd>LD_PRELOAD</kbd>, called <kbd>mysqld_ld_preload</kbd>. Looking for this variable and changing it to the following did the trick:</p><p><code>
mysqld_ld_preload=/usr/lib64/libjemalloc.so.1</code></p><p>After restarting MariaDB, running <kbd>pmap `pidof mysqld` | grep jemalloc</kbd> indeed confirmed the process were using jemalloc now.</p><p>This method should also work with <a href="http://goog-perftools.sourceforge.net/doc/tcmalloc.html" title="TCMalloc : Thread-Caching Malloc">tcmalloc</a>, which is being favoured by Facebook and <a href="https://github.com/blog/1422-tcmalloc-and-mysql" title="TCMalloc and MySQL">GitHub</a>.</p>Rapid nginx Compression ConfigurationDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2013:rapid-nginx-compression-configuration/13689584932013-05-19T10:19:11+00:002013-05-19T10:19:11+00:002013-05-19T10:07:38+00:00<p>Google came up pretty empty about this and I could not find anything in the <a href="http://wiki.nginx.org/HttpGzipModule#gzip_types">documentation</a>, so I thoguht I'd drop it here real quick: It looks like the <kbd>gzip_types</kbd> config directive supports globbing, so instead of keeping an enormous list of mime-types to be compressed, you can do something like <kbd>gzip_types text/*;</kbd> in order to deliver all textual content in compressed form.</p><p>A small c&p-ready snippet from my config:<code><pre>
gzip on;
gzip_comp_level 6;
gzip_types text/*
application/*+xml
image/x-icon
application/x-javascript;
gzip_disable "msie6";
gzip_vary on;
</pre></code></p><p>This has been tested and verified to work with nginx 0.8 and 1.0. I think it is safe to assume later versions of nginx support this as well.</p>Half a Year of Github — A ReviewDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2012:half-a-year-of-github-a-review/13454605372012-08-20T11:02:30+00:002012-08-20T11:03:50+00:002012-08-20T11:02:17+00:00<p>I recently noticed that it's been now more than six months since <a href="https://github.com/DaSourcerer">I joined github</a> - reason enough to write a small review.</p><p>Let me start off with saying that I'd like to separate the git <abbr title="Distributed Version Control System">dvcs</abbr> and github. Thing is: I don't really like git. I prefer <a href="http://mercurial.selenic.com/" title="Mercurial SCM">mercurial</a> for various reasons. Part of it is that I find the tools for git insufficient and I can't cope with the often unforgiving nature of git. Especially the <a href="http://www.eclipse.org/egit/">Eclipe egit plugin</a> is in my eyes often misleading and treacherous. But enough, there's been enough articles on <a href="http://importantshock.wordpress.com/2008/08/07/git-vs-mercurial/" title="Git vs. Mercurial: Please Relax « Important Shock" id="git-vs-mercurial">git versus mercurial</a> <a href="http://nfarina.com/post/9868516270/git-is-simpler" title="Nick Farina - Git Is Simpler Than You Think">around</a>. To me, it simply boils down to this:<br></p><blockquote quote="#git-vs-mercurial"><p>Git is not a Prius. Git is a Model T. Its plumbing and wiring sticks out all over the place. You have to be a mechanic to operate it successfully or you'll be stuck on the side of the road when it breaks down. And it <strong>will</strong> break down.<br></p></blockquote><p>My advice to you: Stick to the git <abbr title="Command Line Interface">cli</abbr> and you should be good to go. The cli tends to be much more verbose than any of the GUI tools. You will find out much sooner why you're suddenly stuck in a disconnected head instead of ending up in the branch you intended to be.</p><p>So, let's talk about github: During the past few years, a lot of interesting projects moved to github. Among them: <a href="https://github.com/horde">The Horde framework</a>, <a href="https://github.com/habari">Habari</a>, <a href="https://github.com/phpmyadmin">phpMyAdmin</a>. Only git itself kept me from following them.</p><p>It's not been until the developers of the <a href="http://yiiframework.com">Yii framework</a> decided to <a href="http://www.yiiframework.com/news/53/yii-moved-to-github/" title="Yii moved to GitHub | News | Yii Framework">move</a> from <a href="http://code.google.com/p/yii/">Google Code</a> to <a href="https://github.com/yiisoft">github</a>. Being heavily involved with that framework (i.e. I had some important patches left on my disk that I didn't want to leave unattended), I saw no choice but to follow. Suffice to say, it's been quite a shock. So, I need to fork the entire project in order to participate? Patches are <a href="https://help.github.com/articles/using-pull-requests" title="Using Pull Requests · github:help">pull requests</a> now? Is this really to speed up development? What took me five minutes in the google code tracker now lasted almost half an hour on github. Not to mention: I've payed my apprentice's due by trashing my fork a couple of times with no way to repair it safe for re-creating it (at least that's what I've been told back then).</p><p>With half a year having passed I've got to say: I'm really grown to like it. Its user interface takes a lot of complexity off of the underlying git. And since I got more proficient with github, setting up pull requests is a much smoother and comfortable process than it used to be for me. The interface also makes code reviews a breeze (and much more fun). The ability to leave notes on certain lines within a pull request is a brilliant idea, too. Miniature changes (e.g. documentation changes in a single file) are ridiculously easy with the <a href="https://github.com/blog/844-forking-with-the-edit-button" title="Forking with the Edit Button — Github Blog">means provided by the web interface</a> which spares you much of the fork-branch-edit-commit-pr-cycle. Apart from that, following interesting changes within selected projects is really comfortable (and often enlightning). The claim "social coding" is surely not a lie. Although the <a href="https://github.com/blog/1204-notifications-stars" title="Notifications & Stars — Github Blog">recent</a> <a href="https://github.com/blog/1214-notification-email-improvements" title="Notification Email Improvements — Github Blog">updates</a> messed up my settings at first.</p><p>While I've accepted the fact that I will probably never master git in full (much like my C-skills), there's little that could keep my from using github now.</p>PHPUnit Cheat SheetDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2012:phpunit-cheat-sheet/13449383842012-08-14T09:59:49+00:002012-08-14T09:59:49+00:002012-08-14T09:59:44+00:00<p>I recently stumbled uppon <a href="http://otroblogmas.com/phpunit-cheat-sheet/" title="PHPUnit Cheat Sheet | Otro Blog Más">this fine PHPUnit Cheat Sheet</a> by Ian Monge. I find it superb enough to recommend it to all :)</p>PHP Exceptions to Gain Finally Keyword - Finally!Da:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2012:php-exceptions-to-gain-finally-keyword-finally/13448660092012-08-13T13:53:41+00:002012-08-13T13:53:53+00:002012-08-13T13:53:41+00:00<p>PHP's exceptions have been around for quite some time now. However, contrary to their cousins in the Java world, they did not feature a <kbd>finally</kbd> keyword. Until <a href="https://github.com/php/php-src/commit/80d5ae3cea4c6fdd85789edfde0e2da721a0741b" title="commit 80d5ae3 — Implemented 'finally' keywords for php">now</a>.</p>PHP's Ambitious PlansDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2012:phps-ambitious-plans/13375425652012-05-20T19:36:07+00:002012-08-22T14:41:52+00:002012-05-20T19:36:05+00:00<p>Looking through the <a href="https://github.com/php/php-src">PHP source on github</a>, I stumbled upon this <a href="https://github.com/php/php-src/blob/c500bd35f3abd237071a4dbba05b9666a32847e4/NEWS#L6">preliminary changelog for v5.5</a>. I'm not quite sure what to say ... Good luck?</p><p><strong>Update:</strong> Looks like Sebastian Bergmann wasn't <a href="https://github.com/php/php-src/commit/a90170e6f803f283d6c8e4e8d6b7bd8b7bd011a4">too fond</a> of this :)</p>CentOS v6.2 as Good as ReleasedDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2011:centos-v62-as-good-as-released/13243945652011-12-20T15:22:46+00:002012-06-18T15:46:01+00:002011-12-20T15:22:45+00:00<p>Looks like a bunch of wizards paired up to work on CentOS now: Only eleven days after the release of v6.1, v6.2 is being <a href="https://twitter.com/#!/CentOS/status/148492003909443584">distributed to the mirrors</a>, bringing CentOS on-par with upstream <abbr title="Redhat Enterprise Linux">RHEL</abbr>.</p><p><strong>Update:</strong> v6.2 has now officially landed. The release notes are <a href="http://wiki.centos.org/Manuals/ReleaseNotes/CentOS6.2">here</a>.</p>How to Disable SELinux for Apache on CentOS 6.xDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2011:how-to-disable-selinux-for-apache-on-centos-6x/13243293772011-12-19T21:24:16+00:002013-12-22T01:26:36+00:002011-12-19T21:24:16+00:00<p>I set up a new development environment using the recently released <a href="http://www.centos.org">CentOS v6.1</a>. For various reasons I prefer to switch off <abbr title="Security Enhanced Linux">SELinux</abbr> for the Apache Webserver. Coming from CentOS 5.x, I expected to be able to do this via the well known <kbd>setsebool -P httpd_disable_trans 1</kbd>. Much to my surprise, SELinux insisted on not knowing that boolean.</p><p>After some research, it looks like <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-SELinux_Contexts_Labeling_Files-Persistent_Changes_semanage_fcontext.html">a change in upstream <abbr title="RedHat Enterprise Linux">RHEL</abbr></a> means using the <kbd>semanage</kbd> helper is now the way to achieve this<sup>*</sup>:</p><p><code>
semanage permissive -a httpd_t
</code></p><p>In case you cannot find it: It's in the <kbd>policycoreutils-python</kbd> package.</p><p>Please keep in mind that this is not a safe setting for production environments.</p><p><span style="font-size: 80%"><sup>*</sup>) Well, not really. It just sets the mode for the httpd module from <em>enforcing</em> to <em>permissive</em>. I couldn't find a way to disable SELinux selectively without disabling it entirely via <kbd>SELINUX=0</kbd> as kernel param. Still, this will allow you to do what you want.</span></p><p><span style="font-size: 80%"><strong>Update:</strong> Looks like <a href="http://unix.stackexchange.com/a/57615/54821" title="centos - Disable SELinux in apache to stop warning - Unix & Linux Stack Exchange">SE</a> approves</span></p>Chive v1.0 ReleasedDa:Sourcererhttp://dasourcerer.nettag:dasourcerer.net,2011:chive-v10-released/13243081712011-12-19T15:29:01+00:002011-12-19T15:29:01+00:002011-12-19T15:29:01+00:00<p>Chive, one of the most prominent applications written with the help of the <a href="http://yiiframework.com">Yii framework</a> has finally reached version 1.0. Chive is a web-2.0-ish clone of the famous <a href="http://phpmyadmin.net">phpMyAdmin</a> administrative tool for MySQL. In <cite id="chive-about" class=""><a href="http://www.chive-project.com/" class="rev-reply">their own words</a></cite>:<br></p><blockquote cite="#chive-about"><p>Chive is a free, open source, web-based database management tool, designed to bring joy to web developers - with easy administration, super fast UI and state of the art web technologies.</p></blockquote><p>The greatest new feature is probably the implementation of table maintenance commands.</p><p>I've kept a close eye at Chive in the past. So far I had some troubles getting it to run with <ahref="http://lighttpd.net">Lighty</a> prior to the v0.5.x series. But all looks good now :)</p>