<?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>André Catita</title>
	<atom:link href="http://andrecatita.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrecatita.com</link>
	<description>Web Developer Portfolio</description>
	<lastBuildDate>Wed, 13 Jan 2016 23:11:45 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>PHP SOAP WSSE OASIS SECURITY</title>
		<link>http://andrecatita.com/code-snippets/php-soap-wsse-oasis-security/</link>
		<comments>http://andrecatita.com/code-snippets/php-soap-wsse-oasis-security/#comments</comments>
		<pubDate>Mon, 21 Apr 2014 21:17:52 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Code Projects]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[oasis]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[wss]]></category>
		<category><![CDATA[wsse]]></category>

		<guid isPermaLink="false">http://andrecatita.com/?p=993</guid>
		<description><![CDATA[Hello, From some of my posts you&#8217;d figure I had a big project, where many problems occurred between SOAP PHP and other services..yeah it happened. I had to implement connections with various security protocols, the other day at StackOverflow I noticed someone having problem with this, and most of the posts have no responses at [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Hello,</p>
<p>From some of my posts you&#8217;d figure I had a big project, where many problems occurred between SOAP PHP and other services..yeah it happened.</p>
<p>I had to implement connections with various security protocols, the other day at StackOverflow I noticed someone having problem with this, and most of the posts have no responses at all.</p>
<p>This specific post will show you to establish a connection to a SOAP WebService that is secured with WSSE, the specific doc is Web Services Security Username Token Profile: http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd</p>
<p>In order to structure it clearly, and make sure PHP doens&#8217;t f*ck while generating the XML, we create various classes.</p>
<p>First we need a Class to store our username and password.</p><pre class="crayon-plain-tag">class WSSEAuth {
   private $Username;
   private $Password;
          function __construct($username, $password) {
             $this-&gt;Username= $username;
             $this-&gt;Password= $password;
          }
}</pre><p>Then we need a class to store our Username Token related to this service.</p><pre class="crayon-plain-tag">class WSSEToken {

   private $UsernameToken;

   function __construct($innerVal) {
      $this-&gt;UsernameToken = $innerVal;
   }

}</pre><p>Now instead of extending the SoapClient, which made errors happened in other places of communication with various other SOAP APIs.</p>
<p>I just make client inside another class, with the security options prepared and then return it to be used elsewhere in the code.</p><pre class="crayon-plain-tag">class MySoapClient {

   private $username;
   private $password;
   private $options;
   private $header;
   private $wsdl;
   private $wsse;
   private $gw;
   public $start_time;

   public function getClient($wsse, $user, $pw, $wsdl, $gw) {

      $this-&gt;wsse = $wsse;
      $this-&gt;username = $user;
      $this-&gt;password = $pw;
      $this-&gt;wsdl = $wsdl;
      $this-&gt;gw = $gw;
      $this-&gt;start_time = microtime(true);

      $this-&gt;options = array(
          'trace'=&gt;1,
          'username'=&gt;$this-&gt;username,
          'password'=&gt;$this-&gt;password,
          'exceptions'=&gt;true,
          'connection_timeout'=&gt;5,
      );

      $objSoapVarUser = new SoapVar($this-&gt;username, XSD_STRING, NULL, $this-&gt;wsse, NULL, $this-&gt;wsse);
      $objSoapVarPass = new SoapVar($this-&gt;password, XSD_STRING, NULL, $this-&gt;wsse, NULL, $this-&gt;wsse);
      $objWSSEAuth = new WSSEAuth($objSoapVarUser, $objSoapVarPass);
      $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $this-&gt;wsse, 'UsernameToken', $this-&gt;wsse);
      $objWSSEToken = new WSSEToken($objSoapVarWSSEAuth);
      $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $this-&gt;wsse, 'UsernameToken', $this-&gt;wsse);
      $this-&gt;header = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $this-&gt;wsse, 'Security', $this-&gt;wsse);
      $objSoapVarWSSEHeader[] = new SoapHeader($this-&gt;wsse, 'Security', $this-&gt;header, true, $this-&gt;gw);

      $objClient = new SoapClient($this-&gt;wsdl, $this-&gt;options);
      $objClient-&gt;__setSoapHeaders($objSoapVarWSSEHeader);

      return $objClient;
   }

}</pre><p>I have trace, exceptions and connection_timeout activated which are all optional.</p>
<p>After all those 3 classes are created, I can just access my prepared client like this:</p><pre class="crayon-plain-tag">$var = new MySoapClient;
$var_client = $var-&gt;getClient('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'your_user', 'your_password', 'your_wsdl', 'your_gate');</pre><p>Obvious as it seems, you need to indicate your user, pw, wsdl and gate (optional) to connect.</p>
<p>Afterwards you use it just as normal, example:</p><pre class="crayon-plain-tag">$var_client-&gt;__soapCall('Function', $soap_payload);</pre><p></p>
<p>Hope this comes in handy for some of you..<br />
Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/code-snippets/php-soap-wsse-oasis-security/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>goals of 2014? 2013 goals updated</title>
		<link>http://andrecatita.com/personal/goals-of-2014-2013-goals-updated/</link>
		<comments>http://andrecatita.com/personal/goals-of-2014-2013-goals-updated/#comments</comments>
		<pubDate>Fri, 24 Jan 2014 23:10:27 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[portfolio]]></category>

		<guid isPermaLink="false">http://andrecatita.com/?p=987</guid>
		<description><![CDATA[Hello everyone.. My 2013 goals didn&#8217;t go so well. We just have to admit failure and prepare new goals, or repeat the one we really need to! And set time for them! My 2014 Goals Fitness Get back in late 2011 shape (2013 goal). This didn&#8217;t work so well, perhaps 10%.. this year I intend [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Hello everyone..</p>
<p>My 2013 goals didn&#8217;t go so well. We just have to admit failure and prepare new goals, or repeat the one we really need to! And set time for them!</p>
<p><span id="more-987"></span></p>
<h3>My 2014 Goals</h3>
<p>Fitness</p>
<ul>
<li><strong><em>Get back in late 2011 shape (2013 goal)<del>.</del></em></strong><br />
This didn&#8217;t work so well, perhaps 10%.. this year I intend to fulfill 80%-90% of that goal. Since I don&#8217;t have the time and will as before.</li>
<li><del>Bought a bike</del>, need to go out with it more, better weather required!</li>
</ul>
<p>Career</p>
<ul>
<li><em><strong><del>Get more gigs as Freelancer. (2013 goal)</del><br />
</strong></em>Need more, more !</li>
<li><del>Contribute and evolve alongside my new place of work.</del></li>
</ul>
<p>Development</p>
<ul>
<li>Definitely expand my Ruby and RoR skills (2013 goal).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/personal/goals-of-2014-2013-goals-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reconstruct PHP SOAP Object</title>
		<link>http://andrecatita.com/code-snippets/reconstruct-php-soap-object/</link>
		<comments>http://andrecatita.com/code-snippets/reconstruct-php-soap-object/#comments</comments>
		<pubDate>Mon, 08 Jul 2013 21:36:55 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[decode]]></category>
		<category><![CDATA[encode]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[reconstruct]]></category>
		<category><![CDATA[serialize]]></category>
		<category><![CDATA[soap]]></category>

		<guid isPermaLink="false">http://andrecatita.com/?p=960</guid>
		<description><![CDATA[Hello guys, Do you use PHP? Do you use SOAP (you better :p) default extension? This post is to be applied in that case and in that case only. I don&#8217;t like NuSOAP and I think it has no use anymore. This is a pretty neat &#8216;hack&#8217;. After sending some data to a webservice, say [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Hello guys,</p>
<p>Do you use PHP? Do you use SOAP (you better :p) default extension?<br />
This post is to be applied in that case and in that case only.<br />
I don&#8217;t like NuSOAP and I think it has no use anymore.</p>
<p>This is a pretty neat &#8216;hack&#8217;. After sending some data to a webservice, say you need to save the XML that is easy.. PHP gives you your request in XML.</p>
<p>But say you need to save the payload as it is, just to re-send it later for some reason.<br />
The payload is the final PHP Soap Object you constructed. (Works in arrays too as the PHP SOAP Object needs to be converted to array to be sent anyway).</p>
<p>You may say, well I will use serialize, and store the serialization of the object, however PHP serialize does NOT work with PHP SOAP Objects.<br />
It doesn&#8217;t recognize the classes and the objects get malformed.</p>
<p>This is a trouble you only experience if you are really trying to rebuild a SOAP Object and not a simple array, but trust me there are cases in which you need SOAP Objects and not just arrays to enforce complicated hierarchy of namespaces.</p>
<p>You move on to json_encode/decode? Then it just won&#8217;t work as all the objects will be re-constructed into Array&#8217;s..</p>
<p>So what you actually need is a re-constructive  function that applies the correct decode transformation to a previous json_encode of the entire Payload SOAP Object.</p>
<p>So after you apply json_decode and you have a extensive Array. You apply this &#8220;&#8221;&#8221;beautiful&#8221;&#8221;&#8221; (read neat hack) function I created to reconstruct it accordingly.</p>
<p>You may want to add some switch&#8217;s in case you used any different type besides XSD_STRING or just SOAP_ENC_OBJECT when constructing the parameters.<br />
I don&#8217;t use any other type seeing as it doesn&#8217;t matter when it gets transformed to XML.</p>
<p>Here&#8217;s the neat function:</p><pre class="crayon-plain-tag">function soapifyAO(array $data, $type_cast) {
   foreach ($data as $k=&gt; &amp;$value) {
      if (is_array($value)) {
         if ($k == '0')
            $value = soapifyAO($value, 2);
         elseif ($k == 'enc_value')
            $value = soapifyAO($value, 3);
         elseif (isset($value[0]))
            $value = soapifyAO($value, 1);
         else
            $value = soapifyAO($value, 2);
      }
   }

   switch ($type_cast) {
      case 1:
         return new ArrayObject($data);
         break;
      case 2:
         switch ($data['enc_type']) {
            case 101:
               return new SoapVar($data['enc_value'], XSD_STRING, NULL, $data['enc_ns'], $data['enc_name'], $data['enc_namens']);
               break;
            case 301:
               return new SoapVar($data['enc_value'], SOAP_ENC_OBJECT, NULL, $data['enc_ns'], $data['enc_name'], $data['enc_namens']);
               break;
         }
         break;
      case 3:
         return (object) $data;
         break;
   }
}</pre><p>Enjoy. Share!</p>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/code-snippets/reconstruct-php-soap-object/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ISO 7064 &#8211; Mod 11,2 PHP</title>
		<link>http://andrecatita.com/code-snippets/iso-7064-mod-112-php/</link>
		<comments>http://andrecatita.com/code-snippets/iso-7064-mod-112-php/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 14:40:45 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[check digit]]></category>
		<category><![CDATA[digit]]></category>
		<category><![CDATA[iso 7064]]></category>
		<category><![CDATA[mod11]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://wpthemes.rubenbristian.com/ikaros/?p=244</guid>
		<description><![CDATA[Today again I&#8217;m here because there&#8217;s a special Modulus Check Digit of the norm ISO/IEC 7064, the Mod 11,2, that I wasn&#8217;t able to find the code for in PHP. To help you all I decided to build a version of it. Mod 11 2 isn&#8217;t a very known modulus because it isn&#8217;t used very [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Today again I&#8217;m here because there&#8217;s a special Modulus Check Digit of the norm ISO/IEC 7064, the Mod 11,2, that I wasn&#8217;t able to find the code for in PHP.</p>
<p>To help you all I decided to build a version of it. Mod 11 2 isn&#8217;t a very known modulus because it isn&#8217;t used very often and perhaps that&#8217;s why there isn&#8217;t much information around.</p>
<p>For example the Mod 97,10 is used to calculate the check digit of an IBAN (International Bank Account Number) and so you can find it in many places.</p>
<p>The Mod 11-2 is used in medical related services, that&#8217;s where you will find it most of the times.</p>
<p>Code can also be found <a title="in the gist here" href="https://gist.github.com/andreCatita/5714353">in the gist here</a> and in the box below.</p>
<p>Share, enjoy.</p><pre class="crayon-plain-tag">class Iso7064mod112 {

  public $code;

  public function encode($code) {
    $this-&gt;code = $code;
    $c = $this-&gt;computeCheck($this-&gt;code);
    if ($c == 10) {
      return $this-&gt;code . "X";
    } else {
      return $this-&gt;code . $c;
    }
  }

  public function verify($code) {
    $this-&gt;code = $code;
    return (computeCheck(substr($this-&gt;code, 0, -1)) == getCheckDigit($this-&gt;code));
  }

  public function computeCheck($str) {
    $p = 0;
    for ($i = 0; $i &lt; strlen($str); $i++) {
      $c = $str[$i];
      $p = 2 * ($p + $c);
   }
   $p %= 11;
   return (12 - $p) % 11;
  }

  public function getCheckDigit($str) {
    $c = substr($str, -1);
    if ($c == 'X' || $c == 'x') {
      return 10;
    } else {
      return $c;
    }
  }

}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/code-snippets/iso-7064-mod-112-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP SOAP Repeated Element Name</title>
		<link>http://andrecatita.com/code-snippets/php-soap-repeated-element-name/</link>
		<comments>http://andrecatita.com/code-snippets/php-soap-repeated-element-name/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 19:49:39 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[arrayobject]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://wpthemes.rubenbristian.com/ikaros/?p=304</guid>
		<description><![CDATA[So you found yourself looking for one of the following keywords &#8216;PHP SOAP Repeated Element Name&#8216; or &#8216;SOAP Structure Repeated Name&#8216;. Then look no further, I&#8217;m going to show you how to properly address this problem. PHP SoapClient is not the most complete library out there, it&#8217;s actually rather poor at times, if you have [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>So you found yourself looking for one of the following keywords &#8216;<strong>PHP SOAP Repeated Element Name</strong>&#8216; or &#8216;<strong>SOAP Structure Repeated Name</strong>&#8216;.</p>
<p>Then look no further, I&#8217;m going to show you how to properly address this problem.<br />
PHP SoapClient is not the most complete library out there, it&#8217;s actually rather poor at times, if you have the time to test and implement, a better, faster, more complete library to replace PHP SoapClient, then google this: WSO2 Web Services Framework for PHP (WSO2 WSF/PHP), it&#8217;s a paid-turned-open source project.</p>
<p>In reference to our problem, you may have a structure like this:</p><pre class="crayon-plain-tag">&lt;Competition&gt;
 &lt;Dogs&gt;
   &lt;Dog&gt;
     &lt;Gender&gt;Male&lt;/Gender&gt;
     &lt;Breed&gt;Aidi&lt;/Breed&gt;
   &lt;/Dog&gt;
   &lt;Dog&gt;
     &lt;Gender&gt;Female&lt;/Gender&gt;
     &lt;Breed&gt;Labrador&lt;/Breed&gt;
   &lt;/Dog&gt;
 &lt;/Dogs&gt;
&lt;/Competition&gt;</pre><p>And whether you are building the response using Objects or Arrays, the answer is pretty much the same.</p>
<p>In case you are working with a complex WSDL Specification you are probably using Objects, for perfect control over the namespaces.</p>
<p><strong>The Solution</strong><br />
The simplest solution relies on a pretty little thing called, ArrayObject, implemented in PHP 5, which can be used whether you are building an Array or an Object.</p><pre class="crayon-plain-tag">// Note, this is a method which can be used in simple and complex responses

$dogParams = new ArrayObject(); // Dog Parameters
$dogs = new ArrayObject(); // Dog Element
$Competition = new stdClass(); // Competition Element

// * Note the hard-coded 0, because this is an example
$dogParams[0]-&gt;Gender = 'Male';
$dogParams[0]-&gt;Breed = 'Aidi';

// If you are building a complex response, you could have gone for this
// example using a SoapVar
$dogParams[1]-&gt;Gender = new SoapVar("Female", XSD_STRING, NULL, $namespace, 'Gender', $namespace);
$dogParams[1]-&gt;Breed= new SoapVar("Labrador", XSD_STRING, NULL, $namespace, 'Breed', $namespace);

// Now that we have two (2) dogs information, create Dog object
$dog=[];
$dog[0] = new SoapVar($dogParams[0],SOAP_ENC_OBJECT,NULL,$namespace,'Dog',$namespace);
$dog[1] = new SoapVar($dogParams[1],SOAP_ENC_OBJECT,NULL,$namespace,'Dog',$namespace);
// and append it to Dogs
$dogs-&gt;append($dog[0]);
$dogs-&gt;append($dog[1]);

// And now our outside structure, Competition element
$competition-&gt;Dogs = new SoapVar($dogs, SOAP_ENC_OBJECT, NULL, $namespace, 'Dogs ', $namespace);</pre><p>If you are a building simple response without need for namespace declarations, you can just put the value instead of using SoapVar&#8217;s.</p>
<p>The example above will output the XML repeated element example above when sent via SOAP.</p>
<p><span id="more-304"></span></p>
<h3>Things you have, hopefully, learned from this post</h3>
<ul>
<li>PHP default <strong>SoapClient</strong> is probably not the best solution to your needs.<br />
*   NuSOAP is not better</li>
<li>There is an <strong>ArrayObject</strong> since PHP 5, which allows objects to work as arrays.</li>
<li>How to <strong>repeat nested elements in a XML SOAP Structure</strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/code-snippets/php-soap-repeated-element-name/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Automatic Image Watermark</title>
		<link>http://andrecatita.com/code-projects/php-automatic-image-watermark/</link>
		<comments>http://andrecatita.com/code-projects/php-automatic-image-watermark/#comments</comments>
		<pubDate>Sun, 14 Apr 2013 19:33:21 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Code Projects]]></category>
		<category><![CDATA[automatic]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://andrecatita.com/?p=938</guid>
		<description><![CDATA[PHP snippet to Watermark Images Automatically. This snippet brings a one line .htaccess, if you choose to use it, any call to a image on your website, gets automatically watermarked, stopping anyone from downloading the image without the watermark. You can also center the watermark in the following &#8216;variable name&#8216; positions: TOP_LEFT , TOP_CENTER, TOP_RIGHT [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>PHP</strong> snippet to Watermark Images Automatically.</p>
<p>This snippet brings a one line .htaccess, if you choose to use it, any call to a image on your website, gets automatically watermarked, stopping anyone from downloading the image without the watermark.</p>
<p>You can also center the watermark in the following &#8216;<em>variable name</em>&#8216; positions:</p>
<ul>
<li>TOP_LEFT , TOP_CENTER, TOP_RIGHT</li>
<li>CENTER_LEFT, CENTER, CENTER_RIGHT</li>
<li>BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT</li>
</ul>
<p>You can either change the default settings in the .php file, or if you invoke the script direct directly you can pass parameters either in .htaccess or in a html page, as you can see in the demo.</p>
<p>The scripts uses two merging type functions (imagecopy and imagecopymerge).<br />
In case you already have a .PNG or .GIF with the opacity set, you can set the script to just overlay it, otherwise if you use a JPEG or any other file without transparency set, you can choose the opacity and the script will merge it accordingly.</p>
<p>You can find the code over <a title="at github" href="https://github.com/andreCatita/imageWatermark" target="_blank">at github</a>. You can find a <a title="Demo here" href="http://andrecatita.com/demos/watermark" target="_blank">Demo here</a>.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/code-projects/php-automatic-image-watermark/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Team ELO Rating</title>
		<link>http://andrecatita.com/code-projects/php-team-elo-rating/</link>
		<comments>http://andrecatita.com/code-projects/php-team-elo-rating/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 00:38:50 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Code Projects]]></category>
		<category><![CDATA[dota]]></category>
		<category><![CDATA[elo]]></category>
		<category><![CDATA[hon]]></category>
		<category><![CDATA[lol]]></category>
		<category><![CDATA[rating]]></category>
		<category><![CDATA[team]]></category>

		<guid isPermaLink="false">http://andrecatita.com/?p=926</guid>
		<description><![CDATA[PHP class to calculate a Team based ELO Rating System for 5 vs 5. This is heavily inspired on: Heroes of Newerth League of Legends DotA 2 The use of this class is quite simple. You can find the code over at github which has a usage example. You can find a demo here. But [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>PHP</strong> class to calculate a <strong>Team</strong> based <strong>ELO</strong> Rating System for 5 vs 5.</p>
<p>This is heavily inspired on:</p>
<ul>
<li><strong>Heroes of Newerth</strong></li>
<li><strong>League of Legends</strong></li>
<li><strong>DotA 2</strong></li>
</ul>
<p>The use of this class is quite simple.<br />
You can find the code over <a title="at github" href="https://github.com/andreCatita/teamRating" target="_blank">at github</a> which has a usage example. You can find a <a title="demo here." href="http://andrecatita.com/demos/teamrating/" target="_blank">demo here.</a>
<p>But simply, this takes two team arrays, with a mandatory <strong>elo</strong> column.<br />
The class will then calculate both team averages, win rate probabilitys.<br />
And when you execute the calculate function it will return the same two arrays with two new columns, containing the &#8216;gain&#8217; and &#8216;loss&#8217; points for each case.<br />
You can use them as you wish.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/code-projects/php-team-elo-rating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP gettext localization alias with sprintf</title>
		<link>http://andrecatita.com/code-snippets/php-gettext-localization-alias-with-sprintf/</link>
		<comments>http://andrecatita.com/code-snippets/php-gettext-localization-alias-with-sprintf/#comments</comments>
		<pubDate>Thu, 21 Mar 2013 21:20:55 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[gettext]]></category>
		<category><![CDATA[il8n]]></category>
		<category><![CDATA[localization]]></category>

		<guid isPermaLink="false">http://andrecatita.com/?p=918</guid>
		<description><![CDATA[For those who use and like gettext for localization. This is a snippet to have a simpler and more powerful way to access it over PHP default. It automatically uses sprintf when needed, and you don&#8217;t have to write a big ass line for a simple plural translation. Code is also in the Gist [crayon-6ad6062f10f1b692020599/]]]></description>
				<content:encoded><![CDATA[<p>For those who use and like <strong>gettext</strong> for <strong>localization</strong>.</p>
<p>This is a snippet to have a simpler and more powerful way to access it over PHP default.</p>
<p>It automatically uses sprintf when needed, and you don&#8217;t have to write a big ass line for a simple plural translation.</p>
<a href="https://gist.github.com/andreCatita/5216677" title="Code is also in the gist" target="_blank">Code is also in the Gist</a>
<p></p><pre class="crayon-plain-tag">/*************
* gettext aliases
* Singular, Plural integrated with sprintf
* http://andrecatita.com
**********************/
 
function _t() {
$args = func_get_args();
$num = func_num_args();
$args[0] = gettext($args[0]);
if ($num &lt;= 1)
return $args[0];
return call_user_func_array('sprintf', $args);
}
 
function __t() {
$args = func_get_args();
$args[0] = ngettext($args[0], $args[1], $args[2]);
array_splice($args, 1, 1);
return call_user_func_array('sprintf', $args);
}
 
// How to use
// _t for singular
 
echo _t('You are a dog');
// Outputs: You are a dog
echo _t('You are a %s', 'horse');
// Outputs: You are a horse
 
// __t for plural
 
echo __t('I have eaten %d %s', 'I have eaten %d %ss', 1, 'apple');
// Outputs: I have eaten 1 apple
echo __t('I have eaten %d %s', 'I have eaten %d %ss', 2, 'apple');
// Outputs: I have eaten 2 apples
 
echo __t('I killed %d human', 'I killed %d humans - %d %s', '1', '9', 'were assholes');
// Outputs: I killed 1 human (remaining parameters are ignored)
echo __t('I killed %d human', 'I killed %d humans - %d %s', '10', '9', 'were assholes');
// Outputs: I killed 10 humans - 9 were assholes</pre><p> </p>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/code-snippets/php-gettext-localization-alias-with-sprintf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hello world; my goals to 2013</title>
		<link>http://andrecatita.com/personal/hello-world-my-goals-to-2013/</link>
		<comments>http://andrecatita.com/personal/hello-world-my-goals-to-2013/#comments</comments>
		<pubDate>Sun, 17 Mar 2013 12:47:54 +0000</pubDate>
		<dc:creator><![CDATA[andrecatita]]></dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[portfolio]]></category>

		<guid isPermaLink="false">http://wpthemes.rubenbristian.com/ikaros/?p=293</guid>
		<description><![CDATA[Hello everyone, Welcome to my brand new Portfolio and DevBlog. I hope you enjoy the look and the way things are organized now. The last version no longer excited me to contribute, and since I wanted to contribute more, besides just having a gallery and share stuff in my blog, I decided to bring this [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>Welcome to my brand new Portfolio and DevBlog.<br />
I hope you enjoy the look and the way things are organized now.</p>
<p>The last version no longer excited me to contribute, and since I wanted to contribute more, besides just having a gallery and share stuff in my blog, I decided to bring this version to life.</p>
<p><span id="more-293"></span></p>
<h3>2013 Goals</h3>
<p>I also wanted to publicly share some of my goals for 2013, since I can always look back and have it in my face what I should and shouldn&#8217;t have done. So here it is, some of my 2013 goals.</p>
<p>Fitness</p>
<ul>
<li>Get back in late 2011 shape.</li>
<li>Buy a new bike and figure out a journey to do with it.</li>
</ul>
<p>Personal</p>
<ul>
<li>Make plans for a out-of-country visit in the start of the next year.</li>
<li>Read more books.</li>
</ul>
<p>Carrer</p>
<ul>
<li>Get more gigs as Freelancer.</li>
<li>Contribute and evolve alongside my new place of work.</li>
</ul>
<p>Development</p>
<ul>
<li>Build a Android App.</li>
<li>Start building a iPhone App.</li>
<li>Build a EmberJS App.</li>
<li>Expand my Ruby and RoR skills. Create a project which evolves both and PHP.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://andrecatita.com/personal/hello-world-my-goals-to-2013/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
