<?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>RedVulpine - Blog</title>
	<atom:link href="http://redvulpine.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://redvulpine.com/blog</link>
	<description>Javascript, PHP, Rails and lots of geek things from Fábio Rogerio</description>
	<lastBuildDate>Tue, 10 Apr 2012 02:43:46 +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>Solving Winamp Wireless Sync in Windows</title>
		<link>http://redvulpine.com/blog/solving-winamp-wireless-sync-in-windows-115?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=solving-winamp-wireless-sync-in-windows</link>
		<comments>http://redvulpine.com/blog/solving-winamp-wireless-sync-in-windows-115#comments</comments>
		<pubDate>Thu, 08 Mar 2012 00:58:51 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[winamp]]></category>

		<guid isPermaLink="false">http://redvulpine.com/blog/?p=115</guid>
		<description><![CDATA[So, recently I&#8217;ve turned into an android user, and, one of the first things that I did, was installing Winamp for android. Since there I didn&#8217;t know about the &#8220;Wireless Sync&#8221;, I loved the idea, but it simply doesn&#8217;t work. I&#8217;ve spent a lot of time on google and didn&#8217;t find anything useful, just more [...]]]></description>
			<content:encoded><![CDATA[<p>So, recently I&#8217;ve turned into an android user, and, one of the first things that I did, was installing Winamp for android.</p>
<p>Since there I didn&#8217;t know about the &#8220;Wireless Sync&#8221;, I loved the idea, but it simply doesn&#8217;t work. I&#8217;ve spent a lot of time on google and didn&#8217;t find anything useful, just more people with the same problem as me.</p>
<p>After researching some options and faced something like before, I&#8217;ve changed some settings in my Windows and then everything worked.</p>
<p>For now, I&#8217;m using Windows *(yeah, I&#8217;m crazy I know) but isn&#8217;t that different from Windows 7.</p>
<p>So, the solution is pretty simple. Just go to your &#8220;Network and Sharing Center&#8221;, search for the link &#8220;Change adapter settings&#8221; in sidebar, in the new window that will open(or it will open in the same on win 7, don&#8217;t remember now), press ALT key to show the menu bar, and then click &#8220;Advanced&#8221;, and then &#8220;Advanced Settings&#8221;.</p>
<p>Take a look what is the wi-fi adapter is in use(in case you have more than one) and in the connection box, just set your active adapter as the first from the list, click ok, restart Winamp on your PC, disable and enable again the wireless sync on your phone, it should take a while and then your phone will be listed.</p>
<p>Sometimes you have to disable and re-enable the wireless sync on your phone.</p>
<p>Hope this work for you!</p>
<p style="text-align: center;"><a href="http://redvulpine.com/blog/wp-content/uploads/2012/03/winamp.jpg"><img class="aligncenter size-medium wp-image-116" title="Instructions" src="http://redvulpine.com/blog/wp-content/uploads/2012/03/winamp-300x178.jpg" alt="" width="300" height="178" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://redvulpine.com/blog/solving-winamp-wireless-sync-in-windows-115/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using HAML with CodeIgniter</title>
		<link>http://redvulpine.com/blog/using-haml-with-codeigniter-96?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-haml-with-codeigniter</link>
		<comments>http://redvulpine.com/blog/using-haml-with-codeigniter-96#comments</comments>
		<pubDate>Wed, 22 Feb 2012 16:16:21 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[HAML]]></category>
		<category><![CDATA[SASS]]></category>

		<guid isPermaLink="false">http://redvulpine.com/blog/?p=96</guid>
		<description><![CDATA[And after working several months with Ruby On Rails, a friend of mine called me to participate into a php project using the CodeIgniter framework. Not a problem for me, but there some things that when you are into, you don&#8217;t want to get rid of them, one of them is HAML. Then, I started [...]]]></description>
			<content:encoded><![CDATA[<p>And after working several months with Ruby On Rails, a friend of mine called me to participate into a php project using the CodeIgniter framework.</p>
<p>Not a problem for me, but there some things that when you are into, you don&#8217;t want to get rid of them, one of them is HAML. Then, I started to look for some code ready to do this, but sadly, I didn&#8217;t find anything that was easy to use or up-to-date. After more search I&#8217;ve found this project: <a title="PHamlP" href="http://code.google.com/p/phamlp/" target="_blank">PHamlP</a>, an updated port of HAML and SASS parser for PHP.</p>
<p>The PHamlP project already have version for Yii and CakePHP framework.</p>
<p>I guess this parser doesn&#8217;t work much different from the Rails parser. It will look if the cached version of template exists, if not then it creates, or if the template file gets modified the cache file is updated too.</p>
<p>In this case the cache file it&#8217;s the PHP version of your HAML code. But, enough talk, let&#8217;s go to the action.</p>
<p>I dunno if this way is the best way to implement the parser on CI, but I didn&#8217;t find any performance problems, and one thing to remember, just tested this with the CodeIgniter 2.1.0.</p>
<p>First, go to your application<strong><em>/config/config.php</em></strong> and check what is your subclass_prefix, in this case, let&#8217;s suppose that it&#8217;s the default <strong><em>MY_</em></strong></p>
<p>Go to the <a title="PHamlP" href="http://code.google.com/p/phamlp/" target="_blank">PHamlP</a> project page and download the code. Create a folder inside <strong><em>application/libraries</em></strong> called <strong><em>phamlp</em></strong>(or whatever you want to use of course) and extract the files from PHamlP package.</p>
<p>After having extracted the files, create a file called <em><strong>MY_Loader.php</strong></em>(Replace the &#8220;MY_&#8221; with your <strong><em>subclass_prefix</em></strong>) in the <strong><em>application/core</em></strong> folder with the following code:</p>
<blockquote><p>Edit: Fixed code to work with CI standard functions(it also fixed the problem trying to load a HAML file inside a HAML file)</p>
<p>Edit: Added fix suggested by <strong>igoooor</strong></p></blockquote>
<pre class="brush: php; title: ; notranslate">

class MY_Loader extends CI_Loader {
    function view($view, $vars = array(), $return = false) {
        $haml_file                = dirname(__DIR__) . &quot;/views/&quot; . $view . &quot;.html.haml&quot;;
        $view_path                = dirname(__DIR__) . &quot;/views/&quot;;

        if(file_exists($haml_file)) {
            load_class('HamlParser', 'libraries/phamlp/haml', '');

            $instance                =&amp; get_instance();
            $haml_cache_path_base    = APPPATH . &quot;cache/&quot;;
            $haml_cache_path        = $haml_cache_path_base . $instance-&gt;router-&gt;fetch_directory() . strtolower(get_class($instance));

            if(!is_writable($haml_cache_path_base)) {
                $haml_error = 'The HAML cache path(' . $haml_cache_path_base . ') isn\'t writtable!';
                log_message('error', $haml_error);

                if(ENVIRONMENT != 'production'){
                    show_error($haml_error);
                }
            }

            if (!file_exists($haml_cache_path)) {
                $haml_cache_path_array = explode(&quot;/&quot;, str_replace($haml_cache_path_base, '', $haml_cache_path));

                // Let's go see if the cache structure exists then =)
                if(count($haml_cache_path_array) &gt; 1) {
                    for($haml_cache_path_counter = 0; $haml_cache_path_counter &lt; count($haml_cache_path_array); $haml_cache_path_counter++) {
                        $haml_cache_path_sliced = $haml_cache_path_base . join(&quot;/&quot;, array_slice($haml_cache_path_array, 0, $haml_cache_path_counter));

                        if(!file_exists($haml_cache_path_sliced)) {
                            mkdir($haml_cache_path_sliced);
                        }
                    }
                } else {
                    mkdir($haml_cache_path);
                }
            }

            $haml        = new HamlParser();
            $rendered    = $haml-&gt;parse($haml_file, $haml_cache_path);

            return $this-&gt;_ci_load(array('_ci_path' =&gt; $rendered, '_ci_vars' =&gt; $this-&gt;_ci_object_to_array($vars), '_ci_return' =&gt; $return));
        } else {
            // if no haml file was found, it uses the default render function
            return $this-&gt;_ci_load(array('_ci_view' =&gt; $view, '_ci_vars' =&gt; $this-&gt;_ci_object_to_array($vars), '_ci_return' =&gt; $return));
        }
    }
}
</pre>
<p>So, this new loader will look for a file in your view path that the name look like &#8220;users.html.haml&#8221;(just like the Rails way), if doesn&#8217;t find anything it fallback to the default function.</p>
<p>Well, the reason that i said that I dunno if this is the best way, it&#8217;s because the workaround with the callback to isolate the assign variables to evict possible conflicts. But, like I said, I didn&#8217;t find any performance problems at all. But that&#8217;s it, nothing more to do, without much code, and no need to change the core of the framework, just a simple extends.</p>
<p>I&#8217;ll be doing another post soon to show you how to implement the SASS parser with the CodeIgniter.</p>
<p>I hope that this gets useful for your as it was for me. Any doubts? Just comment.</p>
<p><strong>Download</strong> <a href="http://redvulpine.com/blog/wp-content/uploads/2012/02/MY_Loader.php_.zip">MY_Loader.php</a></p>
<p>Thanks for the reading.</p>]]></content:encoded>
			<wfw:commentRss>http://redvulpine.com/blog/using-haml-with-codeigniter-96/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Adobe Edge Preview 4: Adding custom prefixes to your assets</title>
		<link>http://redvulpine.com/blog/adobe-edge-preview-4-adding-custom-prefixes-to-your-assets-82?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adobe-edge-preview-4-adding-custom-prefixes-to-your-assets</link>
		<comments>http://redvulpine.com/blog/adobe-edge-preview-4-adding-custom-prefixes-to-your-assets-82#comments</comments>
		<pubDate>Fri, 20 Jan 2012 21:07:14 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Javscript]]></category>
		<category><![CDATA[Adobe Edge]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://redvulpine.com/blog/?p=82</guid>
		<description><![CDATA[And then, the awesome Adobe Edge Preview 4 was launched. I was really excited about it, and tried to create an experimental banner for a website. But then, the problem appeared. After saving the project and trying to insert in my test website I realized that I had to leave the files created by Edge [...]]]></description>
			<content:encoded><![CDATA[<p>And then, the awesome Adobe Edge Preview 4 was launched. I was really excited about it, and tried to create an experimental banner for a website. But then, the problem appeared.</p>
<p>After saving the project and trying to insert in my test website I realized that I had to leave the files created by Edge on the root of my website since I won&#8217;t be using an iframe to show the animation.</p>
<p>So after studying the AdobeEdge component and exported files, I made some patches which let me put my banner anywhere in my server and load it at the homepage without any problem.</p>
<p>So, let&#8217;s begin.</p>
<p>Let&#8217;s suppose that we created a project called &#8220;banner&#8221; and added some images to it, then, when we save it, we have the following files:</p>
<ul>
<li>banner_edgePreload.js</li>
<li>banner_edge.js</li>
<li>banner_edgeActions.js</li>
<li>banner.html</li>
<li>bnner.edge</li>
<li>edge_includes/jquery-1.6.2.min.js</li>
<li>edge_includes/jquery.easing.1.3.js</li>
<li>edge_includes/edge.0.1.4.min.js</li>
<li>images/someimage.png</li>
</ul>
<p>So, as the examples said, we just have to copy the div with our<em> Composition ID</em> and the javascript that points to the <em>Preloader</em> and put them in our page. The limitation here, as I said before, is that all files must be in your root, and that&#8217;s when the problem starts.</p>
<p>What if we want to put my new banner in another place in my server like in<strong> &#8220;assets/banner1&#8243;</strong>?<span id="more-82"></span></p>
<p>We need to patch some exported files, starting by <strong>banner_edgePreload.js</strong> (or the name from your project), where we need to replace the code from &#8220;loadResources&#8221; and add the function &#8220;registerPrefixToComposition&#8221; like it is shown below:</p>
<pre class="brush: jscript; title: ; notranslate">
    function loadResources(files, prefix) {
        prefix  = prefix || &quot;&quot;;

    	AdobeEdge.preload = AdobeEdge.preload || [];
    	AdobeEdge.preload.q = AdobeEdge.preload.q || [];
    	if( !AdobeEdge.preload.busy ){
    		AdobeEdge.requestResources(files, edgeCallback, prefix);
    	} else {
            for(var file in files) {
                files[file] = prefix + files[file];
            }

    	    AdobeEdge.preload.q.push({files: files, callback: edgeCallback});
    	}
    }

    function registerPrefixToComposition(id, prefix) {
        AdobeEdge.prefixes      = AdobeEdge.prefixes || [];
        AdobeEdge.prefixes[id]  = prefix;
    }
</pre>
<p>Add the following line near the end of the file, before the loadResources call:</p>
<pre class="brush: jscript; title: ; notranslate">

registerPrefixToComposition(compId, &quot;/asstes/banner1/&quot;);
</pre>
<p>Change the call to loadResources passing a second parameter which is the path where your files are:</p>
<pre class="brush: jscript; title: ; notranslate">

loadResources([
 &quot;edge_includes/jquery-1.6.2.min.js&quot;,
 &quot;edge_includes/jquery.easing.1.3.js&quot;,
 &quot;edge_includes/edge.0.1.4.min.js&quot;,
 &quot;banner_edge.js&quot;,
 &quot;banner_edgeActions.js&quot;
 ], &quot;/assets/banner1/&quot;);
</pre>
<p>Then, go to <strong>edge_includes/edge.0.1.4.min.js</strong> and add the folowing lines to the end of the file:</p>
<pre class="brush: jscript; title: ; notranslate">

AdobeEdge.registerCompositionDefn0 = AdobeEdge.registerCompositionDefn;

AdobeEdge.registerCompositionDefn = function (a, c, d) {
	AdobeEdge.prefixes	= AdobeEdge.prefixes || [];

	var prefixPath		= AdobeEdge.prefixes[a] || &quot;&quot;;

    for(var i in c) {
        with (c[i]) {
            for(var f in content.dom) {
                if(content.dom[f].fill &amp;&amp; content.dom[f].fill[1] &amp;&amp; content.dom[f].fill[1].toString().match(/png|gif|jpg/)) {
                    content.dom[f].fill[1] = prefixPath + content.dom[f].fill[1];
                }
            }
        }
    }

    this.registerCompositionDefn0(a, c, d)
}
</pre>
<p>And that&#8217;s it!</p>
<p>Remember to do this only when your project is complete so you won&#8217;t be doing this whole process every time you save it =)</p>
<p>I hope this can be useful, but remember that it only affects the paths for images assets.</p>
<p>Thanks for reading.</p>]]></content:encoded>
			<wfw:commentRss>http://redvulpine.com/blog/adobe-edge-preview-4-adding-custom-prefixes-to-your-assets-82/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Popups without popups</title>
		<link>http://redvulpine.com/blog/popups-without-popups-23?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=popups-without-popups</link>
		<comments>http://redvulpine.com/blog/popups-without-popups-23#comments</comments>
		<pubDate>Thu, 09 Jun 2011 21:38:22 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
				<category><![CDATA[Javscript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://redvulpine.com/blog/?p=23</guid>
		<description><![CDATA[Some days ago, a friend asked me if i knew any script that open a “modal popup” to make a sort of hotsite inside online store. I don’t use this kind of script all the time, so, the solution for him was google. And was there that the problem happened. Lot’s of results, but, all of them more [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago, a friend asked me if i knew any script that open a “modal popup” to make a sort of hotsite inside online store.</p>
<p>I don’t use this kind of script all the time, so, the solution for him was google. And was there that the problem happened. Lot’s of results, but, all of them more than outdated.</p>
<p>Then he talk to me asking if i can’t make something to help him. Well, I’ve created a quick script for him since he uses jQuery on his application, and now, looking forward his problem, i was thinking about the usability of this kind of code, then I’ve decided to create a jQuery Plugin.</p>
<p>Of course there are a lot of scripts out there that can do this, but sometimes you have to include extra files like css and other things depending on the script, for me, i don’t like that and it’s the main reason that i’ll be working on it.</p>
<p>Currently this jQuery plugin, can display static content, and load ajax content with two options for loading. For simple content, you don’t need to change anything, but, if you need to load more complex content like an external page that uses specific javascript files, you can load it inside an iframe.</p>
<p>I really don’t have a good name for this plugin, so, i’ll be calling this jqPopupBox. So, let’s begin.</p>
<p>First, you just have to include the jqpopupbox.js into you page and everything will be working(Download link available at the end of the post).</p>
<p>Second, the properties of that you can pass to the object:</p>
<ul>
<li><strong>color</strong> – string – Hexadecimal color for the div that will fill the screen.<br />
<em>Default: #777</em></li>
<li><strong>opacity</strong> – float – Opacity value for the div mentioned above.<br />
<em>Default: .8</em></li>
<li><strong>containerColor</strong> – string – Color for the container that will have the popup content itself.<br />
<em>Default: #FFF</em></li>
<li><strong>width</strong> – int – Width of the container mentioned above.<br />
<em>Default: 400</em></li>
<li><strong>height</strong> – int – Height of the container mentioned above.</li>
<li><em>Default: 400</em></li>
<li><strong>closeText</strong> – sting – The tet that will be shown on the close button.</li>
<li><em>Default: CLOSE</em></li>
<li><strong>close</strong> – Function – A callback that will be called when the users close the popup.</li>
<li><em>Default: null</em></li>
<li><strong>load</strong> – Function – A callback that will be called after the popup creation<br />
<em>Default: null</em></li>
<li><strong>useFrame</strong> – boolean – Defined if the plugin will be using an iframe for loading external content.<br />
<em>Default: false</em></li>
<li><strong>content</strong> – string – The content that will be shown in the popup. If you want to load extenal content, you must specify the full url like ‘http://redvulpine.com’.<br />
<em>Default: in blank</em></li>
</ul>
<p>A simple example</p>
<pre class="brush: jscript; title: ; notranslate">

$(document).ready(function () {
	$.popupBox({
		content: 'Hello World'
	});
});
</pre>
<p>Now, lets suppose that you want to use animations, for loading and closing.</p>
<pre class="brush: jscript; title: ; notranslate">

$(document).ready(function () {
	$.popupBox({
		content: 'Hello World',
		load:	function (r, c) {
			c.hide();
			c.show('slow');
		},
		close:	function (r, c) {
			r.fadeOut('slow');
			c.fadeOut('slow', null, this.remove);
		},
	});
});
</pre>
<p>In the example above, we have two parameters in the callbacks, c and r. Where, <strong>c</strong> is the popup container and <strong>r</strong> is the div that blocks the rest of document. Also, you can customize all the elements using theses css selectors:</p>
<ul>
<li>jqqpopupbox-region</li>
<li>jqqpopupbox-container</li>
<li>jqqpopupbox-close</li>
</ul>
<p>And, that’s it, nothing more, simple as you can see. Maybe i’ll be doing updates later, like, to load images(of course, you can use other scripts in this case, like fancybox) or flash, youtube maybe?</p>
<p>Well, thanks for reading and I expect that this code be useful to you =)</p>
<blockquote><p><strong>Version 0.1.1</strong></p>
<p>- Fixed some typo issues</p>
<p>- Fixed issues with page scrolling</p></blockquote>
<p><strong>Download:</strong> <a href="http://redvulpine.com/blog/wp-content/uploads/2011/06/jqpopupbox.zip">jqPopupBox</a> (Version 0.1.1 – IE 6+, FF, Opera, Safari, Chrome)</p>]]></content:encoded>
			<wfw:commentRss>http://redvulpine.com/blog/popups-without-popups-23/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

