<?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"
	>

<channel>
	<title>Manifesto42 - Arquiva-me</title>
	<atom:link href="http://manifesto42.com/42/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://manifesto42.com/42</link>
	<description>Flex, PHP, Mysql, Flash, doubts and solutions. Kinda like IKEA, but about programming. And smaller. And not swedish.</description>
	<pubDate>Mon, 16 Apr 2012 15:31:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Recover/reset PostgreSQL password</title>
		<link>http://manifesto42.com/42/?p=155</link>
		<comments>http://manifesto42.com/42/?p=155#comments</comments>
		<pubDate>Mon, 16 Apr 2012 15:31:01 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[PostgreSQL]]></category>

		<category><![CDATA[password]]></category>

		<category><![CDATA[reset]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=155</guid>
		<description><![CDATA[Ran into some PostgreSQL problems again (what else is new?), this time regarding the password for the windows user postgres creates.
I was replacing postgreSQL x64 for the x86 version to fix some weborb/php/lots of other stuff problems. I uninstalled my x64 version, it left the data folder and user, and when it was reinstalling, it [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into some PostgreSQL problems again (what else is new?), this time regarding the password for the windows user postgres creates.</p>
<p>I was replacing postgreSQL x64 for the x86 version to fix some weborb/php/lots of other stuff problems. I uninstalled my x64 version, it left the data folder and user, and when it was reinstalling, it asked for my password. I thought i knew it (i still think i do, but lets assume it was me who forgot it and not postgres), but the setup wouyldnt accept it no matter what.</p>
<p>Anyway, to make things short, to reset the password, you can do this:</p>
<p>- Open a Command Prompt with Admin permissions</p>
<p>- type <strong>net user postgres postgres</strong> (the abstract syntax is &#8220;net user [USER HERE] [PASSWORD HERE]&#8220;)</p>
<p>- the password is reset to &#8220;postgres&#8221;</p>
<p>- Smile.</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=155</wfw:commentRss>
		</item>
		<item>
		<title>Recover WinSCP passwords</title>
		<link>http://manifesto42.com/42/?p=151</link>
		<comments>http://manifesto42.com/42/?p=151#comments</comments>
		<pubDate>Wed, 11 Apr 2012 15:11:49 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[password]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=151</guid>
		<description><![CDATA[To recover passwords from winSCP, or any other program that provides an obscured input field (usually with asterisks &#8220;******&#8221; or small dots).
Install this free program (Password Unmask 2.0 from AlpineSnow) - 179kb:
Download from Alpine Snow Website - Link
Local download (in case the other site is offline) - Link (v2.0)

How to use:
- Download
- Unzip (if you [...]]]></description>
			<content:encoded><![CDATA[<p>To recover passwords from winSCP, or any other program that provides an obscured input field (usually with asterisks &#8220;******&#8221; or small dots).</p>
<p>Install this free program (Password Unmask 2.0 from AlpineSnow) - 179kb:</p>
<p>Download from Alpine Snow Website - <a title="Download Password unmask" href="http://www.alpinesnow.com/pwu.shtmlhttp://" target="_blank">Link</a></p>
<p>Local download (in case the other site is offline) - <a title="download password unmask" href="http://www.manifesto42.com/42/downloads/Pwunmask.zip" target="_blank">Link (v2.0)<br />
</a></p>
<p>How to use:</p>
<p>- Download</p>
<p>- Unzip (if you downloaded from my server its inside a zip file)</p>
<p>- Install</p>
<p>- Run</p>
<p>- Open your winSCP (or any other program that has obscured password input fields) and when you pass the mouse over the password field, the password is shown.</p>
<p>Solved my problem, hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=151</wfw:commentRss>
		</item>
		<item>
		<title>Sort an ArrayCollection</title>
		<link>http://manifesto42.com/42/?p=145</link>
		<comments>http://manifesto42.com/42/?p=145#comments</comments>
		<pubDate>Thu, 29 Dec 2011 19:12:49 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Flex Air]]></category>

		<category><![CDATA[arraycollection]]></category>

		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=145</guid>
		<description><![CDATA[If you have an ArrayCollection and need to sort it, heres a quick example:
import mx.collections.ISort;
import mx.collections.ISortField;
var sort:ISort = new Sort();
var sortfieldNome:ISortField = new SortField(&#8221;name&#8221;,true); // &#8220;name&#8221; is a field on the arraycollection
var sortfieldEmail:ISortField = new SortField(&#8221;email&#8221;,true); // &#8220;email&#8221; is another field on the arraycollection
sort.fields = [sortfieldNome, sortfieldEmail];
myArrayCollection.sort = sort;
// this next line is used if [...]]]></description>
			<content:encoded><![CDATA[<p>If you have an ArrayCollection and need to sort it, heres a quick example:</p>
<p>import mx.collections.ISort;<br />
import mx.collections.ISortField;</p>
<p>var sort:ISort = new Sort();<br />
var sortfieldNome:ISortField = new SortField(&#8221;name&#8221;,true); // &#8220;name&#8221; is a field on the arraycollection<br />
var sortfieldEmail:ISortField = new SortField(&#8221;email&#8221;,true); // &#8220;email&#8221; is another field on the arraycollection<br />
sort.fields = [sortfieldNome, sortfieldEmail];<br />
myArrayCollection.sort = sort;</p>
<p>// this next line is used if you want the sort to be reversed.</p>
<p>// sort.reverse();</p>
<p>// Apply the sort to the collection.<br />
myArrayCollection.refresh();</p>
<p>References:</p>
<p>from Adobe Help - <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/collections/Sort.html" target="_blank">spark.collections.sort</a> - read it. its a good source of information</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=145</wfw:commentRss>
		</item>
		<item>
		<title>Copy ArrayCollection - not as a reference</title>
		<link>http://manifesto42.com/42/?p=143</link>
		<comments>http://manifesto42.com/42/?p=143#comments</comments>
		<pubDate>Thu, 29 Dec 2011 19:07:49 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Flex Air]]></category>

		<category><![CDATA[arraycollection]]></category>

		<category><![CDATA[copy]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=143</guid>
		<description><![CDATA[On my day job, i needed to copy an ArrayCollection to a different var so i could manipulate it without affecting the original. Went with this:
arraycollection2 = arraycollection1;
With this method, all i did to arraycollection2 was also happening to arraycollection1.
to copy arrayCollection1 to arrayCollection2 without making it a reference:
arrayCollection2 = ObjectUtil.copy(arrayCollection1) as ArrayCollection;
That&#8217;s that.
Oh, and [...]]]></description>
			<content:encoded><![CDATA[<p>On my day job, i needed to copy an ArrayCollection to a different var so i could manipulate it without affecting the original. Went with this:</p>
<p>arraycollection2 = arraycollection1;</p>
<p>With this method, all i did to arraycollection2 was also happening to arraycollection1.</p>
<p>to copy arrayCollection1 to arrayCollection2 without making it a reference:</p>
<p>arrayCollection2 = ObjectUtil.copy(arrayCollection1) as ArrayCollection;</p>
<p>That&#8217;s that.</p>
<p>Oh, and make sure you import this:</p>
<p>import mx.utils.ObjectUtil;</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=143</wfw:commentRss>
		</item>
		<item>
		<title>FlashBuilder 4.x Color Scheme/Theme</title>
		<link>http://manifesto42.com/42/?p=131</link>
		<comments>http://manifesto42.com/42/?p=131#comments</comments>
		<pubDate>Thu, 08 Dec 2011 03:58:21 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Flash builder IDE]]></category>

		<category><![CDATA[Theme]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=131</guid>
		<description><![CDATA[Spending a lot of time in front of my monitor looking at code on a white background was slowly getting on my nerves. I looked up on changing the flash builder IDE color scheme and came up with some nice alternatives. My life coding life just got much nicer&#8230;and darker.
This is tested on Flash Builder [...]]]></description>
			<content:encoded><![CDATA[<p>Spending a lot of time in front of my monitor looking at code on a white background was slowly getting on my nerves. I looked up on changing the flash builder IDE color scheme and came up with some nice alternatives. My life coding life just got much nicer&#8230;and darker.</p>
<p>This is tested on Flash Builder 4.5/4.5.1/4.6:</p>
<p>1. Go to menu Help -&gt; Eclipse Marketplace&#8230;;</p>
<p>2. Search for &#8220;theme&#8221;;</p>
<p>3. Find the entry called &#8220;Eclipse color theme&#8221; and install;</p>
<p>4. Go to menu Window -&gt; Preferences;</p>
<p>5. Go to entry General -&gt; Appearance -&gt; Color Theme;</p>
<p>6. Select your favorite theme;</p>
<p>7. Write back and thank me for saving your eyes from the white coding death.</p>
<p><strong>Optional</strong> - to change specific colors like background, selections, etc.:</p>
<p>In Window -&gt; Preferences:</p>
<p>- General -&gt; Appearance -&gt; Colors and Fonts</p>
<p>- General -&gt; Editors -&gt; Text Editors</p>
<p>- General -&gt; Editors -&gt; Structured Text Editors</p>
<p>- Flash Builder - Editors - Syntax Coloring</p>
<p>I use an altered <strong>zenburn</strong> theme.</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=131</wfw:commentRss>
		</item>
		<item>
		<title>XAMPP PHP not working with PostgreSQL</title>
		<link>http://manifesto42.com/42/?p=127</link>
		<comments>http://manifesto42.com/42/?p=127#comments</comments>
		<pubDate>Sat, 15 Oct 2011 15:02:56 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[Apache]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[PostgreSQL]]></category>

		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=127</guid>
		<description><![CDATA[This is a recurring problem i had. For some reason (which i later found out), i couldnt get my php scripts to connect to postgresql. The scripts borked at, for example, pg_connect() (unable to find the function, blah blah).
First off, usually php doesnt come configured to run the postgresql dll out of the box (the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a recurring problem i had. For some reason (which i later found out), i couldnt get my php scripts to connect to postgresql. The scripts borked at, for example, pg_connect() (unable to find the function, blah blah).</p>
<p>First off, usually php doesnt come configured to run the postgresql dll out of the box (the windows extension is commented), so you have to uncomment it yourselves.</p>
<p>In php.ini, uncomment (remove the &#8220;;&#8221;) the following line:</p>
<p><strong><em>;extension=php_pgsql.dll</em></strong></p>
<p>so it becomes</p>
<p><strong><em>extension=php_pgsql.dll</em></strong></p>
<p>Still, when i restarted Apache, i got the error:</p>
<p>&#8220;<span>Unable to load dynamic library &#8216;c:\Programs\PHP\ext\php_pgsql.dll&#8217;&#8221;</span></p>
<p>Which was intriguing since the dll was where it was supposed to be.</p>
<p>As it turns out, on later versions of php, the dll is linked to &#8220;libpq.dll&#8221;, a postgresql dll. So, to fix things, i added the following line to httpd.conf:</p>
<p><em><strong>LoadFile &#8220;C:/Programs/PostgreSQL/9.0/bin/libpq.dll&#8221;</strong></em></p>
<p><em><strong></strong></em>(replace the path to your postgresql installation dir, of course - and be careful copying the line above because of the &#8220;)</p>
<p>this way the dll is preloaded when apache is started and we dont get the &#8220;Unable to link&#8230;&#8221; error.</p>
<p>This was tested with xampp on windows xp pro, with apache 2.2.17, php 5.3.5 and postgresql 9.0. Other versions can probably affect the solution presented.</p>
<p>PS - On some situations (probably php versions), it is needed to replace the php_pgsql.dll file that comes with php with one from a previous version. This wasnt necessary on my case.</p>
<p>Heres a useful link from where i got the info:</p>
<p><a href="http://php.net/manual/pt_BR/install.windows.apache2.php" target="_blank">http://php.net/manual/pt_BR/install.windows.apache2.php</a> (see the comments)</p>
<p><strong>UPDATE:</strong></p>
<p>Ran into the same problem, but this time on windows 7 64bit. I was using XAMPP 1.7.7 (Apache 2.2.21 / PHP 5.3.8) and postgresql 9.1 64bit.</p>
<p>- I uncommented the php_pgsql.dll in php.ini, restarted apache and got an error.</p>
<p>- Added the loadfile line (see above) to httpd.conf and the apache service couldnt start.</p>
<p>No matter what i did, nothing worked. After a few hours of head banging, i had the bright idea of searching for the <strong>64bit</strong> part on the postgresql install and i found this article:</p>
<p><a href="http://blog.hagander.net/archives/73-PostgreSQL-vs-64-bit-windows.html" target="_blank">http://blog.hagander.net/archives/73-PostgreSQL-vs-64-bit-windows.html</a></p>
<p>(in case you dont want to read, it says, in a nutshell: you are safe using the 32bit version of postgresql on a 64bit OS)</p>
<p>So i thought the problem might be from just that. Heres what i did:</p>
<p>- Installed the 32bit version of postgresql 9.1</p>
<p>- Added the loadfile line to httpd.conf.</p>
<p>- Restarted the apache service&#8230;and it worked.</p>
<p>So we end up with: Windows 7 Ultimate 64bit + XAMPP 1.7.7 + PostgreSQL 9.1 32bit + Smile</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=127</wfw:commentRss>
		</item>
		<item>
		<title>How to add a line break in a flex TextArea</title>
		<link>http://manifesto42.com/42/?p=124</link>
		<comments>http://manifesto42.com/42/?p=124#comments</comments>
		<pubDate>Wed, 25 May 2011 17:25:53 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Flex Air]]></category>

		<category><![CDATA[linebreak]]></category>

		<category><![CDATA[TextArea]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=124</guid>
		<description><![CDATA[To add a line break inside the text of a TextArea component in flex we cannot use \n, but instead use &#8216;&#38;#13;&#8217; (without the quotes).
For example:
&#60;s:TextArea text=&#8221;this text will be on the first line&#38;#13;and this one on the second&#8221; &#8230;/&#62;
will produce a text box with this text:
this text will be on the first line
and this [...]]]></description>
			<content:encoded><![CDATA[<p>To add a line break inside the text of a TextArea component in flex we cannot use \n, but instead use &#8216;&amp;#13;&#8217; (without the quotes).</p>
<p>For example:</p>
<p>&lt;s:TextArea text=&#8221;this text will be on the first line&amp;#13;and this one on the second&#8221; &#8230;/&gt;</p>
<p>will produce a text box with this text:</p>
<p><span style="color: #0000ff;">this text will be on the first line</span></p>
<p><span style="color: #0000ff;">and this one on the second</span></p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=124</wfw:commentRss>
		</item>
		<item>
		<title>PHPMaker automatic thumbnail creation</title>
		<link>http://manifesto42.com/42/?p=120</link>
		<comments>http://manifesto42.com/42/?p=120#comments</comments>
		<pubDate>Wed, 18 May 2011 14:37:18 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[phpmaker]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=120</guid>
		<description><![CDATA[To create a thumbnail to go along with the image you upload to the DB using PHPMaker, you do something like this:
For the sake of simplicity, let&#8217;s assume you have two directories:
- &#8220;imgs_sessoes&#8221; - for all the regular size images
- &#8220;imgs_sessoes_tn&#8221; - for the thumbnails
After configuring PHPMaker to upload, and resize if you want, the [...]]]></description>
			<content:encoded><![CDATA[<p>To create a thumbnail to go along with the image you upload to the DB using PHPMaker, you do something like this:</p>
<p>For the sake of simplicity, let&#8217;s assume you have two directories:</p>
<p>- &#8220;imgs_sessoes&#8221; - for all the regular size images</p>
<p>- &#8220;imgs_sessoes_tn&#8221; - for the thumbnails</p>
<p>After configuring PHPMaker to upload, and resize if you want, the images, you go to Server Events/Client Scripts, item Row_Inserting and add:<br />
function Row_Inserting(&amp;$rs) {<br />
$file=$rs['ficheiro'];<br />
$this-&gt;ficheiro-&gt;Upload-&gt;ResizeAndSaveToFile(100, 100, 80, &#8220;imgs_sessoes_tn/&#8221;, $file, TRUE);<br />
return TRUE;<br />
}</p>
<p>Change your image field as appropriate (mine is called &#8220;ficheiro&#8221;)</p>
<p>NOTE - ResizeAndSaveToFile() takes 6 arguments: width, height, quality, directory, filename, and boolean for overwrite.</p>
<p>To delete thumbnaill along with regular image, ad in Row_Deleting:</p>
<p>function Row_Deleting(&amp;$rs) {<br />
$filename=$rs['ficheiro'];<br />
@unlink(&#8221;imgs_sessoes_tn/&#8221;.$filename);<br />
return TRUE;<br />
}</p>
<p>NOTE - Again, notice the name of the field.</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=120</wfw:commentRss>
		</item>
		<item>
		<title>Count words using Regex</title>
		<link>http://manifesto42.com/42/?p=116</link>
		<comments>http://manifesto42.com/42/?p=116#comments</comments>
		<pubDate>Tue, 29 Mar 2011 16:16:46 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[count]]></category>

		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=116</guid>
		<description><![CDATA[Yes, i know, very very easy. But i am leaving this here as reference:
$texto = &#8220;how to count words in a very simple step&#8221;;
$contagem = preg_match_all(&#8221;/\w+/&#8221;, $texto, $blaharray);
echo $contagem; // 9
For further reading:
Regular Expressions info
preg_match()
preg_match_all()
]]></description>
			<content:encoded><![CDATA[<p>Yes, i know, very very easy. But i am leaving this here as reference:</p>
<p>$texto = &#8220;how to count words in a very simple step&#8221;;</p>
<p>$contagem = preg_match_all(&#8221;/\w+/&#8221;, $texto, $blaharray);<br />
echo $contagem; // 9</p>
<p>For further reading:</p>
<p><a href="http://www.regular-expressions.info/" target="_blank">Regular Expressions info</a></p>
<p><a href="http://www.php.net/manual/en/function.preg-match.php" target="_blank">preg_match()</a></p>
<p><a href="http://www.php.net/manual/en/function.preg-match-all.php" target="_blank">preg_match_all()</a></p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=116</wfw:commentRss>
		</item>
		<item>
		<title>include() vs require() vs *_once()</title>
		<link>http://manifesto42.com/42/?p=114</link>
		<comments>http://manifesto42.com/42/?p=114#comments</comments>
		<pubDate>Mon, 14 Mar 2011 20:40:37 +0000</pubDate>
		<dc:creator>42</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Add new tag]]></category>

		<category><![CDATA[include]]></category>

		<category><![CDATA[require]]></category>

		<guid isPermaLink="false">http://manifesto42.com/42/?p=114</guid>
		<description><![CDATA[Just to settle this once and for all:
include(&#8217;file.php&#8217;); // will include file.php and emite a WARNING if the file is not found
require(&#8217;file.php&#8217;); // will include file.php and emit a FATAL ERROR if the file is not found
require_once(&#8217;file.php&#8217;); // PHP will check if the file has   already been included, and if so, not include [...]]]></description>
			<content:encoded><![CDATA[<p>Just to settle this once and for all:</p>
<p>include(&#8217;file.php&#8217;); // will include file.php and emite a WARNING if the file is not found</p>
<p>require(&#8217;file.php&#8217;); // will include file.php and emit a FATAL ERROR if the file is not found</p>
<p>require_once(&#8217;file.php&#8217;); // PHP will check if the file has   already been included, and if so, not include (require) it again.</p>
<p>include_once(&#8217;file.php&#8217;); // same as require_once, but will evaluate the file before (yes, its include, with warning and checks to see if file exists).</p>
<p>So there you have it, kids. Just so you(*i*) never forget.</p>
]]></content:encoded>
			<wfw:commentRss>http://manifesto42.com/42/?feed=rss2&amp;p=114</wfw:commentRss>
		</item>
	</channel>
</rss>

