<?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-3296335177913866771</id><updated>2012-01-25T13:55:00.451-05:00</updated><category term='video'/><category term='SAP'/><category term='jQuery'/><category term='SQL'/><category term='Java'/><category term='hardware'/><category term='AviSynth'/><category term='misc'/><category term='.NET'/><title type='text'>C O D E R Y</title><subtitle type='html'>Adventures in .NET, SQL, Java, SAP ECC6, etc.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codery.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>42</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-1505272705602990398</id><published>2011-10-13T14:23:00.000-04:00</published><updated>2011-10-13T14:27:08.495-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Not happy with .NET's FileSystemWatcher</title><content type='html'>I created a Windows Service to watch for a specific file, which heavily relies on the FileSystemWatcher class. I'm not sure it was worth the hassle over using Timer to just check for the file at a certain interval.&lt;br /&gt;&lt;br /&gt;FileSystemWatcher fires an event when a file is created, which is great, except that it seems that it fires the millisecond the file starts to be created (acting more like a "Creating" event...). This was causing problems for me, because my relatively small file was apparently still being written to while I was trying to send it as an attachment and subsequently delete it. There is no "ReallyDoneBeingCreated" event. There is a "Change" event, but that was causing me even more problems.&lt;br /&gt;&lt;br /&gt;I ended up adding "Thread.Sleep(30000)" (waits for a minute) after it sees there is a new file. This is crap. I HATE doing stuff like this, but it works, since it takes about a second to create the file in my case. The only other thing I could think of doing is having some crazy recursive try/catch loop that fails, tries again and again until it succeeds. This is ugly, too, but would probably be better if the file size was unknown.&lt;br /&gt;&lt;br /&gt;My kludge is upsetting me to the point that I may just end up re-writing the code to use a timer interval to check for a new file, but that is a bit backwards, &amp;nbsp;too. Can't win. Anybody know of a better way of doing this?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-1505272705602990398?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/1505272705602990398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=1505272705602990398' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1505272705602990398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1505272705602990398'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2011/10/not-happy-with-nets-filesystemwatcher.html' title='Not happy with .NET&apos;s FileSystemWatcher'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-2790770308706268627</id><published>2011-09-09T09:26:00.000-04:00</published><updated>2011-09-09T09:34:19.851-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video'/><category scheme='http://www.blogger.com/atom/ns#' term='AviSynth'/><title type='text'>Converting a QuickTime .mov (ProRes codec) to a Windows AVI</title><content type='html'>On the phone last month to our video production agency, I told them I could work with any video format. Yesterday I was afraid they had proved me wrong.&lt;br /&gt;&lt;br /&gt;They sent me a QuickTime .mov encoded with the ProRes codec. This was their source format, and the goal was to ensure no loss of quality on their side, so this wasn't just some crazy attempt on their part to trip me up :-). In any case, I figured any standard video converter (like AVC) could handle this, but nothing I tried worked. I then remembered the amazing FFMPEG from my DVR-building days, and was sure this could easily do the conversion if I could just figure out the correct command-line args. Still no luck. I kept getting the error, "swScalar: Unknown format is not supported as input pixel format". Some searching provided some clues that this was due to mapping, so based on a forum post suggestion, I tried adding the flags, "-map 0:0 -map 0:1". I then got a "codec type mismatch error". I installed the ProRes QuickTime decoder, but this didn't help either.&lt;br /&gt;&lt;br /&gt;Finally, I happened upon the following solution:&lt;br /&gt;&lt;br /&gt;- install AviSynth (&lt;a href="http://avisynth.org/mediawiki/Main_Page"&gt;http://avisynth.org/mediawiki/Main_Page&lt;/a&gt;)&lt;br /&gt;- add the QTSource dll to AviSynths "plugins" directory (&lt;a href="http://www.tateu.net/software/dl.php?f=QTSource"&gt;http://www.tateu.net/software/dl.php?f=QTSource&lt;/a&gt;)&lt;br /&gt;- install VirtualDub (&lt;a href="http://www.virtualdub.org/"&gt;http://www.virtualdub.org/&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;Then you just need to write an AviSynth script in the same directory as the video file and name it with an ".avs" extension:&lt;br /&gt;&lt;pre class="csharp" name="code"&gt;QTInput("C:\test.mov", audio=1)&lt;br /&gt;BicubicResize(720,486,0.1,1.00).AssumeFPS(29.97)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;(BTW, the documentation for QTSource says to use audio=true, but AviSynth was having none of that.)&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;- open the .avs file as if it was a video in VirtualDub&lt;br /&gt;- save as .avi&lt;br /&gt;&lt;br /&gt;Whew. I was about five minutes away from admitting defeat and asking them for a different format. Aside from bruising my ego a bit, this would have wasted at least another day or two that I didn't have to spare.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-2790770308706268627?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/2790770308706268627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=2790770308706268627' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2790770308706268627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2790770308706268627'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2011/09/converting-quicktime-mov-prores-codec.html' title='Converting a QuickTime .mov (ProRes codec) to a Windows AVI'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-6874498403226132615</id><published>2011-07-28T11:52:00.007-04:00</published><updated>2011-07-28T12:26:15.387-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>C# recursive file counter</title><content type='html'>I am constantly surprised with how easy .NET makes things sometimes. I needed a quick recursive file counter output to a report, and was able to write this in just a few minutes, using some new methods available in .NET 4 (EnumerateFiles/Directories):&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;   string startingDir = @"C:\files";&lt;br /&gt;   string reportFile = @"C:\file_count.txt";&lt;br /&gt;&lt;br /&gt;   using (StreamWriter report = new StreamWriter(reportFile))&lt;br /&gt;   {&lt;br /&gt;        countFiles(startingDir, report);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private static void countFiles(string dir, StreamWriter report) {&lt;br /&gt;   DirectoryInfo directory = new DirectoryInfo(dir);&lt;br /&gt;   IEnumerable&lt;fileinfo&gt; files = directory.EnumerateFiles();&lt;br /&gt;   IEnumerable&lt;directoryinfo&gt; dirs = directory.EnumerateDirectories();&lt;br /&gt;&lt;br /&gt;   report.WriteLine(String.Format("{0}: {1}", dir, files.Count()));&lt;br /&gt;&lt;br /&gt;   foreach (var d in dirs)&lt;br /&gt;   {&lt;br /&gt;        CountFiles(d.FullName, report);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It works very quickly (100,000 files in as much as 8 directories deep in less than 30 seconds on a modest machine), and couldn't have been more straightforward to write.&lt;br /&gt;&lt;br /&gt;BTW, if all you need is just a total file count, this works well:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;DirectoryInfo d = new DirectoryInfo(startingDir);&lt;br /&gt;int totalCount = d.EnumerateFiles("*.*", SearchOption.AllDirectories).Count();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After thinking about this some more, I wonder if this may even be easier/more efficient with LINQ. I've got to try that for fun, and check the performance of each.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-6874498403226132615?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/6874498403226132615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=6874498403226132615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/6874498403226132615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/6874498403226132615'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2011/07/c-recursive-file-counter.html' title='C# recursive file counter'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8511563861175357061</id><published>2011-07-20T09:49:00.019-04:00</published><updated>2011-07-20T17:03:40.889-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>Graphical Saccades</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/-cP25OP8k-pc/TibviK1wUEI/AAAAAAABe1o/EaEtVrwRO8k/s1600/saccades.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="float:right; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 366px; height: 125px;" src="http://1.bp.blogspot.com/-cP25OP8k-pc/TibviK1wUEI/AAAAAAABe1o/EaEtVrwRO8k/s400/saccades.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5631451754377793602" /&gt;&lt;/a&gt;My son is working through some vision issues, and one of the exercises his vision therapist has him do is called "saccades", basically quick movements of the eyes in the same direction. She gave us a web site that had an animated gif that sequentially displayed a bunch of lines of numbers, at varying distances apart.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This was quite boring for my son, so my wife had an idea for me to make a version of this with pictures of things that he liked. He absolutely LOVES this version of the "game", and wants to play it all the time! &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The exercise randomly displays 20 images at varying distances (five lines with four images per line), and can include the same image more than once. The speed can be adjusted before the run, or in progress.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;From what I understand, the important part of the exercise is just to track and identify sequentially revealed items at the same pace, but at varying distances apart. I would love to hear from any vision therapists out there, though, to make sure that this is correct, and that a graphical version still satisfies the objective. Our therapist is out for a few weeks, so I can't ask her about it now, but I'll update the post when I get any new information. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you want to try it out yourself, &lt;a href="https://docs.google.com/viewer?a=v&amp;amp;pid=explorer&amp;amp;chrome=true&amp;amp;srcid=0B-n7GjZtU23MYmJiM2FhNDktNWM5Ni00MTk3LWFjYWMtMTI5M2U1OTExZTI2&amp;amp;hl=en_US"&gt;here's a zip file&lt;/a&gt; (under the Google Docs icon, click "File" --&amp;gt; "Download Original") with the code and a few sample images. It's set up to go with 30 random images, but it's easily customizable if you want to use your own images, or add more. To run it, just unzip the .zip file, and double-click on the .html file that best fits your screen.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the meantime, I'm working on getting the exercise set up on its own web site, but I'm having a hard time finding a free web site provider that allows HTML.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Technically, this was a breeze to do with jQuery. I define an array of images, and use code similar to JavaScript built-in "setTimeout", but with the ability to adjust the interval in progress (thanks, &lt;a href="http://stackoverflow.com/users/8815/peter-bailey"&gt;Peter Bailey&lt;/a&gt;, for the brilliant &lt;a href="http://stackoverflow.com/questions/1280263/changing-the-interval-of-setinterval-while-its-running"&gt;function&lt;/a&gt;). The key lines are:&lt;/div&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;vi = setVariableInterval(function() {&lt;br /&gt; if (currentItem == 20) {&lt;br /&gt;    this.stop();&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; randomSpacer = Math.floor(Math.random() * maxPixelLength) + minPixelLength;&lt;br /&gt; randomPicture = Math.floor(Math.random() * pictures.length);&lt;br /&gt;&lt;br /&gt; replacementPic = "&amp;lt;img class='p' src='" + pictures[randomPicture].src + "' width='100' height='75' style='margin-left: " + randomSpacer + "px;' /&amp;gt;";&lt;br /&gt; $(pics[currentItem]).replaceWith(replacementPic);&lt;br /&gt;&lt;br /&gt; currentItem++;&lt;br /&gt;}, initialInterval);&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;"randomSpacer" and "randomPicture" create random numbers up to the defined maximums. And the jQuery line just replaces each placeholder with a random image. "pics" lets me access via index all images that use the "p" class (they are initially set up with placeholders).&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;pre name="code" class="java"&gt;pics = $(".p");&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8511563861175357061?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8511563861175357061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8511563861175357061' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8511563861175357061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8511563861175357061'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2011/07/graphical-saccades.html' title='Graphical Saccades'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-cP25OP8k-pc/TibviK1wUEI/AAAAAAABe1o/EaEtVrwRO8k/s72-c/saccades.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-3186044055385229952</id><published>2011-06-09T08:25:00.004-04:00</published><updated>2011-06-09T12:16:47.472-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='SAP'/><title type='text'>Avoiding the "Destination configuration already initialized" error in SAP .NET Connector 3</title><content type='html'>&lt;div&gt;SAP's documentation suggests using a line similar to the following to create a connection to SAP:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;RfcDestinationManager.RegisterDestinationConfiguration(new Config());&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;where Config() is a class that contains connection settings.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This works fine, except, you occasionally get the error, "Destination configuration already initialized", because the connection hasn't timed out. SAP's documentation that I've seen (the .chm help file and the "Overview" document) doesn't address this issue at all, and their sample code doesn't contain any examples of how to close a connection.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've found that the following code works:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Config c = new Config();&lt;/div&gt;&lt;div&gt;RfcDestinationManager.RegisterDestinationConfiguration(c);&lt;/div&gt;&lt;/div&gt;&lt;div&gt;...&lt;/div&gt;&lt;div&gt;(processing code)&lt;/div&gt;&lt;div&gt;...&lt;/div&gt;&lt;div&gt;RfcDestinationManager.UnregisterDestinationConfiguration(c);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, if you've just tried to connect without using "unregister", you'll have to wait until the old connection times out itself before trying the code above (the sample config code SAP provides keeps the connection open for 10 minutes).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Overall, I've found the new SAP Connector 3 to be a HUGE step up from v2, though it is quite a pain having to re-write all of my v2 applications. But I easily prefer a few months of re-writing over being tied to VS2003. Thanks, SAP, for updating this - I thought you had forgotten about us .NET developers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-3186044055385229952?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/3186044055385229952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=3186044055385229952' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3186044055385229952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3186044055385229952'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2011/06/avoiding-destination-configuration.html' title='Avoiding the &quot;Destination configuration already initialized&quot; error in SAP .NET Connector 3'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-2601926880485351028</id><published>2011-04-13T09:51:00.005-04:00</published><updated>2011-04-13T10:06:21.219-04:00</updated><title type='text'>Displaying ActiveDirectory's "whenChanged" attribute in C#</title><content type='html'>"whenChanged" comes through without the time offset. Not a big deal to fix it, but a quick Google search yielded no results on how to deal with it. Here's my solution to properly display Eastern Daylight/Standard time:&lt;br /&gt;&lt;pre&gt;TimeZone localZone = TimeZone.CurrentTimeZone;&lt;br /&gt;DateTime generalizedDate = DateTime.Parse(result.Properties["whenChanged"][0].ToString());&lt;br /&gt;double hourDelta = localZone.IsDaylightSavingTime(generalizedDate) ? -4D : -5D;&lt;br /&gt;DateTime lastUpdated = generalizedDate.AddHours(hourDelta);&lt;/pre&gt;BTW, Sysinternals' &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb963907"&gt;AD Explorer&lt;/a&gt; is great for finding out meta information (i.e. data type, property name) about AD attributes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-2601926880485351028?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/2601926880485351028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=2601926880485351028' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2601926880485351028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2601926880485351028'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2011/04/displaying-activedirectorys-whenchanged.html' title='Displaying ActiveDirectory&apos;s &quot;whenChanged&quot; attribute in C#'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8695378734506425258</id><published>2010-07-13T16:45:00.006-04:00</published><updated>2010-07-13T16:55:41.472-04:00</updated><title type='text'>EXCEPT to compare output of two queries</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Very&lt;/span&gt; helpful SQL Server 2005+ commands:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2007/05/02/60194.aspx"&gt;http://weblogs.sqlteam.com/jeffs/archive/2007/05/02/60194.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I had to find the different rows of two pretty complex, non-related queries, and decided to look up if there was an easier way to do than by exploiting UNION (a technique I think I picked up from the same author, actually...). Turns out you just need to put and EXCEPT in between the queries. That's it.&lt;br /&gt;&lt;br /&gt;I just found this last week and have probably already used it five times. It makes me want to get a book on SQL Server 2008 to see what other time-savers I can find, especially I'm analyzing LOTS of data these days.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8695378734506425258?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8695378734506425258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8695378734506425258' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8695378734506425258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8695378734506425258'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2010/07/except-to-compare-output-of-two-queries.html' title='EXCEPT to compare output of two queries'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-1395649081737197451</id><published>2010-06-25T15:17:00.003-04:00</published><updated>2010-06-25T15:24:45.589-04:00</updated><title type='text'>Quick way to see what SQL data was updated</title><content type='html'>I had a crazy update query I was trying to troubleshoot, and for the life of me could not figure out why it insisted on updating some rows after they had already been updated by a prior run. Here's the quick one-time-use trigger I came up with to see exactly what was updated:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;CREATE TRIGGER dbo.ViewUpdatedRecords&lt;br /&gt;   ON  (table name)&lt;br /&gt;   AFTER UPDATE&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;    SELECT *&lt;br /&gt;    INTO UpdatedRecords&lt;br /&gt;    FROM INSERTED&lt;br /&gt;END&lt;br /&gt;GO&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It only works one time, as SELECT INTO creates a table and will complain if a table by that name already exists. But it only took a minute to write, and helped me solve my issue very quickly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-1395649081737197451?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/1395649081737197451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=1395649081737197451' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1395649081737197451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1395649081737197451'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2010/06/quick-way-to-see-what-sql-data-was.html' title='Quick way to see what SQL data was updated'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8993545656702786209</id><published>2010-04-27T22:48:00.003-04:00</published><updated>2010-04-27T23:14:58.735-04:00</updated><title type='text'>New DVR, finally</title><content type='html'>I've finally put together a DVR out of spare parts. I built one before (and even got mentioned in &lt;a href="http://www.wired.com/science/discoveries/news/2006/03/70328?currentPage=2"&gt;Wired&lt;/a&gt; magazine), making my regular desktop do double duty, with a wireless 802.11B connection to the living room. On the TV side, a small Linux box (Hauppauge MediaMVP) decoded the video and handled the remote. It worked well about 95% of the time, but when it didn't work, it was a nightmare to troubleshoot. And you couldn't use the microwave, talk on the phone, or look funny at it... It also took me a month to build - mostly spent researching and tuning my network connection and figuring out my way around FFMPEG to compress the video.&lt;br /&gt;&lt;br /&gt;When we moved to another house, it just wouldn't work reliably anymore, no matter what I did. I ditched the project for awhile, but picked it back up again when I got a free 10-year old computer - a Celeron 733Mhz with 64MB RAM. This was more an exercise in getting a slimmed down version of Linux (Mythbuntu/Xubuntu) to work more than anything else. I was able to get it to record shows, but not play them :-)&lt;br /&gt;&lt;br /&gt;A few weeks ago, my neighbor gave me an old Dell 4300 1.8GHz machine. It wouldn't boot, but I found out that all it needed was a new power supply. I put an nVidia 5200 128MB card in it, a new quieter fan, and 1GB of RAM that I had saved from another dead computer, and it runs XP Media Center 2005 great (as long as you buy the $20 nVidia PureVideo software - not sure why this is required, but it is). It even runs Hulu perfectly (if you set it to medium quality) via a browser, but it chokes using Hulu desktop for some reason.&lt;br /&gt;&lt;br /&gt;So now my kids are happy b/c they always have their PBS shows on tap, and my wife is happy, as she can watch her CBS shows. And this one only took me a few hours to set up. The thorn has been removed from my side.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8993545656702786209?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8993545656702786209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8993545656702786209' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8993545656702786209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8993545656702786209'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2010/04/new-dvr-finally.html' title='New DVR, finally'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-3055231118177483939</id><published>2010-04-09T09:52:00.010-04:00</published><updated>2010-04-09T10:46:42.748-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL job retry (with additional logic) on fail</title><content type='html'>Here's some code I put together to get a SQL Server 2005 job to retry on fail. I spent a while looking for how to just have the job scheduler retry on  fail, and found nothing. Of course, right after I coded and tested this,  I found out a way to easily retry individual steps on fail, which is  probably the way you want to do it 95%+ of the time :-), but just in case someone has the need to retry a job programatically and insert additional logic, or have more control over the process, or just wants to see how it could otherwise be done (ok, maybe at this point I'm just trying to justify wasting 20 minutes of my life coding this manually...), here's the code:&lt;br /&gt;&lt;br /&gt;USE msdb&lt;br /&gt;&lt;br /&gt;IF(&lt;br /&gt;SELECT COUNT(*)&lt;br /&gt;FROM sysjobhistory&lt;br /&gt;WHERE&lt;br /&gt; -- status 0 = error&lt;br /&gt; run_status = 0&lt;br /&gt; -- isolate the step we're looking for&lt;br /&gt; AND step_name = '(job outcome)'&lt;br /&gt; -- job unique ID (find this out by going to the job properties, and selecting "Script")&lt;br /&gt; AND job_id = '48F4EE80-62C7-4DFF-8F6F-D009F616DA07'&lt;br /&gt; -- today's date in the same style as the job history table format&lt;br /&gt; AND run_date = CONVERT(VARCHAR(8), GETDATE(), 112)&lt;br /&gt;) &gt; 0&lt;br /&gt;BEGIN&lt;br /&gt;-- insert additional logic here&lt;br /&gt;&lt;br /&gt;EXEC sp_start_job @job_name='[JOB YOU WANT TO RETRY]'&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And here's the easy way:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_25EyoA9sNoQ/S783kr2f1ZI/AAAAAAABZHM/cCr74_sO7iM/s1600/job_step.png"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 400px; height: 130px;" src="http://3.bp.blogspot.com/_25EyoA9sNoQ/S783kr2f1ZI/AAAAAAABZHM/cCr74_sO7iM/s400/job_step.png" alt="" id="BLOGGER_PHOTO_ID_5458142376782452114" border="0" /&gt;&lt;/a&gt;Right-click on the job, choose "Properties". Click on "Steps", and select the step you want to retry. Click on "Advanced", and set the "Retry attempts" and "Retry interval". Repeat for additional steps. Done. D'oh!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-3055231118177483939?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/3055231118177483939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=3055231118177483939' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3055231118177483939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3055231118177483939'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2010/04/sql-job-retry-with-additional-logic-on.html' title='SQL job retry (with additional logic) on fail'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_25EyoA9sNoQ/S783kr2f1ZI/AAAAAAABZHM/cCr74_sO7iM/s72-c/job_step.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-5842503187818388019</id><published>2010-01-13T10:53:00.013-05:00</published><updated>2010-01-14T21:31:33.494-05:00</updated><title type='text'>Back to Windows</title><content type='html'>I'm back on Windows after a few months of using Linux exclusively at home. I still like Linux quite a bit, and am running a few distros in virtual machines now just so I can keep my skills up (and to support relatives who I switched to Linux - more on that in a bit), but I switched my main OS back to Windows because of the lack of usable audio and video tools, which I use all the time.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Not sure if "usable" is really the right word, but for me it's just so much more of a pain to work with the audio and video tools I found on Linux that were supposedly "best of breed" (Rosegarden and Ardour for audio, Kino and PiTiVi for video. I tried to get the Cinelerra and the highly-rated OpenShot video editor to work, but ran into lots of issues.) The audio tools were very difficult to set up, and the interfaces are nowhere near as slick as Mackie Tracktion 2 for Windows. Kino and PiTiVi were a total joke.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I initially bought into the idea that since it was open source software, I could fix and improve the software I wanted to work with. But the IDEs that I tried are nowhere near the level of VisualStudio, the languages they were written in I was unfamiliar with, and I just don't have the time to learn right now. Never mind that coding for audio and video applications is difficult to begin with. I might get into this someday, but I didn't want to deal with it now (I usually LOVE this type of stuff).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I did have great successes with converting two of my computer virus-prone relatives to Linux. One works for a major financial institution that has web software that won't work without the Microsoft JVM! Also, Windows security updates wreak havoc on the software. My solution was to install Ubuntu, and use Sun's VirtualBox with a working snapshot of XP. If he ever got a virus, he could just revert back to the snapshot. The financial software now works perfectly, and for the first time in years, he actually like using his computer. I also put my dad on Linux Mint, and he keeps telling me how much he loves it (aside from a few minor annoyances, but nothing like dealing with viruses and malware on Windows).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To be fair, both were using Windows XP - another virus-prone relative who I do tech support for has been on Windows 7 for a few months now (protected primarily with Microsoft Security Essentials), and has not had an issue yet, and loves her computer now as well.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There were initial hardware compatibility and other issues with both of these installs that took a bit of time for me to work through, but both systems are rock-solid stable now. I think Linux can work very well if you are just primarily browsing the web and just need to work with Office-type software (Sun's OpenOffice works very well if you're not doing anything crazy). It can also work well in other situations, depending on your exact needs.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Having switched back to XP myself, I find myself missing a few of the nice features on Linux now. The Bash shell is wicked powerful and a quick way to do system administration, having multiple virtual desktops is great, and I love how configurable pretty much everything is. Also, not having to worry about viruses nearly as much is awesome. I'm sure I will try it again someday.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-5842503187818388019?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/5842503187818388019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=5842503187818388019' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5842503187818388019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5842503187818388019'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2010/01/back-to-windows.html' title='Back to Windows'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-5917491802061365853</id><published>2009-11-05T10:38:00.012-05:00</published><updated>2009-11-06T11:12:37.446-05:00</updated><title type='text'>Xubuntu 9.04 running smoothly on a 1999 iBook</title><content type='html'>My friend Shaun gave me an old iBook to play around with, and after messing with it for about a week, I gave up on it. It was incredibly slow, especially with networking. I looked online and did lots of optimizations, and got it to run a bit faster, but it was just painful to use. Since I didn't have the OS reinstall CD, I figured I was out of options.&lt;br /&gt;&lt;br /&gt;About a month ago, I started playing around with Linux, and am really getting into it now. I did a few searches and found that there's PowerPC builds of Ubuntu. Given the modest hardware specs (300MHz G3, 192MB RAM), I decided to try &lt;a href="http://cdimage.ubuntu.com/xubuntu/ports/releases/jaunty/release/"&gt;Xubuntu 9.04 (alternate install)&lt;/a&gt;. Xubuntu doesn't have all the slickness of Ubuntu, but it usually works really well on old hardware (I've got it zipping along on an old 700MHz PIII box w/ 192MB RAM, that functions as my DVR (using &lt;a href="http://www.mythbuntu.org/"&gt;Mythbuntu&lt;/a&gt;)).&lt;br /&gt;&lt;br /&gt;I'll give a rundown of the problems I encountered below (mostly related to the iBook itself, not Xubuntu), but the bottom line is after ~3 hours, I have a very decent-performing and very usable laptop now.&lt;br /&gt;&lt;br /&gt;Problems&lt;br /&gt;- The CD drive wouldn't recognize a CD. I &lt;a href="http://support.apple.com/kb/HT1379"&gt;reset the PRAM&lt;/a&gt; and shot come compressed air onto the laser. Holding the "C" key down on boot still didn't work, but holding the "Option" key down gave me a boot menu - the CD took a while to show up, but it eventually did.&lt;br /&gt;&lt;br /&gt;- The battery wasn't holding a charge. There were two problems here - the power cord was a bit frayed and had to be positioned just right to work (temporarily solved with electrical tape), and the &lt;a href="http://support.apple.com/kb/HT1431"&gt;PMU needed to be reset&lt;/a&gt;.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- Wireless wouldn't work. Wireless issues Ubuntu turned me off of Linux two years ago, but I was hoping that since this was a PPC build, that they would have the Apple Wireless stuff figured out. And they do, except that Xubuntu didn't support the wireless encryption scheme I was using. Fortunately, this was an easy fix - just install and configure &lt;a href="http://wicd.sourceforge.net/"&gt;wicd&lt;/a&gt; (it's in the repositories - no need to download it from the web site).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Done - working laptop. I kind of feel bad having deMAC-ed a Mac, though (I was a HUGE Mac fanboy back in the day). Maybe I'll put a dock application at the bottom of the screen as an homage :-), or just go all out and do &lt;a href="http://xubuntublog.wordpress.com/2008/02/15/design-your-own-desktop-with-xfce-44-part-2/"&gt;this&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;UPDATE: Just found this helpful link that lists all distros that support the PowerPC architecture:&lt;/div&gt;&lt;div&gt;&lt;a href="http://distrowatch.com/dwres.php?resource=ppc"&gt;http://distrowatch.com/dwres.php?resource=ppc&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-5917491802061365853?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/5917491802061365853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=5917491802061365853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5917491802061365853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5917491802061365853'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2009/11/xubuntu-904-running-smoothly-on.html' title='Xubuntu 9.04 running smoothly on a 1999 iBook'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-3105419257054527930</id><published>2009-09-30T09:51:00.017-04:00</published><updated>2009-10-12T10:51:09.977-04:00</updated><title type='text'>Moving to Linux, at least temporarily</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_25EyoA9sNoQ/SsN_m2ShGfI/AAAAAAAAC7k/rb2LEcaC8kk/s1600-h/thumb_gloria.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_25EyoA9sNoQ/SsN_m2ShGfI/AAAAAAAAC7k/rb2LEcaC8kk/s200/thumb_gloria.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5387289884650183154" /&gt;&lt;/a&gt;Something was up with my Windows install, and for the life of me I couldn't figure it out. The sound was very choppy, Windows startup time and Internet browsing were incredibly slow. I ran every virus/spyware/malware scanner I could think of, cleaned the registry out carefully with CCleaner, reinstalled my sound card drivers, removed always running apps that I didn't need, defragmented the hard drive, defragmented the page file and registry hives, etc, and still had the same problem.&lt;br /&gt;&lt;br /&gt;About to reinstall Windows XP on my 10-year-old computer, I decided to give &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt; another shot, pledging to boot only Ubuntu for a week, and attempting to fix whatever issues came up. I had tried it at v7.04 and was generally impressed, but eventually scrapped it mostly because Windows was working fine for me, my Digital Audio Workstation wasn't supported, and there were no "killer apps" I could think of to keep me on Linux.&lt;br /&gt;&lt;br /&gt;So I installed Ubuntu 9.04, and was about as impressed as I was with 7.04. I worked through a few initial issues, but everyone in the forums I was reading said something like, "[whatever issue] isn't a problem on &lt;a href="http://www.linuxmint.com/"&gt;Linux Mint&lt;/a&gt;". After reading that for about the 5th time, I decided to make a Live USB of Linux Mint 7, and was completely blown away. Pretty much everything just worked out of the box, and the interface looked absolutely stunning and more user-friendly. What really sold me, though, was that it was based on Ubuntu 9.04, so it's got lots of built-in support.&lt;br /&gt;&lt;br /&gt;So I wiped Ubuntu and installed Mint, and mostly haven't missed Windows at all. I still do have a full-screen video issue using the generic video drivers - the "nv" drivers work, but only give me a resolution of about 320 x 240. UPDATE: Installing the latest nv driver fixed this.&lt;br /&gt;&lt;br /&gt;Most of the programs I want are available on Linux - Firefox, Photoshop (via Wine), Picasa, and Netbeans, mostly. But I can't find a DAW that supports MIDI to work. I spent quite a bit of time reading up on this, and it looks like I need a realtime Linux kernel, which can be installed with apt-get, but it seems like nobody can get it working with Linux Mint. I did find &lt;a href="http://revver.com/video/1187744/hyper-low-latency-audio-with-a-real-time-kernel/"&gt;this video&lt;/a&gt;, but it looks very complex (though promising). I've got to spend a lot more time with it, but I may just set up a Windows partition with only my DAW on it.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The "killer app" for me so far is not having to really worry about viruses, spyware, etc. nearly as much (the computer is used by a number of people). I do have ClemAV running now, and am looking into whether or not I need more protection, but I like what I've read so far - that Linux out-of-the-box is leaps and bounds above Windows in regards to these things.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And my son LOVES the Linux Education games - GCompris and Childsplay. To my surprise, he was WAY into the Childsplay letter finding game, which is great because he's working on his lower case letters now. I can't wait to hack these games a bit and put in some customized graphics for the kids.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-3105419257054527930?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/3105419257054527930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=3105419257054527930' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3105419257054527930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3105419257054527930'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2009/09/moving-to-linux-at-least-temporarily.html' title='Moving to Linux, at least temporarily'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_25EyoA9sNoQ/SsN_m2ShGfI/AAAAAAAAC7k/rb2LEcaC8kk/s72-c/thumb_gloria.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-5282030734940470589</id><published>2009-07-10T14:47:00.009-04:00</published><updated>2009-09-30T13:20:30.491-04:00</updated><title type='text'>Quick SQL --&gt; Excel export w/ column names</title><content type='html'>I know there's lot of ways to do this, including an SSIS/DTS package, but here's another quick way I pieced together for ad-hoc exports with that I haven't seen outlined before:&lt;br /&gt;&lt;br /&gt;1. Run the query in SQL Server Management Studio (w/ "Results to Grid")&lt;br /&gt;2. Copy all data from the grid (right-click on the unlabled box at the top left of the grid, choose "copy"), and paste into second row in Excel.&lt;br /&gt;3. Back in SQL, run this query:&lt;br /&gt;&lt;pre name="code" class="SQL"&gt;&lt;br /&gt;SELECT sc.name&lt;br /&gt;FROM syscolumns sc&lt;br /&gt;   INNER JOIN sysobjects so&lt;br /&gt;       ON so.id = sc.id&lt;br /&gt;WHERE so.name = '[table name]'&lt;br /&gt;ORDER BY sc.colid&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;4. Paste the results into Excel in a new sheet.&lt;br /&gt;5. Copy the row, then "paste special" --&gt; "transpose" into the first row in the original worksheet, so that they paste as columns.&lt;br /&gt;&lt;br /&gt;This will probably break down for very large tables, but I just did this with 96 columns, and 10,000+ rows without issues.&lt;br /&gt;&lt;br /&gt;Some more ways to accomplish this:&lt;br /&gt;&lt;a href="http://www.mssqltips.com/tip.asp?tip=1202"&gt;http://www.mssqltips.com/tip.asp?tip=1202&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;BTW, not sure why there's not a "Results to .csv format" in SQL Server Management Studio. "Results to Text" seems rather useless...&lt;br /&gt;&lt;br /&gt;UPDATE: &lt;a href="http://www.davidkearns.com/"&gt;Dave Kearns&lt;/a&gt; points out an even easier way to do this:&lt;br /&gt;&lt;br /&gt;In SQL Server Management Studio, go to "Tools" --&gt; "Options" --&gt; "Query Results" --&gt; "SQL Server" --&gt; "Results to Grid" --&gt; check "Include column headers when copying or saving the results"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-5282030734940470589?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/5282030734940470589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=5282030734940470589' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5282030734940470589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5282030734940470589'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2009/07/quick-sql-excel-export-w-column-names.html' title='Quick SQL --&gt; Excel export w/ column names'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-3114234647458422250</id><published>2009-04-17T12:08:00.011-04:00</published><updated>2009-07-09T16:27:59.182-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Forcing label values to be displayed to the right of a bar (ASP.NET 3.5 chart control)</title><content type='html'>As I've previously written, the new ASP.NET 3.5 chart control is great. However, a minor thing that doesn't work well is displaying value labels for bar charts. It displays the value to the right of the bar except for the longest bar when it determines that it wouldn't fit within the scale. So, if you have a bar with a value of 98, and you have your axis interval set to 25, it will display "98" in the bar. This doesn't necessarily look good, depending on what color the bar is, and it is also inconsistent with the other bars.&lt;br /&gt;&lt;br /&gt;Here's my solution (C#):&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;Chart1.DataBound += delegate(System.Object o, System.EventArgs ea) {&lt;br /&gt;      double longestBarLength = Chart1.Series[0].Points.FindMaxByValue().YValues[0],&lt;br /&gt;             padding = 10d,&lt;br /&gt;             roundedUpBarLengh = Math.Ceiling((longestBarLength + padding) / 25) * 25;&lt;br /&gt;&lt;br /&gt;      Chart1.ChartAreas[0].AxisY.Maximum = roundedUpBarLengh;&lt;br /&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I'm determining the longest bar length w/out looping thanks to a nice built-in function "FindMaxByValue()" which gets me access to the DataPoint object with the largest value, and I'm just grabbing the Y Value from it (in my case, there's only one Y value).&lt;br /&gt;&lt;br /&gt;Then I specify a set padding to make room for the value label to be displayed on the right side of the bar (10 seems to work well for numbers in the 100's at least). Lastly I'm pushing the value whatever the longest bar length is to the nearest 25 and setting the axis max value to that number.&lt;br /&gt;&lt;br /&gt;This all needs to be done after the data is already there, obviously, so this is all wrapped in the databound event handler.&lt;br /&gt;&lt;br /&gt;I'll add pics later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-3114234647458422250?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/3114234647458422250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=3114234647458422250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3114234647458422250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3114234647458422250'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2009/04/preventing-label-values-from-being.html' title='Forcing label values to be displayed to the right of a bar (ASP.NET 3.5 chart control)'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-6269447411965417709</id><published>2009-03-26T13:19:00.008-04:00</published><updated>2009-03-26T14:38:21.662-04:00</updated><title type='text'>Great .NET 3.5 Charting Control from Microsoft</title><content type='html'>I don't know how I missed this when it was released a few months ago, but this control is awesome - it generates very professional-looking charts that you used to have to pay hundreds of dollars for, and it looks just as good as the best charting tools I've seen.&lt;br /&gt;&lt;br /&gt;The organization scheme seems a little convoluted to me, but it probably just seems that way because I was just trying to do a simple 3D bar chart, and the scheme is set up to allow a very high level of customization. I also ran into a few web.config-related snags while getting my code up and running, but nothing that I couldn't fix within a few minutes of searching the web.&lt;br /&gt;&lt;br /&gt;Example screenshots and everything you need to get started are &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-6269447411965417709?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/6269447411965417709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=6269447411965417709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/6269447411965417709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/6269447411965417709'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2009/03/great-net-35-charting-control-from.html' title='Great .NET 3.5 Charting Control from Microsoft'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-2958787462148628230</id><published>2009-02-18T09:06:00.003-05:00</published><updated>2009-02-18T11:05:21.935-05:00</updated><title type='text'>Interesting SAP JCo error</title><content type='html'>&lt;span style="color:blue;"&gt;&lt;b&gt;Exception Details: &lt;/b&gt;  com.sap.mw.jco.JCO$Exception&lt;br /&gt;Type conflict when calling a function module (field length).&lt;br /&gt;&lt;br /&gt;&lt;b&gt; Possible Source of Error: &lt;/b&gt;&lt;br /&gt; Class Name:  &lt;i&gt;com.sap.mw.jco.rfc.MiddlewareRFC$Client&lt;/i&gt;&lt;br /&gt; File Name:  &lt;i&gt;MiddlewareRFC.java&lt;/i&gt;&lt;br /&gt; Method Name:  &lt;i&gt;nativeExecute&lt;/i&gt;&lt;br /&gt; Line Number:  &lt;i&gt;-2&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Line Number -2? Those SAP guys sure are tricky with their coding before the file even starts.&lt;br /&gt;&lt;br /&gt;BTW, SAP JCo is a major nightmare to get working. If somebody brings you a JCo project and says "this should be easy", my advice is to run away as fast as you can.&lt;br /&gt;&lt;br /&gt;UPDATE: I solved this problem, no thanks to the error message. I was trying to pass in a field as an Export instead of an Import. Which makes perfect sense, expect the original VBScript/COM code that I am re-writing this from uses the call "[function].Exports()" for an import (and the code works!).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-2958787462148628230?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/2958787462148628230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=2958787462148628230' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2958787462148628230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2958787462148628230'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2009/02/interesting-sap-jco-error.html' title='Interesting SAP JCo error'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-7242118410879743968</id><published>2008-12-11T19:51:00.010-05:00</published><updated>2008-12-18T09:33:10.420-05:00</updated><title type='text'>Camera Focal Range Data application</title><content type='html'>I'm currently using a point &amp;amp; shoot camera (Canon S2 IS), but have a DSLR on the way (Canon Rebel XS). The DSLR comes with a kit lens that ranges from 18-55mm (28.8mm - 88mm in 35mm equivalents), which is quite a bit shorter than my p&amp;amp;s (up to 432mm equiv!). So I got worried that I wouldn't be too happy with just the kit lens. At the same time, I wanted to try out LINQ in .NET, so a quick project was born...&lt;br /&gt;&lt;br /&gt;I wrote a bare-bones console application that reads in EXIF data from images, extracts the focal length of each, and uses some simple LINQ queries that lets me see exactly how many photos were taken in wide, normal, tele, and super tele modes. It recurses through directories from a starting directory you specify, and tries to get info on all JPEG images.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_25EyoA9sNoQ/SUG4Lm1fsBI/AAAAAAAABxI/wUZRSeKi9Ew/s1600-h/screenshot.gif"&gt;&lt;img style="cursor: pointer; width: 400px; height: 166px;" src="http://1.bp.blogspot.com/_25EyoA9sNoQ/SUG4Lm1fsBI/AAAAAAAABxI/wUZRSeKi9Ew/s400/screenshot.gif" alt="" id="BLOGGER_PHOTO_ID_5278702747797925906" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Right now, there's no nice GUI, it's not multi-threaded, you can only search one folder at a time, there is no progress bar, and you can't actually see what images fall into which category, but if there's any interest in this app at all, I'll add all that sometime soon.&lt;br /&gt;&lt;br /&gt;Also, you have to enter a 35mm focal length equivalent for the categories to be accurate. This is annoying, because for point and shoots, that info is sometimes hard to find. I had to actually take a picture all the way zoomed in, and compare the specs on dpreview.com with the EXIF data (72mm max zoom in the EXIF = 432mm max zoom in the specs, so it has a multiplier of "6"). I may end up looking up the multipliers on a bunch of popular cameras and just ask the user to select his/her camera, or optionally manually enter the focal length multiplier if the user's camera is not on the list.&lt;br /&gt;&lt;br /&gt;Anyway, the application is fully working in it's current state - all you need is the .NET 3.5 framework. If you want to use the app and can't figure out the proper multiplier to use, just post a comment here, and I or another reader can certainly help you out.&lt;br /&gt;&lt;br /&gt;No crazy code in this app, but here's the LINQ part:&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;//generic list&lt;br /&gt;private List&amp;lt;double&amp;gt; zoomData;&lt;br /&gt;...&lt;br /&gt;zoomData = new List&amp;lt;double&amp;gt;();&lt;br /&gt;...&lt;br /&gt;//code in the directory/file loop&lt;br /&gt;zoomData.Add(focalLength * focalLengthX);&lt;br /&gt;...&lt;br /&gt;int shortTele = (from t in zoomData where t &gt; 100 &amp;amp;&amp;amp; t &lt;= 150 select t).Count();&lt;/pre&gt;&lt;br /&gt;In my case, I was happy to see that I had a significant amount more wide and normal shots than telephoto shots, so maybe I won't need an extra lens after all.&lt;br /&gt;&lt;br /&gt;You can download the app &lt;a href="http://gruskada.googlepages.com/Zoom_Data.zip"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;UPDATE: Picasa somehow figures out the 35mm equiv. from the EXIF data. I'm going to figure out how they're doing it and update my application soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-7242118410879743968?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/7242118410879743968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=7242118410879743968' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7242118410879743968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7242118410879743968'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/12/camera-focal-range-data-application.html' title='Camera Focal Range Data application'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_25EyoA9sNoQ/SUG4Lm1fsBI/AAAAAAAABxI/wUZRSeKi9Ew/s72-c/screenshot.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-5572549850600479166</id><published>2008-12-03T10:16:00.017-05:00</published><updated>2008-12-04T11:07:17.071-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>System.Net.Mail throws "no such user" exceptions w/ Lotus Domino!</title><content type='html'>Code that I had running for years without issues suddenly broke with the error "Mailbox unavailable. The server response was: user@domain.com... No such user". Very useful, as with this information, I can now automate (or at least partially automate) internal mailing list management.&lt;br /&gt;&lt;br /&gt;For now, I've just added code to catch this specific exception (in addition to the catch-all SmtpException) to have it generate a work order ticket if there's a problem:&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;try {&lt;br /&gt;    smtp.Send(newsletter);&lt;br /&gt;} catch(System.Net.Mail.SmtpFailedRecipientException ex) {&lt;br /&gt;    //generate work order...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There's also "SmtpFailedRecipientsException" which triggers only if it can't send an email to all the recipients, though I don't see why you would use this over SmtpFailedRecipientException, as the latter informs you in the exception message if all recipients haven't received the email in addition to handling the case where one or some recipients failed.&lt;br /&gt;&lt;br /&gt;However, I've noticed that if more than one recipient email fails, it only displays the first email address that failed in the error message. Makes sense, since it probably is processing one email completely at a time, and if it fails on one, it doesn't go any further. The solution to this, I guess, would be to have each email sent out within a loop of separate SMTP calls instead of using the handy "mail.To.Add" method. There would most likely be a performance hit doing it this way, though.&lt;br /&gt;&lt;br /&gt;I'm going to keep looking into it, but does anyone know of a better way?&lt;br /&gt;&lt;br /&gt;Also, I assume this works with MS Exchange as well, but don't know anyone using email with Exchange to test with. I have verified it doesn't work with Gmail and Hotmail, so this is best used only with an environment where you know that everyone is on the same mail server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-5572549850600479166?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/5572549850600479166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=5572549850600479166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5572549850600479166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5572549850600479166'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/12/systemnetmail-throws-no-such-user.html' title='System.Net.Mail throws &quot;no such user&quot; exceptions w/ Lotus Domino!'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-3415852577066276029</id><published>2008-09-19T09:59:00.004-04:00</published><updated>2008-09-19T15:50:16.141-04:00</updated><title type='text'>Java SwingX ActiveDirectory/LDAP LoginService</title><content type='html'>Sorry for the long break from posting, but I haven't worked on anything interesting enough to post for a while. I've just completed some basic ActiveDirectory auth code with a Java Swing application. I had a heck of a time connecting to AD at all with Java - all the examples I found online seemed like they should have worked, but my test code just hung with no errors, and with no useful debugging info. I'm still not sure what was going on exactly, but the following helper class worked for me (the most notable exception between this code and my previous attempts is that it's now specifying the domain controller):&lt;br /&gt;&lt;br /&gt;LDAPUtils.java:&lt;br /&gt;&lt;pre name="code" class="java"&gt;package app;&lt;br /&gt;&lt;br /&gt;import java.util.Hashtable;&lt;br /&gt;import javax.naming.Context;&lt;br /&gt;import javax.naming.NamingEnumeration;&lt;br /&gt;import javax.naming.NamingException;&lt;br /&gt;import javax.naming.directory.Attributes;&lt;br /&gt;import javax.naming.directory.SearchControls;&lt;br /&gt;import javax.naming.directory.SearchResult;&lt;br /&gt;import javax.naming.ldap.InitialLdapContext;&lt;br /&gt;import javax.naming.ldap.LdapContext;&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;   @author Randy Coates&lt;br /&gt;   Modified slightly by Dave Gruska&lt;br /&gt;*/&lt;br /&gt;public class LDAPUtils {&lt;br /&gt;   static String ATTRIBUTE_FOR_USER = "sAMAccountName";&lt;br /&gt;   public Attributes authenticateUser(String username, String password, String _domain, String host, String dn) {&lt;br /&gt;       String returnedAtts[] ={ "sAMAccountName", "memberOf" };&lt;br /&gt;       String searchFilter = "(&amp;amp;(objectClass=user)(" + ATTRIBUTE_FOR_USER + "=" + username + "))";&lt;br /&gt;      &lt;br /&gt;       //Create the search controls&lt;br /&gt;       SearchControls searchCtls = new SearchControls();&lt;br /&gt;       searchCtls.setReturningAttributes(returnedAtts);&lt;br /&gt;      &lt;br /&gt;       //Specify the search scope&lt;br /&gt;       searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);&lt;br /&gt;       Hashtable environment = new Hashtable();&lt;br /&gt;       environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");&lt;br /&gt;      &lt;br /&gt;       //Using starndard Port, check your instalation&lt;br /&gt;       environment.put(Context.PROVIDER_URL, "ldap://" + host + ":389");&lt;br /&gt;       environment.put(Context.SECURITY_AUTHENTICATION, "simple");&lt;br /&gt;&lt;br /&gt;       environment.put(Context.SECURITY_PRINCIPAL, username + "@" + _domain);&lt;br /&gt;       environment.put(Context.SECURITY_CREDENTIALS, password);&lt;br /&gt;       LdapContext ctxGC = null;&lt;br /&gt;      &lt;br /&gt;       try {&lt;br /&gt;           ctxGC = new InitialLdapContext(environment, null);&lt;br /&gt;          &lt;br /&gt;           //search for objects in the GC using the filter&lt;br /&gt;           String searchBase = dn;&lt;br /&gt;           NamingEnumeration answer = ctxGC.search(searchBase, searchFilter, searchCtls);&lt;br /&gt;           while (answer.hasMoreElements()) {&lt;br /&gt;               SearchResult sr = (SearchResult)answer.next();&lt;br /&gt;               Attributes attrs = sr.getAttributes();&lt;br /&gt;               if (attrs != null)&lt;br /&gt;                   return attrs;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;       catch (NamingException e) {&lt;br /&gt;           e.printStackTrace();&lt;br /&gt;       }&lt;br /&gt;       return null;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;I'm then extending SwingX's LoginService to work with this class and return some extra details, like the user's group (this can be easily expanded to capture an Active Directory attribute):&lt;br /&gt;&lt;br /&gt;LDAPLoginService:&lt;br /&gt;&lt;pre name="code" class="java"&gt;package app;&lt;br /&gt;&lt;br /&gt;import javax.naming.directory.Attributes;&lt;br /&gt;import org.jdesktop.swingx.auth.LoginService;&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;   @author Dave Gruska&lt;br /&gt;*/&lt;br /&gt;public class LDAPLoginService extends LoginService {&lt;br /&gt;   private String domain;&lt;br /&gt;   private String host;&lt;br /&gt;   private String dn;&lt;br /&gt;   private String userName;&lt;br /&gt;   private String groupName;&lt;br /&gt;  &lt;br /&gt;   public String getDomain() {&lt;br /&gt;       return domain;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public void setDomain(String domain) {&lt;br /&gt;       this.domain = domain;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public String getHost() {&lt;br /&gt;       return host;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public void setHost(String host) {&lt;br /&gt;       this.host = host;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public String getDn() {&lt;br /&gt;       return dn;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public void setDn(String dn) {&lt;br /&gt;       this.dn = dn;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public String getUserName() {&lt;br /&gt;       return userName;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public String getGroupName() {&lt;br /&gt;       return groupName;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public LDAPLoginService(String domain, String host, String dn) {&lt;br /&gt;       this.domain = domain;&lt;br /&gt;       this.host = host;&lt;br /&gt;       this.dn = dn;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   @Override&lt;br /&gt;   public boolean authenticate(String name, char[] password, String server) throws Exception {&lt;br /&gt;       LDAPUtils LDAPlogin = new LDAPUtils();&lt;br /&gt;     &lt;br /&gt;       //TODO: investigate if there's a more efficient way to convert this&lt;br /&gt;       StringBuilder passwd = new StringBuilder();&lt;br /&gt;       for(char c : password) {&lt;br /&gt;           passwd.append(c);&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;       Attributes attrs = LDAPlogin.authenticateUser(name, passwd.toString(), this.domain, this.host, this.dn);&lt;br /&gt;      &lt;br /&gt;       if(attrs == null) {&lt;br /&gt;           //login failed&lt;br /&gt;           return false;&lt;br /&gt;       } else {&lt;br /&gt;           //login successful&lt;br /&gt;           String[] splitUserName = attrs.get("sAMAccountName").toString().split(":");&lt;br /&gt;           userName = splitUserName[1].trim();                   &lt;br /&gt;           groupName = attrs.get("memberOf").contains("CN=AppAdmins,CN=Users,DC=domain,DC=com") ? "admin" : "user";&lt;br /&gt;             &lt;br /&gt;           return true;&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;and finally, the presentation layer code displays a login pane (JXLoginPane dialog) that gets called in the constructor right after the components are initialized:&lt;br /&gt;&lt;pre name="code" class="java"&gt;loginService = new LDAPLoginService("domain.com", "[domain controller IP]", "cn=Users,dc=domain,dc=com");&lt;br /&gt;JXLoginPane.Status status = JXLoginPane.showLoginDialog(null, loginService);&lt;br /&gt;      &lt;br /&gt;if(!status.equals(status.SUCCEEDED)) {&lt;br /&gt;    System.exit(0);&lt;br /&gt;}&lt;br /&gt;      &lt;br /&gt;loggedInAsLabel.setText(String.format("%S (%s)", loginService.getUserName(), loginService.getGroupName()));&lt;br /&gt;&lt;/pre&gt;BTW, the System.exit code only gets called when the user gives up on trying to log in.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-3415852577066276029?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/3415852577066276029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=3415852577066276029' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3415852577066276029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/3415852577066276029'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/09/java-swingx-activedirectoryldap.html' title='Java SwingX ActiveDirectory/LDAP LoginService'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-6546938788376113583</id><published>2008-08-11T11:20:00.004-04:00</published><updated>2008-08-11T11:55:09.609-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>My personal Photoshop use is decreasing drastically</title><content type='html'>When I got Photoshop 4 back in the day, I used it daily to do work at home and to do my own personal creations. I also scanned in lots of photos and fixed them up.&lt;br /&gt;&lt;br /&gt;Now that I'm a full-time developer (as opposed to part designer/part developer), I find myself using PS less and less. I've since upgraded to CS2, which in retrospect was actually quite a waste of money - PS 6 had everything I needed. My first digital camera was great (&lt;a href="http://www.dpreview.com/reviews/specs/Sony/sony_dscf707.asp"&gt;Sony DSC F-707&lt;/a&gt;), but almost every image really required post-processing to really look good, so I used PS quite a bit back then. I now have a &lt;a href="http://www.dpreview.com/reviews/specs/Canon/canon_s2is.asp"&gt;Canon S2 IS&lt;/a&gt;, which has excellent color reproduction - good enough that I don't bother with most images anymore. And I've pretty much stopped doing my own image composites for fun (though I occasionally knock a few off for friends/co-workers).&lt;br /&gt;&lt;br /&gt;But I still do a fair amount of image manipulation overall, considering I take &lt;span style="font-style: italic;"&gt;tons&lt;/span&gt; of photos. I've found Google's &lt;a href="http://picasa.google.com/"&gt;Picasa&lt;/a&gt; software handles most of my modifications quite well (red-eye, cropping, slight color fixes) - its "Fill Light" tool is awesome for fixing underlit subjects btw, and way quicker than any method I've ever used in PS. Picasa also manages the photos better than Adobe's Bridge or Lightroom, IMHO.  And I can upload straight to Snapfish. So my workflow all pretty much happens in one place.&lt;br /&gt;&lt;br /&gt;For situations like noise reduction, I use &lt;a href="http://www.neatimage.com/"&gt;Neat Image&lt;/a&gt; (free version). You can't beat its simplicity, and the results are fantastic in my experience so far (I've mostly used it to clean up high ISO noise in otherwise unacceptable-quality pictures). For stitched panoramas I use &lt;a href="http://hugin.sourceforge.net/download/"&gt;Hugin&lt;/a&gt; (also free). And for quick fixes, I use the free (and open source) &lt;a href="http://www.getpaint.net/"&gt;Paint.NET&lt;/a&gt; application, which loads much quicker than PS, and has many of its basic tools.&lt;br /&gt;&lt;br /&gt;There's still situations where I still use Photoshop - mostly for true HDR and HDR-like processing (levels adjustment layers, dodge/burn) to bring out detail, and I recently created a family photo for my parents from a number of different pictures that I wouldn't even consider using another application for, but it's probably dropped to about 5% or so of my total image processing time these days.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-6546938788376113583?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/6546938788376113583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=6546938788376113583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/6546938788376113583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/6546938788376113583'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/08/my-personal-photoshop-use-is-decreasing.html' title='My personal Photoshop use is decreasing drastically'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-1821781439707155025</id><published>2008-07-28T12:02:00.004-04:00</published><updated>2008-07-28T12:21:20.234-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>Retreiving and sending Hotmail email from Gmail</title><content type='html'>I had a Hotmail account years before Gmail was around, and I still keep it around just in case I get an important email there. I tried to use Gmail's "&lt;span class="jwjW1c"&gt;Get mail from other accounts" feature, but it always said "connection timed out". I had just assumed Hotmail offered POP3 - it doesn't. I found a &lt;a href="http://lifehacker.com/software/gmail/how-to-read-your-hotmail-from-gmail-241120.php"&gt;helpful article on LifeHacker&lt;/a&gt; to get around this issue, but the software they mention is not a free service.&lt;br /&gt;&lt;br /&gt;But, buried in the comments is a link to the "GetMail for Hotmail" Windows service. That link, however, sends you to the vendor's Web site, which wants you to sign up for a free trial of some other service in order to download the software. But, &lt;a href="http://www.download.com/GetMail-For-Hotmail/3000-2369_4-10325774.html"&gt;this Download.com link&lt;/a&gt; will let you download it with no strings attached.&lt;br /&gt;&lt;br /&gt;You do have to enter your Hotmail password so that it can retreive the mail, which may be a deal-breaker for some. To be safer, I changed my Hotmail password to make sure it doesn't match any other service I use. I'm also confident that I don't use this account for any service I use, though that still doesn't technically make me 100% protected. &lt;/span&gt;&lt;span class="jwjW1c"&gt;I'm also keeping an eye on it from a network perpective to make sure it's not trying to do anything it's not supposed to. &lt;/span&gt;&lt;span class="jwjW1c"&gt;I may actually attempt to write my own simple version of this some day just for the extra piece of mind. The program also is a resource hog, so you don't want have it set to fetch mail too often.&lt;br /&gt;&lt;br /&gt;It does work well, otherwise, though. I've got mail set up to go directly to my Gmail archive (Settings --&gt; Filters), and labeled with "Hotmail", so it's separate from my regular Gmail mail. I also set up my Hotmail.com account under "Settings --&gt; Send mail as" so that I can have email sent as if it came from Hotmail.&lt;br /&gt;&lt;br /&gt;If everything keeps working well, I'll be very glad to not have to log into Hotmail anymore.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-1821781439707155025?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/1821781439707155025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=1821781439707155025' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1821781439707155025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1821781439707155025'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/07/retreiving-and-sending-hotmail-email.html' title='Retreiving and sending Hotmail email from Gmail'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-4558559175006477638</id><published>2008-07-24T14:11:00.004-04:00</published><updated>2008-07-24T14:15:25.149-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL Server 2000 not deleting backups</title><content type='html'>I'm sure there could be a lot more reasons for backup deletions failing than this, but detaching a database that was set to "offline" fixed the problem for me. No other error messages I could find - luckily I realized the problem started around the time we took that db offline, so it didn't take too long to troubleshoot.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-4558559175006477638?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/4558559175006477638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=4558559175006477638' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/4558559175006477638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/4558559175006477638'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/07/sql-server-2000-not-deleting-backups.html' title='SQL Server 2000 not deleting backups'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8839738558893146446</id><published>2008-07-14T17:03:00.002-04:00</published><updated>2008-07-14T17:30:22.623-04:00</updated><title type='text'>JTabbedPane with close button that sets the tab title correctly</title><content type='html'>Java 6 includes the abilility to add a component (like a "x" to close the tab) to a tab pane, and Alexander Potochkin, has elegantly put together a &lt;a href="http://weblogs.java.net/blog/alexfromsun/archive/2005/11/tabcomponents_i_1.html"&gt;"ButtonTabComponent" class&lt;/a&gt; to easily handle this.&lt;br /&gt;&lt;br /&gt;I've made just a few changes to get the "x" to look more like the "x"'s on the rest of my application, and most importantly for me, to set the title of the JTabbedPane so that calling getTitleAt(tabPosition) doesn't return an empty string, since this is now handled completely by the ButtonTabComponent class. BTW, I'm mixing regular tabs with tabs that can be closed, so I want to be able to just have to call one method to check what each's title is, i.e.:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;     int existingTabPosition = 0;&lt;br /&gt;     int tabCount = tabbedPane.getTabCount();&lt;br /&gt;     for(int i = 0; i &amp;lt; tabCount; i++) {&lt;br /&gt;         String thisTabTitle = tabbedPane.getTitleAt(i);&lt;br /&gt;         if(thisTabTitle.equals(menuSelectedTabTitle)) {&lt;br /&gt;             existingTabPosition = i;&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;    &lt;br /&gt;     if(existingTabPosition != 0) {&lt;br /&gt;         //report already exists - just force focus to it&lt;br /&gt;         tabbedPane.setSelectedIndex(existingTabPosition);&lt;br /&gt;     } else {&lt;br /&gt;         //no report exists by this name - add new tab&lt;br /&gt;         tabbedPane.add(jrView);&lt;br /&gt;         int newTabPosition = tabbedPane.getTabCount() - 1;&lt;br /&gt;        &lt;br /&gt;         tabbedPane.setTabComponentAt(newTabPosition, new ButtonTabComponent(menuSelectedTabTitle, tabbedPane));&lt;br /&gt;         tabbedPane.setSelectedIndex(newTabPosition);&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here's my updated "paintComponent" method of the TabButton inner class:&lt;br /&gt;&lt;pre name="code" class="java"&gt;      //paint the "x" and update the title&lt;br /&gt;     @Override&lt;br /&gt;     protected void paintComponent(Graphics g) {&lt;br /&gt;         super.paintComponent(g);&lt;br /&gt;         Graphics2D g2 = (Graphics2D) g;&lt;br /&gt;         Stroke stroke = g2.getStroke();&lt;br /&gt;      &lt;br /&gt;         //shift the image for pressed buttons&lt;br /&gt;         //changed by DG&lt;br /&gt;         //if(!getModel().isPressed()) {&lt;br /&gt;         //    g2.translate(-1, -1);&lt;br /&gt;         //}&lt;br /&gt;      &lt;br /&gt;         g2.setStroke(new BasicStroke(2));&lt;br /&gt;         g.setColor(Color.BLACK);&lt;br /&gt;         if(getModel().isRollover()) {&lt;br /&gt;             Color highlight = new Color(0, 51, 153); //dark blue - changed by DG&lt;br /&gt;             g.setColor(highlight);&lt;br /&gt;         }         &lt;br /&gt;         int delta = 5; //changed by DG&lt;br /&gt;         g.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);&lt;br /&gt;         g.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);&lt;br /&gt;      &lt;br /&gt;         //NOTE: only needed if button pressed in effect is used above&lt;br /&gt;         //changed by DG&lt;br /&gt;         //leave the graphics unchanged&lt;br /&gt;         //if(!getModel().isPressed()) {&lt;br /&gt;         //    g.translate(1, 1);&lt;br /&gt;         //}&lt;br /&gt;         g2.setStroke(stroke);&lt;br /&gt;      &lt;br /&gt;         //add the title here - added by DG&lt;br /&gt;         int i = pane.indexOfTabComponent(ButtonTabComponent.this);&lt;br /&gt;         pane.setTitleAt(i, label.getText());&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt;I assume the title is set here for a specific reason, though my next experiment will be to remove the title from here and add it back to the JTabbedPane - though the way it is might actually be a bit nicer to work with. Alternatively, you can set both at the same time - it works without problems, but it seems like bad form to have to manually set the same thing twice.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8839738558893146446?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8839738558893146446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8839738558893146446' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8839738558893146446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8839738558893146446'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/07/jtabbedpane-with-close-button-that-sets.html' title='JTabbedPane with close button that sets the tab title correctly'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-859070106095930192</id><published>2008-07-07T11:19:00.003-04:00</published><updated>2008-07-07T11:30:25.100-04:00</updated><title type='text'>Apache Commons</title><content type='html'>I had forgotten that the first Java book I read, Bruce Eckel's "Thinking In Java", highly recommended using &lt;a href="http://commons.apache.org/"&gt;Apache Commons&lt;/a&gt; if you found that the core language didn't contain something you expected to be there. The "Commons" are vast set of libraries that improve and add to the core Java language, and can be a huge time saver.&lt;br /&gt;&lt;br /&gt;My goal this week is to read all the Commons' user guides to get familiar with its capabilities.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-859070106095930192?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/859070106095930192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=859070106095930192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/859070106095930192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/859070106095930192'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/07/apache-commons.html' title='Apache Commons'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8625111745201177018</id><published>2008-07-01T16:46:00.007-04:00</published><updated>2008-07-01T17:17:53.681-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>JTextArea setEnabled strangeness (Java Swing)</title><content type='html'>NetBeans 6.1 automatically wraps a JScrollPane around a JTextArea, and handles all the details of setting it up nicely. But, if you need to work with all your components at once (i.e. to tick the "setEnabled" property on each), you'll find the following code works on everything but the JTextAreas (and probably all other nested components):&lt;br /&gt;&lt;pre name="code" class="java"&gt;for(Component component : ProjectPanel.getComponents()) {&lt;br /&gt; component.setEnabled(false);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;I haven't found a good way around this yet, as the following addition to the loop fails as well:&lt;br /&gt;&lt;pre name="code" class="java"&gt;//use reflection to get the class type&lt;br /&gt;if(component.getClass().equals(JScrollPane.class)) {&lt;br /&gt; JScrollPane scrollPane = (JScrollPane)component;&lt;br /&gt;&lt;br /&gt; for(Component subComponent : scrollPane.getComponents()) {&lt;br /&gt;     subComponent.setEnabled(false);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Debugging reveals that the the JTextArea isn't seen as a component here (things like the scroll bar and viewport are, though). getComponents() doesn't loop over children, so maybe this does work two or three levels deeper, but that's getting a bit ridiculous.&lt;br /&gt;&lt;br /&gt;Until I figure out a better way, I'm setting the values explicitly using the following method:&lt;br /&gt;&lt;pre name="code" class="java"&gt;textArea.setEnabled(false);&lt;br /&gt;textArea.setBackground(UIManager.getColor("TextArea.disabledBackground"));&lt;br /&gt;&lt;/pre&gt;The "setBackground" method is needed here (at least on Windows XP using the "Classic" theme), as the background isn't automatically set to the disabled color when setEnabled is set to "true". Most other components automatically handle this for you. This also means when you re-enable it, you need to set it back to the default enabled color:&lt;br /&gt;&lt;pre name="code" class="java"&gt;textArea.setBackground(UIManager.getColor("TextArea.background"));&lt;br /&gt;&lt;/pre&gt;BTW, I found a good article on using UIManager &lt;a href="http://dn.codegear.com/article/29991"&gt;here&lt;/a&gt; that explains how to use and manipulate UI settings.&lt;br /&gt;&lt;br /&gt;In any case, I found an official &lt;a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4177727"&gt;Java bug report from 1998&lt;/a&gt; concerning what appears to be the exact enabled/disabled problem I ran into - the bug's status is "&lt;span style="color: rgb(255, 0, 0);"&gt;6-Fix Understood,                                                            &lt;!-- show area regardless of statusDetail                                                                                            request for enhancement                                                            --&gt;                                                      &lt;/span&gt;                                            request for enhancement". Though the suggested fix actually didn't work for me...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8625111745201177018?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8625111745201177018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8625111745201177018' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8625111745201177018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8625111745201177018'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/07/jtextarea-setenabled-strangeness.html' title='JTextArea setEnabled strangeness (Java Swing)'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-7859291136858114332</id><published>2008-06-23T12:15:00.016-04:00</published><updated>2008-06-23T15:37:23.715-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Updated enum display values code</title><content type='html'>&lt;p&gt;I previously posted about how to automatically format an enum value by overriding the enum's toString() method. The code works, but it doesn't scale very well and it's not as robust as it could be, so I've pulled it out into it's own method, and added a "case exception list" feature, so it can be called from any enum, and allows for more flexibility:&lt;br /&gt;&lt;/p&gt;&lt;pre name="code" class="java"&gt;public class EnumUtils {&lt;br /&gt;    public static String displayFormat(String enumName, String... caseExceptions) {&lt;br /&gt;        String[] splitNames = enumName.split("_");&lt;br /&gt;        String caseExceptionName = "";&lt;br /&gt;        Boolean caseException = false;&lt;br /&gt;        &lt;br /&gt;        for(String name : caseExceptions) {&lt;br /&gt;            String parsedName = name.replace(" ", "_");&lt;br /&gt;            &lt;br /&gt;            if(enumName.equalsIgnoreCase(parsedName)) {&lt;br /&gt;                caseExceptionName = parsedName.replace("_", " ");&lt;br /&gt;                caseException = true;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        StringBuffer fixedName = new StringBuffer();&lt;br /&gt;&lt;br /&gt;        if(caseException) {&lt;br /&gt;            fixedName.append(caseExceptionName);&lt;br /&gt;        } else {&lt;br /&gt;            for(int i = 0; i &lt; splitNames.length; i++) {&lt;br /&gt;                String firstLetter = splitNames[i].substring(0, 1).toUpperCase(),&lt;br /&gt;                       restOfWord = splitNames[i].substring(1).toLowerCase(), &lt;br /&gt;                       spacer = i == splitNames.length ? "" : " ";&lt;br /&gt;&lt;br /&gt;                fixedName.append(firstLetter).append(restOfWord).append(spacer);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return fixedName.toString();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;which is called from the enum like this, for example:&lt;br /&gt;&lt;pre name="code" class="java"&gt;@Override&lt;br /&gt;public String toString(){&lt;br /&gt;    return EnumUtils.displayFormat(name(), "NT Servers", "SQL Server");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;The method takes in the name of the enum value, as usual, but also allows the developer to specify a variable-length exception list, thanks to Java's "varargs" feature, which lets you accept an array of any basic type as the last argument. All you need to do in the method is specify the type along with ellipses (...), and it takes care of the rest for you. The code allows the developer to specify the enum value with a space between words, or with "_"'s. BTW, it also works fine with no exceptions:&lt;br /&gt;&lt;pre name="code" class="java"&gt;return EnumUtils.displayFormat(name());&lt;br /&gt;&lt;/pre&gt;If you've seen my original code in the post below, you'll also noticed that I've changed StringBuilder to StringBuffer, and changed the String.concat()s to StringBuffer.append()s. StringBuilder is actually just meant for single-threaded operations, so while it's probably safe to use it here, it could potentially wreak havoc. The append()s are for miniscule performance gains (though I haven't run tickcount tests yet to actually confirm that this method is faster). I've also defined the new strings in the second for loop with commas between them, instead of re-typing "String" three times. I heavily doubt there's a performance gain here, as I assume the compiler sees both the same, but it's slightly faster to type :-)&lt;br /&gt;&lt;br /&gt;BTW, I'm now using the &lt;a href="http://fazibear.googlepages.com/blogger.html"&gt;Blogger Syntax Highlighter&lt;/a&gt; to display formatted code, as it looks a bit nicer, and has native support for Java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-7859291136858114332?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/7859291136858114332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=7859291136858114332' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7859291136858114332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7859291136858114332'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/updated-enum-display-values-code.html' title='Updated enum display values code'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-7935383636750356323</id><published>2008-06-19T11:08:00.006-04:00</published><updated>2011-02-23T22:52:40.294-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Binding an enum to a jComboBox with user-friendly name values (Java Swing)</title><content type='html'>&lt;p&gt;Binding an enum to a jComboBox is easy enough (though, as far as I know, not possible using the GUI tools that are available with NetBeans 6.1). First, of course, define the enum:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;enum&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;I&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;_&lt;span class="kwrd"&gt;&lt;/span&gt;W&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;K&lt;span class="kwrd"&gt;&lt;/span&gt;,&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;I&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;_&lt;span class="kwrd"&gt;&lt;/span&gt;M&lt;span class="kwrd"&gt;&lt;/span&gt;O&lt;span class="kwrd"&gt;&lt;/span&gt;N&lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;,&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;   THIS_YEAR&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;Then link it to the combo box:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;B&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;M&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt; cb&lt;span class="kwrd"&gt;&lt;/span&gt;M&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;B&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;M&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;v&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;B&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;M&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;(cb&lt;span class="kwrd"&gt;&lt;/span&gt;M&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;This works fine, except that you get the not so user-friendly "THIS_WEEK", "THIS_MONTH", etc. values displayed in the dropdown. To fix this, the easiest way is to override the "toString()" method of the enum, so the modified enum becomes:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;enum&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;I&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;_&lt;span class="kwrd"&gt;&lt;/span&gt;W&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;K&lt;span class="kwrd"&gt;&lt;/span&gt;,&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;I&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;_&lt;span class="kwrd"&gt;&lt;/span&gt;M&lt;span class="kwrd"&gt;&lt;/span&gt;O&lt;span class="kwrd"&gt;&lt;/span&gt;N&lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;,&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;   THIS_YEAR;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;@&lt;span class="kwrd"&gt;&lt;/span&gt;O&lt;span class="kwrd"&gt;&lt;/span&gt;v&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;[&lt;span class="kwrd"&gt;&lt;/span&gt;]&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;N&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;L&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;w&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="str"&gt;"_"&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;       StringBuffer fixedName = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuffer();&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;      for&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &lt; splitNames.length; i++) {&lt;br /&gt;          String firstLetter = splitNames[i].substring(0, 1).toUpperCase(),&lt;br /&gt;                 restOfWord = splitNames[i].substring(1),&lt;br /&gt;                 spacer = i == splitNames.length ? &lt;span class="str"&gt;""&lt;/span&gt; : &lt;span class="str"&gt;" "&lt;/span&gt;;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;          fixedName.append(firstLetter).append(restOfWord).append(spacer);&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;}&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;N&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;}&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;}&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;This code first lowercases everything, then splits it up into separate words based on the "_" character. It then loops over all the words, isolates and capitalizes the first letter, and isolates the rest of the word in a separate variable.&lt;/p&gt;&lt;p&gt;Next, a space is added if there are more words left to be looped over. Finally, everything is re-assembled and added to the StringBuilder variable that's returned as the "fixed" name. BTW, if anyone know of a more efficient way to do this, I'd love to hear about it. Java's regex doesn't appear to support the "L" flag or anything similar, otherwise I could have done this much more efficiently with one regex replace.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In any case, no other changes are necessary, as toString() only affects the display of the enum and not its underlying values, so you can then use code that uses the enum as usual:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;B&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;j&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;v&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;w&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;event&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;v&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;v&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;J&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;B&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;J&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;B&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;v&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;F&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;I&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;w&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;switch&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;F&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;           case&lt;/span&gt; THIS_WEEK:&lt;br /&gt;           //processing code...&lt;br /&gt;&lt;/pre&gt;BTW, it's interesting that Java's "switch/case" only supports ints, though I guess it does kind of force you into using enums for this type of thing, which, a lot of the time, would be the preferred method over using plain strings. (As you're probably aware, enums underlying real values are ints).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-7935383636750356323?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/7935383636750356323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=7935383636750356323' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7935383636750356323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7935383636750356323'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/binding-enum-to-jcombobox-with-user.html' title='Binding an enum to a jComboBox with user-friendly name values (Java Swing)'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-4612830856152040826</id><published>2008-06-17T16:20:00.002-04:00</published><updated>2008-06-20T12:11:53.116-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Using row highlighters in SwingX 0.9.3</title><content type='html'>&lt;p&gt;I was excited to read about row highlighting in the JXTable SwingX component, and found a number of tutorials showing how to implement this. But, all of them show how to do it the same way, and none of them work any longer (at least as of v 0.9.2+). Here's the &lt;a href="http://swinglabs.org/docs/components/JXTable/tutorial.jsp?step=3"&gt;example code from the SwingLabs tutorial&lt;/a&gt;:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;j&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;[&lt;span class="kwrd"&gt;&lt;/span&gt;]&lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;R&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;w&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;L&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;}&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;/pre&gt;There is no more "HighlighterPipeline", nor is there "AlternateRowHighlighter". I couldn't find any other up-to-date tutorials on the subject, so I did a little digging in the SwingX JavaDocs, and was able to put together the following code that accomplishes the same thing.&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;j&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;v&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;w&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;import org.jdesktop.swingx.decorator.*;&lt;br /&gt;...&lt;br /&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;C&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;O&lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;highlighter.setBackground(Color.getHSBColor(0.62f, 0.01f, 0.92f)); //very light blue&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;DetailsTable.&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;H&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;(highlighter)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;/pre&gt;Not much to explain here, just a different way of doing it. In addition to a number of other features, HighlightPredicate also supports "ROLLOVER_ROW", which works as you'd guess. "ROLLOVER_ROW" has also made the following unnecessary:&lt;br /&gt;&lt;pre class="csharpcode"&gt;jxTable.setRolloverEnabled(&lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;/pre&gt;Code changes are obviously one of the problems with using pre-release code, though I've had great luck with SwingX components so far concerning stability. It's been worth the risk for me so far, though I'm not relying on the extra functions that SwingX provides for anything "mission critical" - just for row sorting, filtering, coloring, packing, etc.. JXTable inherits from the standard JTable, so if I decide to remove SwingX, there should be minimal pain involved (I hope).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-4612830856152040826?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/4612830856152040826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=4612830856152040826' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/4612830856152040826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/4612830856152040826'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/using-row-highlighters-in-swingx-092.html' title='Using row highlighters in SwingX 0.9.3'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-9188518080109786202</id><published>2008-06-17T14:49:00.000-04:00</published><updated>2008-06-17T17:03:39.525-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc'/><title type='text'>See screenshots of your web site with different browsers</title><content type='html'>&lt;p&gt;I've been looking for a site like this for quite a while. &lt;a href="http://browsershots.org/"&gt;BrowserShots.org&lt;/a&gt; lets you select from 67 different browsers/versions, and allows you to select parameters like screen size, color depth, and what features are enabled in the browser.&lt;br /&gt;&lt;/p&gt;It takes a little while for the results to come back (at least five minutes or so, though you can begin browsing the first few screenshots almost immediately), but this is a really helpful service that I could have used years ago.&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-9188518080109786202?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/9188518080109786202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=9188518080109786202' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/9188518080109786202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/9188518080109786202'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/see-screenshots-of-your-web-site-with.html' title='See screenshots of your web site with different browsers'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8799600683282831678</id><published>2008-06-17T09:12:00.000-04:00</published><updated>2008-06-17T09:38:37.778-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Modifying a database schema in NetBeans 6.1</title><content type='html'>If the only changes to your schema are within existing tables, you're in luck, as you can just open the "META-INF" folder, right click on the schema, and choose "Recapture Schema from Database". After doing this, make sure to rebuild the project ("Build" --&gt; "Build Main Project" from the top menu). Now the new schema info will be available in beans binding menus, etc.&lt;br /&gt;&lt;br /&gt;However, the only way I could figure out how to change a schema that involves a new table is to create a new schema, delete the old one, and modify any code that references the old schema. "Recapture..." does not retrieve new tables, and there's no way I could find to actually edit the schema, without diving into the XML code (I've seen it - it's not worth it, and I'm not usually afraid to edit complex XML).&lt;br /&gt;&lt;br /&gt;To create a new schema, right click on the "META-INF" folder, and select "New" --&gt; "Other..." --&gt; select the "Persistence" folder, and "Database Schema". Name it, select your database, select the tables you want to add. Next, either manually edit or delete and re-create any Entity Classes. Rebuild the project, and you're set.&lt;br /&gt;&lt;br /&gt;I assume/hope an "Edit Schema" function is coming to NetBeans someday soon. "Update Entity Class" would be nice, too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8799600683282831678?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8799600683282831678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8799600683282831678' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8799600683282831678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8799600683282831678'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/modifying-database-schema-in-netbeans.html' title='Modifying a database schema in NetBeans 6.1'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-2554405075210952914</id><published>2008-06-11T11:17:00.001-04:00</published><updated>2008-06-11T16:43:33.382-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Retrieving a user's email address from Active Directory</title><content type='html'>&lt;p&gt;An application I'm working on requires complete user management through Active Directory. So I'm slowly building up an "ADUtils" support class to wrap up all the necessary AD querying. I've found a decent amount of ADSI examples online, though finding specific information, and extracting best practices from these has been difficult.&lt;/p&gt;  &lt;p&gt;Being rather new to AD, I don't make any claims that the code below follows all best practices, though I'll try to explain what I've done and why I've done it that way. If you know of a better way to accomplish the following, please let me know.&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="rem"&gt;/// Retrieves the user's email address from AD&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="rem"&gt;/// &amp;lt;param name="user"&amp;gt;User's NT account name without domain prefix&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;User's email address&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;G&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="str"&gt;"LDAP://DC=yourdomain,DC=com"&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;F&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;F&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="str"&gt;"(SAMAccountName={0})"&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;,&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;L&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="str"&gt;"mail"&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;R&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;F&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;O&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;[&lt;span class="str"&gt;"mail"&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;]&lt;span class="kwrd"&gt;&lt;/span&gt;[&lt;span class="kwrd"&gt;&lt;/span&gt;0&lt;span class="kwrd"&gt;&lt;/span&gt;]&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;T&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;}&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;O&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;O&lt;span class="kwrd"&gt;&lt;/span&gt;f&lt;span class="kwrd"&gt;&lt;/span&gt;R&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;x&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;=&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;S&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;g&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;y&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="rem"&gt;//TODO: log/display error&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;}&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;}&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;The LDAP address does not specify the domain controller. This allows AD to intelligently choose which DC to use.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;By explicitly stating what properties to load, you save the server from loading them all.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;"searcher.FindOne()" does exactly what it says and just loads one result. I'm not sure of the performance benefit of using this vs. "searcher.FindAll()" if there's only one result anyway, but this is certainly better form if you're expecting only one result.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Lastly, if the field is left blank in AD, you will get an ArgumentOutOfRangeException instead of a blank field back, so it's a good idea to explicitly handle it.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;p&gt;Using my &lt;a href="http://codery.blogspot.com/2008/05/querying-active-directory-groups-via.html"&gt;"GetUsersInGroup" method&lt;/a&gt;, you can use the "GetEmailAddress" method to get all group members' email addresses:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Configuration;&lt;br /&gt;...&lt;br /&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; LDAPGroupAddress = &lt;span class="str"&gt;"LDAP://CN=yourgroup,CN=Users,DC=yourdomain,DC=com"&lt;/span&gt;;&lt;br /&gt;CommaDelimitedStringCollection emailList = new CommaDelimitedStringCollection();&lt;br /&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;ADU&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;i&lt;span class="kwrd"&gt;&lt;/span&gt;l&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;G&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;t&lt;span class="kwrd"&gt;&lt;/span&gt;U&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;I&lt;span class="kwrd"&gt;&lt;/span&gt;n&lt;span class="kwrd"&gt;&lt;/span&gt;G&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;&lt;/span&gt;L&lt;span class="kwrd"&gt;&lt;/span&gt;D&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;P&lt;span class="kwrd"&gt;&lt;/span&gt;G&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;u&lt;span class="kwrd"&gt;&lt;/span&gt;p&lt;span class="kwrd"&gt;&lt;/span&gt;A&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;d&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;s&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt;.&lt;span class="kwrd"&gt;&lt;/span&gt;F&lt;span class="kwrd"&gt;&lt;/span&gt;o&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;E&lt;span class="kwrd"&gt;&lt;/span&gt;a&lt;span class="kwrd"&gt;&lt;/span&gt;c&lt;span class="kwrd"&gt;&lt;/span&gt;h&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;delegate&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;m&lt;span class="kwrd"&gt;&lt;/span&gt;b&lt;span class="kwrd"&gt;&lt;/span&gt;e&lt;span class="kwrd"&gt;&lt;/span&gt;r&lt;span class="kwrd"&gt;&lt;/span&gt;)&lt;span class="kwrd"&gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&lt;/span&gt;{&lt;span class="kwrd"&gt;&lt;/span&gt;&lt;br /&gt;    emailList.Add(AuthUtils.GetEmailAddress(member));&lt;br /&gt;});&lt;br /&gt;...&lt;br /&gt;mail.To.Add(emailList.ToString());&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;And since we're on the topic of performance, the generic List method "ForEach" is faster than the equivalent regular "foreach", though &lt;a href="http://www.thinksharp.org/performance-iterating-generic-lists/"&gt;"for" is actually the fastest&lt;/a&gt;, but there's really not much of a difference at all unless you're dealing with a huge number of iterations.&lt;/p&gt;&lt;p&gt;As a side note, this is my first post using &lt;a href="http://get.live.com/writer/overview"&gt;Windows Live Writer&lt;/a&gt;, and with the incredibly helpful &lt;a href="http://blogs.msdn.com/mikeormond/archive/2008/02/15/updated-source-code-formatter-for-windows-live-writer.aspx"&gt;"Insert Formatted Code" add-in&lt;/a&gt;. I'm very impressed with both.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-2554405075210952914?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/2554405075210952914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=2554405075210952914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2554405075210952914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2554405075210952914'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/retrieving-user-email-address-from.html' title='Retrieving a user&amp;#39;s email address from Active Directory'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-7337400986685989853</id><published>2008-06-10T10:25:00.000-04:00</published><updated>2008-06-13T09:55:35.294-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>Dead power supply</title><content type='html'>My home desktop computer (Dell Dimension 4500) stopped working last night, but before it died, it blue screened on startup with the following:&lt;br /&gt;&lt;br /&gt;0x0000008E&lt;br /&gt;(0xC0000005, 0x805677CB, 0xF300CB34, 0x00000000)&lt;br /&gt;&lt;br /&gt;According to a number of Google searches, this error can actually mean a few different things, including RAM and driver issues, but the one that made the most sense was that the power supply was weak, since on the next restart attempt, it didn't actually restart (just a green light when the power button is pressed - no fan, no display on the monitor). Also, the power supply fan had been very loud for a few weeks previous. So it all fits.&lt;br /&gt;&lt;br /&gt;I don't have a spare power supply to test with, so I ordered another one last night. Hopefully that's the only problem. I really don't want to get a new computer before &lt;a href="http://www.intel.com/pressroom/archive/releases/20070328fact.htm"&gt;Nehalem&lt;/a&gt; comes out, and preferably not before &lt;a href="http://windows7news.com/"&gt;Windows 7&lt;/a&gt; comes out as well, but my computer is going on seven years, and I've resuscitated it a few times already, so I'm not holding my breath.&lt;br /&gt;&lt;br /&gt;UPDATE (6/12): New power supply arrived (free delivery, only took two days - thanks, &lt;a href="http://911forpcs.com/"&gt;911forPCs.com&lt;/a&gt;!). I installed it, and now everything works again. But, the CPU fan is still a bit loud, so I'm going to try greasing it, or replacing it if necessary.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-7337400986685989853?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/7337400986685989853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=7337400986685989853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7337400986685989853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/7337400986685989853'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/dead-power-supply.html' title='Dead power supply'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-2906427321433234064</id><published>2008-06-09T15:41:00.000-04:00</published><updated>2008-06-10T11:21:13.819-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Using the Java Persistence API with Swing in NetBeans 6.1 (part 1)</title><content type='html'>I have yet to find a good tutorial on how to get started using JPA with the new version of NetBeans that takes advantage of Beans Binding and other helpful new features. NetBeans has a lot built in to help you through it, but configuration is not obvious, and there are a few tricky parts along the way. So hopefully the steps below will at least get you started.&lt;br /&gt;&lt;br /&gt;This tutorial will focus on using JPA without EJB (JPA is part of the EJB spec for now, but was built to be used with or without it - future versions will be separate from the EJB spec to better reflect this). I'm also assuming you have a database already set up, and are just looking to connect it to your application.&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Create a new project in NetBeans 6.1 (Ctrl+Shift+N)&lt;/li&gt;&lt;li&gt;Choose "Java" --&gt; "Java Desktop Application"&lt;/li&gt;&lt;li&gt;Name the application, and select "Basic Application"&lt;/li&gt;&lt;li&gt;Right click on your project, and select "New" --&gt; "Entity Classes from Database..." and select your database connection (see my previous post about connecting to SQL Server)&lt;/li&gt;&lt;li&gt;Change the class names if necessary, and click on "Create Persistence Unit..."&lt;/li&gt;&lt;li&gt;The defaults here are fine - btw, the latest versions of TopLink and Hibernate both fully support JPA. I'm using TopLink for this project.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Back on the main design screen, locate "Java Persistence" in the "Palette" section (normally on the right hand side, at the bottom of the Palette)&lt;/li&gt;&lt;li&gt;Drag an "Entity Manager", "Query", and "Query Result" instance onto the design area, and rename them if you choose.&lt;/li&gt;&lt;li&gt;Click on the instance of the "Query" in the "Inspector" (bottom left-hand side by default), and view its properties (bottom right-hand side by default).&lt;/li&gt;&lt;li&gt;Click on the elipses "..." next to "query" on the properties pane, and type in a valid JPQL query. JPQL is similar in syntax to SQL, but it deal directly with objects. The JPQL query equivalent of&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; *&lt;br /&gt;&lt;span class="kwrd"&gt;FROM&lt;/span&gt; WeeklyDetail&lt;br /&gt;&lt;span class="kwrd"&gt;INNER&lt;/span&gt; &lt;span class="kwrd"&gt;JOIN&lt;/span&gt;...&lt;/pre&gt;would actually be&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;SELECT&lt;/span&gt; wd&lt;br /&gt;&lt;span class="kwrd"&gt;FROM&lt;/span&gt; WeeklyDetail wd&lt;/pre&gt;"wd" is just like a SQL alias (i.e. SELECT wd.* FROM WeeklyDetail wd), but it is required in JPQL.&lt;br /&gt;&lt;br /&gt;The nice part about querying objects is that for simple related objects/tables, you don't need to deal with JOINs. The above JPQL query actually returns all related objects (from different underlying SQL tables). To adjust for performance, you can explicitly state how the data is "fetched" - basically "all at one time" or "on demand". However, this is control in the entity classes.&lt;br /&gt;&lt;br /&gt;There's volumes more to JPA - to really get a handle on how to work with it, I suggest reading "Pro EJB 3: Java Persistence API" by Mike Keith and Merrick Schincariol.&lt;/li&gt;&lt;li&gt;Make sure in "other properties" below the query field, that your Entity Manager is selected as the "entityManager".&lt;/li&gt;&lt;li&gt;Select your "Query Results" instance (I've called mine "weeklyDetailsQueryResult"), and view it's properties.&lt;/li&gt;&lt;li&gt;Select your query that you just worked with, and check "modifiableWrapper" and "observable".&lt;/li&gt;&lt;li&gt;Under the "Code" tab (still in the properties), in the "Type Parameters" field, type the name of your package followed by a "." and the entity class name. Technically, the package name should be different casing from your application name (Pascal case for the application, camel case for the package.&lt;br /&gt;&lt;br /&gt;NOTE: If you type the casing incorrectly, it will appear to work until you run the project.&lt;/li&gt;&lt;li&gt;Drag a jTable onto the design area (or jxTable if you're using SwingX (see my previous post) and want to have built-in column sorting).&lt;/li&gt;&lt;li&gt;Right click on the table, and select "Bind" --&gt; "elements".&lt;/li&gt;&lt;li&gt;For the binding source, choose the query result you just created, and choose the columns you would like displayed in the table.&lt;/li&gt;&lt;li&gt;Now when you run the project, the table should populate with the data from your database.&lt;/li&gt;&lt;/ol&gt;Part 2 of this tutorial will address how to update and delete data from within the table.&lt;br /&gt;&lt;br /&gt;NOTE: screen captures showing each step coming soon&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-2906427321433234064?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/2906427321433234064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=2906427321433234064' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2906427321433234064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/2906427321433234064'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/using-java-persistence-api-with-swing.html' title='Using the Java Persistence API with Swing in NetBeans 6.1 (part 1)'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-4657497324165949162</id><published>2008-06-06T17:06:00.000-04:00</published><updated>2008-06-10T11:22:55.440-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>sp_MSForEachTable</title><content type='html'>I had to improve performance on a just-restored database, and remembered of one of my favorite undocumented SQL Server commands, sp_MSForEachTable. In the below example, the "?" is the variable for where the table name should go in the statement you want to execute:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;EXEC&lt;/span&gt; sp_MSForEachTable "&lt;span class="kwrd"&gt;UPDATE&lt;/span&gt; &lt;span class="kwrd"&gt;STATISTICS&lt;/span&gt; ?"&lt;/pre&gt;Another quick example - to print out all the table names in a db, just run:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;EXEC&lt;/span&gt; sp_MSForEachTable "&lt;span class="kwrd"&gt;PRINT&lt;/span&gt; &lt;span class="str"&gt;'?'&lt;/span&gt;"&lt;/pre&gt;FYI, there's also sp_MSForEachDB that lets you do the same operation on all databases on the server. Learning this alone was worth the price of Brian Knight's "Admin 911: SQL Server 2000" book.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-4657497324165949162?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/4657497324165949162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=4657497324165949162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/4657497324165949162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/4657497324165949162'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/05/spmsforeachtable.html' title='sp_MSForEachTable'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8925587625875551465</id><published>2008-06-05T15:17:00.001-04:00</published><updated>2008-06-13T17:01:18.731-04:00</updated><title type='text'>Baluster End Spacing Calculator in C#</title><content type='html'>I'm working on putting up balusters (spindles) on my deck at home, and since all the posts are spaced differently, I needed to calculate the proper end spacing for each section. Granted, it's easy enough to do this by guessing at the first length, then physically marking out each baluster width and spacing on the actual deck, and then adding the start spacing with the end spacing and dividing by two. And that's probably what I'd normally do, but I wanted to take a little break, so I made a quick app to figure this out for me.&lt;br /&gt;&lt;br /&gt;It's a very simple app, and took about 10 minutes to write, but here's the interesting parts in case anyone is interested:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// Determines the number of balusters needed based on the top railing width&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;Baluster count&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; CalculateBalustersNeeded() {&lt;br /&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; numberOfBalusters = Convert.ToInt32(Math.Ceiling(&lt;br/&gt;(&lt;span class="kwrd"&gt;this&lt;/span&gt;.topRailingWidth - &lt;span class="kwrd"&gt;this&lt;/span&gt;.spacing) / (&lt;span class="kwrd"&gt;this&lt;/span&gt;.balusterWidth + &lt;span class="kwrd"&gt;this&lt;/span&gt;.spacing)));&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; numberOfBalusters;&lt;br /&gt;}&lt;/pre&gt;and&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// Determines the spacing between the post and the baluster.&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="balusterCount"&amp;gt;# of balusters used.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;Spacing at each end in inches&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;float&lt;/span&gt; CalculateEndSpacing(&lt;span class="kwrd"&gt;int&lt;/span&gt; balusterCount) {&lt;br /&gt;    &lt;span class="rem"&gt;//all balusters + spacing without end spacing&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;float&lt;/span&gt; totalUnitWidth = (balusterCount * &lt;span class="kwrd"&gt;this&lt;/span&gt;.balusterWidth)&lt;br/&gt;+ (&lt;span class="kwrd"&gt;this&lt;/span&gt;.spacing * (balusterCount - 1));&lt;br /&gt;    &lt;span class="kwrd"&gt;float&lt;/span&gt; endSpacing = (&lt;span class="kwrd"&gt;this&lt;/span&gt;.topRailingWidth - totalUnitWidth) / 2;&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; endSpacing;&lt;br /&gt;}&lt;/pre&gt;Nothing too exciting, really. And Excel probably would have been a better choice than a console app. But since it's all done with more or less "proper" objects (these methods are part of a "RailingSection" class generic collection that's part of a "Deck" object), I can now easily expand this into a full-blown deck design software package. Right. I guess I just can't get enough of coding at work...&lt;br /&gt;&lt;br /&gt;UPDATE (6/13): Wow, this post is getting a lot of hits by people searching for a baluster calculator - here's the compiled EXE file: &lt;a href="http://gruskada.googlepages.com/BalusterCalc.exe"&gt;BalusterCalc.exe&lt;/a&gt;. You'll need the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6&amp;displaylang=en"&gt;.NET framework&lt;/a&gt; 2.0 or higher to run it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8925587625875551465?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8925587625875551465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8925587625875551465' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8925587625875551465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8925587625875551465'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/06/baluster-end-spacing-calculator-in-c.html' title='Baluster End Spacing Calculator in C#'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-5173437230063472444</id><published>2008-05-22T10:20:00.001-04:00</published><updated>2008-06-10T11:18:34.587-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Querying Active Directory groups via LDAP in ASP.NET</title><content type='html'>The RoleManager in .NET is great for SQL-based auth, but is really lacking when it comes to Windows auth. I needed to get a list of all users in a role, and was excited to find that the following method exists:&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;Roles.GetUsersInRole(&lt;span class="str"&gt;"RoleName"&lt;/span&gt;);&lt;/pre&gt;By the way, to use RoleManager, add the following code in your Web.Config file within the System.Web tags:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt; &lt;span class="attr"&gt;mode&lt;/span&gt;&lt;span class="kwrd"&gt;="Windows"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;roleManager&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;defaultProvider&lt;/span&gt;&lt;span class="kwrd"&gt;="AspNetWindowsTokenRoleProvider"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;Perfect, except that you get the following error when using it with Windows auth:&lt;br /&gt;&lt;blockquote&gt;"The configured Role Provider (WindowsTokenRoleProvider) relies upon Windows authentication to determine the groups that the user is allowed to be a member of. ASP.NET Role Manager cannot be used to manage Windows users and groups. Please use the SQLRoleProvider if you would like to support custom user/role assignment."&lt;/blockquote&gt;Rather lame. I don't want to add/edit/delete users and groups - just look up what users are in a group. In any case, I ended up querying this info from Active Directory with LDAP. I made a static class called "AuthUtils" and first added the following method:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.DirectoryServices;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; GetUsersInGroup(&lt;span class="kwrd"&gt;string&lt;/span&gt; LDAPAddress) {&lt;br /&gt;  List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; groupMembers = &lt;span class="kwrd"&gt;new&lt;/span&gt; List();&lt;br /&gt;  DirectoryEntry group = &lt;span class="kwrd"&gt;new&lt;/span&gt; DirectoryEntry(LDAPAddress);&lt;br /&gt;  &lt;span class="kwrd"&gt;foreach&lt;/span&gt;(&lt;span class="kwrd"&gt;object&lt;/span&gt; dn &lt;span class="kwrd"&gt;in&lt;/span&gt; group.Properties[&lt;span class="str"&gt;"member"&lt;/span&gt;]) {&lt;br /&gt;     &lt;span class="kwrd"&gt;string&lt;/span&gt;[] parsedName = dn.ToString().Replace(&lt;span class="str"&gt;"CN="&lt;/span&gt;, String.Empty).Split(&lt;span class="str"&gt;','&lt;/span&gt;);&lt;br /&gt;     groupMembers.Add(parsedName[0]);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;return&lt;/span&gt; groupMembers;&lt;br /&gt;}&lt;/pre&gt;which is callable with the following:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; LDAPGroupAddress = &lt;span class="str"&gt;"LDAP://domain.com/CN=GroupName,CN=Users,DC=domain,DC=com"&lt;/span&gt;;&lt;br /&gt;List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; groupMembers = AuthUtils.GetUsersInGroup(LDAPGroupAddress);&lt;/pre&gt;The above method strips out the CN (Canonical Name) tags from the results, and returns a list of user name strings.&lt;br /&gt;&lt;br /&gt;I also built another quick method in AuthUtils to determine if a user is in a role, which also depends on the "GetUsersInGroup" method that was just built:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; IsInRole(&lt;span class="kwrd"&gt;string&lt;/span&gt; LDAPAddress, &lt;span class="kwrd"&gt;string&lt;/span&gt; user) {&lt;br /&gt;    List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; groupMembers = GetUsersInGroup(LDAPAddress);&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; groupMembers.Contains(user);&lt;br /&gt;}&lt;/pre&gt;This simply gets the group members as above, and uses the handy "Contains" method that's available in generic lists to return a true or false.&lt;br /&gt;&lt;br /&gt;There is a User.IsInRole that works with regular NTLM auth, but for some reason it seems a bit flaky with an Active Directory back end. The method I've created above has always worked for me so far. I'm in the process of figuring out what the issue is with the regular User.IsInRole("RoleName") method, as it's bothersome that this doesn't work consistently.&lt;br /&gt;&lt;br /&gt;UPDATE: Roles.IsUserInRole("RoleName") works fine with AD (vs. using User.IsInRole("RoleName"), as long as you're using IIS. It doesn't seem to work well with Visual Studio's built-in Web server (it always caches the role info).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-5173437230063472444?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/5173437230063472444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=5173437230063472444' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5173437230063472444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5173437230063472444'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/05/querying-active-directory-groups-via.html' title='Querying Active Directory groups via LDAP in ASP.NET'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-5138462820847184472</id><published>2008-05-20T14:20:00.000-04:00</published><updated>2008-05-22T11:18:38.845-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Free J2EE online course</title><content type='html'>The next run of the J2EE Programming course in the excellent "Java with Passion" series starts on July 1st. This is all put together by &lt;a href="http://www.javapassion.com/SangSchedule.html#Bio"&gt;Sang Shin&lt;/a&gt;, a technology architect at Sun Microsystems.&lt;br /&gt;&lt;br /&gt;More details here:&lt;br /&gt;&lt;a href="http://www.javapassion.com/j2ee/"&gt;http://www.javapassion.com/j2ee/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I've just signed up.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-5138462820847184472?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/5138462820847184472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=5138462820847184472' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5138462820847184472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/5138462820847184472'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/05/free-j2ee-online-course.html' title='Free J2EE online course'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-1324164048440290278</id><published>2008-05-14T09:53:00.000-04:00</published><updated>2008-05-22T11:11:11.649-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Java --&gt; .NET rough equivalents</title><content type='html'>To help me understand Java concepts better, I've made a comparison to the rough equivalents in .NET.&lt;br /&gt;&lt;br /&gt;Here's the list so far:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Java ~= C# or VB.NET&lt;/li&gt;&lt;li&gt;J2EE/JEE (Java Enterprise Edition) ~= .NET framework&lt;/li&gt;&lt;li&gt;Swing ~= Windows Forms&lt;/li&gt;&lt;li&gt;AWT ~= VB6 Forms?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Beans Binding ~= data binding&lt;/li&gt;&lt;li&gt;JPA (Java Persistence API) ~= ORM via ADO.NET Entity Framework / LINQ&lt;br /&gt;&lt;/li&gt;&lt;li&gt;EJBQL/JPQL (Enterprise JavaBeans Query Language/Java Persistence Query Language) ~= LINQ&lt;/li&gt;&lt;li&gt;JDO ~= ADO.NET&lt;br /&gt;&lt;/li&gt;&lt;li&gt;JSF (Java ServerFaces) ~= ASP.NET&lt;/li&gt;&lt;li&gt;JSP (Java Server Pages) ~= plain ASP&lt;/li&gt;&lt;li&gt;Hibernate, JUnit, Spring all have direct .NET equivalents (NHibernate, NUnit, Spring.NET)&lt;/li&gt;&lt;/ul&gt;I'm still getting a grasp on a lot of this stuff, so please let me know if I've misrepresented anything. I'll also add to the list as I think of more things.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-1324164048440290278?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/1324164048440290278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=1324164048440290278' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1324164048440290278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1324164048440290278'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/05/java-net-rough-equivalents.html' title='Java --&gt; .NET rough equivalents'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-1547468057984695701</id><published>2008-05-14T09:36:00.000-04:00</published><updated>2008-05-14T11:01:05.602-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Installing SwingX in NetBeans 6.1</title><content type='html'>SwingX adds some really nice UI and other improvements to Swing. It's sponsored by Sun, and may be released in a future version of Java, but appears stable enough to use in projects now.&lt;br /&gt;&lt;br /&gt;There's a &lt;a href="http://swinglabs.org/docs/ide/netbeans/install-components/tutorial.jsp?step=2"&gt;tutorial&lt;/a&gt; on how to set it up, but it's missing some important content, so here's how I did it:&lt;br /&gt;&lt;br /&gt;1. Download and unzip from &lt;a href="http://swinglabs.org/downloads.jsp"&gt;http://swinglabs.org/downloads.jsp&lt;/a&gt;&lt;br /&gt;2. Place swingx-x.x.x.jar file (from swingx/dist/ folder) in a place that you won't delete it later.&lt;br /&gt;3. Open your project in NetBeans, right-click on "libraries", and choose "Add Library..."&lt;br /&gt;4. Click on "Create...", give it a name (i.e. "SwingX"), and select "Class Libraries".&lt;br /&gt;5. On the next dialog box, under the "Classpath" tab, click "Add JAR/Folder..." and locate the swingx-x.x.x.jar file from step 2.&lt;br /&gt;6. Add the new library to your project.&lt;br /&gt;7. To get the visual items in the palette, go to a jFrame or other class that has a design view, right-click anywhere on the Palette view, and select "Palette Manager...".&lt;br /&gt;8. Click on "New Category..." and type "SwingX" (or whatever you want to call it).&lt;br /&gt;9. Click on "Add from JAR...".&lt;br /&gt;10. Find your swingx.x.x.x.jar file again, and on the next screen, select all the components you want to be displayed.&lt;br /&gt;11. Finally, select the category folder you just created in step 8.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-1547468057984695701?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/1547468057984695701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=1547468057984695701' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1547468057984695701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/1547468057984695701'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/05/installing-swingx-in-netbeans-61.html' title='Installing SwingX in NetBeans 6.1'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-8183031843264309369</id><published>2008-05-13T10:13:00.000-04:00</published><updated>2008-05-14T10:55:56.452-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Working with SQL Server in NetBeans 6.1</title><content type='html'>The JDBC-ODBC bridge wasn't recognizing any of the primary keys I had set up in SQL Server. After lots of head banging, here's the solution I came up with:&lt;br /&gt;&lt;br /&gt;1. Download the appropriate driver. SQL Server 2000 requires the SQL Server 2000 JDBC driver (http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&amp;amp;displaylang=en).&lt;br /&gt;SQL Server 2005 download: (http://www.microsoft.com/downloads/details.aspx?familyid=C47053EB-3B64-4794-950D-81E1EC91C1BA&amp;amp;displaylang=en)&lt;br /&gt;3. After installing, right-click on "Libraries" in your project, and choose "Add Library...". Next, give it a name (i.e. SQLServer2000), and select "Class Libraries".&lt;br /&gt;4. On the next screen, find the JAR files (should be in C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\), and add them under the "Classpath" tab. It will now be available under "Libraries" for future projects.&lt;br /&gt;5. You can now create a connection to a specific database under the "Services" tab (next to "Projects" and "Files" in the top left of the screen). Select "Microsoft Sql Server 2000 (Microsoft Driver)" and format the "Database URL" like this:&lt;br /&gt;&lt;br /&gt;jdbc:microsoft:sqlserver//YOURSERVER:1433;DatabaseName=YOURDATABASE&lt;br /&gt;&lt;br /&gt;1433 is the default port, though your DBA may have changed it.&lt;br /&gt;&lt;br /&gt;I posted a simpler version of this on the NetBeans.org FAQ page - they had the following title with no content on the answer page:&lt;br /&gt;&lt;br /&gt;"Cannot Select Tables From MsSql 2000 Because It Says No Primary Key Next To Each Table But The Tables DO Have A Primary Key. What Do I Do?"&lt;br /&gt;&lt;br /&gt;Looks like somebody was really frustrated, and posted a question in the hopes that somebody would answer it :-) Of course I was really frustrated seeing a question with no answer, so I &lt;a href="http://wiki.netbeans.org/CannotSelectTablesFromMsSql2000BecauseItSaysNoPrimaryKeyNextToEachTableButTheTablesDOHaveAPrimaryKeyWhatDoIDo"&gt;added one&lt;/a&gt; after I figured it out myself.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-8183031843264309369?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/8183031843264309369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=8183031843264309369' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8183031843264309369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/8183031843264309369'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/05/working-with-sql-server-in-netbeans-61.html' title='Working with SQL Server in NetBeans 6.1'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3296335177913866771.post-346509039061279699</id><published>2008-05-12T16:32:00.000-04:00</published><updated>2008-05-14T10:10:00.557-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>.ashx files don't like blank output</title><content type='html'>Interesting - in the case of blank output, a regular .NET web page (.aspx) just outputs nothing to the screen, but a generic handler (.ashx) throws this:&lt;br /&gt;&lt;br /&gt;"XML Parsing Error: no element found"&lt;br /&gt;&lt;br /&gt;The generic handler I was working on was supposed to evaluate where the request was coming from, then do some processing and redirect. This worked fine until I uploaded it live. Turned out my code to evaluate the referrer was not looking for the correct live path. An easy fix, except that the misleading error lead me astray and had me checking .ashx permissions and Win 2k3 settings.&lt;br /&gt;&lt;br /&gt;I finally converted the page back to a .aspx page, and the code returned a blank page, so I was able to quickly find the error after that. Once I corrected the path on the .ashx page, everything worked fine.&lt;br /&gt;&lt;br /&gt;BTW, .ashx files have less overhead than regular .aspx pages, since they're not set up to serve up full web pages, so they're great processing-only pages, and non-html output like XML. More info here:&lt;br /&gt;&lt;a href="http://www.aspcode.net/Creating-an-ASHX-handler-in-ASPNET.aspx"&gt;http://www.aspcode.net/Creating-an-ASHX-handler-in-ASPNET.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3296335177913866771-346509039061279699?l=codery.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codery.blogspot.com/feeds/346509039061279699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3296335177913866771&amp;postID=346509039061279699' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/346509039061279699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3296335177913866771/posts/default/346509039061279699'/><link rel='alternate' type='text/html' href='http://codery.blogspot.com/2008/05/ashx-files-dont-like-blank-output.html' title='.ashx files don&apos;t like blank output'/><author><name>Dave Gruska</name><uri>https://profiles.google.com/112644951132426452686</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-BqdE8s7pGkY/AAAAAAAAAAI/AAAAAAAAAAA/uIUM0G4wxWQ/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry></feed>
