<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-6179220592778404138</atom:id><lastBuildDate>Tue, 08 Apr 2008 14:43:07 +0000</lastBuildDate><title>PHP Programming</title><description/><link>http://backalley.net/phpblog.html</link><managingEditor>Thoroxian</managingEditor><generator>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-6179220592778404138.post-979795775431811272</guid><pubDate>Tue, 08 Apr 2008 14:42:00 +0000</pubDate><atom:updated>2008-04-08T08:43:07.171-06:00</atom:updated><title>Real Cool Perl</title><description>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;</description><link>http://backalley.net/2008/04/real-cool-perl.html</link><author>Thoroxian</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-6179220592778404138.post-7017601555611414793</guid><pubDate>Mon, 15 Oct 2007 17:43:00 +0000</pubDate><atom:updated>2007-10-15T11:45:41.574-06:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>maps</category><category domain='http://www.blogger.com/atom/ns#'>php</category><category domain='http://www.blogger.com/atom/ns#'>google</category><title>Google Maps</title><description>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.</description><link>http://backalley.net/2007/10/google-maps.html</link><author>Thoroxian</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-6179220592778404138.post-1814970827590411821</guid><pubDate>Tue, 17 Jul 2007 18:41:00 +0000</pubDate><atom:updated>2007-07-17T12:45:09.377-06:00</atom:updated><title>Open Laszlo</title><description>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.</description><link>http://backalley.net/2007/07/open-laszlo.html</link><author>Thoroxian</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-6179220592778404138.post-4806544425312495135</guid><pubDate>Tue, 27 Mar 2007 18:33:00 +0000</pubDate><atom:updated>2007-03-27T13:03:18.855-06:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>web server</category><category domain='http://www.blogger.com/atom/ns#'>blackberry</category><category domain='http://www.blogger.com/atom/ns#'>WAP</category><category domain='http://www.blogger.com/atom/ns#'>apache</category><title>WAP for BlackBerry on Apache</title><description>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)</description><link>http://backalley.net/2007/03/wap-for-blackberry-on-apache.html</link><author>Thoroxian</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-6179220592778404138.post-3252842030989642840</guid><pubDate>Tue, 27 Mar 2007 18:27:00 +0000</pubDate><atom:updated>2007-07-17T12:46:43.916-06:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>recursion</category><category domain='http://www.blogger.com/atom/ns#'>geneology</category><category domain='http://www.blogger.com/atom/ns#'>family tree</category><title>Recursion</title><description>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?</description><link>http://backalley.net/2007/03/recursion.html</link><author>Thoroxian</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-6179220592778404138.post-7776995169288438094</guid><pubDate>Wed, 17 Jan 2007 17:25:00 +0000</pubDate><atom:updated>2007-01-17T12:23:54.045-06:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>example</category><category domain='http://www.blogger.com/atom/ns#'>recursion</category><category domain='http://www.blogger.com/atom/ns#'>recrusive</category><category domain='http://www.blogger.com/atom/ns#'>php</category><title>Recursive Programming</title><description>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!</description><link>http://backalley.net/2007/01/recursive-programming.html</link><author>Thoroxian</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-6179220592778404138.post-6997653402356464166</guid><pubDate>Wed, 17 Jan 2007 17:00:00 +0000</pubDate><atom:updated>2007-01-17T11:01:58.507-06:00</atom:updated><title>New Blog</title><description>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.</description><link>http://backalley.net/2007/01/new-blog.html</link><author>Thoroxian</author></item></channel></rss>