Here’s an HTML5 experiment in progress…
This is just an experiment, the code was not optimized for performance, and I do not recommend using it for any projects, however I will post a working engine sometime in the near future.
I ended up doing this all in just under an hour, and I have to say it was pretty easy getting everything to work together. I have not included graphics yet, so for now everything being displayed on the screen is text. I mostly focused on collision detection and sprite movement. Via key presses the sprite will move either horizontally or vertically around the canvas. The sprite will also bump into the edges of the defined map using via the collision detection I wrote. Finally the sprite has been configured to handle parameters such as which direction it is facing, if it is standing still or moving, etc. I might expand these parameters down the road to support things like health or special behaviors.
The explanation of code is broken down into 4 main chunks: the environment, keyboard detection, sprites, and movement. Each code section has unique attributes and functions, and the environment section controls what is displayed on the canvas as well as refreshing and redrawing the canvas. Continue reading
There are a few examples within ESRI’s sample page, however I wanted to provide two examples outlining how I use the Query Task on a regular basis.
Example #1 shows how to use the Query Task’s where clause and pull data directly from a map service. ESRI’s provides a similar example, however it requires the user to submit a query within the page. My example allows you to have the query pre-canned and the results load with the page.
Example #2 takes this a step further and introduces the ability to access the same functionality via POST or GET. This is perfect for anyone interested in loading data into the page via URL variables (example2.php?name=Idaho) or perhaps someone that would like to call this function via AJAX.
I use example #2 all the time, so hopefully you’ll find it as useful as I do.
DOWNLOAD: EXAMPLES 1 & 2
*All data is provided via ESRI's hosted map services. Example 2 requires PHP.
Sometimes you wind up working on a page that switches back and forth between php and html. It can be tricky keeping track of code or making the mistake of over using the echo function. Luckily php supports an alternative syntax for control structures allowing you to jump in and out of php and html. Any code (html, php, anything) nested within a conditional will only parse if the defined conditions are matched. The end result is clean, organized, efficient code.
One of my interns once put all his html code into an array and printed each part while looping through function calls. It worked, but it his source code was so hard to read that when I asked him to take a look at it a few months later he couldn’t even make sense of what he wrote.
PHP's alternative control structure syntax makes it easy to identify code blocks and it’s widely used in many popular open source projects. Continue reading
A great feature in WordPress is automatic updating, it makes life easier for administrators and the feature is now integrated into everything from updating the core software to individual plugins and themes. A very common configuration problem that people run into with auto-updating is when Worpress prompts you with "To perform the requested action, connection information is required", and asks you for FTP credentials.
Have no fear, you do not have to manually update WordPress! There are a few ways of addressing this issue. The most obvious solution is by entering in your FTP credentials, however not everyone wants to enable FTP on their site, and there is a much better way of addressing this issue... Continue reading