<?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>ohsomuchwork</title>
	<atom:link href="http://ohsomodern.org/work/feed" rel="self" type="application/rss+xml" />
	<link>http://ohsomodern.org/work</link>
	<description>Code snippets, ActionScript 3.0 and some other tech stuff</description>
	<lastBuildDate>Tue, 10 Jan 2012 11:16:52 +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>Prevent loaded XML caching in ActionScript 3</title>
		<link>http://ohsomodern.org/work/actionscript3/prevent-loaded-xml-caching-in-actionscript-3</link>
		<comments>http://ohsomodern.org/work/actionscript3/prevent-loaded-xml-caching-in-actionscript-3#comments</comments>
		<pubDate>Tue, 10 Jan 2012 11:15:42 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=237</guid>
		<description><![CDATA[Method 1: var loader:URLLoader = new URLLoader(); var req:URLRequest = new URLRequest("thefiletoload.xml"); req.method = URLRequestMethod.POST; req.data = true; loader.load(req); Method 2: var userFilePath:String = "thefiletoload.xml"; if(Capabilities.playerType != "StandAlone" &#124;&#124; Capabilities.playerType != "External") { userFilePath += "?rnd=" + Math.random(); }]]></description>
			<content:encoded><![CDATA[<p>Method 1:</p>
<pre>var loader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest("thefiletoload.xml");
req.method = URLRequestMethod.POST;
req.data = true;
loader.load(req);</pre>
<p>Method 2:</p>
<pre>var userFilePath:String = "thefiletoload.xml";
if(Capabilities.playerType != "StandAlone" || Capabilities.playerType != "External") {
userFilePath += "?rnd=" + Math.random();
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/actionscript3/prevent-loaded-xml-caching-in-actionscript-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading variables to ActionScript 3.0 from PHP</title>
		<link>http://ohsomodern.org/work/actionscript3/loading-variables-to-actionscript-3-0-from-php</link>
		<comments>http://ohsomodern.org/work/actionscript3/loading-variables-to-actionscript-3-0-from-php#comments</comments>
		<pubDate>Sun, 08 Jan 2012 22:33:30 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=234</guid>
		<description><![CDATA[Prefix the request with http:// if you get undefined variables. I.e. don&#8217;t do: new URLRequest("myfile.php"); Do: new URLRequest("http://mydomain.com/myfile.php");]]></description>
			<content:encoded><![CDATA[<p>Prefix the request with http:// if you get undefined variables.</p>
<p>I.e. don&#8217;t do:</p>
<p><code>new URLRequest("myfile.php");</code></p>
<p>Do:</p>
<p><code>new URLRequest("http://mydomain.com/myfile.php");</code></p>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/actionscript3/loading-variables-to-actionscript-3-0-from-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get contacts from iCloud to Snow Leopard</title>
		<link>http://ohsomodern.org/work/mac-os-x-lion/get-contacts-from-icloud-to-snow-leopard</link>
		<comments>http://ohsomodern.org/work/mac-os-x-lion/get-contacts-from-icloud-to-snow-leopard#comments</comments>
		<pubDate>Sun, 08 Jan 2012 17:29:54 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[Mac OS X Lion]]></category>
		<category><![CDATA[Mac OS X Snow Leopard]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=232</guid>
		<description><![CDATA[Rolling back from Lion, you can get your contacts from iCloud by logging on to www.icloud.com, signing in, then going to Contacts, selecting all the contacts (Cmd + A) and then from the Settings wheel in the bottom left corner &#8230; <a href="http://ohsomodern.org/work/mac-os-x-lion/get-contacts-from-icloud-to-snow-leopard">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Rolling back from Lion, you can get your contacts from iCloud by logging on to www.icloud.com, signing in, then going to Contacts, selecting all the contacts (Cmd + A) and then from the Settings wheel in the bottom left corner choosing Export vCard&#8230;</p>
<p>You can then open the exported file with Address Book and all your contacts are back in there! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/mac-os-x-lion/get-contacts-from-icloud-to-snow-leopard/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X XAMPP phpMyAdmin error</title>
		<link>http://ohsomodern.org/work/php/mac-os-x-xampp-phpmyadmin-error</link>
		<comments>http://ohsomodern.org/work/php/mac-os-x-xampp-phpmyadmin-error#comments</comments>
		<pubDate>Sat, 31 Dec 2011 10:57:08 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=229</guid>
		<description><![CDATA[If your phpMyAdmin gets you the following error message: Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. You can try some of these options: Use a &#8230; <a href="http://ohsomodern.org/work/php/mac-os-x-xampp-phpmyadmin-error">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If your phpMyAdmin gets you the following error message:</p>
<p>Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.</p>
<p>You can try some of these options:</p>
<ul>
<li>Use a different browser; Firefox consistently gave me the error message, but Safari/Chrome did not.</li>
<li>Instead of accessing through http://localhost, try the local IP address of the computer.</li>
<li>Run the security on xampp (sudo /Applications/XAMPP/xamppfiles/xampp security</li>
</ul>
<p>I got this error on my Snow Leopard/XAMPP installation, but not on Lion.</p>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/php/mac-os-x-xampp-phpmyadmin-error/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export SWF to PDF</title>
		<link>http://ohsomodern.org/work/actionscript3/export-swf-to-pdf</link>
		<comments>http://ohsomodern.org/work/actionscript3/export-swf-to-pdf#comments</comments>
		<pubDate>Sun, 11 Dec 2011 11:54:40 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=227</guid>
		<description><![CDATA[Here&#8217;s some code on how to export an entire image/MovieClip/Sprite to a PDF document, using the AlivePDF library. private function printAsPDF():void {             trace("CREATE PDF");                          var pdf:PDF = new PDF();    &#8230; <a href="http://ohsomodern.org/work/actionscript3/export-swf-to-pdf">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s some code on how to export an entire image/MovieClip/Sprite to a PDF document, using the <a href="http://alivepdf.bytearray.org/" target="_blank">AlivePDF</a> library.</p>
<pre>private function printAsPDF():void {
            trace("CREATE PDF");
            
            var pdf:PDF = new PDF();
            var page:Page = new Page(Orientation.LANDSCAPE, Unit.MM, Size.A4);
            pdf.addPage(page);
            pdf.setMargins(0, 0, 0, 0);
            pdf.setDisplayMode(Display.REAL, Layout.SINGLE_PAGE, PageMode.USE_NONE, 1.0);
            // this is the image/movie clip container we're saving to the PDF
            var img:Sprite = Sprite(Canvas.getInstance());
            
            var bmpData:BitmapData = new BitmapData(img.width, img.height, true, 0xFFFFFF);
            var matrix:Matrix = new Matrix();
            matrix.createBox(2, 2, 0, 100, 100);
            bmpData.draw(img, matrix, null, null, null, true);
            
            var res:Resize = new Resize(Mode.FIT_TO_PAGE, Position.CENTERED);
            pdf.addImage(img);
            
            var f:FileReference = new FileReference();
            f.save(pdf.save(Method.LOCAL), "min_pdf.pdf");
        }</pre>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/actionscript3/export-swf-to-pdf/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Samtal väntar hos Tele2</title>
		<link>http://ohsomodern.org/work/uncategorized/samtal-vantar-hos-tele2</link>
		<comments>http://ohsomodern.org/work/uncategorized/samtal-vantar-hos-tele2#comments</comments>
		<pubDate>Tue, 29 Nov 2011 14:47:35 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=218</guid>
		<description><![CDATA[Jag vill kunna se att det ringer även om jag pratar i telefon. Av oklar anledning har Tele2 avaktiverat den funktionen men följande kod ska i alla fall aktivera &#8220;samtal väntar&#8221;/knackning när man är upptagen och någon ringer: *43# lur &#8230; <a href="http://ohsomodern.org/work/uncategorized/samtal-vantar-hos-tele2">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Jag vill kunna se att det ringer även om jag pratar i telefon. Av oklar anledning har Tele2 avaktiverat den funktionen men följande kod ska i alla fall aktivera &#8220;samtal väntar&#8221;/knackning när man är upptagen och någon ringer:</p>
<p>*43# lur</p>
<p>Jag vet inte om man behöver ringa till Tele2:s kundtjänst och faktiskt ha den tjänsten i sitt mobilabonnemang, tidigare har det gått att aktivera det enbart med hjälp av koder. Telefonsvararen/mobilsvar kan man läsa om <a href="http://www.tele2.se/kundservice/telefonsvarare-mobilt.html" target="_blank">här</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/uncategorized/samtal-vantar-hos-tele2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Lion and Time Machine backup error -1 [SOLVED]</title>
		<link>http://ohsomodern.org/work/mac-os-x-lion/mac-os-x-lion-and-time-machine-backup-error-1</link>
		<comments>http://ohsomodern.org/work/mac-os-x-lion/mac-os-x-lion-and-time-machine-backup-error-1#comments</comments>
		<pubDate>Sat, 12 Nov 2011 09:06:46 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[Mac OS X Lion]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=215</guid>
		<description><![CDATA[By the installation of Mac OS X Lion my Time Machine backups started to fail. The backup disk is often not found and results in error code -1. I get the error message &#8220;The backup disk image could not be &#8230; <a href="http://ohsomodern.org/work/mac-os-x-lion/mac-os-x-lion-and-time-machine-backup-error-1">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>By the installation of Mac OS X Lion my Time Machine backups started to fail. The backup disk is often not found and results in error code -1. I get the error message &#8220;The backup disk image could not be accessed (error -1).&#8221; I found that by turning the automatic backups off, bringing the computer in sleep mode to a location out of the WiFi range and then bringing it back, reactivating the backups, it often works. This problem seems to reoccur after each restart, though.</p>
<p><em>Edit:</em> Updating the firmware in the Airport Utility seems to have fixed the issue.</p>
<p><em>Edit 2</em>: Updating the firmware did not resolve the issue after restarting, got the same -1 error. But this time I set up the Time Capsule from scratch (didn&#8217;t erase any backups) through AirPort utility and now it works after restarting. Problem solved, finally!</p>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/mac-os-x-lion/mac-os-x-lion-and-time-machine-backup-error-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP/MySQL: Select blog post user/author</title>
		<link>http://ohsomodern.org/work/php/phpmysql-select-blog-post-userauthor</link>
		<comments>http://ohsomodern.org/work/php/phpmysql-select-blog-post-userauthor#comments</comments>
		<pubDate>Tue, 08 Nov 2011 14:11:50 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=213</guid>
		<description><![CDATA[Use LEFT JOIN in a MySQL query to select both blog posts and blog authors and print them out in your result loop. Example: $query = "SELECT * FROM blog_posts LEFT JOIN users ON blog_posts.user_id = users.user_id";]]></description>
			<content:encoded><![CDATA[<p>Use LEFT JOIN in a MySQL query to select both blog posts and blog authors and print them out in your result loop.</p>
<p>Example:</p>
<pre>$query = "SELECT * FROM blog_posts LEFT JOIN users ON blog_posts.user_id = users.user_id";</pre>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/php/phpmysql-select-blog-post-userauthor/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP outputs MySQL date as zeros</title>
		<link>http://ohsomodern.org/work/php/php-outputs-mysql-date-as-zeros</link>
		<comments>http://ohsomodern.org/work/php/php-outputs-mysql-date-as-zeros#comments</comments>
		<pubDate>Tue, 08 Nov 2011 13:56:22 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=211</guid>
		<description><![CDATA[Echoing out dates from a MySQL database can sometimes generate zeros, like this: 0000-00-00 00:00. This is solved by changing the database column from TIMESTAMP to DATETIME and also to make PHP insert the date in the query, and not &#8230; <a href="http://ohsomodern.org/work/php/php-outputs-mysql-date-as-zeros">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Echoing out dates from a MySQL database can sometimes generate zeros, like this: 0000-00-00 00:00. This is solved by changing the database column from TIMESTAMP to DATETIME and also to make PHP insert the date in the query, and not let MySQL handle it.</p>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/php/php-outputs-mysql-date-as-zeros/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drag and select in ActionScript 3</title>
		<link>http://ohsomodern.org/work/actionscript3/drag-and-select-in-actionscript-3</link>
		<comments>http://ohsomodern.org/work/actionscript3/drag-and-select-in-actionscript-3#comments</comments>
		<pubDate>Thu, 27 Oct 2011 06:14:25 +0000</pubDate>
		<dc:creator>jenni</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://ohsomodern.org/work/?p=208</guid>
		<description><![CDATA[Found this piece of code over at Kirupa that explains how to do a drag-and-select implementation in ActionScript 3.0: import flash.geom.*; var drawingBox:Sprite;/*resized sprite that acts as a selector*/ var stageObjects:Array = createRandomObjects(20);/*array of stage objects that might be selected*/ &#8230; <a href="http://ohsomodern.org/work/actionscript3/drag-and-select-in-actionscript-3">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Found this piece of code over <a href="http://www.kirupa.com/forum/showthread.php?346896-Drag-and-select-multiple-objects" target="_blank">at Kirupa</a> that explains how to do a drag-and-select implementation in ActionScript 3.0:</p>
<pre>import flash.geom.*;

var drawingBox:Sprite;/*resized sprite that acts as a selector*/
var stageObjects:Array = createRandomObjects(20);/*array of stage objects that might be selected*/

var mouseStart:Point;

/*drawing properties of drawingBox*/
var stroke:GraphicsStroke = new GraphicsStroke();
	stroke.thickness=1;
    stroke.fill = new GraphicsSolidFill(0x333399, .5);
var fill:GraphicsSolidFill = new GraphicsSolidFill(0x444444,.5);
var graph:Vector.&lt;IGraphicsData&gt;;
var path:GraphicsPath;

stage.addEventListener(MouseEvent.MOUSE_DOWN,MD,false,0,true);/*start drawing box*/
stage.addEventListener(MouseEvent.MOUSE_UP,MU,false,0,true);/*select objects*/

function createRandomObjects(n:int):Array
{
	var a:Array=new Array();
	for(var i:int=0;i&lt;n;i++)
	{
		var s:Sprite = new Sprite;
		s.graphics.beginFill(Math.random()*0xFFFFFF);
		s.graphics.drawRect(0,0,20,20);
		s.x=Math.random()*stage.stageWidth;
		s.y=Math.random()*stage.stageHeight;
		s.alpha=.5;
		s.name = String(i);
		a.push(s);
		addChild(s);
	}
	return(a);
}

function MD(e:MouseEvent):void
/*MOUSE DOWN - start drawing square*/
{
	// removes previous one
	if(drawingBox!=null)drawingBox.parent.removeChild(drawingBox);
	drawingBox=new Sprite;
	addChild(drawingBox);
	mouseStart=new Point(mouseX,mouseY);
	addEventListener(Event.ENTER_FRAME, EF,false,0,true);

	for(var i:int=0; i&lt;stageObjects.length; i++)
	{
		stageObjects[i].alpha=.5;
		stageObjects[i].rotation=0;
	}
}

function MU(e:MouseEvent):void
/*MOUSE UP - remove square and hit test everything under it*/
{
	removeEventListener(Event.ENTER_FRAME, EF,false);
trace('Selected objects are:');
	/*run a hit test for drawingBox against stageObjects*/
	for(var i:int=0; i&lt;stageObjects.length; i++)
	{
		if(drawingBox.hitTestObject(stageObjects[i]))
		{
			stageObjects[i].alpha=1;
			stageObjects[i].rotation=45;
trace('Hit ' + stageObjects[i].name);
		}
	}
	drawingBox.graphics.clear();
}

function EF(e:Event):void
/*ENTER FRAME - redraws the selction box based on mouse pointer location every frame*/
{
	drawingBox.graphics.clear();
	path = RR(mouseStart.x,mouseStart.y,mouseX,mouseY);
	graph = new Vector.&lt;IGraphicsData&gt;();
	stroke.fill = new GraphicsSolidFill(0xFF0000,1);
	graph.push(stroke, fill, path);
	drawingBox.graphics.drawGraphicsData(graph);
}

function RR(sx:Number, sy:Number, ex:Number, ey:Number):GraphicsPath
/*RETURN RECTANGLE - returns a Graphics path for a rectangle*/
{
	var p:GraphicsPath=new GraphicsPath;
	p.moveTo(sx,sy);
	p.lineTo(ex,sy);
	p.lineTo(ex,ey);
	p.lineTo(sx,ey);
	p.lineTo(sx,sy);
	return(p);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://ohsomodern.org/work/actionscript3/drag-and-select-in-actionscript-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

