<?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>webr3.org &#187; experiments</title>
	<atom:link href="http://webr3.org/blog/category/experiments/feed/" rel="self" type="application/rss+xml" />
	<link>http://webr3.org/blog</link>
	<description>brain&#039;s on fire!</description>
	<lastBuildDate>Mon, 30 Aug 2010 00:11:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>server side js with v8</title>
		<link>http://webr3.org/blog/experiments/server-side-js-with-v8/</link>
		<comments>http://webr3.org/blog/experiments/server-side-js-with-v8/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 01:09:50 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[Apache HTTP Server]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computer science]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Curly bracket programming languages]]></category>
		<category><![CDATA[Ecma International]]></category>
		<category><![CDATA[ECMAScript]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript engine]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ryan Dahl]]></category>
		<category><![CDATA[Scripting languages]]></category>
		<category><![CDATA[Server-side JavaScript]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[V8]]></category>
		<category><![CDATA[Web Sockets]]></category>
		<category><![CDATA[Web Worker]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=363</guid>
		<description><![CDATA[Just logging some thoughts and scoping work..
v8 and server side ecma-262 (javascript) is a fantastic thought, and definitely the future imho (universal language).
To get going and start making server side js web applications there are two good approaches, v8cgi which aims more at letting you run js programs as a cgi app (like you do [...]]]></description>
			<content:encoded><![CDATA[<p>Just logging some thoughts and scoping work..</p>
<p><a href="http://code.google.com/p/v8/">v8</a> and server side <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ecma-262</a> (javascript) is a fantastic thought, and definitely the future imho (universal language).</p>
<p>To get going and start making server side js web applications there are two good approaches, <a href="http://code.google.com/p/v8cgi/">v8cgi</a> which aims more at letting you run js programs as a cgi app (like you do with php cgi) under apache and similar, seems to be picking up speed, nice approach (workable) - the other is <a href="http://nodejs.org/">node.js</a> which is off to a great start as a pure server side environment where 'HTTP is a first class protocol' which just proves what a good start <a href="http://twitter.com/ryah">Ryan Dahl</a> has made.</p>
<p>Briefly to touch on v8, it allows you expose C code to javascript, which is.. well perfect, would be good to see far more lib's exposed to js using tools like <a href="http://code.google.com/p/cproxyv8/">cproxyv8</a> and <a href="http://code.google.com/p/v8-juice/">v8-juice</a> - in particular I'm looking at you <a href="http://librdf.org/">librdf</a> (and an interesting sub-thought, apache and openssl).</p>
<p>Back to node.js, seems to be exciting already has a strong <a href="http://nodejs.org/api.html">API</a> to get some <a href="http://wiki.github.com/ry/node/">great demo's and projects</a> off the ground, and very well aligned with the W3C work (or maybe what-wg..), specifically on the <a href="http://www.whatwg.org/specs/web-workers/current-work/">Web Worker API</a> front; in fact there are already <a href="http://www.web2media.net/laktek/2010/05/04/implementing-web-socket-servers-with-node-js/">implementations of Web Sockets for node.js</a> (and <a href="http://github.com/LearnBoost/Socket.IO-node">socket.io</a>) - <a href="http://github.com/tav/nodelint.js">nodelint (jslint for node)</a> is a handy addition, whilst some projects seem to be <a href="http://www.persvr.org/">going all in, like Persevere</a>.</p>
<p>As for adapting current code to work on the server side, you'll want to be looking in to the <a href="http://wiki.github.com/ry/node/modules">modules</a> .. which.. well to be honest that's a new link I just found, and <a href="http://nodejs.org/api.html">not what I was thinking off</a>.. emm, I think that provides almost everything I need - might be about to jump back in with two feet!</p>
<p>The rest of this post was about to mention <a href="http://phpjs.org/">php.js</a>, <a href="http://www.harmony-framework.com/">harmony framework</a> (Converts PHP 5 code into Javascript), and then <a href="http://ecmascript4.com/">mascara</a> and of course <a href="http://haxe.org/">haxe</a> which compiles to js amongst many other targets.</p>
<p>Might have to come back to this post.. for anybody who follow what I do, thus far I'd figured out that node.js is http+tls friendly, you can get a clients certificate (for <a href="http://esw.w3.org/Foaf%2Bssl">foaf+ssl</a>) and you can send application webid+ssl certs too, although up till now I hadn't found a way to generate certificate (let alone using <a href="http://en.wikipedia.org/wiki/Spkac">spcak</a>) but that could be wrong..</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/experiments/server-side-js-with-v8/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>linked data extractor prototype details</title>
		<link>http://webr3.org/blog/experiments/linked-data-extractor-prototype-details/</link>
		<comments>http://webr3.org/blog/experiments/linked-data-extractor-prototype-details/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 18:53:43 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linked data]]></category>
		<category><![CDATA[semantic web]]></category>
		<category><![CDATA[virtuoso]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[DBpedia]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[extractor]]></category>
		<category><![CDATA[Open access]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=308</guid>
		<description><![CDATA[I recently released a prototype linked data semantic extraction demo which combines OpenCalais, Zemanta and Openlink Virtuoso to effectively categorize and work out what a given peice of text / document is about.
OpenCalais and Zemanta usage details and service comparison.
The demo leverages OpenCalais in order to pick up references to things, which are returned in [...]]]></description>
			<content:encoded><![CDATA[<p>I recently released a <a href="http://extractor.data.fm/?test">prototype linked data semantic extraction</a> demo which combines <a href="http://www.opencalais.com/">OpenCalais</a>, <a href="http://developer.zemanta.com/">Zemanta</a> and <a href="http://virtuoso.openlinksw.com/">Openlink Virtuoso</a> to effectively categorize and work out what a given peice of text / document is about.</p>
<h3>OpenCalais and Zemanta usage details and service comparison.</h3>
<p>The demo leverages OpenCalais in order to pick up references to things, which are returned in most cases as string literals; OpenCalais can also be configured to return back socialtags which give a broad stroke idea of what the document is about, again with string literal "tags". With regards the references (semantic metadata, Entities, Facts, Events etc.) which OpenCalais returns, whilst it is generally string literals, it also returns back vital Type and Relevance information, so in the case of "London" it will also assert that London is a City. Even in the case where it doesn't previously know what a thing is, it can work out that say "Frank Neverbeenheardofbefore" is a Person.</p>
<p>Zemanta is also leveraged, the primary difference between Zemanta and OpenCalais (and thus the need for both services) is that Zemanta focuses more on accurate tagging of text. Primarily though, Zemanta tags (again string literals) are meaningful tags which are commonly known and are referenced to either existing Linked Data identifiers such as http://dbpedia.org/resource/London and further information about the tag (or thing), in the case of the aforementioned London, then it will often also provide links to the wikipedia page for London, the official homepage to the city of London and a link to show the position of London on google maps.</p>
<p>I should point out that ever increasingly OpenCalais also returns back Linked Data too, for instance in the case of London they have given it an HTTP URI which can be dereferenced to retrieve more information about London. At a very crude estimation I would suggest that (depending on the subject matter) OpenCalais returns Linked Data URIs for about 15% of all references it finds to well known "things".</p>
<p>Weighing up the two services I couldn't say that one is better than the other, both have advantages and disadvantages, the only way to get a decent overall picture is to use both. for the benefits of feedback to both of these great services though, here is a general comparison:</p>
<p>note: none of these figures are from exact tests, they are from extensive developer usage of both services as I've used them both since they were made public.</p>
<p>Zemanta is generally 2x as fast for average texts (the size of this post for instance) and as much as 5x as fast for longer texts. Average for Zemanta being 0.7 to 2 seconds. Average for OpenCalais being 1.5 to 10 seconds. It may also be worth noting that the availability of Zemanta is somewhat higher than that of OpenCalais, perhaps 1 in 250 calls to OpenCalais will fail.</p>
<p>OpenCalais does a lot more heavy work than Zemanta though, and *really* semantically analyzes the text to figure out a wealth of information. In this respect the tables are completely turned and Zemanta consitently deals with providing a few high quality known tags; where as OpenCalais often provides at least 10x as much information about a given text, including relevance and type as mentioned before. OpenCalais also extracts Facts / Events, and further it can figure out that "Jim" is also "Jim Bob", and that Jim said X about Y on date D.</p>
<p>Generally you can trust the data from Zemanta 99% as it deals with "known" things, however due to this in some cases very new topics (such as IPad for the first few days after its announcement) remain unknown. Due to the nature of OpenCalais and it's dealing with the unknown you need to take more time to verify what it has returned, however when OpenCalais assigns a LinkedData identifier to something or provides more information you can 99.99% trust that it is entirely accurate.</p>
<p>It's worth noting that both of these services do different things though, and both do it extremely well, Zemanta "tags" and OpenCalais "semantically extracts information", in some respects I was hesitant about comparing the two, as in the context of what I'm doing both are needed and both are equal, however in different contexts both do different jobs and there is a need for people to select one over the other.</p>
<p>Out of all the competition though, I would highly recommend both Zemanta and OpenCalais over their respective competitors, and do hope that neither of these great services ever decide to target each others markets. (e.g. they compliment each other well and both do so well because they stick to what they are good at).</p>
<h3>extractor.data.fm details</h3>
<p>This demo deals primarily with figuring out what a document is about; in that it aims to provide back a list of:</p>
<ul>
<li><strong>Categories</strong><br />A list of 1-5 dbpedia (and therefore wikipedia) categories which the provided document would be categorized under if it were a wikipedia article and had been categorized by a huma who was knowledgeable in the subject domain(s) of the text.</li>
<li><strong>General Topics</strong><br />A short list of the general and broad-strokes Subjects covered by the document, these can are distinct from the primary specific subjects covered and the categories, and in many ways can be seen as the most common intersections between the primary specific subjects discussed.</li>
<li><strong>Primary Subjects</strong><br />These are the specific subjects covered in the document, not just the things mentioned, but the things actively discussed within the document, the primary subject matter as it were.</li>
<li><strong>Related or Mentioned Subjects</strong><br />Whilst I've termed them "related" as in dcterms:related, these are simply things which have been detected in the document or text and which are not primary subjects; in many ways "mentions" may be a more appropriate term.</li>
</ul>
<p>Out of the above list, the two services do the heavy lifting to give the demo it's Primary Subjects and Related Subjects; in short OpenCalais' SocialTags and Zemanta's Tags give us back our Primary Subjects. Whilst OpenCalais by way of the semantic extraction provide us with the Related Subjects, namely all those extracted semantics which have the Type of a real thing (not an IndustryTerm or Event) and which are not all ready a Primary Subject; additionally those extracted semantics which are not tags but have a relevance higher than a certain score are boosted up to be Primary Subjects too.</p>
<p>A primary and initial function of the demo is to associate the tags returned by both services together, and figure out when each is talking about the same thing; this is covered first by dealing with the linked data they return; where both services are talking about the same thing you simply know this unambiguously due to the nature of http URIs and them both being the "sameAs" each other. After this two chunks of unhandled data remain, Zemanta tags which have not determined to be the sameas OpenCalais ones; and OpenCalais semantics which we have a string literal name for and a type.</p>
<p>In step <a href="http://virtuoso.openlinksw.com/">Openlink Virtuoso</a> 6.1 (<a href="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSIndex">open source edition</a>!) with most of dbpedia 3.4 loaded in to do the heavy lifting from here on; Virtuoso is a really powerful bit of kit and has replaced  mysql/sql server/postgres, rdf store and web dav server in my typical server stack. The public lod and dbpedia endpoints really do no justice as to just how powerful and fast Virtuoso is, queries which take a few seconds on the public endpoint return in hundredths of a second on my local (low spec) server, and the comparative performance to the aforementioned RDBMS solutions is not to be sniffed at.</p>
<p>To handle the typed string literals from OpenCalais, I built a custom dbpedia lookup service (using sparql over the aforementioned Virtuoso + dbpedia setup) which tries to unambiguously determine the identifier for a string literal, if it is known; the results are pretty good and I'd safely say that it gets it right in 98% of cases. This essentially turns the remaining unknown string literals in to known Linked Data URIs, and as a side benefit gives the correct full Name for the thing identified along with the correct casing and obviously much more linked data.</p>
<p>Remaining now the demo has a few OpenCalais semantics which are still unknown, but we know the Type and have a name for the thing; and as URIs are given to things that can be Named, I simply mint my own uri's for these and specify the OpenCalais identifier as a "seeAlso" (to be future compatible with a time where they do associate there own hash uris through to linked data).</p>
<p>At this point the demo has all of the Primary Subjects and Related Subjects determined and where possible linked through to additional LinkedData and human readable web documents about the subjects.</p>
<h4>Categorization</h4>
<p>This is where the script comes in to it's own and really leverages virtuoso, up till this point it's all been about cleaning, validating, looking up, associating and suchlike.</p>
<p>Given that we now have linked data HTTP URIs for all the subjects we are dealing with, and in all Primary Subject cases we also have dbpedia.org URIs the demo can start to use some of Virtuoso's more powerful features. First point of call is to get the Category intersection of all primary subjects (including the inferred categories!) via a slightly complex transitive sparql query over the dbpedia dataset. From here the demo calculates a set of primary categories which the text is related to, then it finds the general category intersection (again including inferred categories) between the primary categories, and the primary subjects. with the results returned is a wealth of numerical information which the demo dually considers and can then infer which are the General Subjects and the Categories for the text.</p>
<p>At some point I'll cover this part of the script in more details and give some virtuoso specific transitive SPARQL queries for you to use in your own such creations, but for now the above will have to do.</p>
<h3>Conclusion</h3>
<p>This extractor demo is something I've been working on and trying to achieve for about 5 years, and whilst it is still early days it's the first time the technologies have been available to both make it possible, and to utilize the results correctly to achieve what I'm aiming for overall.</p>
<p>The overall goal is to create a system which allows users to simply drop in content, and the system "files" it in the correct categories, lists it under the correct subjects and interlinks it with other resource via typed links such as "related resources" and looser resource lists of "also mentioned here", further benefits of such a system are that you can accurately figure out what readers are interested in and promote new content to them, you can give users the option of content streams where they can watch specific subjects or combination of subjects to be notified of their "ideal" reading. On the flip side you can also identify users and contributers interests and expertise, and correlate these together (with geo-location) to suggest others users who they may wish to collaborate with, other organisations doing the same work in the same fields and many such uses. In reality I have much of this implemented in a site I've been working on for the last year, which is just being rolled out again, and the system works extremely well with huge benefits to all involved, the site you see deals with climate adaptation and both provides a service to the general adaptation community where they can share and find knowledge, and more importantly serves organisations working on critical issues by letting them see which people / organisations / projects are doing what, where and allows them to both co-ordinate efforts and perhaps more importantly not duplicate efforts and waste resources where it counts most. This has a positive impact on the worlds poorest nations and those suffering people who these organisations are trying to work with and help.</p>
<p>Back to the demo, and with the context described, the extractor.data.fm demo is a quick UI around an API which is in many ways the backbone of the aforementioned system. The API is used in a semi-automated way, where the data returned by it is verified in a UI by the content author / admins who remove any unambiguous data and then hit save, from there everything is automated again and the system functions as above.</p>
<p>I'm unsure whether this kind of system will ever be able to be fully automated (or whether its wise to allow this) as certain scenarios just can't be covered yet, a real life example of this is an initiative called "TEA", ambiguity at this level, and with entities which are unknown to systems or even the web of data, will always be an issue at some point, as things progress it may be they are only ambiguous once, on their first discovery, but that is still once; hence why this may always have to be a semi-automated process.</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/experiments/linked-data-extractor-prototype-details/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Forced Coding</title>
		<link>http://webr3.org/blog/general/forced-coding/</link>
		<comments>http://webr3.org/blog/general/forced-coding/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 20:30:40 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=150</guid>
		<description><![CDATA[
update:
I've been off for a week after finishing a project and moving house, in that time this domain dropped and just prior to that appeared to get 20k+ reads which is a bit omg. Anyways many comments all over the net, and certainly on reddit (comments here) - and thus just to clarify, the entire [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://webr3.org/blog/wp-content/uploads/2009/09/forced-coding.jpg" alt="forced-coding" title="forced-coding" width="600" height="250" class="alignnone size-full wp-image-151" /></p>
<p>update:<br />
I've been off for a week after finishing a project and moving house, in that time this domain dropped and just prior to that appeared to get 20k+ reads which is a bit omg. Anyways many comments all over the net, and certainly on reddit (<a href="http://www.reddit.com/r/programming/comments/9s1n8/forced_coding/">comments here</a>) - and thus just to clarify, the entire content of this post is purely a note to myself, and to help me in those times when you can't get going in the morning or such like.. in no way am I suggesting you don't plan or do things properly whenever you can - this is literally just some ways of getting through the day. Thought I'd made that clear and most people got it ;)<br />
end update:</p>
<p>This one is more for my own reference, but sharing anyways as it may help others. In numerous scenarios it is really hard to "get going" when you're trying to code, particularly under the following circumstances:</p>
<p> * You haven't started coding till late(r) in the day<br />
 * Emails, Blogs, Social networking have taken up more time than expected and/or distracted more than anticipated<br />
 * You've just completed a deliverable, milestone or task.<br />
 * You're tired!</p>
<p>All of these are virtually daily occurances in the coding world, and here are the methods I've used to get going again.. no particular order, just a list.</p>
<p><strong>Under all circumstance, avoid planning!</strong><br />
Planning is one of those things you can't do unless you are all ready in the flow, whether this is because you've just had a client meeting, a long discussion, or read a full spec - it's not the thing to do to get your flow going, all you'll do is plan nothing, plan badly, or stare blankly at the screen / paper.</p>
<p><strong>Don't read related material to get you in the flow.</strong><br />
This will purely serve to distract you, make you think about doing things differently, doublt what you've done or worse throw you in to planning mode - fact is you won't be planning "your" app though, you'll be planning "some" ideal app or scenario.</p>
<p><strong>Pick the smallest task, whether complex or not, and just do it!</strong><br />
Doesn't matter what it is, so long as it's coding a little part of the app, or modifying part of it, then it'll do. It could be adding an extra field to an object or table, popping in some validation, anything small and simple. It really doesn't matter if you do it right or wrong; you're not doing it to sign off a task, you're doing it to re-aquaint yourself with your system, by the time you've been through X lines of code you'll be back in work mode and firing on all cylinders, well on your way to getting zoned.</p>
<p><strong>Music, Headphones, Repeat.</strong><br />
You'll know the genre that suits you, personally I find repeating an album or even song fades me in to the zone and keeps me there. The repetitiveness of the tune keeps you there, because just as a phone call can distract you, so can a change in tune to something at a different tempo or worse a completely different genre.</p>
<p><strong>Don't cram!</strong><br />
If you've only got 15 minutes before the next sizable interuption, forget it, don't do anything just chill - make a coffee, smoke, whatever. You're not wasting time you're saving your zone, you can only get zoned a couple of times a day, so don't get zoned for only 15 minutes - save it and get zoned for longer later on.</p>
<p><strong>Speedcode</strong><br />
Why not? as nike say "just do it", if the code has 10 bugs but is finished in half the time then you've done good, that gives you loads of time to fix the bugs, and more importantly you get to those moments where you realise x,y&#038;z need to be changed much quicker. Not only that, but would you rather have a week to go and have a list of 80 bugs, or a week to go and 2 major deliverables a week overdue..</p>
<p><strong>Communicate for no reason.</strong><br />
Often a major focus is simply talking to somebody else on the same project as you, whether its the client or a workmate, and the more stressed they are the better, they'll not only blast you with things but their urgency / stress will often convey straight over to you and focus / zone you instantly.</p>
<p><strong>Do the thing you know, not the thing you don't.</strong><br />
Inline with "don't plan" and "pick the smallest task", always pick something you can already do (if possible), as with everything else, the things you don't know are much easier when you're already zoned, not only that but you'll be more focussed when doing the thing you don't know so less likely to over spec / over code it.</p>
<p><strong>Don't code other things!</strong><br />
nothing on earth will kill your project like working on something else, every minute you spend on another script or app is like an hour lost on what you should be doing, and with every minute that passes you're getting closer and closer to utter project failure - and hence why most open source projects are dead.</p>
<p>Remember, the key to forced coding is just to get you in the zone, and ultimately boils down to just getting stuck in there with some lines of code on your project.</p>
<p>Works for me anyways [most of the time] - if anybody has anything to add (constructive) then please do!</p>
<p>Regards - nathan</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/general/forced-coding/feed/</wfw:commentRss>
		<slash:comments>123</slash:comments>
		</item>
		<item>
		<title>PHP Events - Actionscript 3 style events in PHP 5</title>
		<link>http://webr3.org/blog/experiments/php-events-actionscript-3-style-events-in-php-5/</link>
		<comments>http://webr3.org/blog/experiments/php-events-actionscript-3-style-events-in-php-5/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 17:33:12 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Curly bracket programming languages]]></category>
		<category><![CDATA[Event Listener]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[multi site systems]]></category>
		<category><![CDATA[Negation]]></category>
		<category><![CDATA[Object-oriented programming]]></category>
		<category><![CDATA[Scripting languages]]></category>
		<category><![CDATA[Serialization]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=111</guid>
		<description><![CDATA[Here are a set of classes which aim to provide basic actionscript style events in php5;
The Point - Events are useful everywhere even when you don't have a UI, the main reason for building this was to create a kind of "hook" system for php. Often we create multi site systems where each implementation of [...]]]></description>
			<content:encoded><![CDATA[<p>Here are a set of classes which aim to provide basic actionscript style events in php5;</p>
<p><strong>The Point </strong>- Events are useful everywhere even when you don't have a UI, the main reason for building this was to create a kind of "hook" system for php. Often we create multi site systems where each implementation of that system has different client specific considerations; consider a system where one client wants all of there images to go to amazon s3 instead of being saved on the host like your other clients. With this system you can simply:</p>
<ol>
<li>throw an "storeUpload" event which is cancelable</li>
<li>register a default event listener which listens for "storeUpload" events and provides default functionality, saving the upload and setting the location (ur) on the event.target</li>
<li>on one site register a custom event listener which listens for the "storeUpload" event, uploads to amazon s3, then cancels the event and set the event.target to the s3 url instead</li>
</ol>
<p>as you can see, with this you can keep the codebase of your multisite application the same and simply hook in to events whereever you want.</p>
<p>the system consists of 2 public classes:</p>
<h3>Event</h3>
<p>The base class for all events, provides event type and cancelable; with typical usage you create a new event, then dispatch it when ready.</p>
<ul>
<li><strong>__construct</strong>( $type , $cancelable=FALSE )<br />
create a new event listener - if you extend the Event class you must call this with parent::__construct( $type , $cancelable );</p>
<p><strong>$type</strong> - string, event type eg "debugEvent"<br />
<strong>$cancelable</strong> - boolean, provides cancelation functionality, so you can prevent further event listeners from firing thus in effect overriding them.</p>
<p>throws InvalidArgumentException if $type is not a string</li>
<li><strong>cancel</strong>() : void<br />
cancels an event, only if it is cancelable</li>
<li><strong>isCancelable</strong>() : Boolean</li>
<li><strong>isCanceled</strong>() : Boolean</li>
<li><strong>getType</strong>() : string</li>
<li><strong>getTarget</strong>() : obj<br />
target always contains the instance which dispatched the event.</li>
</ul>
<h3>EventDispatcher</h3>
<p>All classes which wish to dispatch events must inherit from EventDispatcher (like in most languages), this class provides:</p>
<ul>
<li><strong>addEventListener</strong>( $type , $callable , $owner ) : void<br />
adds an event listener, this may be a function, a class method or a static class method.<br />
note: a current limitation is that event listener methods must be public</p>
<p><strong>$type</strong> - string, event type eg "debugEvent"<br />
<strong>$callable</strong> - string, the function or method which is to be called when event $type is dispatched<br />
<strong>$owner</strong> - mixed, used when $callable is a method, can be either an object instance, or the string name of a class for static methods.</p>
<p><strong>throws:</strong><br />
InvalidArgumentException when type or callable isn't a string<br />
Exception('unknown method / function')</li>
<li><strong>removeEventListener</strong>( $type , $callable , $owner ) : void<br />
removes an event listener that has been added with addEventListener, this only removes a single event listener each call, so if you have 3 identical event listeners you will need to call this method 3 times to remove them all.</p>
<p>arguments are the same as addEventListener - throws no exceptions, always returns void</li>
<li><strong>hasEventListener</strong>( $type ) : Boolean<br />
checks if any event listeners are registered for event $type; always returns boolean true or false.</li>
<li><strong>dispatchEvent</strong>( Event $event ) : void<br />
the obvious one, dispatches an event and notifies all listeners.</li>
</ul>
<h3>Notes:</h3>
<p>The event dispatcher implements a function which hides all instance properties starting with __ from the serialize process, thus hiding the events and meaning your current serialization process will still work, additionally you can utilize it to hide any properties you don't want to be serialized.</p>
<p>I've tried to make the classes as simple, small and practical as possible, they execute rather quickly and shouldn't make any speed difference to your application - do however be aware that loosely coupling and entire system could allow coding errors to creep in, so maybe don't use it everywhere - but then PHP isn't strict anyways so..!</p>
<h2>Download</h2>
<p>You can download the <a href="http://webr3.org/experiments/php/PHPEvents.zip">PHP Event system</a> here (3 classes + example, 4.2k) - hope somebody finds it useful!</p>
<p><img class="alignnone size-full wp-image-112" title="events" src="http://webr3.org/blog/wp-content/uploads/2009/07/events.jpg" alt="events" width="600" height="250" /></p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/experiments/php-events-actionscript-3-style-events-in-php-5/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using Sound.extract to create visualizations.</title>
		<link>http://webr3.org/blog/haxe/using-sound-extract-to-create-visualizations/</link>
		<comments>http://webr3.org/blog/haxe/using-sound-extract-to-create-visualizations/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 20:19:35 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Flash 10]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[3D computer graphics]]></category>
		<category><![CDATA[Computer memory]]></category>
		<category><![CDATA[Data buffer]]></category>
		<category><![CDATA[Frame rate]]></category>
		<category><![CDATA[Sampling]]></category>
		<category><![CDATA[Technology/Internet]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=101</guid>
		<description><![CDATA[
Technically, this is a really stupid thing to do, and move over it isn't the cleverest thing to do, regardless though I've done it just for the hell of it.
The aim of this post is to prevent anybody else from making the same stupid mistakes! end product isn't too bad though.
To give a quick over [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://webr3.org/experiments/sound/sound-extract-visualize/"><img class="alignnone size-full wp-image-102" title="sound" src="http://webr3.org/blog/wp-content/uploads/2009/07/sound.jpg" alt="sound" width="600" height="250" /></a></p>
<p>Technically, this is a really stupid thing to do, and move over it isn't the cleverest thing to do, regardless though I've done it just for the hell of it.</p>
<p>The aim of this post is to prevent anybody else from making the same stupid mistakes! end product isn't too bad though.</p>
<p>To give a quick over view, Sound.extract() gives access to raw sound data, as a ByteArray of floats; typically you setup two sound objects, the first loads the sound data from source, the second requests sound data from the first at regular intervals, extracting 2048-8192 samples per request and then playing it - idea is that in the method that requests the samples you can quickly pre-process it before its played and make some nice effects.</p>
<p>So my illogical train of thought was to visualize the raw sound data in real time as it plays to create some nice effects.</p>
<h3>The Numbers Game</h3>
<p>Music in flash is sampled at 44100 Hz Stereo - 44100 samples per second,  per channel - we're getting it at intervals of either 2048, 4096 or 8192 samples - meaning our visualization can run at either 21.53fps,  10.76fps or 5.45fps - which lets be honest is hardly going to make a nice smooth effect is it.</p>
<p>So our only option is to somehow synchronize the "timeline" (the screen updating) with the raw sound being played.</p>
<h3>The Approach</h3>
<p>I decided the only real way to do this was to make a continual buffer of sound that could be read independently by both the SampleDataEvent and by my own code to do the visualizations - after some playing around with numbers I finally gathered that if one was to run at a framerate of 63fps and render the 700 samples per channel at a time then I'd be consuming (63*700 = 41000 Hz / samples per second) = the data in realtime.</p>
<p>To make this possible I needed some kind of fast buffer to store the data in, obvious choice was fast memory which is a ByteArray and can be read and written to directly.</p>
<p>More number came in to play when the size of the buffer needed calculated, had to be a multiple of both the render speed (700) and the data feed rate (2048); which is a buffer of 358400 samples, or sample requests. (358400/175 = 2048).</p>
<p>To get the data in to the buffer I was finding the next offset at which i should write the data to my buffer, sound.extract'ing the data in to the buffer and using a modulo to create wrap around so after 175 samples data was written back at the start.</p>
<p>This covers getting the sound in to a fast memory buffer without consuming too many resources, next up to get it out and render it!</p>
<h3>The Rendering</h3>
<p>Rendering uses the same idea of requesting samples from the buffer, however this time the magic number is (358400/700 =) 512.</p>
<p>I implemented a simple framecounter that increments each frame and resets to 0 every 512 frames (giving the loop on the buffer), then quickly read 700 pairs of samples from the buffer each frame.</p>
<p>The left channel float value is then scaled by 300 used as an X position, whilst the right channel creates the Y position - both x and y are then fed to setPixel() on BitmapData whilst a simple calculation of 0xFFFFFF*leftChannel / 2 sets the color value.</p>
<p>Each frame the 700 dual channel samples are rendered creating 700 realtime 2D particles (hopefully) in time with the sound, and a simple blur filter is used to clear the previous frame in a nicer way.</p>
<h3>The Point</h3>
<p>It's all stupid, pointless and just stick to computeSpectrum - you only get 256 samples rather than 700 but it's perfectly in time and allows you do something other than exactly 63 fps; further it'll always be in time with the music.</p>
<h3>The Result</h3>
<p>Well, it's here - I've got it tuned in to my other halfs <a href="http://citybeatradio.org/" target="_blank">radio station citybeat radio</a> at the minute (which i wholeheartedly recommend for any electronic / trance music fans) and well.. <a href="http://webr3.org/experiments/sound/sound-extract-visualize/">here it is with source</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/haxe/using-sound-extract-to-create-visualizations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Massive amount of 3D Particles Take Two</title>
		<link>http://webr3.org/blog/haxe/massive-amount-of-3d-particles-take-two/</link>
		<comments>http://webr3.org/blog/haxe/massive-amount-of-3d-particles-take-two/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 15:45:16 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Flash 10]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=71</guid>
		<description><![CDATA[
Ralph Hauwert created a great demo of the power of Flash 10 / PixelBender / Alchemy  that you're probably familiar with, then Joa Ebert made a fantastic Flash 9 pure AS3 version that's very impressive, then I gave it a go with haXe and flash.Memory which turned out rather well too.
It's been bugging me [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-72" title="take2" src="http://webr3.org/blog/wp-content/uploads/2009/06/take2.jpg" alt="take2" width="600" height="250" /></p>
<p>Ralph Hauwert created a great <a href="http://www.unitzeroone.com/blog/2009/03/18/flash-10-massive-amounts-of-3d-particles-with-alchemy-source-included/" target="_blank">demo of the power of Flash 10 / PixelBender / Alchemy </a> that you're probably familiar with, then Joa Ebert made a fantastic <a href="http://blog.joa-ebert.com/2009/04/03/massive-amounts-of-3d-particles-without-alchemy-and-pixelbender/">Flash 9 pure AS3 version</a> that's very impressive, then I gave it <a href="http://webr3.org/blog/haxe/flash-10-massive-amounts-of-3d-particles-with-haxe/">a go with haXe and flash.Memory</a> which turned out rather well too.</p>
<p>It's been bugging me for some time that the code just wasn't real world enough though - so I thought I'd give it a go using AS3 and flash 10, using only native methods and no fancy 3D calculations that us commoners don't quite get. In short I've stripped it down and turned it into a simple class which uses flash 10 Vectors and Matrix3D.</p>
<p>I've taken a different approach with these demo's, rather than all in realtime, you simply click and it runs the enterFrame code once and displays the time in ms that it took. There is however a <a href="http://webr3.org/experiments/particle-pusher-take2/realtime/">final realtime version</a> using this code at the end.</p>
<p>Four examples are provided, Pure AS3, then the same code converted to haxe, then the haxe "inline" keyword added and finally the whole thing working in realtime.</p>
<h2>AS3 Flash 10 Version with Vector / Matrix3D</h2>
<p>Here's the main source used:</p>
<pre class="brush: as3;">private function enterFrameHandler( event : Event ): void {
 var d : Date = new Date();
 var t : Number = d.getTime();

 updateMatrix( mouseX , mouseY );
 _matrix.transformVectors( particleVector , realVector );

 var pxs : Vector.&amp;lt;uint&amp;gt; = new Vector.&amp;lt;uint&amp;gt;( PIXELS , true );
 var po : int = 0;
 var a : int = 0;

 while( a &amp;lt; PARTICLES ) {
   po = pointToOffset( int(realVector[a*3]) , int(realVector[(a*3)+1]) , WIDTH );
   if( 0 &amp;lt; po &amp;amp;&amp;amp; po &amp;lt; PIXELS) {
     pxs[po] = increaseColor( pxs[po] );
   }
   a++;
 }
 // update display
 this.bitmapData.lock();
 this.bitmapData.setVector( this.bitmapData.rect , pxs );
 this.bitmapData.unlock( this.bitmapData.rect );

 d = new Date();
 textField.text = &quot;single frame time: &quot; + ( d.getTime() - t );
}

private function updateMatrix( mx : Number , my : Number ) : void {
 tx = tx + ((mx - tx)/10);
 ty = ty + ((my - ty)/10);
 _matrix.identity();
 _matrix.appendRotation( tx , Vector3D.Y_AXIS );
 _matrix.appendRotation( ty , Vector3D.X_AXIS );
 _matrix.appendTranslation( CX, CY, 10 );
}

private static function increaseColor( c : uint ) : uint {
 return c &amp;lt; MAXCOLOR ? c + SHADE : 0xFFFFFF;
}

private static function pointToOffset( vx : int , vy : int , vw : int ) : uint {
 return vx + ( vy * vw );
}
</pre>
<p><a href="http://webr3.org/experiments/particle-pusher-take2/pure-as3/" target="_blank">And here's the AS3 result (with full source)</a></p>
<h2>The same code in haXe</h2>
<p>next up I spent literally 2 minutes converting this to haXe syntax, changed no functionality - just slight syntax changes between the languages.</p>
<pre class="brush: plain;">private function enterFrameHandler( event : Event ) : Void {
 var d : Date = Date.now();
 var t : Float = d.getTime();

 updateMatrix( mouseX , mouseY );
 _matrix.transformVectors( particleVector , realVector );

 var pxs : Vector&amp;lt;UInt&amp;gt; = new Vector&amp;lt;UInt&amp;gt;( PIXELS , true );
 var po : Int = 0;
 var a : Int = 0;

 while( a &amp;lt; PARTICLES ) {
   po = pointToOffset( Std.int(realVector[a*3]) , Std.int(realVector[(a*3)+1]) , WIDTH );
   if( 0 &amp;lt; po &amp;amp;&amp;amp; po &amp;lt; PIXELS) {
     pxs[po] = increaseColor( pxs[po] );
   }
   a++;
 }
 // update display
 this.bitmapData.lock();
 this.bitmapData.setVector( this.bitmapData.rect , pxs );
 this.bitmapData.unlock( this.bitmapData.rect );

 d = Date.now();
 textField.text = &quot;single frame time: &quot; + ( d.getTime() - t );
}

private function updateMatrix( mx : Float , my : Float ) : Void {
 tx = tx + ((mx - tx)/10);
 ty = ty + ((my - ty)/10);
 _matrix.identity();
 _matrix.appendRotation( tx , Vector3D.Y_AXIS );
 _matrix.appendRotation( ty , Vector3D.X_AXIS );
 _matrix.appendTranslation( CX, CY, 10 );
}

private static function increaseColor( c : UInt ) : UInt {
 return c &amp;lt; MAXCOLOR ? c + SHADE : 0xFFFFFF;
}

private static function pointToOffset( vx : Int , vy : Int , vw : Int ) : UInt {
 return vx + ( vy * vw );
}</pre>
<p><a href="http://webr3.org/experiments/particle-pusher-take2/identical/" target="_blank">And here's the identical haXe result (with full source)</a></p>
<h2>Optimized haXe Version</h2>
<p>Next up I spent another minute optimizing (literally, one minute) - haXe supports inlining of variables and methods, so I added the inline keyword to the static vars and two of the static methods (increaseColor and pointToOffset)</p>
<pre class="brush: plain;">private function enterFrameHandler( event : Event ) : Void {
 var d : Date = Date.now();
 var t : Float = d.getTime();

 updateMatrix( mouseX , mouseY );
 _matrix.transformVectors( particleVector , realVector );

 var pxs : Vector&amp;lt;UInt&amp;gt; = new Vector&amp;lt;UInt&amp;gt;( PIXELS , true );
 var po : Int = 0;
 var a : Int = 0;

 while( a &amp;lt; PARTICLES ) {
   po = pointToOffset( Std.int(realVector[a*3]) , Std.int(realVector[(a*3)+1]) , WIDTH );
   if( 0 &amp;lt; po &amp;amp;&amp;amp; po &amp;lt; PIXELS) {
     pxs[po] = increaseColor( pxs[po] );
   }
   a++;
 }
 // update display
 this.bitmapData.lock();
 this.bitmapData.setVector( this.bitmapData.rect , pxs );
 this.bitmapData.unlock( this.bitmapData.rect );

 d = Date.now();
 textField.text = &quot;single frame time: &quot; + ( d.getTime() - t );
}

private function updateMatrix( mx : Float , my : Float ) : Void {
  tx = tx + ((mx - tx)/10);
  ty = ty + ((my - ty)/10);
  _matrix.identity();
  _matrix.appendRotation( tx , Vector3D.Y_AXIS );
  _matrix.appendRotation( ty , Vector3D.X_AXIS );
  _matrix.appendTranslation( CX, CY, 10 );
}

static inline function increaseColor( c : UInt ) : UInt {
  return c &amp;lt; MAXCOLOR ? c + SHADE : 0xFFFFFF;
}

static inline function pointToOffset( vx : Int , vy : Int , vw : Int ) : UInt {
 return vx + ( vy * vw );
}
</pre>
<p><a href="http://webr3.org/experiments/particle-pusher-take2/optimized/" target="_blank">And here's the inlined haXe result (with full source)</a></p>
<h2>Summary</h2>
<p>In under five minutes and with tiny code changes we've gained well over 100% speed increase; using nothing fancy and the speed rivals all the heavily optimized versions using every trick in the book.</p>
<p>The final result (simply with the event listener changed to Event.ENTER_FRAME and fps added) <a href="http://webr3.org/experiments/particle-pusher-take2/realtime/">is available here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/haxe/massive-amount-of-3d-particles-take-two/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>3D Perlin Particle Light Cloud (and source) - haXe / Flash 10</title>
		<link>http://webr3.org/blog/haxe/3d-perlin-particle-light-cloud-and-source-haxe-flash-10/</link>
		<comments>http://webr3.org/blog/haxe/3d-perlin-particle-light-cloud-and-source-haxe-flash-10/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 17:19:47 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Flash 10]]></category>
		<category><![CDATA[Perlin Noise]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[3D computer graphics]]></category>
		<category><![CDATA[Environment]]></category>
		<category><![CDATA[Fractals]]></category>
		<category><![CDATA[Noise]]></category>
		<category><![CDATA[Technology/Internet]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=47</guid>
		<description><![CDATA[
Been doing some more playing with Perlin Particles, this time going for more natural, and indeed more useful!
Full source and comments included with this one: 3D Perlin Particle Light Cloud
]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-51" title="perlincloud" src="http://webr3.org/blog/wp-content/uploads/2009/06/perlincloud1.jpg" alt="perlincloud" width="600" height="250" /></p>
<p>Been doing some more playing with Perlin Particles, this time going for more natural, and indeed more useful!</p>
<p>Full source and comments included with this one: <a href="http://webr3.org/experiments/perlin-particles/light-cloud/">3D Perlin Particle Light Cloud</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/haxe/3d-perlin-particle-light-cloud-and-source-haxe-flash-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3D Perlin Noise Particles in Realtime</title>
		<link>http://webr3.org/blog/haxe/3d-perlin-noise-particles-in-realtime/</link>
		<comments>http://webr3.org/blog/haxe/3d-perlin-noise-particles-in-realtime/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 15:55:06 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Flash 10]]></category>
		<category><![CDATA[Perlin Noise]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[Computer graphics]]></category>
		<category><![CDATA[Fractals]]></category>
		<category><![CDATA[Joa Ebert]]></category>
		<category><![CDATA[Noise]]></category>
		<category><![CDATA[Perlin]]></category>
		<category><![CDATA[Technology/Internet]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=42</guid>
		<description><![CDATA[
I was flicking through Joa Eberts site the other day and came across a post he did, speed coding 2; the product of which was a load of 2D perlin noise particles that looked.. well great! Kindly Joa gave me permission to dissect, modify and port it to haxe. Ultimately though I ended up recoding [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-43" title="perlincube" src="http://webr3.org/blog/wp-content/uploads/2009/06/perlincube.jpg" alt="perlincube" width="600" height="250" /></p>
<p>I was flicking through Joa Eberts site the other day and came across a post he did, <a href="http://blog.joa-ebert.com/2008/01/20/speedcoding-2/">speed coding 2</a>; the product of which was a load of 2D perlin noise particles that looked.. well great! Kindly Joa gave me permission to dissect, modify and port it to haxe. Ultimately though I ended up recoding it all from scratch, I did however borrow the nice color transform code from the original though, they're damn nice.</p>
<p>Typically you'd call BitmapData.perlinNoise() to generate a 2 color, 2 octave fractal perlin noise image - you then take the 0-255 color values for both of the channels, scale them and use them as your x &amp; y coordinates.</p>
<p>I decided to twist it a bit and try 3D, so in the experiments I'm generating a 3 color, 4 octave fractal perlin noise image then using the   scaling the values to provide x,y,z coordinates. Then mapping each particle into a 3d space, calculating it's color by merging values of particles which land on the same display pixel together.</p>
<p>Enough of the going on anyways, I'll post the full code for the examples once I've cleaned and commented it - all done in haXe of course.</p>
<p>First off, we have a 3D version of <a href="http://blog.joa-ebert.com/2008/01/20/speedcoding-2/">Joa's original</a>; in this one the particles are all mapped into an imaginary cube and some nice effects added : <a href="http://webr3.org/experiments/perlin-particles/cube-tracing-light-particles/">3D perlin noise particles tracing a cube.</a></p>
<p>Next up I thought I'd try some variations:</p>
<ul>
<li><a href="http://webr3.org/experiments/perlin-particles/lazer-tracing-cube/">Lazer tracing a cube</a> (runs v fast)</li>
<li><a href="http://webr3.org/experiments/perlin-particles/noise-in-a-box/">Perlin Noise, In a Box!</a></li>
</ul>
<p>Quite impressed with the base performance here from haxe, I get 100fps on the lazer tracing example, and circa 45-50 fps on the versions with effects or more complex algo's.</p>
<p>liking perlin noise (and haXe).</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/haxe/3d-perlin-noise-particles-in-realtime/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>More Mashed Up Spheres</title>
		<link>http://webr3.org/blog/haxe/more-mashed-up-spheres/</link>
		<comments>http://webr3.org/blog/haxe/more-mashed-up-spheres/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 15:28:57 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Flash 10]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[3D computer graphics]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Particles]]></category>
		<category><![CDATA[Sphere]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=38</guid>
		<description><![CDATA[
Doesn't need much of an introduction, after my previous post "Amazing what happens when you modify a Sphere"; I realised that I'd missed a few combinations, and as such thought it'd be a good idea to finish off the obvious combinations.. you know, to see what they looked like.
One of the best, and the one [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-39" title="morespheres" src="http://webr3.org/blog/wp-content/uploads/2009/06/morespheres.jpg" alt="morespheres" width="600" height="250" /></p>
<p>Doesn't need much of an introduction, after my previous post "Amazing what happens when you modify a Sphere"; I realised that I'd missed a few combinations, and as such thought it'd be a good idea to finish off the obvious combinations.. you know, to see what they looked like.</p>
<p>One of the best, and the one that makes the most sense formula wise is M16.. here's the formula for it</p>
<pre>x = Math.cos(a) * Math.cos(r);
y = Math.cos(a) * Math.sin(r);
z = Math.sin(a) * Math.sin(r);</pre>
<p>makes sense to me! anyway, on with the show - here are the rest:</p>
<ul>
<li><a href="/experiments/basic-3d-particles/mashed-up-8/">M8</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-9/">M9</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-10/">M10</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-11/">M11</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-12/">M12</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-13/">M13</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-14/">M14</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-15/">M15</a></li>
<li><a href="/experiments/basic-3d-particles/mashed-up-16/">M16</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/haxe/more-mashed-up-spheres/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazing what happens when you modify a Sphere..</title>
		<link>http://webr3.org/blog/haxe/amazing-what-happens-when-you-modify-a-sphere/</link>
		<comments>http://webr3.org/blog/haxe/amazing-what-happens-when-you-modify-a-sphere/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 16:59:35 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Flash 10]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[3D computer graphics]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=35</guid>
		<description><![CDATA[
Taking the 3d particle primatives a bit further (and adding color) I've found that some very nice and rather interesting models can be made when you simply change a sphere a little bit.
Normally I'd do these in order, but in this case I'd recommend you checkout M4 first to get a taste (it's certainly my [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-36" title="eyecandyspheres" src="http://webr3.org/blog/wp-content/uploads/2009/06/eyecandyspheres.jpg" alt="eyecandyspheres" width="600" height="250" /></p>
<p>Taking the 3d particle primatives a bit further (and adding color) I've found that some very nice and rather interesting models can be made when you simply change a sphere a little bit.</p>
<p>Normally I'd do these in order, but in this case I'd recommend you checkout <a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-4/">M4</a> first to get a taste (it's certainly my fav).</p>
<p>Before the list, a very brief description; here we have the code to generate a sphere:</p>
<p><code><br />
for( i in 0...PARTICLES ) {<br />
a = (PARTICLES/360)*i;<br />
r = (i/PARTICLES) * Math.PI;<br />
x = Math.cos(a) * Math.cos(r);<br />
y = Math.cos(a) * Math.sin(r);<br />
z = Math.sin(a);<br />
}<br />
</code></p>
<p>now all we are going to be doing is adding in some steps, or changing the odd cos/sin with cos/sin/tan - nothing complex.</p>
<ul>
<li><a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-1/">M1 Variation</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-2/">M2 Variation</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-3/">M3 Variation</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-4/">M4 Variation</a> (my fav)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-5/">M5 Variation</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-6/">M6 Variation</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/mashed-up-7/">M7 Variation<br />
</a></li>
</ul>
<p>Now.. M7 is a rather interesting one.. because it has two very interesting variations (imho) primarily the eye which produces a flat, yet 3d shaded circle..?</p>
<ul>
<li><a href="http://webr3.org/experiments/basic-3d-particles/m7-strange-variation-the-eye/">M7 Strange Variation - The Eye</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/m7-strange-variation-the-feather/">M7 Strange Variation - The Feather</a></li>
</ul>
<p>In addition there are a few more which are created by simply stepping colors or values:</p>
<ul>
<li><a href="http://webr3.org/experiments/basic-3d-particles/3d-abstract-rainbow/">3D Abstract Rainbow</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/one-three-twentyfour/">One, Three, TwentyFour</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/three-six-twelve/">Three, Six, Twelve</a></li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/six-six-twelve/">Six, Six, Twelve</a></li>
</ul>
<p>again, thanks to <a href="http://haxe.org/">haXe</a> for allowing this - remember it's all just particles rendered in realtime.</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/haxe/amazing-what-happens-when-you-modify-a-sphere/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Particle Cubes and Spheres</title>
		<link>http://webr3.org/blog/haxe/particle-cubes-and-spheres/</link>
		<comments>http://webr3.org/blog/haxe/particle-cubes-and-spheres/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 16:11:44 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[Flash 10]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[haXe]]></category>
		<category><![CDATA[3D computer graphics]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Particles]]></category>
		<category><![CDATA[Rendering]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=30</guid>
		<description><![CDATA[
Following earlier unpublished work, and my version of 300k particles in flash, I found that I've created a nice little setup for rendering the results of mathematical functions in flash; specifically rendering the results as 300k/500k particles - I'm kind of fascinated with particles and plotting functions, as are many others - my preference is [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-31" title="primatives" src="http://webr3.org/blog/wp-content/uploads/2009/06/primatives.jpg" alt="primatives" width="600" height="250" /></p>
<p>Following earlier unpublished work, and <a href="http://webr3.org/blog/haxe/flash-10-massive-amounts-of-3d-particles-with-haxe/">my version of 300k particles</a> in flash, I found that I've created a nice little setup for rendering the results of mathematical functions in flash; specifically rendering the results as 300k/500k particles - I'm kind of fascinated with particles and plotting functions, as are many others - my preference is to work with strange attractors; however I thought I'd shoot right back to basics and see what can be made with primatives and modifications of.</p>
<p><strong>pre-warning, if you're looking for eye candy, forget it </strong>- these are simple practical examples and a bit boring, but useful if you need to know how</p>
<p>Starting with the simplest we have the <strong><a href="http://webr3.org/experiments/basic-3d-particles/random-particle-cube/">Particle Cube</a></strong> - 500k random particles plotted in 3d space within an invisible cube. Then I modified it a bit..</p>
<ul>
<li><a href="http://webr3.org/experiments/basic-3d-particles/sine-modified-x-particle-cube/">Sine Modified Particle Cube</a> (it's all skewed)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/particle-cube-sine-variation/">Sine and Time Modified Particle Cube</a> (double cube with a flow of particles between)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/particle-cube-sin-cos-tan/">Sine, Tan and Cos Modified Particle Cube</a> (one function applied to each axis)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/particle-cube-sin-cos-tan-v1/">Alternative Flattened Sine, Tan, Cos Modified Particle Cube</a> (patchwork circular flattened cube!)</li>
</ul>
<p>Next up the <strong><a href="http://webr3.org/experiments/basic-3d-particles/3d-particle-sphere/">Particle Sphere</a></strong> - another 500k particles in 3d space, all random, and then some modified versions..</p>
<ul>
<li><a href="http://webr3.org/experiments/basic-3d-particles/3d-particle-spherical-circles/">Spherical Circles</a> (evenly distributed particles, creates a single line wrapped around a sphere)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/3d-emphasized-particle-sphere/">Emphasized Particle Sphere</a> (double spaced to create a messy particle sphere - but more like particles)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/3d-particle-half-sphere/">Half a Sphere</a> (go on, guess)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/3d-white-bubble/">White Particle Bubble</a> (evenly distributed to create a kind of bubble effect)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/the-binlid-3d-particles/">Split Sections of a Sphere</a> (two opposing but differing chunks of sphere, again all particles, like a swing bin lid)</li>
</ul>
<p>And finally a couple of simple experiments..</p>
<ul>
<li><a href="http://webr3.org/experiments/basic-3d-particles/atan2-warped-random-plane/">Random Warped Particle Plane</a> (random x, random y, atan2(x,y) for z)</li>
<li><a href="http://webr3.org/experiments/basic-3d-particles/3d-beach-bubble/">Beach Bubble</a> (the white bubble with some colour, like a beach ball but translucent)</li>
</ul>
<p>In summary, it's good to see how easily different effects and primatives can be build, and even better to see how easily they can be modified with basic mathematical functions. (and how good <a href="http://haxe.org/">haXe</a> is :p)</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/haxe/particle-cubes-and-spheres/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experiments Upgraded</title>
		<link>http://webr3.org/blog/general/experiments-upgraded/</link>
		<comments>http://webr3.org/blog/general/experiments-upgraded/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 13:58:05 +0000</pubDate>
		<dc:creator>nathan</dc:creator>
				<category><![CDATA[experiments]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[Extensible Stylesheet Language]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XSL Transformations]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://webr3.org/blog/?p=20</guid>
		<description><![CDATA[
It's a bit premature, seeing as I haven't even blogged about what the existing experiments are yet, however I'm glad to say that the section is finished and ready for veiwing.
Seeing as most of the audience of this blog will be using more recent browsers, I've opted for XSLT templates and small XML descriptors for [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-22" title="xslt-labs" src="http://webr3.org/blog/wp-content/uploads/2009/06/xslt-labs.jpg" alt="xslt-labs" width="600" height="250" /><br />
It's a bit premature, seeing as I haven't even blogged about what the existing experiments are yet, however I'm glad to say that the section is finished and ready for veiwing.</p>
<p>Seeing as most of the audience of this blog will be using more recent browsers, I've opted for XSLT templates and small XML descriptors for each item - this saves me writing tonnes of html, saves the server some weight, saves you some bandwidth and let's me palm off all rendering on to the client.</p>
<p>Inkeeping with the spirit of experiments, one of the main reasons I've done this is to see how the xml documents get listed in google (if at all); and to check if analytics works with XSLT.</p>
<p>On this note, I had to do a little bit of fiddling with the recommended embed code from google to get it to work; if anybody else hits this problem here's a modified version.</p>
<p><code><br />
&lt;script src="http://www.google-analytics.com/ga.js" type="text/javascript"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;<br />
try {<br />
var pageTracker = _gat._getTracker("UA-3391780-6");<br />
pageTracker._trackPageview();<br />
} catch(err) {}<br />
&lt;/script&gt;<br />
</code></p>
<p>And as for the listings, well thats just a quick and dirty PHP 5 class which iterates the directories, loads them in to a dom document and spits out the xml - ultra simples.</p>
]]></content:encoded>
			<wfw:commentRss>http://webr3.org/blog/general/experiments-upgraded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
