<?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>Shared Know How</title>
	<atom:link href="http://www.sharedknowhow.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharedknowhow.com</link>
	<description>Howto: fix, find, use, make &#38; do it guide</description>
	<lastBuildDate>Mon, 17 Jan 2011 08:37:06 +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>.htaccess redirect to maintenance &#8211; under construction page</title>
		<link>http://www.sharedknowhow.com/2011/01/htaccess-redirect-to-maintenance-under-construction-page/</link>
		<comments>http://www.sharedknowhow.com/2011/01/htaccess-redirect-to-maintenance-under-construction-page/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 08:37:06 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Other stuff]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=121</guid>
		<description><![CDATA[For simple redirect while doing maintenance on websites like upgrades or emergency fixes I put a site in maintenance by adding the next few lines to my .htacces RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 RewriteCond %{REQUEST_URI} !(\.(gif&#124;jpg&#124;css)$&#124;^/maintenance\.html$) RewriteRule ^(.*)$ /maintenance.html [R=302,L] Ofcourse change the 123\.123\.123\.123 to your ip address and create a maintenance.html. This .htaccess will still serve [...]]]></description>
			<content:encoded><![CDATA[<p>For simple redirect while doing maintenance on websites like upgrades or emergency fixes I put a site in maintenance by adding the next few lines to my .htacces</p>
<p><code>RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123<br />
RewriteCond %{REQUEST_URI} !(\.(gif|jpg|css)$|^/maintenance\.html$)<br />
RewriteRule ^(.*)$ /maintenance.html [R=302,L]</code></p>
<p>Ofcourse change the 123\.123\.123\.123 to your ip address and create a maintenance.html. This .htaccess will still serve images and css normally so you can use them in your maintenance page.</p>
<p>If you want to add more ip adresses just duplicate the line: RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 and change the ip.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2011/01/htaccess-redirect-to-maintenance-under-construction-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Share printer with Airprint under Linux/Ubuntu 10.04</title>
		<link>http://www.sharedknowhow.com/2010/11/share-printer-with-airprint-under-linuxubuntu-10-04/</link>
		<comments>http://www.sharedknowhow.com/2010/11/share-printer-with-airprint-under-linuxubuntu-10-04/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 18:26:33 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Other stuff]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=112</guid>
		<description><![CDATA[Getting Airprint printer sharing to work under linux is fairly simple. First off all you need to get your printer working under linux using Cups and make sure you have pdf support (apt-get install cupsd cups-pdf). I won't get into detail howto configure cups. This will be different from printer to printer and pretty well described [...]]]></description>
			<content:encoded><![CDATA[<p>Getting Airprint printer sharing to work under linux is fairly simple.</p>
<p>First off all you need to get your printer working under linux using Cups and make sure you have pdf support (apt-get install cupsd cups-pdf). I won't get into detail howto configure cups. This will be different from printer to printer and pretty well described on the internet.</p>
<ul>
<li>Download the script to  <a href="https://github.com/tjfontaine/airprint-generate">the script</a> to generate an Avahi daemon config file provided by <a href="http://www.atxconsulting.com/blog/tjfontaine/2010/11/21/automatically-generate-airprint-avahi-service-files-cups-printers">tjfontaine</a>:</li>
</ul>
<p><em>git clone https://github.com/tjfontaine/airprint-generate.git </em>(apt-get install git - if you don't have git yet)</p>
<ul>
<li>To run this script you need python and python-cups:</li>
</ul>
<p><em>apt-get install python python-cups</em></p>
<ul>
<li>run the script:</li>
</ul>
<p><em>cd airport-generate/<br />python airprint-generate.py </em></p>
<ul>
<li>copy the created files to your avahi services config directory:</li>
</ul>
<p><em>cp *.service /etc/avahi/services/</em></p>
<p>After this you should be ready to go. I still did get one error in my cups error log:<br />Request from "fe80::7ec5:37ff:fe09:62df%eth0" using invalid Host: field "office.local"</p>
<p>To get this working I still needed to add one line in /etc/cupsd.conf  :<br /><em>ServerAlias *</em></p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2010/11/share-printer-with-airprint-under-linuxubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimize your PHP website performance</title>
		<link>http://www.sharedknowhow.com/2010/04/optimizing-your-php-website-performance/</link>
		<comments>http://www.sharedknowhow.com/2010/04/optimizing-your-php-website-performance/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 09:39:44 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Other stuff]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=101</guid>
		<description><![CDATA[Optimize your PHP website by making sure you use the following tricks The list Optimize front-end Combine CSS files as much as possible Combine Javascript files as much as possible Always place a favicon.ico (saves needless 404 request and file searches) If you use a lot of small images for your website make use of [...]]]></description>
			<content:encoded><![CDATA[<p>Optimize your PHP website by making sure you use the following tricks</p>
<p><strong>The list</strong></p>
<p>Optimize front-end</p>
<ul>
<li>Combine CSS files as much as possible</li>
<li>Combine Javascript files as much as possible</li>
<li>Always place a favicon.ico (saves needless 404 request and file searches)</li>
<li>If you use a lot of small images for your website make use of CSS Sprites</li>
<li>Use GZIP compression</li>
</ul>
<p>Optimize PHP</p>
<ul>
<li>Install APC (Alternative PHP Cache). This will speed your php up a lot</li>
<li>if you don't use .htaccess or have control over the server remove .htaccess ability and set any options in your apache virtual host file.</li>
<li>don't use current directory (".") in your include path but instead link directly to files in your code: include("./example.php")</li>
<li>Watch how many include paths you have. It will search in every folder for to find include file.</li>
<li>use persistent mysql connection (mysql_pconnect)</li>
</ul>
<p>This list is based on the presentation of Rasmus Ledorf at Campus Party 2010 - <a href="http://talks.php.net/show/cp10">http://talks.php.net/show/cp10</a>. Out of this e've compiled a small checklist of things to do when you create a php website. This will make sure you will use all the simple tricks to make your website and PHP code to run fast. Further information on how to benchmark this look at the presentation of Rasmus.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2010/04/optimizing-your-php-website-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solved Dojo&gt; Dijit.Dialog in ZendFrameWork doesn&#8217;t parse</title>
		<link>http://www.sharedknowhow.com/2009/06/solved-dojo-dijitdialog-in-zendframework-doesnt-parse/</link>
		<comments>http://www.sharedknowhow.com/2009/06/solved-dojo-dijitdialog-in-zendframework-doesnt-parse/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 13:23:39 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[dijit]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[zendframework]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=78</guid>
		<description><![CDATA[When trying to make a Dojo dialog work with another controller which is loaded trough the href attribute of the dialog. The content will not render as dijit elements. This is because ZendFramework places all the properties in the Javascript array zendDijits and then add them to the elements after loading. However this will not [...]]]></description>
			<content:encoded><![CDATA[<p>When trying to make a Dojo dialog work with another controller which is loaded trough the href attribute of the dialog. The content will not render as dijit elements.</p>
<p>This is because ZendFramework places all the properties in the Javascript array zendDijits and then add them to the elements after loading. However this will not work for the loaded Dialog because the ZendDijits are set in the view of the controller opening the dialog.</p>
<p>The simple solution to this is to use the declaritive formin the Zend_Dojo_View_Helper_Dojo by placing the following line in your code:</p>
<pre class="php">&nbsp;
Zend_Dojo_View_Helper_Dojo::<span style="color: #006600;">setUseDeclarative</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>I placed this in my bootstrap.php right after the line where the Zend_Dojo_View_Helper is loaded.</p>
<p>Making de view helper declarative will place the dojo properties directly into the html of the elements.<br />
Side-effect: the script will not be correctly verified as valid (x)html but it will solve the problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2009/06/solved-dojo-dijitdialog-in-zendframework-doesnt-parse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Evolution importing old mail in Ubuntu Intrepid 8.10 hangs</title>
		<link>http://www.sharedknowhow.com/2008/10/evolution-importing-old-mail-in-ubuntu-intrepid-810-hangs/</link>
		<comments>http://www.sharedknowhow.com/2008/10/evolution-importing-old-mail-in-ubuntu-intrepid-810-hangs/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 10:02:14 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[evolution linux bug crash fix]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=74</guid>
		<description><![CDATA[Ofcourse yesterday when the new Ubuntu 8.10 came out I couldn't wait to install the new version. I came across a big problem though that evolution was hanging on importing/migrating my old mail. I tried to copy my old .evolution folder and even importing a backup I made. Evolution segfaulted with the following line in [...]]]></description>
			<content:encoded><![CDATA[<p>Ofcourse yesterday when the new Ubuntu 8.10 came out I couldn't wait to install the new version. I came across a big problem though that evolution was hanging on importing/migrating my old mail. I tried to copy my old .evolution folder and even importing a backup I made.</p>
<p>Evolution segfaulted with the following line in messages<br />
<code><br />
[   56.897763] evolution[6320]: segfault at 0 ip b6a45d07 sp bff95824 error 4 in libglib-2.0.so.0.1800.2[b69e9000+b5000]<br />
</code><br />
It turns out that importing fails on the ev-summary files in ~/.evolution/</p>
<p>The solution is deleting those ev-summary files. They will be regenerated by evolution. Because I have dozens of folders in my evolution I used the following line:</p>
<p>find ~/.evolution -name *ev-summary -print0 | xargs -0 rm</p>
<p>after that  evolution works just fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2008/10/evolution-importing-old-mail-in-ubuntu-intrepid-810-hangs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Linux PPTP VPN server install for use with Iphone</title>
		<link>http://www.sharedknowhow.com/2008/09/linux-vpn-server-installation-for-use-with-iphone/</link>
		<comments>http://www.sharedknowhow.com/2008/09/linux-vpn-server-installation-for-use-with-iphone/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 15:19:00 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nat]]></category>
		<category><![CDATA[poptop]]></category>
		<category><![CDATA[pptpd]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=30</guid>
		<description><![CDATA[I was looking into getting an vpn connection from my iphone to my server because I wouldn't want to send my email passwords and webpasswords clear over any public WIFI. Setting up an open source vpn connection from the Iphone is fairly simple but there is not much choiche of software. To my knowledge OpenVPN [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking into getting an vpn connection from my iphone to my server because I wouldn't want to send my email passwords and webpasswords clear over any public WIFI. Setting up an open source vpn connection from the Iphone is fairly simple but there is not much choiche of software. To my knowledge OpenVPN and Openswan are not supported so my choiche came down to:  <a href="http://www.poptop.org/" target="_blank">Poptop</a> which is probably not the most secure solution because it's uses the Microsoft protocol which has a few <a href="http://poptop.sourceforge.net/dox/protocol-security.phtml" target="_blank">flaws</a> but I figured it would be much safer then nothing and if there is an evil WIFI I would guess they will just go for the easy targets.</p>
<p>My install is a CentOS 5.2 installation but it should work under any fairly recent Linux distribution</p>
<p>Setting Poptop VPN for Iphone is done in just four steps:</p>
<p><span id="more-30"></span></p>
<p><strong>1 Installing Poptop on your linux server</strong></p>
<p>Some distributions already have pptpd, if not you can install it from source with the following steps.</p>
<p>Download the latest pptpd from <a href="http://sourceforge.net/project/showfiles.php?group_id=44827" target="_blank">Sourceforge</a>.</p>
<p>Unpack pptpd, configure and run make install:</p>
<pre class="text">tar -zxvf pptpd-1.3.4.tar.gz
cd pptpd-1.3.4
./configure
make
make install</pre>
<p><strong>2 Configuring pptpd (poptop)</strong></p>
<p>Now we need to configure the different files used by pptpd to setup up for the vpn:</p>
<p>/etc/pptpd.conf</p>
<pre class="text">option /etc/ppp/options.pptpd
localip 192.168.8.1
remoteip 192.168.8.234-238</pre>
<p>/etc/ppp/options.pptpd</p>
<pre class="text"> name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
#require-mppe-128 //comment for iphone 4 
#opendns dns services, you can replace this by your dns provider
ms-dns 208.67.222.222
ms-dns 208.67.220.220
lock
nobsdcomp
nologfd</pre>
<p>/etc/ppp/chap-secrets</p>
<pre class="text"># Secrets for authentication using CHAP
#set one or more username and passwords to use with the pptp VPN
# username    pptpd   password         IP addresses
username       pptpd   password        *</pre>
<p><strong>3 Setup the server for Masquerading/NAT</strong></p>
<p>Because we want to share the internet connection of the server with the Iphone we need to do NAT. The following couple of lines enable this. I am assuming eth0 is the network interface conneted to the internet. Just first try this out by copy and pasting this into bash but to keep it working even after a reboot you can copy the following lines into /etc/rc.local</p>
<pre class="text">echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth0 -o ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPT
&nbsp;
#and start pptpd
/usr/local/sbin/pptpd</pre>
<p><strong>4 Configuring the Iphone</strong></p>
<p>On your iphone click settings &gt; network &gt;VPN &gt; Add VPN Configuration</p>
<p>Click PPTP and fill in a description<br /> the hostname of the server<br /> account = the username filled in in /etc/ppp/chap-secrets<br /> RSA SecurID: OFF<br /> password, as filled in in /etc/ppp/chap-secrets<br /> Encryption Level = Auto<br /> Send All Trafic: ON</p>
<p>Now press save and when Turning VPN to ON it should connect to the server.</p>
<p>If you have any problems don't hesistate to ask in the comments.</p>
<p><strong>Update iPhone 4:</strong></p>
<p>According to <a href="http://tech.chickenandporn.com/2010/08/31/pptp-on-iphone-changes-iphone3-to-iphone4/">C&amp;P</a> this setup doesn't work anymore on iPhone 4. Comment the line</p>
<pre class="text">#require-mppe-128</pre>
<p> </p>
<p>searching for <a href="http://www.netfirms.ca" target="_blank">web site hosting</a>?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2008/09/linux-vpn-server-installation-for-use-with-iphone/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>AF9015 &#8211; equinux tubestick under Ubuntu</title>
		<link>http://www.sharedknowhow.com/2008/09/af9015-equinux-tubestick-under-ubuntu/</link>
		<comments>http://www.sharedknowhow.com/2008/09/af9015-equinux-tubestick-under-ubuntu/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 14:25:57 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[dvb af9015 linux ubuntu tv]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=22</guid>
		<description><![CDATA[Installing drivers for the af9015 sold as the Equinux tubestick and numerous other brands for Linux is pretty easy to find &#38; install. Go to http://linuxtv.org/hg/~anttip/af9015/ and download the latest drivers. We need to build these drivers so make sure you installed the following packages build-essential linux-headers-generic for the use of the usb stick itself [...]]]></description>
			<content:encoded><![CDATA[<p>Installing drivers for the af9015 sold as the Equinux tubestick and numerous other brands for Linux is pretty easy to find &amp; install. Go to <a href="http://linuxtv.org/hg/~anttip/af9015/ " target="_blank">http://linuxtv.org/hg/~anttip/af9015/</a> and download the latest drivers.</p>
<p>We need to build these drivers so make sure you installed the following packages</p>
<p>build-essential<br />
linux-headers-generic</p>
<p><span id="more-22"></span></p>
<p>for the use of the usb stick itself we need: dvb-utils</p>
<p>these are all to be found in synaptics.</p>
<p>now unpack the file and go into it's directory and type:<br />
(when compiling for second time or new kernel, "make distclean")</p>
<pre class="text">make all
sudo make install</pre>
<p>now download the <a href="http://www.otit.fi/~crope/v4l-dvb/af9015/af9015_firmware_cutter/firmware_files/4.95.0/dvb-usb-af9015.fw">firmware</a> (right click save-as) for the AF9015 and place this in /lib/firmware</p>
<p>then do a:</p>
<pre class="text">sudo modprobe dvb-usb-af9015</pre>
<p>and it will load all necessary modules.<br />
Type dmesg to check if everything loaded</p>
<p>use scan to find all the channels which are available to this by using the right file for your region:</p>
<pre class="text">scan /usr/share/doc/dvb-utils/examples/scan/dvb-t/COUNTRY_YOURREGION &gt; channels.conf</pre>
<p>this file you can us to view tv in xine or me-tv</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2008/09/af9015-equinux-tubestick-under-ubuntu/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Flex 3 Combobox error #1502</title>
		<link>http://www.sharedknowhow.com/2008/09/flex-3-combobox-error-1502/</link>
		<comments>http://www.sharedknowhow.com/2008/09/flex-3-combobox-error-1502/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 13:47:59 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[flex3 flex combobox bug]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=16</guid>
		<description><![CDATA[We where dealing with finding the bug in the following error: ﻿Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds. at mx.core::UIComponent/get owner() at mx.core::UIComponent/owns()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8811] at mx.managers::PopUpManagerImpl$/nonmodalMouseDownOutsideHandler()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:820] at PopUpData/mouseDownOutsideHandler()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:980] It turns out that it has to do with a certain id in one of our elements which [...]]]></description>
			<content:encoded><![CDATA[<p>We where dealing with finding the bug in the following error:</p>
<p>﻿Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.   at mx.core::UIComponent/get owner()   at mx.core::UIComponent/owns()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8811]   at mx.managers::PopUpManagerImpl$/nonmodalMouseDownOutsideHandler()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:820]   at PopUpData/mouseDownOutsideHandler()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:980]</p>
<p>It turns out that it has to do with a certain id in one of our elements which had the id "owner" apparently this is used internally in flex as well. Simple to fix but pretty hard to find</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2008/09/flex-3-combobox-error-1502/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixed AS3 Flash TextArea &#8211; CSS incompatibility</title>
		<link>http://www.sharedknowhow.com/2008/07/fixed-flash-textarea-css-incompatibility/</link>
		<comments>http://www.sharedknowhow.com/2008/07/fixed-flash-textarea-css-incompatibility/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 16:36:25 +0000</pubDate>
		<dc:creator>wytze</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[class extends]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[stylesheet]]></category>
		<category><![CDATA[text format]]></category>
		<category><![CDATA[TextArea]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=13</guid>
		<description><![CDATA[When working with flash components we often run into disadvantages. As with the TextArea class (fl.controls.TextArea) we encountered that it is not possible to use a CSS on its 'textField' property. Once again we thought to have the fast way to an end with components, but nothing of the sort.:'( Since the 'styleSheet' property returns [...]]]></description>
			<content:encoded><![CDATA[<p>When working with flash components we often run into disadvantages. As with the TextArea class (fl.controls.TextArea) we encountered that it is not possible to use a CSS on its 'textField' property. Once again we thought to have the fast way to an end with components, but nothing of the sort.:'(</p>
<p>Since the 'styleSheet' property returns a standard TextField instance it struck us as weird that setting its 'styleSheet' property didn't work. The TextArea class was trying to set textFormat which fails after setting the stylesheet of the textfield.</p>
<p><strong>Error message:</strong></p>
<div style="margin: 0pt; padding: 0pt; white-space: pre; display: inline;">Error: Error #2009: This method cannot be used on a text field with a style sheet.</div>
<div style="margin: 0pt; padding: 0pt; white-space: pre; display: inline;">at flash.text::TextField/setTextFormat()</div>
<div style="margin: 0pt; padding: 0pt; white-space: pre; display: inline;">at fl.controls::TextArea/drawTextFormat()</div>
<div style="margin: 0pt; padding: 0pt; white-space: pre; display: inline;">at fl.controls::TextArea/draw()</div>
<div style="margin: 0pt; padding: 0pt; white-space: pre; display: inline;">at fl.core::UIComponent/callLaterDispatcher()</div>
<p>This pointed us to the 'drawTextFormat()' function in the TextArea class. After taking a look we figured out what to do.</p>
<p>The problem turned out to be that every time you add text to your textarea the class tries to add a designated, or default flash-textFormat to the textfield. Adding Flash TextFormat objects to textfields conflicts with stylesheets. Our solutions was relatively simple: a small class extends of the textArea class.</p>
<p>Click continue for the fixing source<br />
<span id="more-13"></span></p>
<pre class="actionscript">    <span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">controls</span>.<span style="color: #006600;">TextArea</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">/**
    * @makes it possible to do textArea.textField.styleSheet
    * @author Tim de Jong - Dooping VOF 2008 - tim -AT- dooping.nl
    * @version 001
    */</span>
&nbsp;
    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> doopingTextArea <span style="color: #0066CC;">extends</span> TextArea
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> doopingTextArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        override protected <span style="color: #000000; font-weight: bold;">function</span> drawTextFormat<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">textField</span>.<span style="color: #006600;">styleSheet</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">super</span>.<span style="color: #006600;">drawTextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                setEmbedFont<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>_html<span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">textField</span>.<span style="color: #0066CC;">htmlText</span> = _savedHTML;
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #66cc66;">&#125;</span></pre>
<p>Then load the stylesheet by passing it to the textField object inside the textArea.</p>
<pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> myTextArea = <span style="color: #000000; font-weight: bold;">new</span> doopingTextArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
myTextArea.<span style="color: #0066CC;">textField</span>.<span style="color: #006600;">styleSheet</span> = styleSheetObject;</pre>
<p>As you can see we simply check if a styleSheet exists and than decide whether or not to do the original text formatting or not. Now we're able to use CSS on TextArea's and keep styling and code neatly separated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2008/07/fixed-flash-textarea-css-incompatibility/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Hiding TextArea border in AS3</title>
		<link>http://www.sharedknowhow.com/2008/07/hiding-textarea-border-in-as3/</link>
		<comments>http://www.sharedknowhow.com/2008/07/hiding-textarea-border-in-as3/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 15:06:21 +0000</pubDate>
		<dc:creator>thijs</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[actionscript3]]></category>

		<guid isPermaLink="false">http://www.sharedknowhow.com/?p=12</guid>
		<description><![CDATA[Problem: TextArea shows a border by default Solution: myTextArea.setStyle("upSkin",Sprite); Description: Using a TextArea in actionscript 3 could come in handy as the Flash component adds in a ScrollBar by default. But it also provides some things you might not want there.. One of those things is the border, that is placed there by default. Inspired [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong><br />
TextArea shows a border by default</p>
<p><strong>Solution:</strong><br />
<code>myTextArea.setStyle("upSkin",Sprite);</code></p>
<p><strong>Description:</strong><br />
Using a TextArea in actionscript 3 could come in handy as the Flash component adds in a ScrollBar by default. But it also provides some things you might not want there..</p>
<p>One of those things is the border, that is placed there by default.</p>
<p>Inspired by the solution posted <a title="Kirupa" href="http://www.kirupa.com/forum/archive/index.php/t-275633.html" target="_blank">here </a>I found that you can override the skin that is used by default in the component ("upSkin") by using:</p>
<blockquote><p><code>myTextArea.setStyle("upSkin",Sprite);</code></p></blockquote>
<p>by overriding it with a Sprite, which is empty by default, all the visual aspects are cleared... including the border!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharedknowhow.com/2008/07/hiding-textarea-border-in-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

