<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8081104093023484777</id><updated>2011-10-27T23:49:59.337-04:00</updated><category term='search'/><category term='colorbox'/><category term='cocoa'/><category term='flash'/><category term='awakeFromNib'/><category term='wmode'/><category term='software'/><category term='lightbox'/><category term='html'/><category term='stack overflow'/><category term='programming'/><category term='google'/><title type='text'>Coding Scars</title><subtitle type='html'>Helping programmers avoid the same mistakes</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codingscars.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://codingscars.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Austin Grigg</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-mjOCYiATFKg/AAAAAAAAAAI/AAAAAAAAANo/f5b3k-2ZWBM/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8081104093023484777.post-2854945849531931482</id><published>2010-03-10T14:25:00.068-05:00</published><updated>2010-03-10T18:24:45.592-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stack overflow'/><category scheme='http://www.blogger.com/atom/ns#' term='search'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Why I Don't Use Stack Overflow's Search</title><content type='html'>Let me preface this by saying, I love &lt;a href="http://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt;. &amp;nbsp;I got hooked listening to Jeff and Joel talk about how they built the site using asp.net mvc and managing their own servers on the podcast. &amp;nbsp;I think they've created an incredible resource for programmers and a vibrant community. &amp;nbsp;I've gotten numerous questions answered there and done my best to provide some answers of my own.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The site is fast, clean, and they continue to make small, cohesive improvements that make for a great experience. &amp;nbsp;I can tell they put a lot of thought into every aspect of the site and continue to refine and refactor.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The one issue I take with stackoverflow.com is the search. &amp;nbsp;Like many (maybe most) people I started finding Stack Overflow answers through searching in Google. &amp;nbsp;Joel and Jeff have made it pretty clear that they intend, or expect, for this to be the&amp;nbsp;predominant way people reach Stack Overflow questions, and it works great. &amp;nbsp;But, after finding a number of great answers at Stack Overflow I began to go there first. &amp;nbsp;I didn't want to have to filter through Google search results to find the Stack Overflow answers. &amp;nbsp;But I ended up going back to Google because I couldn't find what I was looking for using the search on stackoverflow.com&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For example, I was looking for a way to remove all non-numeric characters from a string using c# the other day. &amp;nbsp;So, I typed "c# strip numbers" in the search box on stackoverflow.com and the 3 results were:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://stackoverflow.com/questions/2287471/how-to-strip-email-and-phone-numbers-from-html-input"&gt;How-to strip email and phone numbers from html input?&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://stackoverflow.com/questions/1108585/strip-wav-header-in-c"&gt;Strip wav header in c#&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://stackoverflow.com/questions/74479/scalable-moebius-strip-in-wpf"&gt;Scalable Moebius strip in WPF&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Not at all what I was looking for. &amp;nbsp;So, I want to use Google and limit the results only to stackoverflow.com -- in comes &lt;i&gt;site: &amp;nbsp;&lt;/i&gt;Add &lt;i&gt;site:stackoverflow.com &lt;/i&gt;to the end of any Google search and boom, relevant search results from stackoverflow.com! &amp;nbsp;This has been well documented &lt;a href="http://stackoverflow.com/search"&gt;on the site&lt;/a&gt; and &lt;a href="http://blog.stackoverflow.com/2008/10/stack-overflow-search-now-51-less-crappy/"&gt;on the blog&lt;/a&gt;, but I find using this trick in my browser search bar to be easiest. Typing in the same search into Google using &lt;i&gt;:site &lt;/i&gt;"c# strip numbers site:stackoverflow.com" yields:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://stackoverflow.com/questions/262448/replace-non-numeric-with-empty-string"&gt;Replace non-numeric with empty string - Stack Overflow&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Exactly what I was looking for! &amp;nbsp;To be fair, the search on Stack Overflow yields useful result sometimes (particularly when using tags), but for now, I'm going to stick with Google and&amp;nbsp;&lt;i&gt;site:stackoverflow.com. &amp;nbsp;&lt;/i&gt;Stack Overflow &lt;a href="http://blog.stackoverflow.com/2009/07/stack-overflow-search-now-61-less-crappy/"&gt;continues to improve their search&lt;/a&gt;, but it is hard to beat Google, &lt;cite title="Jeff Atwood"&gt;the most important website in the history of recorded time.&lt;/cite&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8081104093023484777-2854945849531931482?l=codingscars.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingscars.blogspot.com/feeds/2854945849531931482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingscars.blogspot.com/2010/03/why-stack-overflows-search-is-useless.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/2854945849531931482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/2854945849531931482'/><link rel='alternate' type='text/html' href='http://codingscars.blogspot.com/2010/03/why-stack-overflows-search-is-useless.html' title='Why I Don&apos;t Use Stack Overflow&apos;s Search'/><author><name>Austin Grigg</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-mjOCYiATFKg/AAAAAAAAAAI/AAAAAAAAANo/f5b3k-2ZWBM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8081104093023484777.post-6355487479838802928</id><published>2010-03-09T20:20:00.004-05:00</published><updated>2010-03-09T20:24:47.934-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='colorbox'/><category scheme='http://www.blogger.com/atom/ns#' term='wmode'/><category scheme='http://www.blogger.com/atom/ns#' term='lightbox'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Get Flash to Appear Over Lightbox</title><content type='html'>It's a simple thing, but it is annoying when you use a lightbox (like &lt;a href="http://www.huddletogether.com/projects/lightbox2/"&gt;lightbox 2&lt;/a&gt;, &lt;a href="http://jquery.com/demo/thickbox/"&gt;thickbox&lt;/a&gt;, or my new favorite &lt;a href="http://colorpowered.com/colorbox/"&gt;colorbox&lt;/a&gt;) and a flash video that is on the page shows up over the lightbox. &amp;nbsp;The good news is that the fix is simple: add a wmode param to your object tag and wmode="transparent" to the embed tag. &amp;nbsp;So, your &amp;lt;object&amp;gt; tag would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&amp;nbsp;codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"&amp;nbsp;width="300" height="300"&amp;gt;
    &amp;lt;param name="movie" value="movie.swf"&amp;gt; 
    &amp;lt;param name="quality" value="high"&amp;gt; 
    &amp;lt;param name="wmode" value="transparent"&amp;gt; 
    &amp;lt;embed src="movie.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="300"&amp;gt;&amp;lt;/embed&amp;gt;
&amp;lt;/object&amp;gt;&lt;/pre&gt;
Hope that helps someone out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8081104093023484777-6355487479838802928?l=codingscars.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingscars.blogspot.com/feeds/6355487479838802928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingscars.blogspot.com/2010/03/get-flash-to-appear-over-lightbox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/6355487479838802928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/6355487479838802928'/><link rel='alternate' type='text/html' href='http://codingscars.blogspot.com/2010/03/get-flash-to-appear-over-lightbox.html' title='Get Flash to Appear Over Lightbox'/><author><name>Austin Grigg</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-mjOCYiATFKg/AAAAAAAAAAI/AAAAAAAAANo/f5b3k-2ZWBM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8081104093023484777.post-8785959629103959123</id><published>2009-10-24T10:41:00.002-04:00</published><updated>2009-10-24T10:44:34.280-04:00</updated><title type='text'>Simple CSS Tips</title><content type='html'>It wasn't that long ago that the de-facto way to layout web pages was to use tables. &amp;nbsp;You ended up with these heinously nested tables that made it very difficult to find anything in your code and were not very flexible. &amp;nbsp;Then came the advent of CSS. &amp;nbsp;It opened up a lot of possibilities, but it could be abused, or misused just as easily as tables -- you still see a lot of very poorly written CSS that is worse to maintain that tables.&lt;br /&gt;
&lt;br /&gt;
All that to say, it took me a while to feel really comfortable with CSS, but here are a few tips and tricks I've picked up along the way to make your CSS clean and reusable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: x-large;"&gt;Tip 1&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: x-large;"&gt;&amp;nbsp;margin: 0 auto;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
One of the most confusing things to me when I started using CSS was trying to figure out how to align something centered on the page. &amp;nbsp;The trick is to create a div, set the width you want and set the margin to 0 auto. &amp;nbsp;The first 0 tells the div to have no top or bottom margin and the auto tells the left and right margins to have equal margin, aligning the div in the center of the page.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;#wrapper
{
    width:600px;
    margin: 0 auto;
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: x-large;"&gt;Tip 2 &lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: x-large;"&gt;Multiple Classes&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You can assign multiple classes to your html elements. &amp;nbsp;For example, You might have a class called "product" that set a particular font size and color for a product on your website. &amp;nbsp;You could keep the product class on your div and add to it a "featured" class that might highlight the product using a background color. &amp;nbsp;The beauty of CSS is that you can apply both classes and not have to replicate the product attributes in the featured class.  You separate multiple classes with a space in your HTML. &amp;nbsp;Here is an example below:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;div class="product featured"&amp;gt;
    &amp;lt;h3&amp;lt;Chacos&amp;gt;/h3&amp;gt;
    The best thing your feet have ever walked in!
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;.product {
    width: 150px;
    height: 150px;
    font-family: Arial;
}

.product h3 {
    font-weight:bold;
    font-family: Tahoma, Verdana;
}

.product.featured { /* This applies to elements with product and featured applied. */
    background-color: Red;
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;span style="font-size: x-large;"&gt;&lt;b&gt;Tip 3 &lt;/b&gt;Absolute Positioning&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Absolute positioning can be abused, but it is very helpful sometimes. &amp;nbsp;When you want to stick something somewhere and don't want it's positioning affected by other things on the page, absolute positioning is the way to go. &amp;nbsp;A lot of times I'll have a header div and I want the menu to sit at the bottom right of the header. &amp;nbsp;You could float the menu right and add top margin until it was positioning at the bottom of the header, but what if you change the height of the header, you then have to adjust your margin. &amp;nbsp;Here is some html and css I typically use for this type of setup (simplified):&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;div id="header"&amp;gt;
    &amp;lt;ul id="menu"&amp;gt;
        &amp;lt;li&amp;gt;&amp;lt;a href="Home.aspx"&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
        &amp;lt;li&amp;gt;&amp;lt;a href="About.aspx"&amp;gt;About us&amp;lt;/a&amp;gt;&amp;lt;li&amp;gt;
        &amp;lt;li&amp;gt;&amp;lt;a href="Contact.aspx"&amp;gt;Contact Us&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
    &amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;#header {
    width:900px;
    height:100px;
    background-color: Blue;
    position: relative; /* Important so our menu is positioned relative to the header */
}

#menu {
    position:absolute;
    bottom: 5px;
    right: 10px;
    list-style: none;
}

#menu li {
    display:inline;
    margin-left:10px;
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8081104093023484777-8785959629103959123?l=codingscars.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingscars.blogspot.com/feeds/8785959629103959123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingscars.blogspot.com/2009/10/simple-css-tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/8785959629103959123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/8785959629103959123'/><link rel='alternate' type='text/html' href='http://codingscars.blogspot.com/2009/10/simple-css-tips.html' title='Simple CSS Tips'/><author><name>Austin Grigg</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-mjOCYiATFKg/AAAAAAAAAAI/AAAAAAAAANo/f5b3k-2ZWBM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8081104093023484777.post-4045329599452744271</id><published>2009-10-08T19:15:00.002-04:00</published><updated>2009-10-09T16:01:24.362-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='awakeFromNib'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='cocoa'/><title type='text'>[super awakeFromNib]</title><content type='html'>Being my first blog post, it seems appropriate that I deal with awakeFromNib.  I work for a &lt;a href="http://www.icnventures.com/"&gt;software company&lt;/a&gt; developing websites on a Microsoft stack, but I've been playing around with Cocoa for almost a year now and it has been a lot of fun to work with.  It is always challenging to work with a new technology and who doesn't like to work on a mac?&lt;br /&gt;
&lt;br /&gt;
My hope is to share some things I've learned along the way as a software developer and help other people avoid the mistakes I've made. I got the idea of Coding Scars from my friend Ken, who mentored me as a programer.  Just about every time I am pulling my hair out over some nasty bug and I call Ken over, he usually knows the answer in a few minutes.  I tell him how incredible he is and he always says, "Scars, I just have more scars."  So, hopefully those days when you trace down through the debugger or spend a week parsing web service xml, you are developing some coding scars that will serve you well later.&lt;br /&gt;
&lt;br /&gt;
With that out of the way, I spent the last week trying to debug a nasty issue, that ended up being a dumb mistake.  I had a subclassed NSWindowController that I was using to load a window from a nib and show it on the screen.  My code to load the nib and show the window was as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;-(IBAction)showCustomWindow:(id)sender 
{
    if(!windowController){
        windowController = [[MyWindowController alloc] initWithWindowNibName:@"MyWindow"];
    }

    [windowController showWindow:self];
}
&lt;/pre&gt;
&lt;br /&gt;
On a machine running 10.6 when showCustomWindow was called, the window would show as normal; however, on 10.5 the method would have to be called twice before the window would appear.  I was using functions that were available on both 10.5 and 10.6 (10.0 for that matter), so I couldn't figure it out.&lt;br /&gt;
&lt;br /&gt;
Finally, I bit the bullet and pulled down my project in XCode onto a machine running 10.5 and ran it through the debugger.  I finally realized that my app was failing when the nib was loaded and a subclass of NSView in my nib called it's awakeFromNib function.  My awakeFromNib looked like:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;- (void)awakeFromNib
{
    [super awakeFromNib];

    .... bind to objects ....
}
&lt;/pre&gt;
&lt;br /&gt;
Seemed perfectly normal to me!  But, as I came to find out, not every super class implements awakeFromNib!  So, when I called [super awakeFromNib] it failed with a "does not respond to selector".  The simple solution is to take out the [super awakeFromNib], but a little more elegant solution is to check to see if the superclass responds to awakeFromNib, like so:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;if([NSView instancesRespondToSelector:@selector(awakeFromNib)]) {
    [super awakeFromNib];
}
&lt;/pre&gt;
&lt;br /&gt;
With that change, it worked like a dream.  Note: I initially thought i could do:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;if([super respondsToSelector:@selector(awakeFromNib)]) {
    [super awakeFromNib];
}
&lt;/pre&gt;
&lt;br /&gt;
but, you can't call respondsToSelector on super in awakeFromNib, it seems to always return true.  So, hopefully this has been helpful or informative and will save someone else some pain.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8081104093023484777-4045329599452744271?l=codingscars.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingscars.blogspot.com/feeds/4045329599452744271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codingscars.blogspot.com/2009/10/super-awakefromnib.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/4045329599452744271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8081104093023484777/posts/default/4045329599452744271'/><link rel='alternate' type='text/html' href='http://codingscars.blogspot.com/2009/10/super-awakefromnib.html' title='[super awakeFromNib]'/><author><name>Austin Grigg</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-mjOCYiATFKg/AAAAAAAAAAI/AAAAAAAAANo/f5b3k-2ZWBM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry></feed>
