<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-6179220592778404138</id><updated>2008-04-08T08:43:07.092-06:00</updated><title type='text'>PHP Programming</title><link rel='alternate' type='text/html' href='http://backalley.net/phpblog.html'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.backalley.net/atom.xml'/><author><name>Thoroxian</name></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6179220592778404138.post-979795775431811272</id><published>2008-04-08T08:42:00.002-06:00</published><updated>2008-04-08T08:43:07.171-06:00</updated><title type='text'>Real Cool Perl</title><content type='html'>A friend on mine posted this Perl tidbit in IRC, so I had to pass it along:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#39275f;"&gt;(9:23:00 AM) &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#39275f;"&gt;&lt;span style="font-size:100%;"&gt;ghost:&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; $name =~ s/([\W\-])?([^\s\-]+)/join('', $1||'', ucfirst(lc($2)))/ge&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#39275f;"&gt;(9:25:02 AM) &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#39275f;"&gt;&lt;span style="font-size:100%;"&gt;ghost:&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; that takes a sentence in all caps.. "SUCH AS THIS" and turns it into "Such As This"&lt;br /&gt;&lt;br /&gt;NICE... for sure.&lt;br /&gt;&lt;/span&gt;</content><link rel='alternate' type='text/html' href='http://backalley.net/2008/04/real-cool-perl.html' title='Real Cool Perl'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6179220592778404138&amp;postID=979795775431811272' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.backalley.net/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/979795775431811272'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/979795775431811272'/><author><name>Thoroxian</name></author></entry><entry><id>tag:blogger.com,1999:blog-6179220592778404138.post-7017601555611414793</id><published>2007-10-15T11:43:00.000-06:00</published><updated>2007-10-15T11:45:41.574-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='maps'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google Maps</title><content type='html'>Having written my first application with the Google Maps API, I must say that it went fairly smoothly, using PHP as my database interface and Ajax calls to update data within the page works nicely.  If you have not tried this yet, there are a zillion reasons to aggregate data available on the web and put it on a map.  My project is a nationwide map of CCH-unfriendly stores.</content><link rel='alternate' type='text/html' href='http://backalley.net/2007/10/google-maps.html' title='Google Maps'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6179220592778404138&amp;postID=7017601555611414793' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.backalley.net/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/7017601555611414793'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/7017601555611414793'/><author><name>Thoroxian</name></author></entry><entry><id>tag:blogger.com,1999:blog-6179220592778404138.post-1814970827590411821</id><published>2007-07-17T12:41:00.001-06:00</published><updated>2007-07-17T12:45:09.377-06:00</updated><title type='text'>Open Laszlo</title><content type='html'>I have really fallen in LOVE with &lt;a href="http://www.openlaszlo.org/"&gt;Open Laszlo&lt;/a&gt; recently.  It is a fantastic language that will interface nicely with php server requests to provide an outstanding user experience.  In 85 lines of code I wrote a small website package with content tabs, animation, database interaction, and form interaction!  Open Laszlo applications compile to Flash 7 or 8 and you just toss them into a HTML wrapper and you are good to go.&lt;br /&gt;&lt;br /&gt;For anyone who wants to provide a much better user experience that AJAX alone can provide, taking a look at Open Laszlo very attractive.</content><link rel='alternate' type='text/html' href='http://backalley.net/2007/07/open-laszlo.html' title='Open Laszlo'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6179220592778404138&amp;postID=1814970827590411821' title='2 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.backalley.net/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/1814970827590411821'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/1814970827590411821'/><author><name>Thoroxian</name></author></entry><entry><id>tag:blogger.com,1999:blog-6179220592778404138.post-4806544425312495135</id><published>2007-03-27T12:33:00.000-06:00</published><updated>2007-03-27T13:03:18.855-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web server'/><category scheme='http://www.blogger.com/atom/ns#' term='blackberry'/><category scheme='http://www.blogger.com/atom/ns#' term='WAP'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>WAP for BlackBerry on Apache</title><content type='html'>This is slightly off the topic, but I will figure out a way to tie it in.&lt;br /&gt;&lt;br /&gt;You have a webhost with Apache and allowing .htaccess files... how can I make WAP friendly pages to display?&lt;br /&gt;&lt;br /&gt;1. Create a .htaccess file and upload it to your WAP subdomain or directory!&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;Options +Indexes&lt;br /&gt;AddType audio/adpcm adp&lt;br /&gt;AddType text/vnd.sun.j2me.app-descriptor jad&lt;br /&gt;AddType application/java-archive jar&lt;br /&gt;AddType text/vnd.wap.wml wml&lt;br /&gt;AddType application/vnd.wap.wmlc wmlc&lt;br /&gt;AddType image/vnd.wap.wbmp wbmp&lt;br /&gt;AddType text/vnd.wap.wmlscript wmls&lt;br /&gt;AddType application/vnd.wap.wmlscriptc wmlsc&lt;br /&gt;AddType application/vnd.wap.xhtml+xml xhtml&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This should handle all the file types listed.  The adp will handle ringtones converted from mp3 to adp for blackberry.  Download and save as a ringtone!&lt;br /&gt;&lt;br /&gt;jar and jad will handle install java apps.  Be sure to upload the .cod file also.&lt;br /&gt;&lt;br /&gt;wml, wmlc, wbmp, wmls, wmlsc, xhtml are the pages for your WAP browser.&lt;br /&gt;&lt;br /&gt;2. I want to redirect depending on if it is a WAP browser or a "real" browser.&lt;br /&gt;&lt;br /&gt;Good News, here is some PHP code that does it written by Anurag Singh:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;//Description&lt;br /&gt;//Do not remove the below code. This will lead to violation of Terms Of Use&lt;br /&gt;/****************************************************************************&lt;br /&gt;This script is written by Anurag Singh&lt;br /&gt;Title: Wap Redirect&lt;br /&gt;Version: 1.0&lt;br /&gt;Email: tom.anu007@gmail.com,&lt;br /&gt;Homepage: http://tom.anu007.googlepages.com/wapredirect&lt;br /&gt;Special thanks to Harald Hope, Website: http://techpatterns.com/&lt;br /&gt;And also to Joseph George Jacobs , Email joe@spitzbucket.com&lt;br /&gt;****************************************************************************/&lt;br /&gt;//Configuration&lt;br /&gt;global $userBrowser;&lt;br /&gt;&lt;br /&gt;// Your wapsite&lt;br /&gt;//enter the link you want user to be redirected in case of WML browser&lt;br /&gt;$wmllink = "http://backalley.net/wap/wap.xhtml";&lt;br /&gt;&lt;br /&gt;// Your website&lt;br /&gt;//enter the link you want user to be redirected in case of PC browser&lt;br /&gt;$htmllink = "http://backalley.net/wap/pc.html";&lt;br /&gt;&lt;br /&gt;//There is no need to edit any information from this point on&lt;br /&gt;//however in case if you want to contribute please do so&lt;br /&gt;//please be sure to let me know about the changes&lt;br /&gt;//Detect the browser&lt;br /&gt;$userBrowser = $_SERVER['HTTP_USER_AGENT']; &lt;br /&gt;&lt;br /&gt;//Remove the below // qutoes.&lt;br /&gt;//It helps to check if there is any error when editing&lt;br /&gt;//If everything is all right it will display the browser information&lt;br /&gt;//please remember to put // back after testing or no redirection will occur&lt;br /&gt;//echo $userBrowser;&lt;br /&gt;&lt;br /&gt;//Check for Windows CE&lt;br /&gt;if(stristr($userBrowser, 'Windows CE'))&lt;br /&gt;{&lt;br /&gt;  $ub = "WML";&lt;br /&gt;}&lt;br /&gt;//Check for Mozilla&lt;br /&gt;elseif(stristr($userBrowser, 'Mozilla')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for Mozilla&lt;br /&gt;elseif(stristr($userBrowser, 'gecko')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for opera&lt;br /&gt;elseif(stristr($userBrowser, 'opera')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for omniweb&lt;br /&gt;elseif(stristr($userBrowser, 'omniweb')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for msie&lt;br /&gt;elseif(stristr($userBrowser, 'msie')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for konqueror&lt;br /&gt;elseif(stristr($userBrowser, 'konqueror')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for safari&lt;br /&gt;elseif(stristr($userBrowser, 'safari')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for netpositive&lt;br /&gt;elseif(stristr($userBrowser, 'netpositive')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for lynx&lt;br /&gt;elseif(stristr($userBrowser, 'lynx')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for elinks&lt;br /&gt;elseif(stristr($userBrowser, 'elinks')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for Mozilla&lt;br /&gt;elseif(stristr($userBrowser, 'Mozilla')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for links&lt;br /&gt;elseif(stristr($userBrowser, 'links')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for w3m&lt;br /&gt;elseif(stristr($userBrowser, 'w3m')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for webtv&lt;br /&gt;elseif(stristr($userBrowser, 'webtv')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for amaya&lt;br /&gt;elseif(stristr($userBrowser, 'amaya')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for dillo&lt;br /&gt;elseif(stristr($userBrowser, 'dillo')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for ibrowse&lt;br /&gt;elseif(stristr($userBrowser, 'ibrowse')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for icab&lt;br /&gt;elseif(stristr($userBrowser, 'icab')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for crazy browser&lt;br /&gt;elseif(stristr($userBrowser, 'crazy browser')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//Check for IE&lt;br /&gt;elseif(stristr($userBrowser, 'internet explorer')) &lt;br /&gt;{&lt;br /&gt;  $ub="PC";&lt;br /&gt;}&lt;br /&gt;//If it's not any of the above browsers&lt;br /&gt;//Then it gotta be a WML or very unpopular browser&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;  $ub="WML";&lt;br /&gt;  }&lt;br /&gt;//Code for redirecting based upon the results&lt;br /&gt;if($ub == "PC") {&lt;br /&gt;    header("Location: ".$htmllink);&lt;br /&gt;    exit;&lt;br /&gt;    }&lt;br /&gt;    else &lt;br /&gt;    {&lt;br /&gt;    header("Location: ".$wmllink);&lt;br /&gt;    exit;&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;?&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now you can host your WAP site on the same server as your normal website with no problems!  (As long as your webhost allows .htaccess files of this nature)</content><link rel='alternate' type='text/html' href='http://backalley.net/2007/03/wap-for-blackberry-on-apache.html' title='WAP for BlackBerry on Apache'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6179220592778404138&amp;postID=4806544425312495135' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.backalley.net/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/4806544425312495135'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/4806544425312495135'/><author><name>Thoroxian</name></author></entry><entry><id>tag:blogger.com,1999:blog-6179220592778404138.post-3252842030989642840</id><published>2007-03-27T12:27:00.000-06:00</published><updated>2007-07-17T12:46:43.916-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='recursion'/><category scheme='http://www.blogger.com/atom/ns#' term='geneology'/><category scheme='http://www.blogger.com/atom/ns#' term='family tree'/><title type='text'>Recursion</title><content type='html'>Several people have asked me for reasons to use recursion:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bengalpedigrees.com"&gt;bengalpedigrees.com&lt;/a&gt; is a project I volunteer server and programming on.  It is pretty standard family tree record keeping and outputting of pedigrees...&lt;br /&gt;&lt;br /&gt;why use recursion on this?&lt;br /&gt;&lt;br /&gt;For one, you write one display function, then a pedigree of any depth can be called by the same function with a little math to determine which row you are currently displaying to place table cells properly.&lt;br /&gt;&lt;br /&gt;I five generation pedigree has 2+4+8+16+32 for a total of 62 cells.  Who the heck wants to hand code a page of that mess?&lt;br /&gt;&lt;br /&gt;This means that the website is capable of outputting 1 row, or ALL the rows, based on a single function and parameter!  A tiny amount of code that provides quite a bit of functionality and makes for easy to maintain.&lt;br /&gt;&lt;br /&gt;So, anyone else have another example for a good use of recursion?</content><link rel='alternate' type='text/html' href='http://backalley.net/2007/03/recursion.html' title='Recursion'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6179220592778404138&amp;postID=3252842030989642840' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.backalley.net/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/3252842030989642840'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/3252842030989642840'/><author><name>Thoroxian</name></author></entry><entry><id>tag:blogger.com,1999:blog-6179220592778404138.post-7776995169288438094</id><published>2007-01-17T11:25:00.000-06:00</published><updated>2007-01-17T12:23:54.045-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='recursion'/><category scheme='http://www.blogger.com/atom/ns#' term='recrusive'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Recursive Programming</title><content type='html'>Recursion is the nemesis of many new programmers, and done improperly, the result is a slow and incorrect outcome.  Done properly, very few lines of code can solve huge recursive problems.   Let's take an example.&lt;br /&gt;&lt;br /&gt;A classic example is computing factorials:  3! = 3*2*1&lt;br /&gt;&lt;br /&gt;Lets write a function:&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&lt;br /&gt;function factorial($number) {     &lt;br /&gt;     if ($number == 1) return 1;     &lt;br /&gt;     else return $number * factorial($number-1); &lt;br /&gt;}  &lt;br /&gt;&lt;br /&gt;echo "Factorial 5 = " . factorial(5);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Example: http://backalley.net/factorial.php&lt;br /&gt;&lt;br /&gt;The most important part of this function is the return 1 statement.  Without it, you would have endless loop.  This is the most common mistake for new programmers.&lt;br /&gt;&lt;br /&gt;To create a recursive function we MUST do the following:&lt;br /&gt;&lt;br /&gt;1. Initialize!  This is often simply checking for a valid parameter.  Modify this function to check for $number &gt; 0 or return an error (-1).&lt;br /&gt;&lt;br /&gt;2. Check for the base case.  Here, if the number is 1, we return 1.&lt;br /&gt;&lt;br /&gt;3. Redefine the answer as a set of smaller problems.&lt;br /&gt;&lt;br /&gt;4. Run algorithm on sub-problems.&lt;br /&gt;&lt;br /&gt;5. Combine and return the results.&lt;br /&gt;&lt;br /&gt;Recursion is useful for mathematical functions, linked lists, array traversals, string searching, and many other more complex operations such as trees.&lt;br /&gt;&lt;br /&gt;When you are ready to move beyond the world of simple loops, think of a recursive project and give it a shot!</content><link rel='alternate' type='text/html' href='http://backalley.net/2007/01/recursive-programming.html' title='Recursive Programming'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6179220592778404138&amp;postID=7776995169288438094' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.backalley.net/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/7776995169288438094'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/7776995169288438094'/><author><name>Thoroxian</name></author></entry><entry><id>tag:blogger.com,1999:blog-6179220592778404138.post-6997653402356464166</id><published>2007-01-17T11:00:00.000-06:00</published><updated>2007-01-17T11:01:58.507-06:00</updated><title type='text'>New Blog</title><content type='html'>Time to give back something to the community and cover some PHP topics which I do not see very many tutorials for.  Check back, they are coming soon.</content><link rel='alternate' type='text/html' href='http://backalley.net/2007/01/new-blog.html' title='New Blog'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6179220592778404138&amp;postID=6997653402356464166' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.backalley.net/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/6997653402356464166'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6179220592778404138/posts/default/6997653402356464166'/><author><name>Thoroxian</name></author></entry></feed>