<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Mashups, Marketing and Me</title>
	
	<link>http://www.cfg.no</link>
	<description>The blog project, a journey!</description>
	<lastBuildDate>Wed, 02 Sep 2009 17:51:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/MakingYourFirstOnlineDollar" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="makingyourfirstonlinedollar" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Temperature sensors on Dell Poweredge 850 in Linux</title>
		<link>http://www.cfg.no/2009/06/temperature-sensors-on-dell-poweredge-850-in-linux/</link>
		<comments>http://www.cfg.no/2009/06/temperature-sensors-on-dell-poweredge-850-in-linux/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 12:40:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[ipmi]]></category>
		<category><![CDATA[p850]]></category>
		<category><![CDATA[poweredge]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[temperature]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=229</guid>
		<description><![CDATA[		
		
		
		This is what I had to do to get some temperature reading from a Dell P850 in Ubuntu Linux.
Loading the IPMI kernel modules

root@server:~# modprobe ipmi_devintf
root@server:~# modprobe ipmi_si

Creating the device unless it&#8217;s already made
(I.e. if /dev/ipmi0 doesn&#8217;t already exist, do this step.)

root@server:~# mknod /dev/ipmi0 c 252 0

Installing the tools and reading temperatures
This will install the ipmitool [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/06/temperature-sensors-on-dell-poweredge-850-in-linux/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Temperature+sensors+on+Dell+Poweredge+850+in+Linux";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><em>This is what I had to do to get some temperature reading from a Dell P850 in Ubuntu Linux.</em></p>
<p><strong>Loading the IPMI kernel modules</strong></p>
<blockquote><p>
root@server:~# modprobe ipmi_devintf<br />
root@server:~# modprobe ipmi_si
</p></blockquote>
<p><strong>Creating the device unless it&#8217;s already made</strong><br />
(I.e. if /dev/ipmi0 doesn&#8217;t already exist, do this step.)</p>
<blockquote><p>
root@server:~# mknod /dev/ipmi0 c 252 0
</p></blockquote>
<p><strong>Installing the tools and reading temperatures</strong></p>
<p>This will install the ipmitool package </p>
<blockquote><p>
root@server:~# apt-get install ipmitool
</p></blockquote>
<p>Read temperatures</p>
<blockquote><p>
root@server:~# ipmitool sdr type Temp<br />
Temp             | 01h | ok  |  3.1 | 38 degrees C<br />
Planar Temp      | 04h | ok  |  7.1 | 28 degrees C<br />
Temp Interface   | 53h | ns  |  7.1 | Disabled
</p></blockquote>
<p>I wrote a munin plugin to parse and graph this too,  shout if it&#8217;s interesting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/06/temperature-sensors-on-dell-poweredge-850-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Learning PHP (6) – Connecting to a database</title>
		<link>http://www.cfg.no/2009/06/learning-php-6-connecting-to-a-database/</link>
		<comments>http://www.cfg.no/2009/06/learning-php-6-connecting-to-a-database/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 20:13:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learning PHP]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=221</guid>
		<description><![CDATA[		
		
		
		Everyone needs to store and get data from a database every now and then. MySQL can be an excellent choice for some.
Creating a table
This is how you create a simple table from the CLI, you can recognize the values if you use systems like phpmyadmin for modifying database structures.
mysql&#62; CREATE TABLE mytable (
-&#62; id INT [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/06/learning-php-6-connecting-to-a-database/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Learning+PHP+%286%29+%26%238211%3B+Connecting+to+a+database";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><em>Everyone needs to store and get data from a database every now and then. MySQL can be an excellent choice for some.</em></p>
<p><strong>Creating a table</strong><br />
This is how you create a simple table from the CLI, you can recognize the values if you use systems like phpmyadmin for modifying database structures.</p>
<blockquote><p>mysql&gt; CREATE TABLE mytable (<br />
-&gt; id INT NOT NULL AUTO_INCREMENT,<br />
-&gt; name VARCHAR(255) NOT NULL,<br />
-&gt; PRIMARY KEY(id)<br />
-&gt; );<br />
Query OK, 0 rows affected (0.02 sec)</p></blockquote>
<p>The MySQL reserved are upper cased, all the text in lower case are things<br />
that you can change. This basically creates a table named &#8216;mytable&#8217; with<br />
two columns; &#8220;id&#8221; and &#8220;name&#8221;, id is an INT(eger) and name is a varchar of<br />
max 255 characters.</p>
<p>AUTO_INCREMENT means that id will be automatically incremented if not defined.</p>
<p><strong>Connecting to MySQL from PHP</strong><br />
<em>Disclaimer: This is a very basic example, if you are coding for production use please at least look at the function mysql_real_escape_string() or a library<br />
that will handle insertion and such.</em></p>
<p>The example above inserts a record in MySQL, the id will be automatically set to 1 (for the first row you insert, 2 for the next, etc.). To read this record out from the database again you can do something like this:</p>
<pre lang='php'>

<b>Warning</b>:  mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Unknown MySQL server host 'mysqlhost' (1) in <b>/home/espen/virtualhosts/www.cfg.no/htdocs/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code</b> on line <b>26</b>

<b>Warning</b>:  mysql_select_db(): supplied argument is not a valid MySQL-Link resource in <b>/home/espen/virtualhosts/www.cfg.no/htdocs/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code</b> on line <b>27</b>
Data from MySQL
<b>Warning</b>:  mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in <b>/home/espen/virtualhosts/www.cfg.no/htdocs/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code</b> on line <b>31</b>
</pre>
<p>This piece of code will perform a &#8220;SELECT * FROM mytable&#8221; query (the * means every column from the table, you could get only the name by doing &#8220;<em>SELECT name FROM mytable</em>&#8220;.<br />
Since there can be multiple rows we perform a while loop, so while $row gets fed with data from the mysql_fetch_assoc() function it will print the &#8216;id&#8217; and &#8216;name&#8217; columns from the table.</p>
<p>Select specific row(s) only (match on name)</p>
<pre lang='php'>

<b>Warning</b>:  mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Unknown MySQL server host 'mysqlhost' (1) in <b>/home/espen/virtualhosts/www.cfg.no/htdocs/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code</b> on line <b>43</b>

<b>Warning</b>:  mysql_select_db(): supplied argument is not a valid MySQL-Link resource in <b>/home/espen/virtualhosts/www.cfg.no/htdocs/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code</b> on line <b>44</b>
Data from MySQL
<b>Warning</b>:  mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in <b>/home/espen/virtualhosts/www.cfg.no/htdocs/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code</b> on line <b>48</b>
</pre>
<p>Now we used the LIKE keyword in MySQL, the percent (<strong>%</strong>) sign is a wildcard.<br />
This will get every row from the table where name begins with an E.</p>
<p>Homework: Now try to combine $_GET and $_POST + MySQL. <img src='http://www.cfg.no/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/06/learning-php-6-connecting-to-a-database/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Learning PHP (5) – Using built-in functions</title>
		<link>http://www.cfg.no/2009/06/learning-php-5-using-built-in-functions/</link>
		<comments>http://www.cfg.no/2009/06/learning-php-5-using-built-in-functions/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 20:18:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learning PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[built-in]]></category>
		<category><![CDATA[explode]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[learn php]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[stristr]]></category>
		<category><![CDATA[strstr]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=212</guid>
		<description><![CDATA[		
		
		
		I had promised myself that I would post every second day, but I didn&#8217;t know exactly where to go from what we have built up and I also became engaged, she said yes! So it has been crazy days.
But I&#8217;m happy, at least  
I am going to continue with showing how to take use [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/06/learning-php-5-using-built-in-functions/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Learning+PHP+%285%29+%26%238211%3B+Using+built-in+functions";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><em>I had promised myself that I would post every second day, but I didn&#8217;t know exactly where to go from what we have built up and I also became engaged, she said yes! So it has been crazy days.<br />
But I&#8217;m happy, at least <img src='http://www.cfg.no/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </em></p>
<p>I am going to continue with showing how to take use of some of the <a rel="nofollow" href="http://no.php.net/manual/en/ref.strings.php">built-in string fuctions</a>. These can be used to manipulate text variables that you might receive from the $_GET and $_POST variables.</p>
<p><strong>Find occurrence of text in strings</strong><br />
You can for example use the function <a rel="nofollow" href="http://no.php.net/manual/en/function.strstr.php">strstr()</a> or <a rel="nofollow" href="http://no.php.net/manual/en/function.stristr.php">stristr()</a> if you want a cast-insensitive matching style.</p>
<p><em>Example</em></p>
<pre class="php">$mystring = 'this websites owner is nice';
if (strstr($mystring, 'website')) {
 echo 'I found the word "website" in the string.';
}</pre>
<p>I can use double quotes in the string because I have it enclosed in single quotes.<br />
If I were to use single quotes it would unquote the string and generate a syntax error.</p>
<p>If you replace <em>strstr</em> with <em>stristr</em> in the example, it would<br />
also give a match if $mystring contains the word &#8216;Website&#8217; with an upper case W.</p>
<p><strong>explode() strings</strong><br />
If you get a string such as &#8220;one,two,three,four,five,six&#8221; and you would rather have<br />
it indexed in an array you can use the function <a rel="nofollow" href="http://no.php.net/manual/en/function.explode.php">explode()</a> to achieve this.</p>
<p>The build-in function explode() will parse a string and split it based on the<br />
argument you give the function. An example will follow:</p>
<pre class="php">$mystring = "one,two,three,four;five,six,seven";
$myarray = explode(",", $mystring);

var_dump($myarray);</pre>
<p>The first argument to explode is the delimiting character, while the other<br />
is the string that will be split into an array. The result of this would be:</p>
<blockquote><p>array(6) {<br />
[0]=&gt;<br />
string(3) &#8220;one&#8221;<br />
[1]=&gt;<br />
string(3) &#8220;two&#8221;<br />
[2]=&gt;<br />
string(5) &#8220;three&#8221;<br />
[3]=&gt;<br />
string(9) &#8220;four;five&#8221;<br />
[4]=&gt;<br />
string(3) &#8220;six&#8221;<br />
[5]=&gt;<br />
string(5) &#8220;seven&#8221;<br />
}
</p></blockquote>
<p>Notice that $myarray[3] contains four;five, this is due to a common<br />
mistake.. it can be hard to overlook, so can you figure out why it does that? <img src='http://www.cfg.no/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p>Anyways, you should check out the <a rel="nofollow" href="http://no.php.net/manual/en/ref.strings.php">documentation</a> and try out some<br />
of the functions, because they are really easy to use and implement.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/06/learning-php-5-using-built-in-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning PHP Part Four – If and else</title>
		<link>http://www.cfg.no/2009/05/learning-php-part-four-if-and-else/</link>
		<comments>http://www.cfg.no/2009/05/learning-php-part-four-if-and-else/#comments</comments>
		<pubDate>Sat, 30 May 2009 14:13:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learning PHP]]></category>
		<category><![CDATA[else]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[learn php]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=203</guid>
		<description><![CDATA[		
		
		
		Have you been playing around with the GET and POST arrays now?
If not, learn about foreach in PHP here.
What can I do now?
You can go ahead and use if to check the contents of variables.
Check this out.
If
The syntax for if goes like this:

if (statement) {
  Insert your code here
}
The statement will be checked, and [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/05/learning-php-part-four-if-and-else/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Learning+PHP+Part+Four+%26%238211%3B+If+and+else";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>Have you been playing around with the GET and POST arrays now?<br />
If not, learn about <a href="http://www.cfg.no/2009/05/learning-php-part-three-reserved-variables-and-loops/">foreach in PHP here</a>.</p>
<p><strong>What can I do now?</strong><br />
You can go ahead and use if to check the contents of variables.<br />
Check this out.</p>
<p><strong>If</strong><br />
The syntax for if goes like this:</p>
<pre lang="PHP">
if (statement) {
  Insert your code here
}</pre>
<p>The statement will be checked, and if it is true the code within the { and } will be executed.<br />
Take for example a script where you get a variable from the url, take the previous<br />
example where you used <strong>$_GET['name']</strong> to retrieve the <strong>?name=</strong> part of the URL.</p>
<p>Now, if your name is John and you want the page to say hello to you but not to anyone else.</p>
<pre lang="PHP">
</pre>
<p>The <em>$_GET['name'] == &#8216;John&#8217;</em> part is called the statement,<br />
you probably understand it but it checks to see if the $_GET array variable<br />
with the key &#8216;name&#8217; contains a string &#8216;John&#8217;.</p>
<p>You can do similar tests with numbers, but then you won&#8217;t need the quotes<br />
like the ones I have around &#8216;John&#8217;.</p>
<p>The example will then be:</p>
<pre lang="PHP">
</pre>
<p>Let us say you want to check if the name is NOT John.</p>
<pre lang="PHP">
You're not my master.</pre>
<p><strong>Else</strong><br />
Now, take the example where you output &#8216;Hi master&#8217;, what if you want<br />
to print something to the ones not being the master? You can use <strong>else</strong></p>
<pre lang="PHP">
You're not my master</pre>
<p>That&#8217;s all for today, I don&#8217;t have so much time today so I am going to keep it quite short.<br />
I will get back with a new article in these series in a couple of days, hope I&#8217;ll see you back here then!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/05/learning-php-part-four-if-and-else/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Really cool Spotify and last.fm Mashup</title>
		<link>http://www.cfg.no/2009/05/really-cool-spotify-and-lastfm-mashup/</link>
		<comments>http://www.cfg.no/2009/05/really-cool-spotify-and-lastfm-mashup/#comments</comments>
		<pubDate>Fri, 29 May 2009 21:00:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mashups]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[spotify]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=196</guid>
		<description><![CDATA[		
		
		
		Just a short post for today, but I thought I&#8217;d make you aware of an application (that has been around for a while, but hey, it&#8217;s creative).
If you use Spotify and Last.fm this mashup of an application is a great way to find music on added to Spotify that matches your top 50 artists (or [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/05/really-cool-spotify-and-lastfm-mashup/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Really+cool+Spotify+and+last.fm+Mashup";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><strong>Just a short post</strong> for today, but I thought I&#8217;d make you aware of an application (that has been around for a while, but hey, it&#8217;s creative).</p>
<p>If you use Spotify and Last.fm <a href="http://lutt.se/lastfm+spotify+new/">this mashup of an application</a> is a great way to find music on added to Spotify that matches your top 50 artists (or so, <a href="http://lutt.se">Vilhelm</a> writes.)</p>
<p>Maybe you can find some goodies there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/05/really-cool-spotify-and-lastfm-mashup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning PHP (3); Reserved vars and loops</title>
		<link>http://www.cfg.no/2009/05/learning-php-part-three-reserved-variables-and-loops/</link>
		<comments>http://www.cfg.no/2009/05/learning-php-part-three-reserved-variables-and-loops/#comments</comments>
		<pubDate>Thu, 28 May 2009 14:49:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learning PHP]]></category>
		<category><![CDATA[$_GET]]></category>
		<category><![CDATA[$_POST]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[loops]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=185</guid>
		<description><![CDATA[		
		
		
		In my previous article I explained arrays and their use. But have you ever wondered what happens to those variables set in the url?  They are contained within an array which is prefilled for your scripts.
The array variables $_GET, $_POST and $_SERVER are some of the interesting ones you can use.
The reserved $_GET variable
An [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/05/learning-php-part-three-reserved-variables-and-loops/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Learning+PHP+%283%29%3B+Reserved+vars+and+loops";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>In my <a href="http://www.cfg.no/2009/05/learning-php-part-two-arrays/">previous article</a> I explained arrays and their use. But have you ever wondered what happens to those variables set in the url?  They are contained within an array which is prefilled for your scripts.</p>
<p>The array variables $_GET, $_POST and $_SERVER are some of the interesting ones you can use.</p>
<p><strong>The reserved $_GET variable</strong><br />
An example would be this type of URL.<br />
<em>http://www.example.domain/myphpscript.php?name=Espen</em></p>
<p>To catch the variable &#8216;name&#8217; you can do this piece of PHP</p>
<blockquote><p>
&lt;?php<br />
echo &#8220;Hi &#8221; . $_GET['name'];<br />
?&gt;
</p></blockquote>
<p>This will output &#8220;Hi Espen&#8221;.</p>
<p><strong>Using the reserved $_POST variable</strong><br />
To get the variables from a form you can use $_POST['<em>key</em>'].<br />
Look at this example:</p>
<p>Create this HTML form, change the path to <em>myhelloscript.php</em> to a place where you test your scripts.</p>
<blockquote><p>
&lt;form action=&#8221;http://my.domain/myhelloscript.php&#8221; method=&#8221;post&#8221;&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;name&#8221;&gt;<br />
&lt;input type=&#8221;submit&#8221; value=&#8221;send it&#8221;&gt;<br />
&lt;/form&gt;
</p></blockquote>
<p>Then create the file <em>myhelloscript.php</em> with the following contents</p>
<blockquote><p>
&lt;?php<br />
echo &#8220;hi &#8221; . $_POST['name'];<br />
?&gt;
</p></blockquote>
<p>You see? The same result here, only now we&#8217;re using <strong>POST</strong> instead of GET (you can also notice that the URL does not contain the variables).</p>
<p><strong>Looping over an array</strong><br />
Looping over an array can be very usefull in the case where you don&#8217;t know what the reference keys are.<br />
Let us say you didn&#8217;t know that the key for the name in the previous post example was not called  &#8216;name&#8217;, how would you find it?</p>
<p>Here is an example of looping over an array, looping through all the key and value pairs.</p>
<blockquote><p>
&lt;?php<br />
$myarray = array(&#8216;Espen&#8217;, &#8216;John&#8217;, &#8216;Lisa&#8217;, &#8216;Mark&#8217;);</p>
<p>foreach ($myarray as $value) {<br />
echo $value . &#8220;&lt;br&gt;&#8221;;<br />
}<br />
?&gt;
</p></blockquote>
<p>Now we&#8217;re saying for each &#8216;entry&#8217; in $myarray get the entry as $value and do something with it between the { and }<br />
So for each $myarray as $value: echo $value and a &#8216;&lt;br&gt;&#8217; (to get a newline).</p>
<p>This example will output</p>
<blockquote><p>
Espen<br />
John<br />
Lisa<br />
Mark
</p></blockquote>
<p><strong>Getting the key</strong><br />
But that&#8217;s not the key, is it?  How do you find the keys?<br />
This example will use the foreach command in another way to get the keys also</p>
<blockquote><p>
&lt;?php<br />
foreach ($myarray as $key =&gt; $value) {<br />
echo $key . &#8216; is &#8216; . $value . &#8216;&lt;br&gt;&#8217;;<br />
}<br />
?&gt;
</p></blockquote>
<p>Now you can also use the variable $key within the loop for each value to get the corresponding key.</p>
<p>This is an example of looping over the $_GET array</p>
<blockquote><p>
&lt;?php<br />
foreach ($_GET as $key =&gt; $value) {<br />
echo $key . &#8216; is set to &#8216; . $value . &#8216;&lt;br&gt;&#8217;;<br />
}<br />
?&gt;
</p></blockquote>
<p><strong>A Challenge</strong><br />
The $_SERVER variable contains a lot of variables about the request, can you figure out how to show them all?</p>
<p>If you get any weird syntax errors or such, post them as a comment and I will try to help you out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/05/learning-php-part-three-reserved-variables-and-loops/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning PHP – Part two; Arrays</title>
		<link>http://www.cfg.no/2009/05/learning-php-part-two-arrays/</link>
		<comments>http://www.cfg.no/2009/05/learning-php-part-two-arrays/#comments</comments>
		<pubDate>Tue, 26 May 2009 09:59:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learning PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[learn php]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=178</guid>
		<description><![CDATA[		
		
		
		Here&#8217;s my follow up on my PHP articles, this time I am going to talk a bit about arrays. They are so important that you should learn about them sooner than later.
What are arrays?
This quote is from wikipedia.org
An array is a systematic arrangement of objects, usually in rows and columns. Specifically, it may refer to [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/05/learning-php-part-two-arrays/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Learning+PHP+%26%238211%3B+Part+two%3B+Arrays";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>Here&#8217;s my follow up on my PHP articles, this time I am going to talk a bit about arrays. They are so important that you should learn about them sooner than later.</p>
<p><strong>What are arrays?</strong><br />
This quote is from <a href="http://wikipedia.org">wikipedia.org</a></p>
<blockquote><p>An array is a systematic arrangement of objects, usually in rows and columns. Specifically, it may refer to several things.</p></blockquote>
<p>That&#8217;s exactly what it is, it&#8217;s a variable (<a href="http://www.cfg.no/2009/05/learning-php-part-one/">see previous post</a>) containing several values (like a shelf with several compartments) that can be retrieved by a key (the number on the compartment).  Array keys are per default a number, but it can also be an associative array with text strings for keys.</p>
<p><strong>So make an array and fill it with data</strong><br />
Here is an example on how to declare an array:</p>
<blockquote><p>
&lt;?php<br />
$bookshelf = array(<br />
&#8216;old books&#8217;,<br />
&#8216;new books&#8217;,<br />
&#8216;cooking books&#8217;<br />
);<br />
?&gt;
</p></blockquote>
<p>The variable name is $bookshelf, it is set to be an array(). The contents is put in between the (), but you can also declare an empty array by doing this:</p>
<blockquote><p>
$bookshelf = array();
</p></blockquote>
<p>By default, the first value will have the key 0, the second will have 1, etc.<br />
To refer to a value within an array and echo it out to display:</p>
<blockquote><p>
&lt;?php<br />
$bookshelf = array(<br />
&#8216;old books&#8217;,<br />
&#8216;new books&#8217;,<br />
&#8216;cooking books&#8217;<br />
);</p>
<p>echo <strong>$bookshelf[0]</strong>;</p>
<p>?&gt;
</p></blockquote>
<p>The result outputted from this script will be:</p>
<blockquote><p>
<em>old books</em>
</p></blockquote>
<p>By using the [ and ] signs behind a variable you are referring to it as an array, what you put between them is the key you are using. <em>Try to change the value between them to 1 and check the result.</em></p>
<p><strong>Adding values to a PHP array</strong><br />
You can make use of the array_push() function to insert more variables to a previously declared array.</p>
<blockquote><p>
&lt;?php<br />
$bookshelf = array(<br />
&#8216;old books&#8217;,<br />
&#8216;new books&#8217;,<br />
&#8216;cooking books&#8217;<br />
);</p>
<p>array_push($bookshelf, &#8216;dvds&#8217;);</p>
<p>echo <strong>$bookshelf[3]</strong>;</p>
<p>?&gt;
</p></blockquote>
<p>You can also set a variable directly by using the key</p>
<p>&lt;?php<br />
$bookshelf = array(<br />
&#8216;old books&#8217;,<br />
&#8216;new books&#8217;,<br />
&#8216;cooking books&#8217;<br />
);</p>
<p>$bookshelf[3] = &#8216;dvds&#8217;;</p>
<p>echo <strong>$bookshelf[3]</strong>;</p>
<p>?&gt;
</p></blockquote>
<p><strong>Deleting a value from a PHP array</strong><br />
Several ways to this also, you can use array_pop() to unset the last value in the array.<br />
The unset() function can be on the array value to unset it.<br />
You can set it to null by referring to the key</p>
<blockquote><p>
array_pop($bookshelf);<br />
unset($bookshelf[3]);<br />
$bookshelf[3] = null;
</p></blockquote>
<p>While these are regular arrays, there are other possible ways to use this. A string variable like $name = &#8220;Espen&#8221;; in my previous article is actually an array of characters. $name[0] will refer to &#8216;E&#8217;, 1 will refer to &#8217;s&#8217; so on and so forth.</p>
<p><strong>Associative Arrays in PHP</strong><br />
You can use keys which are not numbers in an array, those are called associative arrays.<br />
Here is an example, I bet you understand most of the basics now, and in case NOT &#8211; drop me a comment!</p>
<blockquote><p>
$bookshelf['favourite'] = &#8216;Marketing 911&#8242;;<br />
echo $bookshelf['favourite'];
</p></blockquote>
<p>In my next article you will get magic behind the array variables $_GET, $_POST and $_SERVER to finally be able to handle user input from forms and every secret of the request. Want to know when I post it? <a href="/feed">Get Learning by RSS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/05/learning-php-part-two-arrays/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning PHP – Part one</title>
		<link>http://www.cfg.no/2009/05/learning-php-part-one/</link>
		<comments>http://www.cfg.no/2009/05/learning-php-part-one/#comments</comments>
		<pubDate>Sun, 24 May 2009 17:07:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Learning PHP]]></category>
		<category><![CDATA[hello world]]></category>
		<category><![CDATA[learn php]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[teach php]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=169</guid>
		<description><![CDATA[		
		
		
		Do you want to learn PHP?
I&#8217;ve been coding (or scripting if you want) PHP actively for myself for probably 10 years now, over the years I&#8217;ve had a lot of questions about it and have done a lot of small favours for people. I would be happy to give away some of my knowledge, so [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/05/learning-php-part-one/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Learning+PHP+%26%238211%3B+Part+one";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><strong>Do you want to learn PHP?</strong></p>
<p>I&#8217;ve been coding (or scripting if you want) PHP actively for myself for probably 10 years now, over the years I&#8217;ve had a lot of questions about it and have done a lot of small favours for people. I would be happy to give away some of my knowledge, so please ask if there is anything.</p>
<p>I am going to teach PHP from basic to advanced, I will try to keep it to one article every other day.<br />
<a href="http://www.cfg.no/feed/">Subscribe to my feed</a> if you don&#8217;t want to miss out on this chance.</p>
<p><strong>Basic Introduction</strong><br />
What is PHP? It is a scripting language that resides on the server-side as opposed to javascript which is downloaded and ran by the client (which is called client-side).</p>
<p>To be able to execute PHP scripts, you need access to a webserver that runs PHP scripts &#8211; there are a lot of alternatives.<br />
I am not going to explain them here, but I am sure it is possible to arrange something if you need a place and is into learning.<br />
It is also possible to run an <a href="http://httpd.apache.org">Apache</a> server locally with PHP.</p>
<p><strong>My First PHP Script</strong><br />
Create a file named first.php and this is the contents</p>
<blockquote><p>
&lt;?php<br />
  echo &#8220;hello (word)&#8221;;<br />
?&gt;
</p></blockquote>
<p>Save this file somewhere on the webserver and try to go to the url.<br />
It will display: hello (world)</p>
<p><strong>Explanation</strong><br />
<strong>The first line</strong> is <strong>&lt;?php</strong>, this tells the webserver that it is about to parse PHP scripting. You need this before every piece PHP script for it to be executed as PHP.</p>
<p><strong>The second line</strong> is <strong>echo &#8220;hello (world)&#8221;;</strong>, this is actually the PHP script line.<br />
It uses the built-in function &#8216;echo&#8217; to display a string, the string needs to be contained within quotes.<br />
And <strong>notice</strong> that the ending of the line is <strong>;</strong>, this finishes off the statement.<br />
If you were to forget the <strong>;</strong> and had several lines of code the server will continue to feed the rest of the code into the echo function, which would probably not work or give really really unexpected results.</p>
<p><strong>The third line</strong> is <strong>?&gt;</strong>, this tells the webserver that the PHP script is over.<br />
When it reaches this tag, it will continue to output the rest of the page to the browsing user. This means that you can use PHP in between HTML to generate dynamic responses.</p>
<p><strong>My Second PHP Script</strong><br />
Heck, since it&#8217;s the first post and the first script was so easy.. I will show you another script and teach how variables work.<br />
I will move on to more advanced things later, so keep watching if this is way too basic for you. There will be more blood! <img src='http://www.cfg.no/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<blockquote><p>
  &lt;?php<br />
     $name = &#8220;Espen&#8221;;<br />
     $age = 23;<br />
     $twice = $age * 2;<br />
     echo &#8220;My name is &#8221; . $name . &#8221; and my age is &#8221; . $age . &#8220;, if I had lived twice as long I&#8217;d be &#8221; . $twice;<br />
  ?&gt;
</p></blockquote>
<p><strong>Explanation</strong><br />
The <strong>first line of PHP script</strong> is <strong>$name = &#8216;Espen&#8217;;</strong>.<br />
The dollar sign ($) indicates that this is a variable, variables are used to contain dynamic information like if you want to display it at several places in your document.</p>
<p>The variable name is actually &#8216;name&#8217;, and it is set to contain anything behind the equal (=).<br />
The string behind the equal sign is &#8220;Espen&#8221;, notice the <strong>;</strong> ending again.<br />
Because it is contained within quotes, PHP automatically identifies it as a string, it will not work without quotes.<br />
I will show some examples between the difference in double and single quotes later.</p>
<p>The <strong>second line</strong> is <strong>$age = 23;</strong>.<br />
As before, notice the dollar sign and also notice the <strong>;</strong> ending.<br />
Because age is an integer, you don&#8217;t need quotes. If you use quotes around the age like &#8216;23&#8242;, PHP will identify it as a string and doing calculations on it can fail.</p>
<p>The <strong>third line</strong> is <strong>$twice = $age * 2;</strong><br />
This sets the variable named <strong>$twice</strong> to contain whatever is in the variable $age and multiply it with two.<br />
We know from before that $age is set to 23, so this will yield a result of 46. $twice now contains 46.</p>
<p>The <strong>fourth line</strong> is:<br />
echo &#8220;My name is &#8221; . $name . &#8221; and my age is &#8221; . $age . &#8220;, if I had lived twice as long I&#8217;d be &#8221; . $twice;</p>
<p>One of the methods of combining variables into another is the usage of the period character <strong>(.)</strong> There are other and better ways to do it, but that may be to complicated for a beginner for now.<br />
Some if you may relate this to javascript where they use + to combine variables.<br />
So this actually feeds a lot of parts of information to the echo function to display it:<br />
&#8220;My name is &#8221; is the first part, the next variable will be printed right after it &#8211; so notice the white space before the last qutoe.<br />
Then the period character is used to append the variable $name to it.<br />
The string &#8221; and my age is &#8221; is appended by . again, notice white spaces before and after the string.<br />
You probably understand the rest of it now.<br />
<strong>Notice</strong> that any white space added that is not contained within quotes will not be displayed either.</p>
<p>If anything is unclear or completely wrong, feel free to drop me a comment!<br />
More learning is coming: <a href="http://www.cfg.no/feed/">Subscribe to my feed</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/05/learning-php-part-one/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Google Maps in Flash with the Flex SDK and haXe</title>
		<link>http://www.cfg.no/2009/05/google-maps-in-flash-with-the-flex-sdk-and-haxe/</link>
		<comments>http://www.cfg.no/2009/05/google-maps-in-flash-with-the-flex-sdk-and-haxe/#comments</comments>
		<pubDate>Sat, 23 May 2009 00:12:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mashups]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[haXe]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=162</guid>
		<description><![CDATA[		
		
		
		and getting it to work together.. seems like people have a lot of issues with this, so here are the steps you have to take.
If you do not have an API key, sign up for one here.
This way of installing haXe is pretty bad and should be avoided, but it made it easy swapping haXe [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/05/google-maps-in-flash-with-the-flex-sdk-and-haxe/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Google+Maps+in+Flash+with+the+Flex+SDK+and+haXe";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><em>and getting it to work together.. seems like people have a lot of issues with this, so here are the steps you have to take.</em></p>
<p>If you do not have an API key, sign up for one <a href="http://code.google.com/apis/maps/signup.html">here</a>.</p>
<p>This way of installing haXe is pretty bad and should be avoided, but it made it easy swapping haXe versions fast.<br />
I use the haXe version 1.19 together with the Google Maps Flash API.</p>
<p>Lets first get haXe and the Googles Flash API</p>
<blockquote><p>
root@devbox:/usr/local/src$ mkdir flashdevelopment<br />
root@devbox:/usr/local/src$ cd flashdevelopment/<br />
root@devbox:/usr/local/src/flashdevelopment$ wget -q \</p>
<p>http://maps.googleapis.com/maps/flash/release/sdk.zip</p>
<p>root@devbox:/usr/local/src/flashdevelopment$ wget -q \</p>
<p>http://haxe.org/file/haxe-1.19-linux.tar.gz</p>
<p>root@devbox:/usr/local/src/flashdevelopment$ unzip -q sdk.zip<br />
root@devbox:/usr/local/src/flashdevelopment$ tar -zxf \<br />
haxe-1.19-linux.tar.gz
</p></blockquote>
<p>To make haXe work:</p>
<blockquote><p>
root@devbox:/usr/local/src/flashdevelopment$ cd haxe-1.19-linux<br />
root@devbox:/usr/local/src/flashdevelopment/haxe-1.19-linux$ cp haxe /usr/bin/<br />
root@devbox:/usr/local/src/flashdevelopment/haxe-1.19-linux$ cp haxelib /usr/bin<br />
root@devbox:/usr/local/src/flashdevelopment/haxe-1.19-linux$ cp haxedoc /usr/bin/<br />
root@devbox:/usr/local/src/flashdevelopment/haxe-1.19-linux$ mkdir /usr/lib/haxe<br />
root@devbox:/usr/local/src/flashdevelopment/haxe-1.19-linux$ ln -s /usr/local/src/flashdevelopment/haxe-1.19-linux/std/ /usr/lib/haxe
</p></blockquote>
<p>Now we need to generate hxclasses from the SDK to make it usable in haXe</p>
<blockquote><p>
root@devbox:/usr/local/src/flashdevelopment$ cd lib<br />
root@devbox:/usr/local/src/flashdevelopment/lib$ mv map_1_9.swc map_1_9.zip<br />
root@devbox:/usr/local/src/flashdevelopment/lib$ unzip map_1_9.zip<br />
Archive:  map_1_9.zip<br />
  inflating: library.swf<br />
  inflating: catalog.xml<br />
root@devbox:/usr/local/src/flashdevelopment/lib$ haxe &#8211;gen-hx-classes library.swf
</p></blockquote>
<p>Now, there are some changes that has to made to make haXe like the API<br />
I generated the working sources with a newer version of haXe, and applied the changes to it.<br />
This makes the patchfile a bit larger than it had to be, because I had to make a patch against my haxe 1.19-generated hxclasses/ folder.<br />
Anyways, this works and it is against the 1.9 file from Google.</p>
<blockquote><p>
root@devbox:/usr/local/src/flashdevelopment/lib$ wget -q \</p>
<p>http://arpa.no/googlemaps.diff</p>
<p>root@devbox:/usr/local/src/flashdevelopment/lib$ patch -p0 < \<br />
googlemaps.diff
</p></blockquote>
<p>Clean up a bit so we can just develop here:</p>
<blockquote><p>
root@devbox:/usr/local/src/flashdevelopment$ rm lib/map_*<br />
root@devbox:/usr/local/src/flashdevelopment$ rm haxe-1.19-linux.tar.gz sdk.zip
</p></blockquote>
<p>Lets try to create just a simple map, this file will be /usr/local/src/flashdevelopment/MyMap.hx</p>
<blockquote><p>
import com.google.maps.Map;<br />
import com.google.maps.MapEvent;<br />
import com.google.maps.LatLng;<br />
import com.google.maps.MapType;<br />
import com.google.maps.controls.ZoomControl;<br />
import com.google.maps.controls.MapTypeControl;<br />
import com.google.maps.controls.PositionControl;</p>
<p>class MyMap extends Map {<br />
        static function main() {<br />
                var app:MyMap = new MyMap();<br />
                flash.Lib.current.addChild(app);<br />
                app.setSize(new flash.geom.Point(400,400));<br />
        }</p>
<p>        public function new(){<br />
                super();<br />
                addEventListener(MapEvent.MAP_READY, onMapReady);<br />
        }</p>
<p>        private function onMapReady(event:MapEvent) {<br />
                setCenter(new LatLng(40.416740,-3.703250), 2, MapType.NORMAL_MAP_TYPE);<br />
                setZoom(2,false);<br />
                addControl(new ZoomControl());<br />
                addControl(new PositionControl());<br />
                addControl(new MapTypeControl());<br />
        }</p>
<p>}
</p></blockquote>
<p>Now we need to make a way for haXe to understand how to compile this with the API, so this is the contents of:<br />
/usr/local/src/flashdevelopment/compile.hxml</p>
<blockquote><p>
-swf map.swf<br />
-swf-version 9<br />
-cp lib/hxclasses/<br />
-swf-lib lib/library.swf<br />
-main MyMap
</p></blockquote>
<p>Use haXe to compile this map into an SWF:</p>
<blockquote><p>
root@devbox:/usr/local/src/flashdevelopment$ haxe compile.hxml<br />
root@devbox:/usr/local/src/flashdevelopment$
</p></blockquote>
<p>Voila!  Your first Google Flash Map, fresh from the oven.. the filename is map.swf<br />
Try to include this on a webpage, check the source here if you don&#8217;t know how to do it.<br />
Your API key should be in the flashvars when applying the flash object on a webpage.<br />
&#038;ltparam name=&#8221;flashvars&#8221; value=&#8221;key=key&#8221;/&#038;gt</p>
<p>Here is my result, I messed up the width/height of my app, but it works:<br />
<object id="map" width="400" height="400"  type="application/x-shockwave-flash" data="/wp-content/map.swf" ><param name="movie" value="/wp-content/map.swf" /><param name="quality" value="high" /><param name="play" value="true" /><param name="loop" value="true" /><param name="bgcolor" value="#E5E5E5" /><param name="flashvars" value="key=ABQIAAAAKGyUKyuZICfIfsfKBWvaexTTwDV3CHqYJVEQUjP_FHuAnm2oRBQxH4YkCJYSMWcuUIVBLftXVgbT6Q"/></object></p>
<p>Hope someone can have use out of this! <img src='http://www.cfg.no/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/05/google-maps-in-flash-with-the-flex-sdk-and-haxe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>7 Websites with a good API for Mashups</title>
		<link>http://www.cfg.no/2009/05/7-websites-with-a-good-api-for-mashups/</link>
		<comments>http://www.cfg.no/2009/05/7-websites-with-a-good-api-for-mashups/#comments</comments>
		<pubDate>Fri, 22 May 2009 19:01:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mashups]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[bitly]]></category>
		<category><![CDATA[digg]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[geonames]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.cfg.no/?p=144</guid>
		<description><![CDATA[		
		
		
		Mashups. To be able to think creatively about it you must know which sites offer an API. And then; what kind of data you can expect to be able to access.  Here is a list of websites which offer an API. Some are the most popular, but you will find a little golden egg [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://www.cfg.no/2009/05/7-websites-with-a-good-api-for-mashups/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "7+Websites+with+a+good+API+for+Mashups";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p><strong>Mashups</strong>. To be able to think creatively about it you must know which sites offer an API. And then; what kind of data you can expect to be able to access.  Here is a list of websites which offer an API. Some are the most popular, but you will find a little golden egg or two in this list.<br />
<a href="http://www.facebook.com"><img class="alignnone size-full wp-image-145" title="fb_logosm" src="http://www.cfg.no/wp-content/uploads/2009/05/fb_logosm.gif" alt="fb_logosm" width="350" height="131" /></a></p>
<p><strong>Facebook</strong> have an API, you can use most of the data users have stored at facebook, like friends, profile info, photos.<br />
<strong>API Docs:</strong> <a href="http://wiki.developers.facebook.com/index.php/API">Facebook API Documentation</a></p>
<p><a href="http://twitter.com"><img class="alignnone size-full wp-image-146" title="twitter_logo" src="http://www.cfg.no/wp-content/uploads/2009/05/twitter_logo.gif" alt="twitter_logo" width="477" height="200" /></a><br />
From <strong>Twitter</strong> you can get the user data, followers, friends and status updates. A previous article on this website was about <a href="http://www.cfg.no/2009/05/14-excellent-power-twitter-tools-and-tips/">Twitter applications</a>.<strong><br />
API Docs:</strong> <a href="http://apiwiki.twitter.com/Twitter-API-Documentation">Twitter API Documentation</a></p>
<p><a href="http://last.fm"><img class="alignnone size-full wp-image-147" title="lastfmlogo" src="http://www.cfg.no/wp-content/uploads/2009/05/lastfmlogo.png" alt="lastfmlogo" width="103" height="50" /></a><br />
With the <strong>last.fm</strong> API you can retrieve user data, most popular songs and everything stored within last.fm</p>
<p>A friend of mine created <a href="http://lutt.se/lastfm+spotify+new/">this mashup</a> of Spotify and Last.fm.<br />
<strong>API Docs:</strong> <a href="http://www.last.fm/api">Last.Fm API Documentation</a></p>
<p><a href="http://bit.ly"><img class="alignnone size-full wp-image-148" title="bitlylogo" src="http://www.cfg.no/wp-content/uploads/2009/05/bitlylogo.png" alt="bitlylogo" width="280" height="47" /></a></p>
<p>With the <strong>bit.ly</strong> API you can expand and shorten URL&#8217;s, then gather statistics about traffic on those specific short URL&#8217;s.<br />
A lot of Twitter users post links shortened with bit.ly, so it would also be possible to keep track of what&#8217;s popular by the use of this API.<br />
<strong>API Docs:</strong> <a href="http://code.google.com/p/bitly-api/wiki/ApiDocumentation">Bit.ly API Documentation</a></p>
<p><a href="http://maps.google.com"><img src="http://maps.google.com/intl/en_ALL/images/maps_logo_small_blue.png" alt="" /></a><br />
Create your own maps, you can use <strong>Google Maps API</strong> to display geodata in your mashup.<br />
<strong>API Docs:</strong> <a href="http://code.google.com/apis/maps/documentation/">Google Maps API Documentation</a></p>
<p><a href="http://www.geonames.org/">GeoNames</a><br />
With the <strong>GeoNames</strong> API you can get data for your Google Maps; Airports, Hotels and a lot of other things. Trivial resource!<br />
<strong>API Docs:</strong> <a href="http://www.geonames.org/export/web-services.html">GeoNames API Documentation</a></p>
<p><a href="http://www.digg.com"><img class="alignnone size-full wp-image-149" title="digglogo" src="http://www.cfg.no/wp-content/uploads/2009/05/digglogo.gif" alt="digglogo" width="300" height="158" /></a></p>
<p>With the <strong>Digg.com</strong> API you can get current popular stories from all categories, the digg count, comments and a lot of other data.<br />
<strong>API Docs:</strong> <a href="http://apidoc.digg.com/">Digg.com API Documentation<br />
</a></p>
<p>That&#8217;s the list!</p>
<p><em>Which other popular APIs exist?</em> If you have used another API, leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cfg.no/2009/05/7-websites-with-a-good-api-for-mashups/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
