<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Corey Coogan</title>
	<atom:link href="http://blog.coreycoogan.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.coreycoogan.com</link>
	<description>Python, .Net, C#, ASP.NET MVC, Architecture and Design</description>
	<lastBuildDate>Wed, 01 Feb 2012 13:50:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.coreycoogan.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/ba1b8857133275abcfb1794dbd2e242e?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Corey Coogan</title>
		<link>http://blog.coreycoogan.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.coreycoogan.com/osd.xml" title="Corey Coogan" />
	<atom:link rel='hub' href='http://blog.coreycoogan.com/?pushpress=hub'/>
		<item>
		<title>Using jQuery to Dynamically Display a Slideout</title>
		<link>http://blog.coreycoogan.com/2011/05/19/using-jquery-to-dynamically-display-a-slideout/</link>
		<comments>http://blog.coreycoogan.com/2011/05/19/using-jquery-to-dynamically-display-a-slideout/#comments</comments>
		<pubDate>Thu, 19 May 2011 14:42:18 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[offset]]></category>
		<category><![CDATA[slide left]]></category>
		<category><![CDATA[slideToggle]]></category>
		<category><![CDATA[toggle]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=422</guid>
		<description><![CDATA[Here&#8217;s something I find myself needing to do often enough that it warrants a post. Here&#8217;s the situation&#8230; I am dynamically displaying an unknown number of data items. The item itself is unimportant for this post, however, the item may contain some attributes that shouldn&#8217;t be displayed on the page all the time.  Perhaps it&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=422&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s something I find myself needing to do often enough that it warrants a post. Here&#8217;s the situation&#8230;</p>
<p>I am dynamically displaying an unknown number of data items. The item itself is unimportant for this post, however, the item may contain some attributes that shouldn&#8217;t be displayed on the page all the time.  Perhaps it&#8217;s a  long description or information about how the item was last updated.  Whatever it is, this data is better to be hidden unless someone actually wants to see it.  This may be a good use case for some sort of panel that slides out when an &#8220;info&#8221; icon or &#8220;&gt;&gt;&#8221; button is clicked.</p>
<p>Making this happen with jQuery is pretty simple and consists of a few steps:</p>
<ol>
<li>Wire up a &#8220;click&#8221; event to the button or text from where the panel will slide.</li>
<li>Using the clicked on element as an anchor, use jQuery&#8217;s offset() method to get the coordinates.</li>
<li>Either clone an existing element, such as a DIV, or create one on the fly and assign the following CSS rules to it:</li>
<ol>
<li><a href="http://www.w3schools.com/Css/pr_class_position.asp">Position</a> &#8211; This should be set to <strong>absolute</strong> so the panel displays relative to its containing element.</li>
<li><a href="http://www.w3schools.com/css/pr_pos_top.asp">Top</a> &#8211; The distance in pixels, from the top of the containing element, where the panel should be placed.</li>
<li><a href="http://www.w3schools.com/css/pr_pos_left.asp">Left</a> &#8211; The distance in pixels, from the left of the containing element, where the panel should be placed.</li>
</ol>
<li>Append the new panel to the container that is holding the list of data items.</li>
<li>Display the panel using a cool effect &#8211; or hide it.</li>
</ol>
<div> A couple of notes before we get to the example.  First, there are 2 ways to get an element&#8217;s position in jQuery &#8211; <a href="http://api.jquery.com/offset/">offset()</a> and <a href="http://api.jquery.com/position/">position()</a>.  You can read the descriptions to understand what they both do, but offset() typically works for me. I&#8217;m also using the <a href="http://jqueryui.com/demos/toggle/#option-effect">&#8216;slide&#8217; toggle effect from jQuery UI</a> to slide my panel from left to right with the toggle() method.</div>
<p>Now for an example:</p>
<p><pre class="brush: jscript;">

&lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){

	//either get data from a service here or have it ready from server-side code

});

function showMoreInfo(anchor,itemId)
{
	//make a jQuery object
	anchor = $(anchor);

	//the dynamic ID of the moreInfo panel
	var panelId = 'moreInfo_' + itemId;
	//see if the panel already exists
	var info = anchor.parent().parent().find('#' + panelId);

	if(!info.length){
		//the panel doesn't exist, so create it

		//get the coordinates from our anchor
		var coords = anchor.offset();
		//clone our info panel, or use jQuery templates
		info = $('#moreInfoPanel').clone();

		info.find('#description').html('&lt;b&gt;Get this data based on the itemId&lt;/b&gt;');
		info.find('#lastUpdated').html('&lt;b&gt;Get this data based on the itemId&lt;/b&gt;');

		//set the new dynamic ID
		info.attr('id',panelId);

		//now set the CSS to make the panel display where we want
		info.css({
			position: 'absolute',
			top: coords.top-(info.height()),
			left: coords.left+anchor.width() + 15
		});
		//append the panel to the item div
		anchor.parent().parent().append(info);
	}

	//use the jquery UI slide definition
	info.toggle('slide',function(){
		//slide callback to change the button text depending on the state
		if(info.is(':visible')){
			anchor.html('&lt;&lt; Less'); 		}else{ 			anchor.html('More &gt;&gt;');
		}
	});

}
&lt;/script&gt;

</pre></p>
<p><pre class="brush: xml;">
&lt;body&gt;

&lt;div id='moreInfoPanel' style='display:none;background:silver;padding:20px;'&gt;
	&lt;div id='description'&gt;&lt;/div&gt;
	&lt;div id='lastUpdated'&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id='dataItems'&gt;

	&lt;!-- this is an example data item. this would be generated dynamically server side or from a web service --&gt;
	&lt;!-- jQuery Templates could be nice here --&gt;
	&lt;div id='dataItem_ITEMID' class='dataItem' style='border:1px solid black;width:200px'&gt;
		&lt;div style='text-align:right'&gt;
			&lt;!-- wire up the click event --&gt;
			&lt;button onclick='javascript:showMoreInfo(this,&quot;ITEMID&quot;);'&gt;More &gt;&gt;&lt;/button&gt;
		&lt;/div&gt;
		&lt;hr/&gt;
		&lt;div&gt;
			Main content goes here
		&lt;/div&gt;
		
	&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/422/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=422&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/05/19/using-jquery-to-dynamically-display-a-slideout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Remember when&#8230; Apple Marketing</title>
		<link>http://blog.coreycoogan.com/2011/04/26/remember-when-apple-marketing/</link>
		<comments>http://blog.coreycoogan.com/2011/04/26/remember-when-apple-marketing/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 13:39:28 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Apple Logo]]></category>
		<category><![CDATA[Apple Marketing]]></category>
		<category><![CDATA[Product Placement]]></category>
		<category><![CDATA[Windows Logo]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=417</guid>
		<description><![CDATA[I remember many years ago, when Windows was completely dominating the market with 3.1 and Windows 95, it was a common belief that Apple might have a  better product, but they totally dropped the ball when it came to marketing.  I can&#8217;t really say if that was true or not, as I was much younger [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=417&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I remember many years ago, when Windows was completely dominating the market with 3.1 and Windows 95, it was a common belief that Apple <em>might</em> have a  better product, but they totally dropped the ball when it came to marketing.  I can&#8217;t really say if that was true or not, as I was much younger then, but I know I heard it mentioned quite often.</p>
<p>I look at Apple&#8217;s marketing today and it&#8217;s a very different animal.  Forget the iPad and iPod marketing campaigns, as those products pretty much stand on their own.  When I consider the computer market, there&#8217;s been quite a shift.  It seems that more often than not, where there is a computer in a movie or a TV show, you see the Apple logo &#8211; typically on the back of a laptop, but sometimes from an iMac.  Product placement I assume.</p>
<p>I&#8217;ve now begun to notice in some movies and television shows a new and strange type of computer [monitor].  This piece of hardware appears to be manufactured by Microsoft because it has the Windows logo for all to see on the back of the monitor, where one might typically see an apple.  I&#8217;ve noticed this on the T.V. show The Mentalist and others that I can&#8217;t think of right now.  It appears that MS is taking a queue from Apple in this department.  I wonder if anyone ever walks into Best Buy looking for a Windows monitor?</p>
<p>But what really brought this to light, and inspired this blog post, was a drawing by my 6 year old daughter.  She had to draw a picture of what her Daddy does, so she drew me working at my desk.  I sit with my back to the wall, so when my kids approach me they see the top of my head looking down at my dual 23&#8243; monitors, displaying Windows 7.  Despite the fact that the only Apple product we own (for now) is an iPad and we don&#8217;t know anyone else with a Mac, my daughter drew my monitor with a large apple on the back, clear as day.</p>
<p>If that&#8217;s not effective marketing, I don&#8217;t know what is.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/417/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=417&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/04/26/remember-when-apple-marketing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Google Chrome JavaScript Error Notification</title>
		<link>http://blog.coreycoogan.com/2011/04/08/google-chrome-javascript-error-notification/</link>
		<comments>http://blog.coreycoogan.com/2011/04/08/google-chrome-javascript-error-notification/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 15:14:12 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Helpful Tips]]></category>
		<category><![CDATA[Error Notification Extension]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript Errors]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=412</guid>
		<description><![CDATA[I love Google Chrome &#8211; it&#8217;s fast, simple and standards-based. I really like the built-in developer tools, which are just like Firebug, but readily available without managing any add-ons or extensions. One thing that is lacking from Chrome for a developer is the notification of JS errors on a page. Typically, I would hit [SHIFT+CTL+J] [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=412&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I love Google Chrome &#8211; it&#8217;s fast, simple and standards-based.  I really like the built-in <a href="http://code.google.com/chrome/devtools/">developer tools</a>, which are just like <a href="http://getfirebug.com/">Firebug</a>, but readily available without managing any add-ons or extensions.</p>
<p>One thing that is lacking from Chrome for a developer is the notification of JS errors on a page.  Typically, I would hit [SHIFT+CTL+J] to fire up the JavaScript console and see if there are any errors.  This can be a bit of a hassle and has caused me to miss some subtle errors at the times where I wasn&#8217;t using the console.</p>
<p>Knowing that Google has an <a href="https://chrome.google.com/extensions">extensive set of extensions</a> available, I figured I&#8217;d check for something to notify me when there&#8217;s an error on the page.  Sure enough, I found the <a href="https://chrome.google.com/extensions/detail/jafmfknfnkoekkdocjiaipcnmkklaajd?hl=en">JavaScript Errors Notifier</a> extension that gives me exactly what I&#8217;ve been longing for.  Why did it take me so long to search this out?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=412&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/04/08/google-chrome-javascript-error-notification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding to an Enum in Postgres 8.x and 9.0</title>
		<link>http://blog.coreycoogan.com/2011/04/04/adding-to-an-enum-in-postgres-8-x-and-9-0/</link>
		<comments>http://blog.coreycoogan.com/2011/04/04/adding-to-an-enum-in-postgres-8-x-and-9-0/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 19:50:11 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Postgres]]></category>
		<category><![CDATA[8.x]]></category>
		<category><![CDATA[9.0]]></category>
		<category><![CDATA[add value]]></category>
		<category><![CDATA[postgres enum]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=408</guid>
		<description><![CDATA[Postgres has an emum type that I&#8217;m quite fond of. To create one, you just something like this: Now let&#8217;s say that I realize later I also need an order status for BackOrdered. In PG 9.1, adding an enum value becomes much simpler, but for those of us on earlier versions, we&#8217;ll have to do [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=408&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Postgres has an emum type that I&#8217;m quite fond of.  To create one, you just something like this:</p>
<p><pre class="brush: sql;">
CREATE TYPE order_status AS ENUM ('Pending','Processing','Shipped');
</pre></p>
<p>Now let&#8217;s say that I realize later I also need an order status for BackOrdered.  In PG 9.1, adding an enum value <a href="http://developer.postgresql.org/pgdocs/postgres/sql-altertype.html">becomes much simpler</a>, but for those of us on earlier versions, we&#8217;ll have to do this the hard way.</p>
<p>Postgres stores enum values in the pg_enum system table.  It stores the enum types in the pg_type table.  For user-defined types, such as an enum, PG will prefix the name with an underscore.  So my enum type of &#8220;order_status&#8221; is actually stored by PG as &#8220;_order_status&#8221;.  Knowing this, I can simply insert my new value into the pg_enum table, using the numeric ID used by PG for the special underscore name.  </p>
<p>Here&#8217;s the result:</p>
<p><pre class="brush: sql;">
INSERT INTO pg_enum (enumtypid, enumlabel)
  SELECT typelem, 'BackOrdered' FROM pg_type WHERE
    typname='_order_status';
</pre></p>
<p>This will put the new value at the end of the enum.  If you care where it goes, and I can&#8217;t see a reason why you would, you&#8217;ll have to resort to some other trickery.  I learned this method, as well as ways to change the order, from <a href="http://stackoverflow.com/questions/1771543/postgresql-updating-an-enum-type">this post on Stack Overflow</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/408/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=408&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/04/04/adding-to-an-enum-in-postgres-8-x-and-9-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Get the most from O&#8217;Reilly Books</title>
		<link>http://blog.coreycoogan.com/2011/03/10/get-the-most-from-oreilly-books/</link>
		<comments>http://blog.coreycoogan.com/2011/03/10/get-the-most-from-oreilly-books/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 16:16:31 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Developer Life]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[o'reilly]]></category>
		<category><![CDATA[o'reilly bundles]]></category>
		<category><![CDATA[o'reilly promotions]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=405</guid>
		<description><![CDATA[I love technical books and have purchased a fair amount from Manning, who gives a free eBook edition with their print books. I also like O&#8217;Reilly books and have purchased hard-copy books from their website in the past. Now that I have an iPad, I like the idea of having the books available to read [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=405&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I love technical books and have purchased a fair amount from Manning, who gives a free eBook edition with their print books.  I also like O&#8217;Reilly books and have purchased hard-copy books from their website in the past.  Now that I have an iPad, I like the idea of having the books available to read on it, but some technical books are better suited to print.  Having to flip through several pages to see a code sample can really become distracting.</p>
<p>I recently went to purchase some books from O&#8217;Reilly (3/9/2011) and they were having a buy 2 get 1 free deal.  I tried to buy the print/eBook bundles and realized I couldn&#8217;t combine the &#8220;bundle&#8221; offer with the Buy Two promotion.  Then it occurred to me that the bundle is unnecessary.</p>
<p>If there are any promotions happening on O&#8217;Reilly, ALWAYS take it over the bundle.  NEVER take the bundle over any other promotion.  The reason?  Once you have a print book, you can go back to O&#8217;Reilly&#8217;s website and get the eBook for $4.99 &#8211; anytime.  Now you get the bundle AND the current promotion.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/405/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/405/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/405/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=405&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/03/10/get-the-most-from-oreilly-books/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Enter the Python</title>
		<link>http://blog.coreycoogan.com/2011/03/01/enter-the-python/</link>
		<comments>http://blog.coreycoogan.com/2011/03/01/enter-the-python/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 15:51:49 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[SQLAlchemy]]></category>
		<category><![CDATA[.net to python]]></category>
		<category><![CDATA[Mock]]></category>
		<category><![CDATA[Postgres]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sqlalchemy nhibernate]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=398</guid>
		<description><![CDATA[My .NET related posts have been pretty sparse lately, mainly because I spend almost no time doing .NET development anymore. That&#8217;s right, my platform of choice over the last 11 years is now on the back-burner as it makes room for Python. There is a lot of hype over Ruby and specifically Ruby on Rails [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=398&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My .NET related posts have been pretty sparse lately, mainly because I spend almost no time doing .NET development anymore.  That&#8217;s right, my platform of choice over the last 11 years is now on the back-burner as it makes room for Python.</p>
<p>There is a lot of hype over <a href="http://www.ruby-lang.org/en/">Ruby</a> and specifically <a href="http://rubyonrails.org/">Ruby on Rails</a> these days.  I had been following it and thought that would be the dynamic language and web framework I would cut my teeth on.  However, a really great project came along and the requirements included nothing from the MS stack:</p>
<li><a href="http://www.python.org/">Python</a></li>
<li>Linux</li>
<li>Apache</li>
<li><a href="http://www.cherrypy.org/">CherryPy</a> or other WSGI server</li>
<li>PHP</li>
<li><a href="http://www.postgresql.org/">Postgres</a></li>
<li><a href="http://www.sqlalchemy.org/">SQLAlchemy</a> (ORM)</li>
<h2>Python</h2>
<p>I was very excited to learn something new and have found that I really enjoy working with Python.  It&#8217;s dynamic, flexible and easy to work with.  One thing I have really learned to love over static languages is that it doesn&#8217;t compile.  That means I just code and go.  That also means I get an interpretter where I can easily spike some code and see how things look and feel.  This makes development much faster for me and I have more confidence than I would with straight TDD.  I can shape my code on the fly and run it with a 2 hits of the ENTER key.</p>
<p>Speaking of TDD, mocking in Python is an absolute dream.  No more time-consuming and costly setups to mock my objects with <a href="http://www.ayende.com/projects/rhino-mocks.aspx">Rhino</a>.  Using the <a href="http://www.voidspace.org.uk/python/mock/">Mock module</a> is as easy as can be.   A simple example of stubbing a &#8220;firstName&#8221; property looks like this:</p>
<p><pre class="brush: python;">
person = Mock()
person.firstName = 'corey'
</pre></p>
<p>If I want to stub a method, it&#8217;s as simple as this:</p>
<p><pre class="brush: python;">
person.fullName.return_value = 'corey a. coogan'
</pre></p>
<p>There&#8217;s much more that can be done, but stubbing alone probably satisfies 80% of my mocking needs.</p>
<h2>On the Web</h2>
<p>Often times when people think of Python they think of <a href="http://www.djangoproject.com/">Django</a>.  Django looks really terrific and I look forward to having an opportunity to use it.  For now, however, PHP is the answer.  I&#8217;ve only worked a little bit with PHP in the past and formed an opinion many years ago.  After working with it for several months, I am still not an advocate for PHP, but it does have it&#8217;s strengths. Fortunately, much of the PHP work involves calling JSON services and then using <a href="http://jquery.com/">jQuery</a> and JS on the client to do something with it.  There is still a fair amount of PHP tag soup, reminiscant of my classic ASP roots, but I hope to eradicate that one day.</p>
<h2>SQLAlchemy</h2>
<p>SQLAlchemy(SA) is to Python what <a href="http://nhforge.org/Default.aspx">NHibernate</a> is to .NET.  They both allow for domain classes that are completely separated from the mappings, but SA also has some other styles, such as <a href="http://www.sqlalchemy.org/docs/orm/extensions/declarative.html">Declarative</a> and <a href="http://www.sqlalchemy.org/docs/orm/extensions/sqlsoup.html?highlight=sqlsoup#sqlalchemy.ext.sqlsoup">SQL Soup</a>, that can come in pretty handy.  The syntax seems pretty clunky at first, but I&#8217;m getting used to it.  The documentation is a bit rough, as many of the methods accept  <a href="http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/">*args,**kwargs</a>, which means you can pass in any number of values and name/value pairs.  The doc tells you what are acceptable arguments, but the examples tend to be a bit scarce.  Look for an upcoming post that has examples for all the things that have tripped me up so far.</p>
<h2>The Times They Are a Changin&#8217;</h2>
<p>This blog will continue to focus on technology agnostic goodness, like JavaScript, jQuery, SQL, etc, but .NET content will be far and few between.  I&#8217;ll be sharing more of what I&#8217;ve learned in Postgres, SQLAlchemy and Python.  Hopefully I don&#8217;t lose too many of my .NET readers and hope that my content can help out a new group of people.</p>
<p>Until next time&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/398/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=398&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/03/01/enter-the-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Hide the X in the corner of a JQuery Dialog</title>
		<link>http://blog.coreycoogan.com/2011/01/31/hide-the-x-in-the-corner-of-a-jquery-dialog/</link>
		<comments>http://blog.coreycoogan.com/2011/01/31/hide-the-x-in-the-corner-of-a-jquery-dialog/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 13:30:25 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[dialog]]></category>
		<category><![CDATA[jQuery UI]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=386</guid>
		<description><![CDATA[NOTE TO SELF: Until you find a better way, here&#8217;s how you remove the X that closes a JQuery dialog box: $( &#8216;a.ui-dialog-titlebar-close&#8217; ).remove(); OR Change the Style definition in the HEAD.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=386&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>NOTE TO SELF:</p>
<p>Until you find a better way, here&#8217;s how you remove the X that closes a JQuery dialog box:</p>
<p>$( &#8216;a.ui-dialog-titlebar-close&#8217; ).remove();</p>
<p>OR</p>
<p>Change the Style definition in the HEAD.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/386/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=386&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/01/31/hide-the-x-in-the-corner-of-a-jquery-dialog/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Use Excel to Automate Data Entry</title>
		<link>http://blog.coreycoogan.com/2011/01/27/use-excel-to-automate-data-entry/</link>
		<comments>http://blog.coreycoogan.com/2011/01/27/use-excel-to-automate-data-entry/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 12:16:10 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Helpful Tips]]></category>
		<category><![CDATA[Data Entry]]></category>
		<category><![CDATA[Date to Text]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Insert into Database]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=377</guid>
		<description><![CDATA[Over the course of my career, I have frequently been given random excel spreadsheets that contain data that needs to be either inserted or updated to a database. There are many routes one can go with this task, most of which are more complicated then necessary. I find the simplest solution is to use Excel [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=377&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Over the course of my career, I have frequently been given random excel spreadsheets that contain data that needs to be either inserted or updated to a database.  There are many routes one can go with this task, most of which are more complicated then necessary.  I find the simplest solution is to use Excel formulas to generate my SQL statements for me.</p>
<ol>
<li>Create a formula for the SQL statement in a blank cell  of the spreadsheet&#8217;s first row of data.</li>
<li>Copy and paste the formula to the same blank cell in every other row. This fastest way I know to do the paste is to: <del>select the first cell you wish to paste.  Hold down CTL+SHIFT+END.  This will select everything from the point of selection to the last row and last cell in the spreadsheet.  At this point, continue to hold down shift and arrow back to the left to get to the original column and hit enter.</del><br />
<blockquote><p>With the cursor on the cell with the formula, Excel outlines the cell with a tiny square on the bottom right corner.  Double click on that tiny square and your formula is repeated all the way to where the data ends next to it.<br />
(Thanks to<a href="http://worldclasstech.wordpress.com/"> Todd Boehm</a> for posting this to the comments)</p></blockquote>
<p>The formula will now be copied to each row.</li>
<li>Select every row that contains the sql and paste into your database query window.</li>
<li>Run the queries and you are done.</li>
</ol>
<h2>An Example</h2>
<p>Given the following spreadsheet for some customers, I will show a simple formula to do an insert into the customer table.</p>
<table border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td></td>
<td><strong>A</strong></td>
<td><strong>B</strong></td>
<td><strong>C</strong></td>
<td><strong>D</strong></td>
</tr>
<tr>
<td>1</td>
<td>NAME</td>
<td>PHONE</td>
<td>SIGNUP_DATE</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>Joe Smith</td>
<td>(920) 555-1112</td>
<td>5/21/2010</td>
<td>= &#8220;insert into CUSTOMER (name,phone,signupDate) values (&#8216;&#8221; &amp; A2 &amp; &#8220;&#8216;, &#8216;&#8221; &amp; B2 &amp; &#8220;&#8216;, &#8216;&#8221; &amp; TEXT(C2,&#8221;M/dd/yyyy&#8221;) &amp; &#8220;&#8216;)&#8221;</td>
</tr>
</tbody>
</table>
<h2>Convert Excel Date to Text or String</h2>
<p>Notice the use of the TEXT function against the value for SIGNUP_DATE.  This is necessary with dates because Excel will spit that value out in a serial format, which isn&#8217;t what we want in our database.  Use the TEXT function to convert the Excel Date to text for the insert.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/377/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=377&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2011/01/27/use-excel-to-automate-data-entry/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Move PostgreSql Tables to a Different Schema</title>
		<link>http://blog.coreycoogan.com/2010/12/22/how-to-move-postgresql-tables-to-a-different-schema/</link>
		<comments>http://blog.coreycoogan.com/2010/12/22/how-to-move-postgresql-tables-to-a-different-schema/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 17:47:49 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[migrate database]]></category>
		<category><![CDATA[migrate schema]]></category>
		<category><![CDATA[Postgres]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[sql script]]></category>

		<guid isPermaLink="false">http://blog.coreycoogan.com/?p=371</guid>
		<description><![CDATA[Recently an application I&#8217;m working on had the need to move a mess of tables from the PG default &#8220;Public&#8221; schema to a new one, which we&#8217;re calling &#8220;Selection&#8221;. The more recent versions of PG (8.2 as of this writing) have a SET SCHEMA action available on the ALTER TABLE command. ALTER TABLE name SET [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=371&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently an application I&#8217;m working on had the need to move a mess of tables from the PG default &#8220;Public&#8221; schema to a new one, which we&#8217;re calling &#8220;Selection&#8221;.  The more recent versions of PG (8.2 as of this writing) have a SET SCHEMA action available on the ALTER TABLE command.</p>
<p><strong>ALTER TABLE name SET SCHEMA new_schema</strong></p>
<p>SET SCHEMA is very nice in that it not only moves the tables, but any associated indexes, sequences and constraints.</p>
<p>From the <a href="http://www.postgresql.org/docs/8.2/static/sql-altertable.html">8.2 Documentation</a>:</p>
<blockquote><p>This form moves the table into another schema. Associated indexes, constraints, and sequences owned by table columns are moved as well.</p></blockquote>
<p>This is all fine and good, but if you have more than a couple tables to move, this can be hassle.  Here&#8217;s how to use PG&#8217;s pg_tables System Table to generate the sql for every table in your database.  Run this query against the database that has the tables you wish to move.  Then simply copy/paste the output into another query window and execute.  Don&#8217;t forget to make the schema first!</p>
<p><pre class="brush: sql;">
select 'alter table &quot;' || tablename || '&quot; set schema &quot;Selection&quot;;' 
from pg_tables  
where schemaname='public';
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/371/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=371&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2010/12/22/how-to-move-postgresql-tables-to-a-different-schema/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
		<item>
		<title>Calling ASP.NET Web Service (ASMX) from JQuery</title>
		<link>http://blog.coreycoogan.com/2010/12/17/calling-asp-net-web-service-asmx-from-jquery/</link>
		<comments>http://blog.coreycoogan.com/2010/12/17/calling-asp-net-web-service-asmx-from-jquery/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 04:42:20 +0000</pubDate>
		<dc:creator>coreycoogan</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[asmx]]></category>
		<category><![CDATA[asp.net web services]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[scriptmethod]]></category>
		<category><![CDATA[scriptservice]]></category>
		<category><![CDATA[webmethod]]></category>

		<guid isPermaLink="false">https://coreycoogan.wordpress.com/?p=360</guid>
		<description><![CDATA[UPDATE: 12/17/2010 12:55 AM CST &#8211; Thanks to Dave&#8217;s comments below, I learned that the script service handles object serialization to JSON for me. This means that if your return type is that of an object, it will automatically serialize this object to JSON. If you want to create an anonymous object, such as you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=360&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong> 12/17/2010 12:55 AM CST &#8211; Thanks to Dave&#8217;s comments below, I learned that the script service handles object serialization to JSON for me.  This means that if your return type is that of an object, it will automatically serialize this object to JSON.  If you want to create an anonymous object, such as you may do from a LINQ query, just set your return type to &#8220;object&#8221;.  I thought I had to turn that into a string, but that&#8217;s not necessary.  Thanks again Dave. I also removed the [ScriptMethod] attribute, which is isn&#8217;t necessary and actually causes the JSON returned to be a string and not a JSON object.</p>
<p>I’ve not done anything real meaningful in Web Forms in some time, so I was very surprised at how much trouble I had trying to call a simple HelloWorld service from a jQuery Post and have it return some JSON back to my screen.  It took a couple hours to finally get it right, and I know I’m not the only one.  There are Stack Overflow posts about this and many blog posts as well. Unfortunately, as helpful as those posts were, it seems that I was still missing things&#8230; the things I’m going to cover in this here post.</p>
<h2>ASMX Web Service</h2>
<p>First, let’s start with the old school web service that I’d like to use to communicate with the client.  Sure I could go WCF, but an ASMX is just fine for my needs and darn simple. The important things to note on the service:</p>
<ul>
<li>To call a service from JavaScript, the service class must be decorated with the [ScriptService] attribute.</li>
<li>The service method should not decorated with the [ScriptMethod] attribute, only the [WebMethod] attribute.  The ScriptMethod causes the return JSON to be a string that needs to be deserialized on the client.  Without it, it comes down as a valid JSON object, automatically deserialized by jQuery for me.</li>
<li>If you are going to return a hardcoded JSON string for jQuery to parse, it has be formated with double quotes around the names and properties.  I was using single ticks, which I have gotten away with in some cases, but not here (return &#8220;{\&#8221;response\&#8221;:\&#8221;Hello World\&#8221;}&#8221;).</li>
<li>Mark the return type of the method to &#8220;object&#8221; if you want to return with an anonymous object from a LINQ query or something like that. </li>
</ul>
<p>This is an example of a working service:</p>
<p><pre class="brush: csharp;">
    [ScriptService]
    [WebService(Namespace = &quot;http://tempuri.org/&quot;)]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class HelloWorld : System.Web.Services.WebService
    {
        [WebMethod]
        //[ScriptMethod(ResponseFormat = ResponseFormat.Json)] Don't need this attribute.  
        public HelloWorldResponse SayIt(string name)
        {
            //the Identity of the logged in user is available
            var userName = HttpContext.Current.User.Identity.Name;
            
           return new HelloWorldResponse() {Name = name, NickName = &quot;Mad Dog&quot;};
        }

        public class HelloWorldResponse
        {
            public string Name { get; set; }
            public string NickName { get; set; }
        }
    }
</pre></p>
<h2>AJAX and jQuery</h2>
<p>Now for the jQuery, for which I’m using version 1.4.4.  Here’s the things that tripped me up:</p>
<ul>
<li>I was using a JQ <a href="http://api.jquery.com/jQuery.post/">$.post</a> call in my web pages to communicate with the server.  That caused me some problems in that the data was always returned as XML, no matter what I tried.  Knowing that $.post is a shortcut against the <a href="http://api.jquery.com/jQuery.ajax/">$.ajax</a> method, I switched to using that so I could explicitly set the contentType to “application/json”.  I do realize that I can probably set that on the $.post method, as I’m pretty sure I’ve done that in the past, but that can cause confusion, especially with new developers.</li>
<li>If you are accessing more than one service in more than place, create a utility method or use the <a href="http://api.jquery.com/jQuery.ajaxSetup/">$.ajaxSetup</a> method to configure the defaults.</li>
<li>If you don’t set the dataType to “json”, the response data is returned as xml.</li>
<li>If you don’t pass empty data when there are no parameters needed for the service, the response data will be returned as xml.</li>
<li>The dictionary passed to the service in the data parameter must be quoted or the service will throw a 500 error.  Web Service parameters are passed with the name of the parameter as the key (see example).</li>
<li>This is discovered soon enough, but the response from the service comes wrapped in another JSON object, available at the ‘d’ key.  If the value for ‘d’ is a JSON string, it will have to be deserialized into a proper JSON object.  I use jQuery’s <a href="http://api.jquery.com/jQuery.parseJSON/">$.parseJSON</a> function for that.  This example will return &#8216;d&#8217; as a proper JSON object.</li>
</ul>
<p><pre class="brush: jscript;">
&lt;script&gt;
    $(document).ready(function() {

        //this would be done in a common script file if you are going to
        //make a lot of these calls
        $.ajaxSetup({ type: 'POST', dataType: 'json', contentType: 'application/json', data: {} });

        $('#btn').click(function() { 
             //call the web service with the button is clicked
            $.ajax({ url: 'webservices/helloworld.asmx/SayIt',
                data: '{ &quot;name&quot;: &quot;Corey&quot; }', //ensure the data is enclosed in a quote
                success: function(data) {
                    var responseJson = data.d; //the real json is wrapped, get it and parse it
                    $('#sayit').html(responseJson.Name + ' aka ' + responseJson.NickName); //put the response value from the return json
                }
            });

            //return false to avoid a postback
            return false;
        });

    });
&lt;/script&gt;
</pre></p>
<p><pre class="brush: xml;">
&lt;div&gt;
	&lt;button id='btn'&gt;Load It&lt;/button&gt;
	&lt;div id='sayit'&gt;&lt;/div&gt;
&lt;/div&gt;
</pre></p>
<h2>Authorization and Authentication</h2>
<p>Any ASMX service written in our web project will be available to the world.  If you are using a ROLES and MEMBERSHIP provider and your site requires authentication, use the &lt;location&gt; tag in your web.config to lock down the directory where you put all your services.  In my example, I’ve put all my services in a WebServices directory and only authenticated users in the Admins role have access.</p>
<p><pre class="brush: xml;">
 &lt;location path=&quot;WebServices&quot;&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;deny users=&quot;?&quot;/&gt;
        &lt;allow roles=&quot;Admins&quot;/&gt;
        &lt;deny users=&quot;*&quot;/&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;
</pre></p>
<p>If the user is logged in, there will be an active IIdentity in HttpContext.Current.User.Identity, so your service can use that for authorization where necessary.</p>
<p><pre class="brush: csharp;">var userName = HttpContext.Current.User.Identity.Name;</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coreycoogan.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coreycoogan.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coreycoogan.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coreycoogan.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coreycoogan.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coreycoogan.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coreycoogan.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coreycoogan.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coreycoogan.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coreycoogan.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coreycoogan.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coreycoogan.wordpress.com/360/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coreycoogan.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coreycoogan.wordpress.com/360/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.coreycoogan.com&amp;blog=7719567&amp;post=360&amp;subd=coreycoogan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.coreycoogan.com/2010/12/17/calling-asp-net-web-service-asmx-from-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e09ede8123295427210e9a3565804401?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coreycoogan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
