<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tudor Barbu&#039;s professional blog</title>
	<atom:link href="http://blog.motane.lu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.motane.lu</link>
	<description>Ramblings about software development</description>
	<lastBuildDate>Mon, 16 Apr 2012 21:08:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Validate URLs in Zend Framework</title>
		<link>http://blog.motane.lu/2012/04/16/validate-urls-in-zend-framework/</link>
		<comments>http://blog.motane.lu/2012/04/16/validate-urls-in-zend-framework/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 21:08:14 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=2005</guid>
		<description><![CDATA[I was doing some dev work, as usual in ZF, and I was surprised to find out that there&#8217;s no Zend_Validate_Url or Zend_Validate_Uri class among the framework&#8217;s default validators. Which is a bit weird, as validating URLs in a very common task in web development, much more common than, let&#8217;s say, validating a barcode or [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing some dev work, as usual in ZF, and I was surprised to find out that there&#8217;s no Zend_Validate_Url or Zend_Validate_Uri class among the framework&#8217;s default validators. Which is a bit weird, as validating URLs in a very common task in web development, much more common than, let&#8217;s say, validating a barcode or an IBAN.</p>
<p>But validating a URI is easy using a combination of <a href="http://framework.zend.com/apidoc/1.10/_Validate_Callback.html" title="Zend_Validate_Callback" class="outgoing">Zend_Validate_Callback</a> and <a href="http://framework.zend.com/apidoc/core/db_Uri.html" title="Zend_Uri" class="outgoing">Zend_Uri</a>. Check it out:</p>
<pre class="brush: php; title: ; notranslate">
$url = new Zend_Form_Element_Text('url');
$url-&gt;setOptions(
	array(
		'label'      =&gt; 'Enter the URL',
		'filters'    =&gt; array(
							'StringTrim',
							'StripTags',
						),
		'validators' =&gt; array(
							'NotEmpty',
							array(
								'Callback',
								true,
								array(
									'callback' =&gt; function($value) {
										return Zend_Uri::check($value);
									}
								),
								'messages' =&gt; array(
									Zend_Validate_Callback::INVALID_VALUE =&gt; 'Please enter a valid URL',
								),
							),
						),
	)
);
</pre>
<p>It still puzzles me why there&#8217;s not a standard URI validator&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/04/16/validate-urls-in-zend-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Open .ai files in Gimp under MacOS</title>
		<link>http://blog.motane.lu/2012/03/13/open-ai-files-in-gimp-under-macos/</link>
		<comments>http://blog.motane.lu/2012/03/13/open-ai-files-in-gimp-under-macos/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 12:09:04 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1997</guid>
		<description><![CDATA[Do you know what a web designer is? A guy that wasn&#8217;t man enough to become a software developer yet not gay enough to become a fashion designer. Leaving the joke aside, design is an important part of web development. As with everything, looks do matter. And you truly see the value of a designer [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.motane.lu/wp-content/uploads/2012/03/GIMP-logo.png" alt="" title="GIMP-logo" width="250" height="250" class="alignright size-full wp-image-2001" />Do you know what a web designer is? A guy that wasn&#8217;t man enough to become a software developer yet not gay enough to become a fashion designer. Leaving the joke aside, design is an important part of web development. As with everything, looks do matter. </p>
<p>And you truly see the value of a designer when you don&#8217;t have one on the team. Like me now. I needed some graphical changes and didn&#8217;t have anyone to do them. Big problem. But I&#8217;m quite good at solving problems, and I&#8217;m not scared to try new things, so I dove in. I had some Photoshop and Illustrator files from the previous the previous designer and I thought it shouldn&#8217;t be too hard to change some colors. </p>
<p>The only problem was that I didn&#8217;t have Photoshop installed on my laptop. Given that Photoshop is quite pricey and I don&#8217;t want to spend money on a piece of software I use once every 6 months, I started looking for alternatives to Photoshop that work under MacOS. And the first one that popped into my mind was <a href="http://www.gimp.org/" title="GNU Image Manipulation Program" class="outgoing">GIMP</a>. Which is a good piece of software, but it comes with X11, so all MacOS shortcuts don&#8217;t work &#8211; CMD + C / CMD + V have to be replaced with CTRL + C / CTRL + V and so on, which is a bit annoying, but hey, it&#8217;s free and it does the job. Or not.</p>
<p>I had to open an .ai file &#8211; Adobe Illustrator &#8211; which GIMP does not support. I know that this might sound stupid, but I never used image editing software. After some googling around, I found out that GIMP is not supposed to open .ai images as these are vectorial. So I needed something that can open vectorial image formats, was free or extremely cheap. And I did: <a href="http://inkscape.org/" title="Draw freely" class="outgoing">Inkscape</a>. </p>
<p>So, for all developers out there, if you want to open an .ai file and don&#8217;t have Photoshop / Illustrator, install GIMP and Inkscape, open the file in Inkscape and then import it in GIMP. Maybe it will save you several hours of googling around. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/03/13/open-ai-files-in-gimp-under-macos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cisco VPN blocking other connections</title>
		<link>http://blog.motane.lu/2012/02/23/cisco-vpn-blocking-other-connections/</link>
		<comments>http://blog.motane.lu/2012/02/23/cisco-vpn-blocking-other-connections/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 11:25:04 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1993</guid>
		<description><![CDATA[I had a weird problem today with my VPN connection: when I was connected, my Cisco VPN client seemed to block all other HTTP connections. Skype &#038; Yahoo! Messenger were working but all HTTP(S) connections on both browsers (Chrome &#038; FF) were down. Which is extremely weird and I couldn&#8217;t pinpoint to the core of [...]]]></description>
			<content:encoded><![CDATA[<p>I had a weird problem today with my VPN connection: when I was connected, my Cisco VPN client seemed to block all other HTTP connections. Skype &#038; Yahoo! Messenger were working but all HTTP(S) connections on both browsers (Chrome &#038; FF) were down. Which is extremely weird and I couldn&#8217;t pinpoint to the core of the problem.</p>
<p>So I did what any responsible IT person would do: googled. But I couldn&#8217;t find anything relevant. One article suggested going to &#8220;Modify &raquo; Transport&#8221; and check the &#8220;Allow Local LAN Access&#8221;. Which I did but didn&#8217;t work. </p>
<p>So I started playing with the network settings and at some point I got it working by changing the DNS servers to 8.8.8.8 &#8211; Google&#8217;s DNS. While I&#8217;m not sure what cause the problem or if this is the right solution, I&#8217;m posting it here so maybe it will work for somebody else. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/02/23/cisco-vpn-blocking-other-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ACTA vs &#8220;cookie law&#8221; or how retarded EU MPs are</title>
		<link>http://blog.motane.lu/2012/02/15/acta-vs-cookie-law-or-how-retarded-eu-mps-are/</link>
		<comments>http://blog.motane.lu/2012/02/15/acta-vs-cookie-law-or-how-retarded-eu-mps-are/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 20:22:18 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fun stuff]]></category>
		<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1974</guid>
		<description><![CDATA[I&#8217;m quite sure that by now everyone has heard of ACTA. It&#8217;s an international treaty negotiated in secret by a bunch of spineless, unelected wankers set to fulfil the wishes of their Hollywood paymasters. Just read my previous post to find out more. Under ACTA everything we do online will be tracked and our privacy [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.motane.lu/wp-content/uploads/2012/02/4978EUflag.jpg"><img src="http://blog.motane.lu/wp-content/uploads/2012/02/4978EUflag-300x225.jpg" alt="" title="4978EUflag" width="300" height="225" class="alignright size-medium wp-image-1980" /></a> I&#8217;m quite sure that by now everyone has heard of ACTA. It&#8217;s an international treaty negotiated in secret by a bunch of spineless, unelected wankers set to fulfil the wishes of their Hollywood paymasters. Just read <a href="http://blog.motane.lu/2012/01/27/a-new-threat-of-the-horizont-acta/" title="A new threat of the horizont – ACTA">my previous post to find out more</a>. </p>
<p>Under ACTA everything we do online will be tracked and our privacy will be violated just to enforce the IP rights of some media giants. Big Content companies will have the right to ask ISPs for our data directly, without any judicial supervision, without having to even consider obtaining a search warrant. The only way our privacy would be violated more is if the government &#8211; or private companies to follow ACTA&#8217;s trend &#8211; install video cameras in our apartments. </p>
<p>And, for the time being, the European Parliament is okay with ACTA.</p>
<p>I&#8217;m not saying that European MPs are complete idiots, not all of them anyway, just the majority required to pass a bill. And not any bill, I&#8217;m talking about the <a href="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:337:0011:0036:En:PDF" title="2009/136/EC" directive" class="outgoing">2009/136/EC</a> Directive or the so called &#8220;Cookie Law&#8221;. This law prevents websites from using cookies without asking for user consent. If you&#8217;re a tekkie, you know what a cookie is and what impact this law will have on the internet. If you&#8217;re not, well, just trust me on this one: over 90% of sites are illegal under this law. And complying with the law is a messy, expensive and time consuming process that will cripple EU technology companies trying to compete with their American or Asian counterparts. </p>
<p>And why this directive, you ask!? Well, to protect the average EU citizen&#8217;s right to privacy. Yes! The same body &#8211; EU parliament &#8211; enacted both ACTA and Directive 2009/136/EC. Just to put things in perspective, the last EU election was held in June 2009 and the directive was passed in November 2009, so the exact same people that passed the Cookie Law are thinking of passing ACTA. It&#8217;s not even a different legislature. </p>
<p>This is how I picture a normal day in the European Parliament:</p>
<p><iframe width="420" height="315" src="http://www.youtube.com/embed/IiZ4C3k0Z4U" frameborder="0" allowfullscreen></iframe></p>
<p>I think that we should vote a new law in place, so all members of the EU parliament to be forced to take an IQ test before being sworn in office. Just to see whether they&#8217;re smarter than door knob or not. A regular door knob, not a fancy electrical one! </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/02/15/acta-vs-cookie-law-or-how-retarded-eu-mps-are/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Db_Select and the LIKE clause</title>
		<link>http://blog.motane.lu/2012/02/13/zend_db_select-and-the-like-clause/</link>
		<comments>http://blog.motane.lu/2012/02/13/zend_db_select-and-the-like-clause/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 09:47:28 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=636</guid>
		<description><![CDATA[This is a post I&#8217;ve wanted to write for a long time, perhaps it will be useful to others. It&#8217;s about using Zend_Db_Table_Select and the SQL LIKE statement. I remember it giving me some headaches in the past, so here it is: The problem is that Zend&#8217;s implementation is a bit counterintuitive, as the % [...]]]></description>
			<content:encoded><![CDATA[<p>This is a post I&#8217;ve wanted to write for a long time, perhaps it will be useful to others. It&#8217;s about using <a href="http://framework.zend.com/apidoc/1.7/Zend_Db/Table/Zend_Db_Table_Select.html" title="Zend_Db_Table_Select" class="outgoing">Zend_Db_Table_Select</a> and the SQL <strong>LIKE</strong> statement. I remember it giving me some headaches in the past, so here it is:</p>
<p>The problem is that Zend&#8217;s implementation is a bit counterintuitive, as the % sign is part of the query &#8211; as it has a special significance in SQL &#8211; and not of the string being search. So the first thing in my mind was:</p>
<pre class="brush: php; title: ; notranslate">
My_Table_Example extends Zend_Db_Table
{
    public function search($value)
    {
        $select = $this-&gt;select();
        $select-&gt;where('column LIKE ?%', $value);

        // ...
    }
}
</pre>
<p>Which doesn&#8217;t quite work. Of course, one can always use good ol&#8217; string concatenation, do it like this:</p>
<pre class="brush: php; title: ; notranslate">
My_Table_Example extends Zend_Db_Table
{
    public function search($value)
    {
        $select = $this-&gt;select();
        $select-&gt;where('column LIKE &quot;' . $value . '%&quot;'); 

        // ...
    }
}
</pre>
<p>&#8230;and risk an SQL Injection attack. Definitely not the best approach! In the end I found the best solution to do it is:</p>
<pre class="brush: php; title: ; notranslate">
My_Table_Example extends Zend_Db_Table
{
    public function search($value)
    {
        $select = $this-&gt;select();
        $select-&gt;where($this-&gt;_db-&gt;quoteInto('column LIKE ?', $value . '%'));

        // ...
    }
}
</pre>
<p>&#8230;which, as previously stated, it&#8217;s quite counterintuitive. But hey, it works <img src='http://blog.motane.lu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/02/13/zend_db_select-and-the-like-clause/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Certified Ethical hacker v7 prepkit from uCertify</title>
		<link>http://blog.motane.lu/2012/02/02/certified-ethical-hacker-v7-prepkit-from-ucertify/</link>
		<comments>http://blog.motane.lu/2012/02/02/certified-ethical-hacker-v7-prepkit-from-ucertify/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 17:38:27 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[certifications]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1901</guid>
		<description><![CDATA[Few days ago I was asked if I can review on of uCertify prepkits. I wrote a review some time ago for a different prepkit &#8211; full review here XK0-002: Linux + PrepKit &#8211; and at the time I was impressed with the quality of the kit. So I agreed to do it again. This [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago I was asked if I can review on of uCertify prepkits. I wrote a review some time ago for a different prepkit &#8211; full review here <a href="http://blog.motane.lu/2009/03/08/review-of-xk0-002-linux-prepkit/" title="Review of XK0-002: Linux + PrepKit"> XK0-002: Linux + PrepKit</a> &#8211; and at the time I was impressed with the quality of the kit. So I agreed to do it again. This time, I picked the <a href="http://www.ucertify.com/exams/EC-Council/312-50-v7.html" title="CEH preparation kit" class="outgoing">prepkit</a> for the <a href="https://cert.eccouncil.org/" title="Certified Ethical Hacker" class="outgoing">Certified Ethical Hacker</a> or CEH certification. For those of you who don&#8217;t know it, this is the Chuck Norris of security certifications. </p>
<p>I downloaded the Windows executable version of the prepkit, in hope that I will be able to make it work on my Macbook. No such luck. I tried <a href="http://wiki.winehq.org/MacOSX" title="Wine" class="outgoing">Wine</a> and <a href="http://www.codeweavers.com/products/" title="CrossOver" class="outgoing">CrossOver</a>, but it kept on crashing. After several hours of frustration I emailed back the guys at uCertify with the issue. They suggested using the web version of the prepkit &#8211; at the the time I didn&#8217;t know there was a web version &#8211; which worked like a charm on all platform. So, first lesson learned &#8211; if you have a Linux / Mac system &#8211; go straight to the web version. </p>
<h2><span>Usability, look and feel</span></h2>
<p><a href="http://blog.motane.lu/wp-content/uploads/2012/01/Screen-shot-2012-01-31-at-19.49.18.png"><img src="http://blog.motane.lu/wp-content/uploads/2012/01/Screen-shot-2012-01-31-at-19.49.18-300x216.png" alt="" title="Screen shot 2012-01-31 at 19.49.18" width="300" height="216" class="alignright size-medium wp-image-1924" /></a></p>
<p>I found the prepkit to be particularly easy to use. The interface is really straight forward, very clean, with good typography that doesn&#8217;t tire your eyes. Typography is particularly in this case, as geeks &#8211; myself included &#8211; wear glasses and don&#8217;t like hard to read &#8220;artistic&#8221; fonts.</p>
<p>The information is structured in a logical manner, everything is where you expect it to be. Just have a quick look to the screenshot on the right!</p>
<p>Maximum score to usability &#038; ease of use. </p>
<h2><span>Features</span></h2>
<p>The information is divided into 3 main areas: Learn &#038; Practice, Study Material and Performance Assessment and Analytics and each section is divided into multiple sub-sections.</p>
<p><a href="http://blog.motane.lu/wp-content/uploads/2012/02/Screen-shot-2012-02-02-at-15.55.33.png"><img src="http://blog.motane.lu/wp-content/uploads/2012/02/Screen-shot-2012-02-02-at-15.55.33-300x220.png" alt="" title="Screen shot 2012-02-02 at 15.55.33" width="300" height="220" class="alignright size-medium wp-image-1953" /></a></p>
<p>The Learn &#038; Practice section is comprised of various tests, which can be used to mimic a real life exam (<em>Test mode</em>), study (<em>Learning mode</em>) or to review your knowledge (<em>Review mode</em>). Screenshot to the right!</p>
<p>Study Material is comprised of: </p>
<ul>
<li>Subject/Exam Standards &#038; Objectives</li>
<li>Study notes</li>
<li>Articles</li>
<li>Flash Cards</li>
<li>Key Terms</li>
<li>Glossary</li>
<li>Online Reference Library</li>
<li>Study Tips</li>
</ul>
<p>&#8230;and Performance Assessment and Analytics of:</p>
<ul>
<li>Study Planner</li>
<li>Progress reports</li>
<li>My Activity</li>
<li>Daily Snapshot</li>
<li>My Focus</li>
<li>Performance on Practice Tests</li>
<li>Readiness Report</li>
</ul>
<p>Some of the features are really cool, I especially liked the Study Planner, which helps you plan and keep track of your progress, a very important tool as we all know that IT guys are generally lazy and don&#8217;t like reading manuals. </p>
<p>Although getting messages like: </p>
<blockquote><p>
Your preparation is about 0.5% complete. You took 1 days to complete 0.5%. At this pace you will need another 6 Months, 2 Weeks, 5 Days, to be fully prepared for the exam.</p></blockquote>
<p>might be a bit demotivational. </p>
<h2><span>Usefulness</span></h2>
<p>To make things clear from the start, this is not an online course for beginners. The prepkit targets experienced professionals, not learners or script kiddies. But that&#8217;s not necessarily bad, as the last two categories are not even eligible for certification according to <a href="https://cert.eccouncil.org/?page_id=309" title="EC-Council's eligibility form" class="outgoing">EC-Council&#8217;s eligibility form</a>. </p>
<p>As I have yet to take the CEH exam, I can&#8217;t say how accurate or useful the questions are in a real life scenario, but given uCertify&#8217;s vast experience in the area of preparation kits for top IT certifications, I&#8217;m sure it&#8217;s useful. </p>
<h2><span>Conclusion</span></h2>
<p>I found the prepkit easy to use, filled with high quality information and well structured. I think it&#8217;s a good deal for $119.99 (aprox. €91 / £75), especially since uCertify offers a full refund if you fail the exam. <a href="http://www.ucertify.com/exams/EC-Council/312-50-v7.html" title="Preparation kit for the EC-Council CEH exam" class="outgoing">Give it a try</a>. Or if my review didn&#8217;t convince you, try it for your self. There&#8217;s a demo version available <a href="http://www.ucertify.com/download/312-50-v7.html" title="Download the demo version of the prepkit" class="outgoing">here</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/02/02/certified-ethical-hacker-v7-prepkit-from-ucertify/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A new threat of the horizont &#8211; ACTA</title>
		<link>http://blog.motane.lu/2012/01/27/a-new-threat-of-the-horizont-acta/</link>
		<comments>http://blog.motane.lu/2012/01/27/a-new-threat-of-the-horizont-acta/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 00:23:48 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1886</guid>
		<description><![CDATA[Once again I&#8217;m ashamed of my government. Disappointed and enraged at it. And this time it&#8217;s not about spending public money on crap, increasing taxes to pay astronomic salaries to some lazy ass MPs or being generally worthless. It&#8217;s much worse! Today Romania signed ACTA. An international agreement which is so broad in scope and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.motane.lu/wp-content/uploads/2012/01/200acta.jpg" alt="" title="Stop ACTA" width="250" height="295" class="alignleft size-full wp-image-1892" />Once again I&#8217;m ashamed of my government. Disappointed and enraged at it. </p>
<p>And this time it&#8217;s not about spending public money on crap, increasing taxes to pay astronomic salaries to some lazy ass MPs or being generally worthless. It&#8217;s much worse! </p>
<p>Today Romania signed <a href="http://en.wikipedia.org/wiki/Anti-Counterfeiting_Trade_Agreement" title="Anti-Counterfeiting Trade Agreement" class="outgoing">ACTA</a>. An international agreement which is so broad in scope and so evil that makes SOPA look like a plea to save the whales.</p>
<p>At least I&#8217;m not the only one.The following EU countries also signed it: Austria, Belgium, Bulgaria, the Czech Republic, Denmark, Finland, France, Greece, Hungary, Iceland, Ireland, Italy, Lithuania, Latvia, Luxembourg, Malta, Poland, Portugal, Slovenia, Spain, Sweden and the UK. Shame on them too.</p>
<p>Unlike <a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act" title="Stop Online Piracy Act" class="outgoing">SOPA</a> / <a href="http://en.wikipedia.org/wiki/PROTECT_IP_Act" title="Protect IP Act" class="outgoing">PIPA</a>, ACTA was negotiated in secret. The public was deemed &#8220;too ignorant&#8221; to be involved in the talks. For the first time in modern history, democracy was left out on a global scale. If you&#8217;re unfamiliar with ACTA, just take a look at the clip below:</p>
<p><iframe width="500" height="315" src="http://www.youtube.com/embed/citzRjwk-sQ" frameborder="0" allowfullscreen></iframe></p>
<p>In a world where technological progress should be used to improve the quality of life for everyone, ACTA enslaves us all.</p>
<p>Cheap medicine could be banned under ACTA in order to protect the intelectual rights of big pharmaceutical companies. Under current legislation, a government in difficulty, for example facing an epidemic, if it can&#8217;t get the required medication at a reasonable price, can break patents and produce the drugs in order to save its population without fear of retaliation. Under ACTA, this will no longer be possible. </p>
<p>All internet traffic will be monitored in order to detect possible breaches in copyright. All confidential medical information, all the love letters sent via email, all the chat conversations in which you&#8217;re flirting with your hot co-worker, all your bank details, everything &#8211; and I do mean everything &#8211; will be scanned and recorded by your ISP. </p>
<p>Open source programs could be banned. Even if you&#8217;re a M$ fanboy / fangirl that only uses Winblows™, you still have to understand that the Internet runs on Linux and open source. Popular services such as Google, Facebook, Wikipedia or WordPress run on open source and the Apache web server powers 60% of all the sites on the Internet. </p>
<p>You might even end up in jail for posting a video from your birthday party because some copyrighted music is playing in the background. </p>
<p>Don&#8217;t get me wrong, I&#8217;m not a lazy-ass socialist. I truly believe in capitalism, but I also believe that everybody should have a fair chance of making a good living by hard and honest work. If legislation like ACTA gets enacted, the world will be split in the chosen few, wealthy individuals that will use legislation to kill any newcomer in their field with patents and copyright issues, an army defending them and the rest, with </p>
<p>Respect to Germany, the Netherlands, Estonia, Cyprus and Slovakia for not signing ACTA today. But for the rest of us, the fight is not yet lost. All international treaties have to be <a href="http://en.wikipedia.org/wiki/Ratification" title="Ratification in Wikipedia" class="outgoing">ratified</a> so we can still stop this. </p>
<p>If you want to help, contact your representative and tell him / her that you don&#8217;t want such legislation ratified. The MPs are there to represent you and usually they tend to give in when they see their political carers threatened. If enough people contact them, they will not ratify ACTA and risk not being voted again. </p>
<p>Go to protests, if there are some in your area. </p>
<p>Do not engage in fights with the police. Do not attempt to DoS government agencies. Hacktivism is for hackers and security experts. Downloading the LOIC doesn&#8217;t make you a hacker and flooding some government website won&#8217;t help that much. And if you don&#8217;t really know what you&#8217;re doing, you&#8217;re going to get caught and thrown in jail. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/01/27/a-new-threat-of-the-horizont-acta/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multiple inheritance in PHP</title>
		<link>http://blog.motane.lu/2012/01/21/multiple-inheritance-in-php/</link>
		<comments>http://blog.motane.lu/2012/01/21/multiple-inheritance-in-php/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 12:32:06 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[extreme php]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1878</guid>
		<description><![CDATA[I wrote yesterday an article introducing Cosmin&#8217;s blog. His most recent article is on multiple inheritance and how easy it would be to implement that into weakly typed like PHP. Just have a look at the article. Having learned OOP in Java, I am generally against multiple inheritance. I believe that if the answer is [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote yesterday an article introducing Cosmin&#8217;s blog. His <a href="http://cosmi.nu/multiple-inheritance-suddenly-more-easy-in-php-than-in-c/45" title="Multiple inheritance suddleny more easy in PHP than in C" class="outgoing">most recent article</a> is on multiple inheritance and how easy it would be to implement that into weakly typed like PHP. Just have a look at the article.</p>
<p>Having learned OOP in Java, I am generally against multiple inheritance. I believe that if the answer is multiple inheritance, you&#8217;re asking the wrong question. But, for &#8220;academic&#8221; reasons, I tried to implement multiple inheritance in PHP. And I came up with the following abomination.</p>
<p>First, create a parent class from which all classes in need of multiple inheritance extend. The parent classes will be placed in the $_parents array as strings. When the main object is instantiated, the constructor creates objects from all the parent classes. And by using __call() I&#8217;m just going to redirect method calls on the main object to the first suitable parent object. I know it sounds complicated, so long story short, just read the code! I&#8217;m a developer, not a writer!</p>
<pre class="brush: php; title: ; notranslate">
/**
 * Abomination class implementing multiple inheritance via
 * __call magic method
 */
abstract class MultipleInheritance
{
    /**
     * List of parent classes
     *
     * @var array
     * @access protected
     */
    protected $_parents = array();    

    /**
     * List of parent objects - generated automatically
     *
     * @var array
     * @access private
     */
    private $_parentObjects = array();

    /**
     * Constructor (thank you captain Obvious)
     *
     * - init the parent objects
     *
     * @access public
     */
    public function __construct()
    {
        foreach ($this-&gt;_parents as $parentClass) {
            $this-&gt;_parentObjects []= new $parentClass();
        }
    }

    /**
     * __call magic method
     *
     * @param string $name
     * @param array $arguments
     * @access public
     * @return mixed
     */
    public function __call($name, array $arguments)
    {
        foreach ($this-&gt;_parentObjects as $object) {
            if (method_exists($object, $name)) {
                return call_user_func_array(array($object, $name), $arguments);
            }
        }

        throw new Exception('No such method: ' . $name);
    }
}
</pre>
<p>Now, some very sexist implementations of Mom and Dad classes:</p>
<pre class="brush: php; title: ; notranslate">
class Dad
{
    /**
     * Can parallel park
     *
     * @access public
     * @return void
     */
    public function park()
    {
        echo 'Look, I can parallel park' . PHP_EOL;
    }    

    /**
     * Can ground the kids
     *
     * @access public
     * @return void
     */
    public function ground()
    {
        echo 'Grounded by DAD' . PHP_EOL;
    }
}

class Mom
{
    protected $_parents = array('GrandMa');

    /**
     * Makes sandwiches
     *
     * @access public
     * @return void
     */
    public function makeSandwich()
    {
        echo 'Just making a sandwich' . PHP_EOL;
    }    

    /**
     * Can grounds the kids
     *
     * @access public
     * @return void
     */
    public function ground()
    {
        echo 'Grounded by MOM' . PHP_EOL;
    }
}
</pre>
<p>&#8230;and finally the child class:</p>
<pre class="brush: php; title: ; notranslate">
class Child extends MultipleInheritance
{
    protected $_parents = array('Dad', 'Mom');
}
</pre>
<p>Let&#8217;s try it out:</p>
<pre class="brush: php; title: ; notranslate">
$child = new Child();
$child-&gt;park();
$child-&gt;makeSandwich();
$child-&gt;ground();
</pre>
<p>And it works. And when two parent classes have the same method &#8211; ground() in this case &#8211; the method belonging to the first encountered class is executed. And voila, multiple inheritance in PHP. Well, sort of.</p>
<p>Now there&#8217;s a small problem with the <strong>instanceof</strong> operator. And by small problem I mean it doesn&#8217;t work and there&#8217;s no way to fix it. The following code</p>
<pre class="brush: php; title: ; notranslate">
if ($child instanceof Mom) {
    echo get_class($child) . ' class inherits from Mom' . PHP_EOL;
} else {
    echo get_class($child) . ' class does not inherit from Mom' . PHP_EOL;
}
</pre>
<p>will always go on the &#8220;else&#8221; branch, although in my application&#8217;s logic, the Child class extends from the Mom class. And since PHP doesn&#8217;t allow overloading the operators, there&#8217;s no clean way to do this. Of course, there&#8217;s a hacky way around it, by adding an isInstanceOf() method to the MultipleInheritance class:</p>
<pre class="brush: php; title: ; notranslate">
abstract class MultipleInheritance
{
    // ...

    /**
     * Check inheritance
     *
     * @param string $class
     * @access public
     * @return bool
     */
    public function isInstanceOf($class)
    {
        if (in_array($this-&gt;_parents, $class)) {
            return true;
        }

        foreach ($this-&gt;_parentObjects as $parent) {
            if ($parent instanceof MultipleInheritance) {
                if ($parent-&gt;isInstanceOf($class)) {
                    return true;
                }
            }
        }

        return false;
    }
}
</pre>
<p>&#8230;and using it to check inheritance:</p>
<pre class="brush: php; title: ; notranslate">
if ($child-&gt;isInstanceOf('Mom')) {
    echo get_class($child) . ' class inherits from Mom' . PHP_EOL;
} else {
    echo get_class($child) . ' class does not inherit from Mom' . PHP_EOL;
}
</pre>
<p>But the abomination is not completed yet. Because I used <a href="http://php.net/manual/en/function.method-exists.php" title="method_exists() in the PHP manual" class="outgoing">method_exists()</a> instead of <a href="http://php.net/manual/en/function.is-callable.php" title="is_callable() in the PHP manual" class="outgoing">is_callable()</a>, magic methods in the parent class will not be detected. To fix this, just change the code from:</p>
<pre class="brush: php; title: ; notranslate">
if (method_exists($object, $name)) {
    return call_user_func_array(array($object, $name), $arguments);
}
</pre>
<p>&#8230;to&#8230;</p>
<pre class="brush: php; title: ; notranslate">
if (is_callable($object, $name)) {
    return call_user_func_array(array($object, $name), $arguments);
}
</pre>
<p>&#8230;and it will work. At last, the abomination is ready. Doctor Frankenstein would be proud! Here is a gist with the entire example: <a href="https://gist.github.com/1652646" title="Go to https://gist.github.com/1652646" class="outgoing">https://gist.github.com/1652646</a>.</p>
<p>PS: DO NOT USE MULTIPLE INHERITANCE IN REAL LIFE APPLICATIONS!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/01/21/multiple-inheritance-in-php/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>New kid on the block</title>
		<link>http://blog.motane.lu/2012/01/20/new-kid-on-the-block/</link>
		<comments>http://blog.motane.lu/2012/01/20/new-kid-on-the-block/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 18:24:25 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[other]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1873</guid>
		<description><![CDATA[Meet Cosmin. He&#8217;s my dev partner at StoreBeez. He&#8217;s a software developer who recently turned to the light side of the Force by making the switch from .NET and other M$ technologies to PHP and open source. While he still uses Windows &#8211; which bears testimony of his former allegiance with the evil empire &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Meet <a href="http://cosmi.nu/" title="Cosmin's blog" class="outgoing">Cosmin</a>. He&#8217;s my dev partner at <a href="http://www.storebeez.com" title="Virtual mall selling jewellery, handmade, vintage and fashion items" class="outgoing">StoreBeez</a>. He&#8217;s a software developer who recently turned to the light side of the Force by making the switch from .NET and other M$ technologies to PHP and open source. </p>
<p>While he still uses Windows &#8211; which bears testimony of his former allegiance with the evil empire &#8211; he&#8217;s moving up the ladder and started a blog on PHP and other FLOSS technologies. <a href="http://cosmi.nu/" title="Cosmin's blog" class="outgoing">Check him out</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/01/20/new-kid-on-the-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SOPA blackout</title>
		<link>http://blog.motane.lu/2012/01/19/sopa-blackout/</link>
		<comments>http://blog.motane.lu/2012/01/19/sopa-blackout/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 22:05:08 +0000</pubDate>
		<dc:creator>Tudor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://blog.motane.lu/?p=1871</guid>
		<description><![CDATA[Today the anti-SOPA blackout came into action. Wikipedia was partially out &#8211; users just had to hit escape before the page finishes loading or disable Javascript, Google, Reddit, 9Gag and other well trafficked sites joined the protest. Unfortunately not everybody did it, although I would have expected it, as SOPA threatens the entire industry as [...]]]></description>
			<content:encoded><![CDATA[<p>Today the anti-SOPA blackout came into action. Wikipedia was partially out &#8211; users just had to hit escape before the page finishes loading or disable Javascript, Google, Reddit, 9Gag and other well trafficked sites joined the protest. Unfortunately not everybody did it, although I would have expected it, as SOPA threatens the entire industry as a whole, not just a few company. YouTube, Facebook as well as other online giants stayed on the bench. Sad! </p>
<p>I was curious whether GoDaddy will join the protest, after the recent scandal which forced them to withdraw their support for SOPA / PIPA. They had the decency to stay out, which is good.</p>
<p>And a short clip outlining why people <strong>should support SOPA</strong>. </p>
<p><iframe width="500" height="315" src="http://www.youtube.com/embed/3CFUrwI2_rI" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.motane.lu/2012/01/19/sopa-blackout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

