<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>e r e b o s . n e t &#187; Code Snippets</title>
	<atom:link href="http://www.erebos.net/category/code-snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.erebos.net</link>
	<description></description>
	<lastBuildDate>Wed, 14 Sep 2011 21:35:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>US States as List of SelectListItems in .NET</title>
		<link>http://www.erebos.net/2011/09/us-states-as-selectlistitem-list/</link>
		<comments>http://www.erebos.net/2011/09/us-states-as-selectlistitem-list/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 21:35:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[FWIW]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Repetitive]]></category>

		<guid isPermaLink="false">http://www.erebos.net/?p=215</guid>
		<description><![CDATA[FWIW &#8211; Needed this list once, and only found many prepared html select/option lists &#8211; so I have created this and posting here future reference. In this example, creating a dynamic ViewBag object &#8216;ViewBag.States&#8217;, and adding a bunch of SelectListItems as properties.  ViewBag.States = new List&#60;SelectListItem&#62;                {                  new SelectListItem { Text ="AK" },                 new SelectListItem { Text ="AL" },                 new SelectListItem { Text ="AR" },                 new SelectListItem { Text ="AZ" },                 new SelectListItem { Text ="CA" },                 new SelectListItem { Text ="CO" },                 new SelectListItem { Text ="CT" },                 new SelectListItem { Text ="DC" },                 new SelectListItem { Text ="DE" },                 new SelectListItem { Text ="FL" },                 new SelectListItem { Text ="GA" }, [...]]]></description>
			<content:encoded><![CDATA[<p>FWIW &#8211; Needed this list once, and only found many prepared html select/option lists &#8211; so I have created this and posting here future reference.</p>
<p>In this example, creating a dynamic ViewBag object &#8216;ViewBag.States&#8217;, and adding a bunch of SelectListItems as properties.</p>
<pre>
<code> ViewBag.States = new List&lt;SelectListItem&gt;
               {
                	new SelectListItem { Text ="AK" },
	                new SelectListItem { Text ="AL" },
	                new SelectListItem { Text ="AR" },
	                new SelectListItem { Text ="AZ" },
	                new SelectListItem { Text ="CA" },
	                new SelectListItem { Text ="CO" },
	                new SelectListItem { Text ="CT" },
	                new SelectListItem { Text ="DC" },
	                new SelectListItem { Text ="DE" },
	                new SelectListItem { Text ="FL" },
	                new SelectListItem { Text ="GA" },
	                new SelectListItem { Text ="HI" },
	                new SelectListItem { Text ="IA" },
	                new SelectListItem { Text ="ID" },
	                new SelectListItem { Text ="IL" },
	                new SelectListItem { Text ="IN" },
	                new SelectListItem { Text ="KS" },
	                new SelectListItem { Text ="KY" },
	                new SelectListItem { Text ="LA" },
	                new SelectListItem { Text ="MA" },
	                new SelectListItem { Text ="MD" },
	                new SelectListItem { Text ="ME" },
	                new SelectListItem { Text ="MI" },
	                new SelectListItem { Text ="MN" },
	                new SelectListItem { Text ="MO" },
	                new SelectListItem { Text ="MS" },
	                new SelectListItem { Text ="MT" },
	                new SelectListItem { Text ="NC" },
	                new SelectListItem { Text ="ND" },
	                new SelectListItem { Text ="NE" },
	                new SelectListItem { Text ="NH" },
	                new SelectListItem { Text ="NJ" },
	                new SelectListItem { Text ="NM" },
	                new SelectListItem { Text ="NV" },
	                new SelectListItem { Text ="NY" },
	                new SelectListItem { Text ="OH" },
	                new SelectListItem { Text ="OK" },
	                new SelectListItem { Text ="OR" },
	                new SelectListItem { Text ="PA" },
	                new SelectListItem { Text ="RI" },
	                new SelectListItem { Text ="SC" },
	                new SelectListItem { Text ="SD" },
	                new SelectListItem { Text ="TN" },
	                new SelectListItem { Text ="TX" },
	                new SelectListItem { Text ="UT" },
	                new SelectListItem { Text ="VA" },
	                new SelectListItem { Text ="VT" },
	                new SelectListItem { Text ="WA" },
	                new SelectListItem { Text ="WI" },
	                new SelectListItem { Text ="WV" },
	                new SelectListItem { Text ="WY" },
              };</pre>
<p></code><br />
&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.erebos.net/2011/09/us-states-as-selectlistitem-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby/Other:  Fix for missing header files on Mac OSX 10.6</title>
		<link>http://www.erebos.net/2011/03/rubyother-fix-for-missing-header-files-on-mac-osx-10-6/</link>
		<comments>http://www.erebos.net/2011/03/rubyother-fix-for-missing-header-files-on-mac-osx-10-6/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 03:52:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://www.erebos.net/?p=165</guid>
		<description><![CDATA[Having trouble installing certain Ruby gems (mysql) on Mac OSX 10.6?   MacPorts ? Error message similar to this?: mkmf.rb can&#8217;t find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h Solution: Reinstall Xcode.   To verify this problem,  you can run &#8216;which make&#8217; from terminal and most likely you will receive no response if you are getting the missing [...]]]></description>
			<content:encoded><![CDATA[<p>Having trouble installing certain Ruby gems (mysql) on Mac OSX 10.6?   MacPorts ?</p>
<p>Error message similar to this?:</p>
<p><em>mkmf.rb can&#8217;t find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h</em></p>
<p><strong>Solution: </strong>Reinstall Xcode.   To verify this problem,  you can run &#8216;which make&#8217; from terminal and most likely you will receive no response if you are getting the missing header file error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.erebos.net/2011/03/rubyother-fix-for-missing-header-files-on-mac-osx-10-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Zend Studio for Eclipse Code Assist with SVN projects</title>
		<link>http://www.erebos.net/2009/05/zend-studio-fi/</link>
		<comments>http://www.erebos.net/2009/05/zend-studio-fi/#comments</comments>
		<pubDate>Wed, 27 May 2009 17:55:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://www.erebos.net/?p=110</guid>
		<description><![CDATA[For whatever reason, when adding a project from SVN without first creating the PHP project, you lose code assist. Found a very useful post that addressed this, with a pretty simple fix by editing the .project file: Change buildCommand name to: org.eclipse.php.core.PhpIncrementalProjectBuilder And natures to: org.eclipse.php.core.PHPNature Refresh/Rebuild and Zend/Eclipse will once again be as helpful [...]]]></description>
			<content:encoded><![CDATA[<p>For whatever reason, when adding a project from SVN without first creating the PHP project, you lose code assist.</p>
<p>Found a very useful post that addressed this, with a pretty simple fix by editing the .project file:</p>
<blockquote><p>
Change buildCommand name to:<br />
org.eclipse.php.core.PhpIncrementalProjectBuilder</p>
<p>And natures to:<br />
org.eclipse.php.core.PHPNature
</p></blockquote>
<p>Refresh/Rebuild and Zend/Eclipse will once again be as helpful (or annoying) as ever.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.erebos.net/2009/05/zend-studio-fi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing Javascript Arrays to PHP</title>
		<link>http://www.erebos.net/2009/04/passing-javascript-arrays-to-php/</link>
		<comments>http://www.erebos.net/2009/04/passing-javascript-arrays-to-php/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 01:40:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[php javascript]]></category>

		<guid isPermaLink="false">http://www.erebos.net/?p=94</guid>
		<description><![CDATA[Needed to pass a simple Javascript array to a PHP script for some back end processing. Here&#8217;s a quick and dirty way of doing so by &#8216;serializing&#8217; the javascript array as a string to send along in your request, and then splitting this string into tokens to create a PHP array. Javascript: (using jquery javascript [...]]]></description>
			<content:encoded><![CDATA[<p>Needed to pass a simple Javascript array to a PHP script for some back end processing.   Here&#8217;s a quick and dirty way of doing so by &#8216;serializing&#8217;  the javascript array as a string to send along in your request, and then splitting this string into tokens to create a PHP array.</p>
<p>Javascript: <em>(using <a href="http://jquery.com/">jquery</a> javascript library)</em><br />
<code><br />
	var selections = new Array;<br />
        var userSelections;<br />
	$('#multipleSelection :selected').each(function(i, selected) {<br />
	              selections[i] = $(selected).val();<br />
          });<br />
	userSelections = selections.join(",");<br />
</code></p>
<p>In the PHP script, it&#8217;s just a matter of processing the individual elements of the array.  Depending on how you sent the ajax request (POST/GET).</p>
<p>PHP Example:<br />
<code><br />
$selectionsArray = explode(',',$_GET['userSelections']);</p>
<p>foreach($selectedArray as $index=>$value) {<br />
  echo $index ." = ".$value;<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.erebos.net/2009/04/passing-javascript-arrays-to-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

