<?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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>A Web Developers Blog</title>
	
	<link>http://jrtashjian.com/blog</link>
	<description />
	<lastBuildDate>Tue, 02 Feb 2010 14:00:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</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/jrtashjian" /><feedburner:info uri="jrtashjian" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Link: Anatomy of a Feature</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/YK-NcuDkgPY/</link>
		<comments>http://jrtashjian.com/blog/anatomy-of-a-feature/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:59:47 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/blog/?p=351</guid>
		<description><![CDATA[&#8220;Oh, it’s easy, just a quick http call. I could write a script to do it in like 20 seconds.&#8221;
I have definitely said that more than once in the beginning of my career. Enthusiasm for a project is awesome but, don&#8217;t let it come back to bite you in the rear!
If you&#8217;re one to say ...]]></description>
			<content:encoded><![CDATA[<blockquote><p>&#8220;Oh, it’s easy, just a quick http call. I could write a script to do it in like 20 seconds.&#8221;</p></blockquote>
<p>I have definitely said that more than once in the beginning of my career. Enthusiasm for a project is awesome but, don&#8217;t let it come back to bite you in the rear!</p>
<p>If you&#8217;re one to say that as well, <a href="http://inessential.com/2009/07/30/anatomy_of_a_feature">read this article</a> written by <a href="http://inessential.com/">Brent Simmons</a>. It&#8217;s easy to jump to conclusions when you&#8217;re excited about a project or you just have so much going on that you overlook the details. Step back and take the time to look at the details before you set any commitments.</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/YK-NcuDkgPY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/anatomy-of-a-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/anatomy-of-a-feature/</feedburner:origLink></item>
		<item>
		<title>Link: Designers are not Programmers</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/B-aIEtaegrQ/</link>
		<comments>http://jrtashjian.com/blog/link-designers-are-not-programmers/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:06:19 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/blog/?p=348</guid>
		<description><![CDATA[I found this article today and figured I would share it. I&#8217;ve had debates at my workplace about if the Designers should also know how to code and I believe this article reflects my thoughts on it.
This article was written by Lukas Mathis and although it was written in March of 2009, it is still ...]]></description>
			<content:encoded><![CDATA[<p>I found this article today and figured I would share it. I&#8217;ve had debates at my workplace about if the Designers should also know how to code and I believe this article reflects my thoughts on it.</p>
<p>This article was written by <a href="http://ignorethecode.net/blog/">Lukas Mathis</a> and although it was written in March of 2009, it is still relevant. <a href="http://ignorethecode.net/blog/2009/03/10/designers-are-not-programmers/">Check it out</a>.</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/B-aIEtaegrQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/link-designers-are-not-programmers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/link-designers-are-not-programmers/</feedburner:origLink></item>
		<item>
		<title>Be A Better Programmer</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/DHU_2ZuRg2Y/</link>
		<comments>http://jrtashjian.com/blog/be-a-better-programmer/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 06:01:06 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/blog/?p=330</guid>
		<description><![CDATA[Aaron Swartz posted an article today on his blog titled: How I Hire Programmers. If you haven’t done so already, read it!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.aaronsw.com">Aaron Swartz</a> posted an article today on his <a href="http://www.aaronsw.com/weblog">blog</a> titled: <a href="http://www.aaronsw.com/weblog/hiring">How I Hire Programmers</a>. If you haven&#8217;t done so already, <a href="http://www.aaronsw.com/weblog/hiring">read it</a>!</p>
<p>I believe this article is not only for employers looking for a way to hire better programmers. But, it could also be beneficial for an aspiring programmer to work on themselves to be a better candidate for the job.</p>
<p>Below, I&#8217;ve picked out a couple quotes and added my response.</p>
<blockquote><p>&#8220;Someone who gets stuff done but isn’t smart is inefficient: non-smart people get stuff done by doing it the hard way and working with them is slow and frustrating.&#8221;</p></blockquote>
<p>Anybody can Google around and find a code snippet, paste it in, and continue working. However, do you know what that snippet of code is doing? Do you know why that block of code works, and how it works? You need to.</p>
<p>Whenever I run into something I don&#8217;t know how to solve, I&#8217;ll Google it. I&#8217;ll find a snippet of code or a tutorial and read through it. I&#8217;ll pick it apart, look up function calls, comment the code and even completely rewrite it. Line by line I&#8217;ll figure out a better way it could have been written. I will make it mine. You should do the same.</p>
<blockquote><p>&#8220;&#8230; do they learn? At some point in the conversation, you’ll probably be explaining something to them. Do they actually understand it or do they just nod and smile? There are people who know stuff about some small area but aren’t curious about others. And there are people who are curious but don’t learn, they ask lots of questions but don’t really listen. You want someone who does all three.&#8221;</p></blockquote>
<p>With the technology of today, always changing and new things being introduced, you can&#8217;t afford not to learn something new. Are you intrigued by the API&#8217;s and Web Services available? If you&#8217;ve never used it before, use it now! Make a simple script, just to test it out. Do that, and you will become a better programmer.</p>
<p>Do any of these sound like you? Take a look at yourself and these points from the article. See how you can make yourself a better programmer.</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/DHU_2ZuRg2Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/be-a-better-programmer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/be-a-better-programmer/</feedburner:origLink></item>
		<item>
		<title>Google Maps API: Center Point Location</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/YOnXAnXxihI/</link>
		<comments>http://jrtashjian.com/blog/google-maps-api-center-point-location/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 04:56:22 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/blog/?p=324</guid>
		<description><![CDATA[As stated in the last article, I have been working a lot with the Google Maps API for a current client project. The most recent problem, was the application was required to display a quick overview of the current location the user was looking at. The City and the State.
Again, jQuery will be used in ...]]></description>
			<content:encoded><![CDATA[<p>As stated in the <a href="http://jrtashjian.com/blog/google-maps-api-custom-zoom-slider/">last article</a>, I have been working a lot with the <a href="http://code.google.com/apis/maps/">Google Maps API</a> for a current client project. The most recent problem, was the application was required to display a quick overview of the current location the user was looking at. The City and the State.</p>
<p>Again, <a href="http://jquery.com/">jQuery</a> will be used in this demo and we will be using the <a href="http://code.google.com/apis/maps/documentation/reference.html#GClientGeocoder">GClientGeocoder</a> service.</p>
<h2>Loading Google Maps API</h2>
<p>Here is the HTML for the map and the initial Google Maps API javascript code:</p>
<pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en-us&quot; lang=&quot;en-us&quot;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;

	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
	&lt;title&gt;Google Maps API: Center Point Location&lt;/title&gt;

	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/reset.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/screen.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/print.css&quot; media=&quot;print&quot; /&gt;

	&lt;!--[if lte IE 6]&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie6-screen.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie6-print.css&quot; media=&quot;print&quot; /&gt;
	&lt;![endif]--&gt;

	&lt;!--[if IE 7]&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie7-screen.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie7-print.css&quot; media=&quot;print&quot; /&gt;
	&lt;![endif]--&gt;

	&lt;!-- JQUERY --&gt;
	&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;javascript/jquery.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;javascript/jquery.ui.js&quot;&gt;&lt;/script&gt;

	&lt;!-- GOOGLE MAPS API --&gt;
	&lt;script src=&quot;http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;sensor=false&amp;amp;key=YOUR_API_KEY_HERE&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;

	&lt;script type=&quot;text/javascript&quot;&gt;
	// store the current zoom level for reference with google maps and custom zoom slider
	var currentZoomLevel = 10;

	// map object (global)
	var map;

	// geocoder object (global)
	var geocoder = new GClientGeocoder();

	$(document).ready(function() {
		// create the google map
		map = new GMap2(document.getElementById(&quot;map&quot;));

		// set starting center point
		map.setCenter(new GLatLng(37.4419, -122.1419), currentZoomLevel);

		// set map UI as default
		map.setUIToDefault();
	});
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;div id=&quot;container&quot;&gt;
	&lt;h1&gt;Google Maps API: Center Point Location&lt;/h1&gt;

	&lt;div id=&quot;content&quot;&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;strong&gt;State: &lt;/strong&gt;&lt;span id=&quot;map-state&quot;&gt;current state&lt;/span&gt;&lt;/li&gt;
			&lt;li&gt;&lt;strong&gt;City: &lt;/strong&gt;&lt;span id=&quot;map-city&quot;&gt;current city&lt;/span&gt;&lt;/li&gt;
		&lt;/ul&gt;

		&lt;div id=&quot;map&quot;&gt;&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h2>Retrieving the Current Location</h2>
<p>Now that Google Maps API has been loaded, we need to create a function to get the current center-point&#8217;s Longitude and Latitude. Then we need to get the address, via GClientGeocoder. Then we need to strip out the data we need and update our display.</p>
<pre><code>function updateMapLocation() {
	geocoder.getLocations(map.getCenter().toString(), function(point) {

		var currentAddress = point.Placemark[0].address;
		currentAddress = $.trim(currentAddress);
		var currentAddressMatches = currentAddress.split(/^([^,]*),\s([^,]*),\s([A-Z]{2})\s([0-9]*),\s([^,]*)$/);

		if(/^([^,]*),\s([a-zA-Z^,]*)[0-9\s]*,\s[^,]*$/.test(currentAddress)) {
			var currentAddressMatches = currentAddress.split(/^([^,]*),\s([a-zA-Z^,]*)[0-9\s]*,\s[^,]*$/);
		} else if(/^[^,]*,\s([^,]*),\s([a-zA-Z^,]*)[0-9\s]*,\s[^,]*$/.test(currentAddress)) {
			var currentAddressMatches = currentAddress.split(/^[^,]*,\s([^,]*),\s([a-zA-Z^,]*)[0-9\s]*,\s[^,]*$/);
		}

		var currentCity = currentAddressMatches[1];
		var currentState = currentAddressMatches[2];

		$(&#x27;span#map-state&#x27;).html(currentState);
		$(&#x27;span#map-city&#x27;).html(currentCity);
	});
}</code></pre>
<p>In the code above, I realized GClientGeocoder was returning addresses for the current center point, in a few different formats. The two regular expression tests determine which format was returned and then splits out the data we need. After the data has been retrieved, we update the HTML display for span#map-state and span#map-city.</p>
<p>Now that we have a function to pull the address portions, we need to call it somewhere! I have two places where I have decided was the best time to update the location. When the maps is loaded (on page load) and anytime the map has been moved or zoomed.</p>
<p>So, we write an if statement to check if <a href="http://code.google.com/apis/maps/documentation/reference.html#GMap2.isLoaded">maps.isLoaded()</a> and then we need to <a href="http://code.google.com/apis/maps/documentation/reference.html#GEvent.addListener">addListenter()</a> to even &#8216;moveend&#8217;.</p>
<pre><code>// once map has fully loaded, update current location in view
if(map.isLoaded()) { updateMapLocation(); }

// update location in view upon changing the map in any way
GEvent.addListener(map, &#x27;moveend&#x27;, function() { updateMapLocation(); });</code></pre>
<h2>Conclusion</h2>
<p>I hope this little code snippet helps someone out! You can view the <a href="http://demo.jrtashjian.com/google-center-point-location/">demo</a> and <a href="http://files.jrtashjian.com/google-center-point-location/google-center-point-location.zip">download the source</a> to try it out for yourself. If you have any questions feel free to leave a comment or email me. Enjoy!</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/YOnXAnXxihI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/google-maps-api-center-point-location/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/google-maps-api-center-point-location/</feedburner:origLink></item>
		<item>
		<title>Google Maps API: Custom Zoom Slider</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/5gwZUEAHuzI/</link>
		<comments>http://jrtashjian.com/blog/google-maps-api-custom-zoom-slider/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 19:03:43 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Google Maps API]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/blog/?p=315</guid>
		<description><![CDATA[Google Maps API is just one of the API&#8217;s I&#8217;ve been working with recently. The most recent problem I&#8217;ve run into that needed to be solved was the ability to create a custom designed zoom slider, replacing the default. The default one was not gonna work for this project and the designer created a better ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/apis/maps/">Google Maps API</a> is just one of the API&#8217;s I&#8217;ve been working with recently. The most recent problem I&#8217;ve run into that needed to be solved was the ability to create a custom designed zoom slider, replacing the default. The default one was not gonna work for this project and the designer created a better looking one.</p>
<p>While searching online to see if this had already been achieved. I failed to find any example of what I needed to accomplish easily and still be able to reuse the code. So, I decided to take on the feat. But, where to start?</p>
<h2>jQuery</h2>
<p>I am a huge fan of <a href="http://jquery.com">jQuery</a> and jQuery has a user interface library, <a href="http://jqueryui.com">jQuery UI</a>. jQuery UI gives us the ability to create a slider widget, which is highly customizable and would work for what I needed to do.</p>
<p>So, go download <a href="http://jquery.com">jQuery</a> and download <a href="http://jqueryui.com/download">jQuery UI</a> and we&#8217;ll get started! You will also need to get a <a href="http://code.google.com/apis/maps/signup.html">Google Maps API key</a>.</p>
<h2>Setup</h2>
<p>To begin, we will have to create an HTML file which loads all of our stylesheets, javascript and google map. Below is the initial HTML code. I have added the HTML for our custom slider already.</p>
<pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en-us&quot; lang=&quot;en-us&quot;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;

	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
	&lt;title&gt;Google Maps API: Custom Zoom Slider&lt;/title&gt;

	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/reset.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/screen.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/print.css&quot; media=&quot;print&quot; /&gt;

	&lt;!--[if lte IE 6]&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie6-screen.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie6-print.css&quot; media=&quot;print&quot; /&gt;
	&lt;![endif]--&gt;

	&lt;!--[if IE 7]&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie7-screen.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;themes/default/css/ie7-print.css&quot; media=&quot;print&quot; /&gt;
	&lt;![endif]--&gt;

	&lt;!-- JQUERY --&gt;
	&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;javascript/jquery.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;javascript/jquery.ui.js&quot;&gt;&lt;/script&gt;

	&lt;!-- GOOGLE MAPS API --&gt;
	&lt;script src=&quot;http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;sensor=false&amp;amp;key=ABQIAAAA-WM7gTOleclYxwsxgykv_RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQCs2_9EkO6SKmciFP_eMEAkjYcfA&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;!-- our custom slider container --&gt;
&lt;div id=&quot;zoom-slider&quot;&gt;

	&lt;!-- decrease zoom level control --&gt;
	&lt;a id=&quot;zoom-control-minus&quot; href=&quot;#&quot;&gt;&lt;/a&gt;

	&lt;!-- zoom slider control --&gt;
	&lt;div id=&quot;zoom-range&quot;&gt;
		&lt;div id=&quot;zoom-path&quot;&gt;&lt;/div&gt;
	&lt;/div&gt;

	&lt;!-- increase zoom level control --&gt;
	&lt;a id=&quot;zoom-control-plus&quot; href=&quot;#&quot;&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;!-- this is where google maps will load --&gt;
&lt;div id=&quot;map&quot;&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre>
<h2>Loading Google Maps API</h2>
<p>Next we will need to load the Google Maps API. Here is the code. It is commented pretty well and should be easy to understand.</p>
<pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
// store the current zoom level for reference with google maps and custom zoom slider
var currentZoomLevel = 10;

// map object (global)
var map;

$(document).ready(function() {
	// create the google map
	var map = new GMap2(document.getElementById(&quot;map&quot;));

	// set starting center point
	map.setCenter(new GLatLng(37.4419, -122.1419), currentZoomLevel);

	// force normal maps type
	map.setMapType(G_NORMAL_MAP);

	// define minimum and maximum zoom levels
	G_NORMAL_MAP.getMinimumResolution = function() { return 0; }
	G_NORMAL_MAP.getMaximumResolution = function() { return 19; }

	// sets the map to &quot;animate&quot; zoom (only on double click and mouse wheel scroll)
	map.enableContinuousZoom();

	// enable the ability to zoom via mouse wheel
	map.enableScrollWheelZoom();
});
&lt;/script&gt;</code></pre>
<p>You can configure the return values of G_NORMAL_MAP.getMinimumResolution and G_NORMAL_MAP.getMaximumResolution to limit the zoom distance. 0 is the lowest value and 19 being the highest value (20 zoom levels).</p>
<h2>Lets Style It!</h2>
<p>Now that we have Google Maps loading into our div, we need to style it! Below is the code to style the Google Map and the custom slider. Again, I use a reset stylesheet which is bundled in the download.</p>
<pre><code>/* Globals
------------------------------------------------------*/
body { font:75% helvetica, arial, sans-serif; background:#fff; color:#333; text-align:center; }

/* Google Map
------------------------------------------------------*/
#map { margin-top:25px; height:300px; width:518px; border:1px solid #fff; }

/* Custom Slider
------------------------------------------------------*/
#zoom-slider { margin:0 auto; position:relative; height:28px; width:203px; background:url(../images/zoom-slider-background.jpg) no-repeat; }
	/* minus button */
	#zoom-slider #zoom-control-minus { position:absolute; top:9px; left:11px; display:block; height:10px; width:10px; background:url(../images/zoom-control-minus.jpg) no-repeat; overflow:hidden; text-indent:-9999em; }
	/* plus button */
	#zoom-slider #zoom-control-plus { position:absolute; top:9px; right:11px; display:block; height:10px; width:10px; background:url(../images/zoom-control-plus.jpg) no-repeat; overflow:hidden; text-indent:-9999em; }
	/* container for the zoom &#x27;handle&#x27; */
	#zoom-slider #zoom-range { position:absolute; top:9px; left:31px; height:10px; width:140px; background:url(../images/zoom-slider-range.jpg) no-repeat; z-index:1; }
		/* the zoom handle */
		#zoom-slider #zoom-range .ui-slider-handle { position:absolute; top:0px; margin-left:-5px; height:10px; width:10px; background:url(../images/zoom-control-handle.png) no-repeat; border:0; cursor:pointer; z-index:2; outline:none; }
		/* size path handle can travel*/
		#zoom-slider #zoom-range #zoom-path { position:absolute; height:10px; width:130px; top:0px; left:5px; cursor:pointer; }</code></pre>
<p>The zoom slider will now look like this (images bundled in the download):</p>
<p><img src="http://jrtashjian.com/blog/wp-content/uploads/2009/11/zoom-slider-image.jpg" alt="zoom-slider-image" title="zoom-slider-image" width="202" height="27" class="aligncenter size-full wp-image-316" /></p>
<h2>Make It Work</h2>
<p>Now that we have everything looking nice and loading correctly, we need to make it work! Using jQuery UI and the Slider Widget, we will hook the div#zoom-slider div#zoom-path and allow jQuery UI to do it&#8217;s magic. however, we still need to hook the plus and minus buttons and make the slider communicate with Google Maps to update our map. In the Javascript, after we are done setting up Google Maps, we will need to place this code.</p>
<pre><code>$(function() {
	// slider target
	var target = $(&#x27;#zoom-slider #zoom-path&#x27;);

	// create the slider
	target.slider({
		orientation: 	&#x27;horizontal&#x27;,
		value: 			currentZoomLevel,
		min: 			parseInt(G_NORMAL_MAP.getMinimumResolution()),
		max: 			parseInt(G_NORMAL_MAP.getMaximumResolution()),
		step: 			1,
		animate: 		true,
		stop: function() {
			map.setZoom(parseInt(target.slider(&#x27;option&#x27;,&#x27;value&#x27;)));
		}
	});

	// update slider on zoom with double click
	GEvent.addListener(map, &#x27;moveend&#x27;, function() { target.slider(&#x27;option&#x27;,&#x27;value&#x27;, map.getZoom()); });

	// maximum slider value
	var maxValue = parseInt(target.slider(&#x27;option&#x27;, &#x27;max&#x27;));

	// minimum slider value
	var minValue = parseInt(target.slider(&#x27;option&#x27;, &#x27;min&#x27;));

	// hook increase zoom control
	$(&#x27;#zoom-control-plus&#x27;).click(function() {
		// current slider value
		var currentValue = parseInt(target.slider(&#x27;option&#x27;,&#x27;value&#x27;));

		// current slider value increased by 1
		var newValue = currentValue+1;

		// is new value greater than max value?
		if(newValue &lt;= maxValue) {
			// increase slider value
			target.slider(&#x27;option&#x27;, &#x27;value&#x27;, newValue);
			map.setZoom(newValue);
		} else {
			// slider is at max value
			target.slider(&#x27;option&#x27;, &#x27;value&#x27;, maxValue);
			map.setZoom(maxValue);
		}
		return false;
	});

	// hook decrease zoom control
	$(&#x27;#zoom-control-minus&#x27;).click(function() {
		// current slider value
		var currentValue = parseInt(target.slider(&#x27;option&#x27;,&#x27;value&#x27;));

		// current slider value increased by 1
		var newValue = currentValue-1;

		// is new value greater than max value?
		if(newValue &gt;= minValue) {
			// increase slider value
			target.slider(&#x27;option&#x27;, &#x27;value&#x27;, newValue);
			map.setZoom(newValue);
		} else {
			// slider is at max value
			target.slider(&#x27;option&#x27;, &#x27;value&#x27;, minValue);
			map.setZoom(minValue);
		}
		return false;
	});
});</code></pre>
<p>Slider does a nice job of incrementing and decrementing the value and moving the handle the appropriate distance. Anytime the slider moves we need to update the map. Anytime the map moves we need to update the slider.</p>
<p>So, when initializing the slider, we hook the stop event of the slider. Each time the slider &#8220;stops&#8221; movement, we update the map zoom using the Google Map API function <a href="http://code.google.com/apis/maps/documentation/reference.html#GMap2.setZoom">setZoom()</a>. So, now we know when we move the slider, the map will update as well!</p>
<p>Next, we hook the &#8220;moveend&#8221; event of Google Maps. If the user double clicks the map to zoom in and out or uses the scroll wheel to zoom in and out, we update the zoom value of the slider using $.slider(&#8216;option&#8217;, &#8216;value&#8217;, map.getZoom()). So, now we know when the map moves the slider will move as well.</p>
<p>Next, we need to hook the plus and minus buttons to allow a user to click them to zoom in and out. Using jQuery, we will bind each click event to update the map and slider values. The plus button will continue to zoom in until we reach the maximum zoom value. The minus button will continue to zoom out until we reach the minimum zoom value.</p>
<h2>Conclusion</h2>
<p>Well, there you have it! I hope someone finds this useful! You can <a href="http://demo.jrtashjian.com/google-custom-zoom/">view the demo</a> and <a href="http://files.jrtashjian.com/google-custom-zoom/google-custom-zoom.zip">download the source</a> to try it out for yourself. If you have any questions feel free to leave a comment or email me. Enjoy!</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/5gwZUEAHuzI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/google-maps-api-custom-zoom-slider/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/google-maps-api-custom-zoom-slider/</feedburner:origLink></item>
		<item>
		<title>User Management System: Part 2</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/IzqNDmjsEO0/</link>
		<comments>http://jrtashjian.com/blog/user-management-system-part-2/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 20:22:11 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/blog/?p=306</guid>
		<description><![CDATA[The next part of our user management system we will be creating are the views and css styles. The styles are going to be really simple and basic. Feel free to create your own styles if you want. I will not go too deeply into explaining it.
First we need to setup a directory where all ...]]></description>
			<content:encoded><![CDATA[<p>The next part of our <a href="http://jrtashjian.com/blog/?p=273/">user management system</a> we will be creating are the views and css styles. The styles are going to be really simple and basic. Feel free to create your own styles if you want. I will not go too deeply into explaining it.</p>
<p>First we need to setup a directory where all of our styles will reside. I will create a new directory at the root of our site, and call it &#8216;assets&#8217;. Here is the hierarchy:</p>
<pre><code>/assets/
/assets/themes/
/assets/themes/default/
/assets/themes/default/images/
/assets/themes/default/css/
/assets/themes/default/css/reset.css
/assets/themes/default/css/screen.css</code></pre>
<p>I use <a href="http://meyerweb.com/eric/">Eric Meyer&#8217;s</a> <a href="http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/">reset stylesheet</a> for all my projects. In screen.css paste this:</p>
<pre><code>/* =========== */
/* = GLOBALS = */
/* =========== */
body { background:#fff; font:75% helvetica, arial, sans-serif; color:#333; text-align:center; }

/* ============== */
/* = CONTAINERS = */
/* ============== */
#container { margin:0 auto; width:960px; text-align:left; }

/* ========== */
/* = HEADER = */
/* ========== */
#header { padding:30px 0px; border-bottom:2px solid #333; }
	#header p#pagetitle { font:2.5em Georgia, Times, serif; }

/* ========== */
/* = FOOTER = */
/* ========== */
#footer { padding:10px 0px 30px; border-top:2px solid #333; }
	#footer p#createdby { line-height:1em; }

/* =========== */
/* = CONTENT = */
/* =========== */
#content { padding:50px 0px; }
	#content table { width:100%; }
	#content h1 { font:1.75em helvetica, arial, sans-serif; margin-bottom:10px; }

/* ================ */
/* = User Listing = */
/* ================ */
#user_listing { border:1px solid #000; }
#user_listing thead tr { background:#e5e5e5; }
#user_listing td, #user_listing th { padding:5px; border:1px solid #000; }
	#user_listing col#user_listing_name { width:30%; }
	#user_listing col#user_listing_lastlogin { width:25%; }
	#user_listing col#user_listing_lastip { width:25%; }
	#user_listing col#user_listing_edit { width:10%; }
	#user_listing col#user_listing_delete { width:10%; }

/* ========= */
/* = FORMS = */
/* ========= */
form {  }
form div { padding-bottom:20px; }
form em.error { color:#a00; }
form label { display:inline; }
form input { display:block; }
form select { display:block; }

form .textfield {  }
form .textfield label {  }
form .textfield input { width:240px; padding:6px 5px 5px; color:#444; background:#f5f5f5; border:1px solid #aaa; }

form .dropdown {  }
form .dropdown label {  }
form .dropdown select { width:140px; padding:6px 5px 5px; color:#444; background:#f5f5f5; border:1px solid #aaa; }

form .buttons {  }
form .buttons input { display:block; margin-top:10px; padding:8px 10px; background:#f5f5f5; color:#444; border:1px solid #aaa; cursor:pointer; }</code></pre>
<p>To load the styles into the views, I create a site config file with variables containing the paths to the assets directory and themes directory. Create this file in ./application/config/</p>
<pre><code>&lt;?php if( ! defined(&#x27;BASEPATH&#x27;)) exit(&#x27;No direct script access allowed&#x27;);

$config[&#x27;site_name&#x27;] = &quot;User Management&quot;;

$config[&#x27;base_path&#x27;]	= dirname($_SERVER[&#x27;SCRIPT_NAME&#x27;]) . &#x27;/&#x27;;
$config[&#x27;asset_dir&#x27;]	= $config[&#x27;base_path&#x27;] . &#x27;assets/&#x27;;
$config[&#x27;asset_themes&#x27;]	= $config[&#x27;asset_dir&#x27;] . &#x27;themes/&#x27;;

/* End of file site_config.php */
/* Location: ./path/to/site_config.php */</code></pre>
<p>Then you need to load the config file. I will autoload it by adding it to the config autoload variable in ./application/config/autoload.php</p>
<pre><code>$autoload[&#x27;configd&#x27;] = array(&#x27;site_config&#x27;);</code></pre>
<h2>Controller</h2>
<p>Next we will create a controller for our administration. We will add 4 basic functions for each functionality we need. We will need a user listing page, create a user page, update a user page and delete a user. I will name the controller users.php:</p>
<pre><code>&lt;?php
class Users extends Controller
{

	function Users()
	{
		parent::Controller();
	}

	function index()
	{
		// LOAD HELPERS
		$this-&gt;load-&gt;helper(array(&#x27;url&#x27;));

		// LOAD VIEWS
		$this-&gt;load-&gt;view(&#x27;header&#x27;);
		$this-&gt;load-&gt;view(&#x27;users_listing&#x27;);
		$this-&gt;load-&gt;view(&#x27;footer&#x27;);
	}

	function add()
	{
		// LOAD LIBRARIES
		$this-&gt;load-&gt;library(array(&#x27;form_validation&#x27;));

		// LOAD HELPERS
		$this-&gt;load-&gt;helper(array(&#x27;form&#x27;, &#x27;url&#x27;));

		// setup form validation rules
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_name&#x27;, &#x27;name&#x27;, &#x27;required&#x27;);
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_email&#x27;, &#x27;email&#x27;, &#x27;required|valid_email&#x27;);
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_password&#x27;, &#x27;password&#x27;, &#x27;required&#x27;);
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_role&#x27;, &#x27;role&#x27;, &#x27;required&#x27;);
		$this-&gt;form_validation-&gt;set_error_delimiters(&#x27;&lt;em class=&quot;error&quot;&gt;&#x27;, &#x27;&lt;/em&gt;&#x27;);

		if($this-&gt;form_validation-&gt;run())
		{
			// create user
		}

		// LOAD VIEWS
		$this-&gt;load-&gt;view(&#x27;header&#x27;);
		$this-&gt;load-&gt;view(&#x27;users_add&#x27;);
		$this-&gt;load-&gt;view(&#x27;footer&#x27;);
	}

	function edit()
	{
		// LOAD LIBRARIES
		$this-&gt;load-&gt;library(array(&#x27;form_validation&#x27;));

		// LOAD HELPERS
		$this-&gt;load-&gt;helper(array(&#x27;form&#x27;, &#x27;url&#x27;));

		// setup form validation rules
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_name&#x27;, &#x27;name&#x27;, &#x27;required&#x27;);
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_email&#x27;, &#x27;email&#x27;, &#x27;required|valid_email&#x27;);
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_password&#x27;, &#x27;password&#x27;, &#x27;required&#x27;);
		$this-&gt;form_validation-&gt;set_rules(&#x27;account_role&#x27;, &#x27;role&#x27;, &#x27;required&#x27;);
		$this-&gt;form_validation-&gt;set_error_delimiters(&#x27;&lt;em class=&quot;error&quot;&gt;&#x27;, &#x27;&lt;/em&gt;&#x27;);

		if($this-&gt;form_validation-&gt;run())
		{
			// Update user
		}

		// LOAD VIEWS
		$this-&gt;load-&gt;view(&#x27;header&#x27;);
		$this-&gt;load-&gt;view(&#x27;users_edit&#x27;);
		$this-&gt;load-&gt;view(&#x27;footer&#x27;);
	}

	function delete()
	{
		// LOAD HELPERS
		$this-&gt;load-&gt;helper(array(&#x27;url&#x27;));

		redirect(&#x27;/users/index/&#x27;);
	}
}

/* End of file users.php */
/* Location: ./application/controllers/users.php */</code></pre>
<p>I&#8217;ve gone ahead and added validation functionality to these pages, which you will also see in the view pages. Create each of these in the ./application/views/ folder.</p>
<p><b>header.php:</b></p>
<pre><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en-us&quot; lang=&quot;en-us&quot;&gt;

&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;

	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
	&lt;title&gt;&lt;?=$this-&gt;config-&gt;item(&#x27;site_name&#x27;)?&gt;&lt;/title&gt;

	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;&lt;?=$this-&gt;config-&gt;item(&#x27;asset_themes&#x27;)?&gt;default/css/reset.css&quot; media=&quot;screen,projection&quot; /&gt;
	&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;&lt;?=$this-&gt;config-&gt;item(&#x27;asset_themes&#x27;)?&gt;default/css/screen.css&quot; media=&quot;screen,projection&quot; /&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;div id=&quot;container&quot;&gt;

	&lt;div id=&quot;header&quot;&gt;
		&lt;p id=&quot;pagetitle&quot;&gt;&lt;a href=&quot;&lt;?=base_url()?&gt;&quot;&gt;&lt;?=$this-&gt;config-&gt;item(&#x27;site_name&#x27;)?&gt;&lt;/a&gt;&lt;/p&gt;
	&lt;/div&gt;

	&lt;div id=&quot;content&quot;&gt;

		&lt;?php if($this-&gt;session-&gt;flashdata(&#x27;message_text&#x27;)) : ?&gt;
			&lt;p class=&quot;&lt;?=$this-&gt;session-&gt;flashdata(&#x27;message_type&#x27;)?&gt;&quot;&gt;&lt;?=$this-&gt;session-&gt;flashdata(&#x27;message_text&#x27;)?&gt;&lt;/p&gt;
		&lt;?php endif; ?&gt;</code></pre>
<p><b>footer.php:</b></p>
<pre><code>	&lt;/div&gt;

	&lt;div id=&quot;footer&quot;&gt;
		&lt;p id=&quot;createdby&quot;&gt;Created by &lt;a href=&quot;http://jrtashjian.com&quot;&gt;A Web Developer&lt;/a&gt;&lt;/p&gt;
	&lt;/div&gt;

&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p><b>user_listing.php:</b></p>
<pre><code>&lt;h1&gt;User Listing&lt;/h1&gt;

&lt;a href=&quot;&lt;?=site_url(&#x27;/users/add/&#x27;)?&gt;&quot;&gt;Create a User&lt;/a&gt;

&lt;table id=&quot;user_listing&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
	&lt;colgroup&gt;
		&lt;col id=&quot;user_listing_name&quot; /&gt;
		&lt;col id=&quot;user_listing_lastlogin&quot; /&gt;
		&lt;col id=&quot;user_listing_lastip&quot; /&gt;
		&lt;col id=&quot;user_listing_edit&quot; /&gt;
		&lt;col id=&quot;user_listing_delete&quot; /&gt;
	&lt;/colgroup&gt;
	&lt;thead&gt;
		&lt;tr&gt;
			&lt;th&gt;Name&lt;/th&gt;
			&lt;th&gt;Last Login&lt;/th&gt;
			&lt;th&gt;Last IP&lt;/th&gt;
			&lt;th&gt;Edit&lt;/th&gt;
			&lt;th&gt;Delete&lt;/th&gt;
		&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;a href=&quot;&lt;?=site_url(&#x27;/users/edit/&#x27;)?&gt;&quot;&gt;User Name&lt;/a&gt;&lt;/td&gt;
			&lt;td&gt;&lt;?=date(&#x27;F jS, Y h:i a&#x27;, strtotime(&#x27;08-01-1988 12:34 am&#x27;))?&gt;&lt;/td&gt;
			&lt;td&gt;192.168.2.1&lt;/td&gt;
			&lt;td&gt;&lt;a href=&quot;&lt;?=site_url(&#x27;/users/edit/&#x27;)?&gt;&quot;&gt;[Edit]&lt;/a&gt;&lt;/td&gt;
			&lt;td&gt;&lt;a href=&quot;&lt;?=site_url(&#x27;/users/delete/&#x27;)?&gt;&quot;&gt;[Delete]&lt;/a&gt;&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;</code></pre>
<p><b>user_add.php:</b></p>
<pre><code>&lt;h1&gt;User Add&lt;/h1&gt;

&lt;?=form_open(&#x27;/users/add/&#x27;)?&gt;
	&lt;div class=&quot;textfield&quot;&gt;
		&lt;?=form_label(&#x27;Name&#x27;, &#x27;account_name&#x27;)?&gt;
		&lt;?=form_error(&#x27;account_name&#x27;)?&gt;
		&lt;?=form_input(&#x27;account_name&#x27;, set_value(&#x27;account_name&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;textfield&quot;&gt;
		&lt;?=form_label(&#x27;Email&#x27;, &#x27;account_email&#x27;)?&gt;
		&lt;?=form_error(&#x27;account_email&#x27;)?&gt;
		&lt;?=form_input(&#x27;account_email&#x27;, set_value(&#x27;account_email&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;textfield&quot;&gt;
		&lt;?=form_label(&#x27;Password&#x27;, &#x27;account_password&#x27;)?&gt;
		&lt;?=form_error(&#x27;account_password&#x27;)?&gt;
		&lt;?=form_input(&#x27;account_password&#x27;, set_value(&#x27;account_password&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;dropdown&quot;&gt;
		&lt;?=form_label(&#x27;Role&#x27;, &#x27;account_role&#x27;)?&gt;
		&lt;?=form_dropdown(&#x27;account_role&#x27;, array(&#x27;user&#x27; =&gt; &#x27;User&#x27;, &#x27;admin&#x27; =&gt; &#x27;Admin&#x27;), set_value(&#x27;account_role&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;buttons&quot;&gt;
		&lt;?=form_submit(&#x27;user_add&#x27;, &#x27;Create User&#x27;)?&gt;
	&lt;/div&gt;
&lt;?=form_close()?&gt;</code></pre>
<p><b>user_edit.php:</b></p>
<pre><code>&lt;h1&gt;User Edit&lt;/h1&gt;

&lt;?=form_open(&#x27;/users/edit/&#x27;)?&gt;
	&lt;div class=&quot;textfield&quot;&gt;
		&lt;?=form_label(&#x27;Name&#x27;, &#x27;account_name&#x27;)?&gt;
		&lt;?=form_error(&#x27;account_name&#x27;)?&gt;
		&lt;?=form_input(&#x27;account_name&#x27;, set_value(&#x27;account_name&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;textfield&quot;&gt;
		&lt;?=form_label(&#x27;Email&#x27;, &#x27;account_email&#x27;)?&gt;
		&lt;?=form_error(&#x27;account_email&#x27;)?&gt;
		&lt;?=form_input(&#x27;account_email&#x27;, set_value(&#x27;account_email&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;textfield&quot;&gt;
		&lt;?=form_label(&#x27;Password&#x27;, &#x27;account_password&#x27;)?&gt;
		&lt;?=form_error(&#x27;account_password&#x27;)?&gt;
		&lt;?=form_input(&#x27;account_password&#x27;, set_value(&#x27;account_password&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;dropdown&quot;&gt;
		&lt;?=form_label(&#x27;Role&#x27;, &#x27;account_role&#x27;)?&gt;
		&lt;?=form_dropdown(&#x27;account_role&#x27;, array(&#x27;user&#x27; =&gt; &#x27;User&#x27;, &#x27;admin&#x27; =&gt; &#x27;Admin&#x27;), set_value(&#x27;account_role&#x27;))?&gt;
	&lt;/div&gt;

	&lt;div class=&quot;buttons&quot;&gt;
		&lt;?=form_submit(&#x27;user_create&#x27;, &#x27;Update User&#x27;)?&gt;
	&lt;/div&gt;
&lt;?=form_close()?&gt;</code></pre>
<p>Now that we have some basic functionality setup, we can start writing the code that actually communicates with our database and get some users created! The next part of this series will be up tonight, tomorrow morning at the latest. So, check back!</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/IzqNDmjsEO0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/user-management-system-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/user-management-system-part-2/</feedburner:origLink></item>
		<item>
		<title>Changes are coming!</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/LaFlngzl4rU/</link>
		<comments>http://jrtashjian.com/blog/changes-are-coming/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 05:36:26 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/?p=305</guid>
		<description><![CDATA[I haven&#8217;t been keeping up with writing an article a week. Mostly due to other personal projects I&#8217;ve wanted to complete as well. One of these projects is The Poll Place. Check it out if you haven&#8217;t already!
Anyway, now that I&#8217;ve got a few projects off my chest I want to get back into writing. ...]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t been keeping up with writing an article a week. Mostly due to other personal projects I&#8217;ve wanted to complete as well. One of these projects is <a href="http://thepollplace.com">The Poll Place</a>. Check it out if you haven&#8217;t already!</p>
<p>Anyway, now that I&#8217;ve got a few projects off my chest I want to get back into writing. Even if the post is very short, like the <a href="http://jrtashjian.com/?p=291">last</a> <a href="http://jrtashjian.com/?p=286">couple</a> have been. Some of you may be wondering what happened to the User Management System Series went. Well, they didn&#8217;t fall off the face of the Earth! I&#8217;ll be posting the rest of the parts by the end of the week (making up for the past month!).</p>
<p>Some of the changes I am talking about are structural changes with the site (I&#8217;ve got some things cooking right now). I plan on writing book reviews on web development books and any book I&#8217;ve read that may be of interest to fellow readers. I will also be changing how I write tutorials a bit. I also want to get into writing classes for popular API&#8217;s such as <a href="http://twitter.com">Twitter</a>, <a href="http://facebook.com">Facebook</a>, <a href="http://last.fm">Last.FM</a>, etc. You&#8217;ll be seeing a lot more of me around this site.</p>
<p>In the meantime, I&#8217;ve updated the <a href="http://feeds.feedburner.com/jrtashjian">RSS feed</a> link to use <a href="http://feedburner.google.com/">Feedburner</a>. Please update your url, as site URL&#8217;s may be changing as well. Updating the url will allow you to stay informed about new articles being posted. Also, you can always <a href="http://twitter.com/jrtashjian">follow me</a> on <a href="http://twitter.com/">Twitter</a>! Send me a question, have a quick chat, or just to see what I&#8217;m up to. You can also nag me to get an article up, in case I start slacking again. :P</p>
<p>Thanks for reading A Web Developers Blog!</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/LaFlngzl4rU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/changes-are-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/changes-are-coming/</feedburner:origLink></item>
		<item>
		<title>Don't Hard Code Your Age!</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/8XK-4is5J70/</link>
		<comments>http://jrtashjian.com/blog/dont-hard-code-your-age/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 05:06:33 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/?p=291</guid>
		<description><![CDATA[Even though this is not at all as important as not hardcoding copyright years. It can still a time saver if you happen to hard code your age into a biography on a website.]]></description>
			<content:encoded><![CDATA[<p>Even though this is not at all as important as not <a href="http://davidwalsh.name/dear-developers-hardcode-copyright-year">hardcoding copyright years</a>. It can still a time saver if you happen to hard code your age into a biography on a website.</p>
<h2>Lets make those ages DYNAMIC!</h2>
<p>I wrote a little code snippet which updates your age automatically. All you do is enter your birth date and php does the rest! I will use my birthday in the example:</p>
<pre><code>$birth_date = getdate(strtotime("August 1st 1988"));
$current_date = getdate(time());
echo ($current_date['mday'] &gt;= $birth_date['mday'] AND $current_date['mmonth'] &gt;= $birth_date['mmonth']) ? ($current_date['year'] - $birth_date['year']) : (($current_date['year'] - $birth_date['year']) - 1);</code></pre>
<p>This would return 21, which is how old I am currently. If the current time was July 31st 2009, it would return 20. I made sure it checked both the day and month, not just subtract the years, to figure out the date. Just replace &#8220;August 1st 1988&#8243; with your birth date.</p>
<p>It&#8217;s that Simple.</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/8XK-4is5J70" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/dont-hard-code-your-age/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/dont-hard-code-your-age/</feedburner:origLink></item>
		<item>
		<title>CodeIgniter's alternator() function </title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/0AcLDfeaEMo/</link>
		<comments>http://jrtashjian.com/blog/codeigniters-alternator-function/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 03:54:07 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Codeigniter]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/?p=286</guid>
		<description><![CDATA[It's surprising to me how often I find little functions for tedious tasks, that CodeIgniter already has built in. One of these functions is the alternator() function in the String Helper.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s surprising to me how often I find little functions for tedious tasks, that <a href="http://codeigniter.com">CodeIgniter</a> already has built in. One of these functions is the alternator() function in the <a href="http://codeigniter.com/user_guide/helpers/string_helper.html">String Helper</a>.</p>
<p>To begin using this function, make sure you have loaded the String Helper with the following code:</p>
<pre><code>$this-&gt;load-&gt;helper('string');</code></pre>
<p>What the alternator() function does is allow two or more items to be alternated between when iterating through a loop. Example from the CodeIgniter User Guide:</p>
<pre><code>for($i = 0; $i &lt; 10; $i++)
{
	echo alternator('string one', 'string two');
}</code></pre>
<p>There is also no limit to how many parameters you can have:</p>
<pre><code>...
echo alternator('one', 'two', 'three', 'four', 'five');
...</code></pre>
<h2>Put it to Use</h2>
<p>What would you ever need that for? Well, what about if you are creating a list of items and every other needs class=&#8221;alt&#8221; attached to it for styling differences? I run into this issue all the time.</p>
<p>This is how I used to do it:</p>
<pre><code>&lt;ul&gt;
	&lt;?php $count = 1; ?&gt;
	&lt;?php foreach($list as $item) : ?&gt;
		&lt;?php (empty($count)) ? $count = 1 : $count = 0; ?&gt;
		&lt;li &lt;?=($count == 1) ? 'class="alt"' : ''?&gt;&gt;
			&lt;?=$item?&gt;
		&lt;/li&gt;
	&lt;?php endforeach; ?&gt;
&lt;/ul&gt;</code></pre>
<p>And this is with the alternator() function:</p>
<pre><code>&lt;ul&gt;
	&lt;?php foreach($list as $item) : ?&gt;
		&lt;li &lt;?=alternator('class="alt"', '')?&gt;&gt;
			&lt;?=$item?&gt;
		&lt;/li&gt;
	&lt;?php endforeach; ?&gt;
&lt;/ul&gt;</code></pre>
<p>The alternator() function makes the ability to do this, much easier and cleaner than my original way. Hopefully I&#8217;ve helped someone out who had no idea this function was available.</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/0AcLDfeaEMo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/codeigniters-alternator-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/codeigniters-alternator-function/</feedburner:origLink></item>
		<item>
		<title>The Poll Place – Project Launched!</title>
		<link>http://feedproxy.google.com/~r/jrtashjian/~3/sVlDoC33iE0/</link>
		<comments>http://jrtashjian.com/blog/the-poll-place-project-launched/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 21:32:47 +0000</pubDate>
		<dc:creator>JR Tashjian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jrtashjian.com/?p=283</guid>
		<description><![CDATA[Hey everyone!
I&#8217;ve had this project cooking for a while now, and felt I needed to launch it sooner than later. So, here it is: The Poll Place (http://thepollplace.com/)
Check it out! Make some Polls! Vote on others! But most of all, share it with others! My goal is to have this become a competitor to some ...]]></description>
			<content:encoded><![CDATA[<p>Hey everyone!</p>
<p>I&#8217;ve had this project cooking for a while now, and felt I needed to launch it sooner than later. So, here it is: The Poll Place (<a href="http://thepollplace.com/">http://thepollplace.com/</a>)</p>
<p>Check it out! Make some Polls! Vote on others! But most of all, share it with others! My goal is to have this become a competitor to some of the big polling sites out there, namely <a href="http://polldaddy.com/">Poll Daddy</a>. So please, spread the word! There is a new kid in town!</p>
<p>I have got plenty of todo&#8217;s for The Poll Place, a couple major issues and a handful of minor issues. As the site grows you will notice new features being added that you can take advantage of.</p>
<p>I hope you all enjoy this site and use it often. Thanks in advanced for sharing it around!</p>
<img src="http://feeds.feedburner.com/~r/jrtashjian/~4/sVlDoC33iE0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://jrtashjian.com/blog/the-poll-place-project-launched/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://jrtashjian.com/blog/the-poll-place-project-launched/</feedburner:origLink></item>
	</channel>
</rss>
