tag:blogger.com,1999:blog-62961213912259608952024-03-08T12:50:48.694-07:00junior propellerHeadThus spake the master programmer:
After three days without programming,
life becomes meaningless.
- The Zen of ProgrammingMikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.comBlogger49125tag:blogger.com,1999:blog-6296121391225960895.post-1087148910437301702010-08-30T13:46:00.003-06:002010-08-30T13:49:36.382-06:00Fiddler and Android SDKSo, I've been trying to get my android emulator to talk through fiddler. I've run through all the settings, command line options, and nothing seems to work. I ran across one quote that I suspect is true, in Android 2 it ignores any proxy settings and is broke. It works great in 1.5.<br /><br />Even though we aren't using Android 2.2 OS, I decided, why not. Kick it off, tweak the settings, and sure enough, it actually works. Since what I'm needing to test isn't specific to 2.1 or 2.2, this is good enough for me. YMMV, but try it with 2.2 and it should work. (if only Google would go back and fix 2.1)...Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-91285222199564492632010-08-26T08:12:00.003-06:002010-08-26T08:23:04.234-06:00Custom Membership Provider in winformsSo, I've been tasked to create users on one system into another. No prob. I just create a simple console app, add our custom membership provider to the right config section, borrow some code from another app, and loop it. Whee....<br /><br />... Until, that is, I kept getting the error, Unable to find XXXX.Membership in System.Web....<br /><br />There's all kinds of references of how to use the default membership provider in a winform or console app, but not much on a custom membership provider. After a good bit of digging, I found this blog: <a href="http://geekswithblogs.net/Shadowin/archive/2007/04/05/110864.aspx">http://geekswithblogs.net/Shadowin/archive/2007/04/05/110864.aspx</a><br /><br />I failed to put ", AssemblyName" in the reference in the config. So it was defaulting to System.Web.<br /><br />Your entry for the custom membership provider should look something like this:<br /><br /><pre><br />< add name="AspNetSqlMembershipProvider" <br />type="XXXXWeb.Security.CustomMembershipProvider, XXXXMembership" <br />connectionstringname="SiteSqlServer" / ><br /></pre>Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-35617318386303658922010-07-28T14:33:00.003-06:002010-07-28T15:20:59.901-06:00'standardEndpoints' cannot be read because it is missing a section declarationI just tried to publish my first WCF RESTful service to our 2k8 box, and hit the wall with the following error:<br /><br /><blockquote>The configuration section 'standardEndpoints' cannot be read because it is missing a section declaration </blockquote><br /><br />Well, after much searching, trying different options, reconfiguring, reading documentation, I finally found a post that should clear it out: <br /><br /><a href="http://blogs.msdn.com/b/rampo/archive/2009/10/26/net-4-0-beta1-beta2-web-application-configuration-section-missing-declaration-error.aspx">NET 4.0 Beta1/Beta2 Web Application Configuration section missing declaration error</a><br /><br /><a href="http://support.microsoft.com/kb/958854/en-us">http://support.microsoft.com/kb/958854/en-us</a><br /><br />Appearently, on a windows server 2008 box, most .net 40 stuff works (well stuff that I've tried), but a couple of the items were missed. I didn't see an sp2 for win2k8 in the updates, so I downloaded and ran the HotFix. And what do you know? That worked. I've seen a bunch of posts on how to fix this error. This might just be the solution you're looking for.Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-23874384468497349352010-06-29T10:47:00.002-06:002010-06-29T10:50:56.536-06:00Okay... i've been busy...Currently, I'm working on a new project using asp.net MVC 2, StructureMap, and all those goodies. I just ran across a nice blog that combines all those, plus some:<br /><a href="http://blog.jorritsalverda.nl/2010/02/09/maintainable-mvc-series-inversion-of-control-container-structuremap/">Maintainable MVC series</a>.<br /><br />The main point was this little nugget, that I figured out on my own, but would have been nice to know about in the beginning: <br /><br /><blockquote>If a class is created by StructureMap it defaults to the constructor with the most parameters.</blockquote><br /><br />Oh well. Even though it takes longer, you often remember things better when you have to struggle to find the answer than it being given to you.<br /><br />Thanks anyways!Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-76278910584922867362009-08-19T15:21:00.001-06:002009-08-19T15:23:58.970-06:00Windows 7 BSOD<p>Hey!  I’m so excited!  I thought they got rid of the blue screen of death with Vista (though those reports were vastly over exaggerated).</p> <p> </p> <p>I got my first BSOD in Windows 7 the other day, and I thought I’d post a screen shot for all to see:</p> <p> </p> <p><a href="http://lh4.ggpht.com/_TkVdO4y2QtA/Soxs5V1-5qI/AAAAAAAABXI/faGgZi2ZU_c/s1600-h/BSOD_Win7_VM%5B3%5D.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BSOD_Win7_VM" border="0" alt="BSOD_Win7_VM" src="http://lh4.ggpht.com/_TkVdO4y2QtA/Soxs50uwB9I/AAAAAAAABXM/Ltv0iDArj2k/BSOD_Win7_VM_thumb%5B1%5D.jpg?imgmax=800" width="402" height="306" /></a> </p> <p>Of course, I was only able to get the BSOD from windows 7 running in a VM. </p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-8795177440570109232009-06-15T13:53:00.001-06:002009-08-19T15:24:28.270-06:00CHM files and Vista<p>I’m working on installing on a new server, TFS 2008, and in the setup directories there is an Install Guide.  Being the diligent (for once) developer, I opened it up, and it said to download the latest install guide giving me a link.  </p> <p>However, after downloading the new chm file from Microsoft, it wouldn’t open.  On one system, it said to check my dns server.  and on my host Vista system, it just wouldn’t display.  I opened up IE, checked the local intranet settings and didn’t see anything there.</p> <p>The solution?  I right-clicked the file, and noticed that there was an Unblock button.  After clicking that, it opened just fine.  Apparently, Vista was preventing me from viewing the web pages inside the help file because they came from a different zone. </p> <p> </p> <p>Once unblocked, the button no longer shows up, and I can read it just fine.</p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-31131757351566306652009-06-05T13:34:00.001-06:002009-06-05T13:36:01.667-06:00Stored Procedure taking forever.<p>Today, I came across an issue where from Sql Server Management Studio, a stored procedure was taking forever to run.  But from the application it was running just fine, and if I executed the sql from within the proc on it’s own, it ran just fine.  </p> <p>Luckily, a friend, Chris Brandsma had stumbled across this about a year ago, and posted it and a solution on <a href="http://elegantcode.com/" target="_blank">Elegant Code</a>.</p> <p><a title="http://elegantcode.com/2008/05/17/sql-parameter-sniffing-and-what-to-do-about-it/" href="http://elegantcode.com/2008/05/17/sql-parameter-sniffing-and-what-to-do-about-it/" target="_blank">http://elegantcode.com/2008/05/17/sql-parameter-sniffing-and-what-to-do-about-it/</a></p> <p>It’s called SQL Parameter sniffing, and MS (as well as Oracle and the others) use it to improve performance of stored procs.  However, if you have a large or sudden variance in the number of rows returned, the proc will seem to “hang up.”</p> <p>At least I know what the fix is, and what to look for if it happens again on one of those “random” timeout bugs.</p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-46488761449182383752009-05-20T17:04:00.001-06:002009-05-20T17:04:08.017-06:00VS2008 and SS Express 2008<p>If you’re running Visual Studio 2008 sp1 and Sql Server 2008 in Vista x64, then you’ve probably come across the error when creating a database:</p> <blockquote> <p> </p> <p>“Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component of download from the URL: </p> <p><a href="http://go.microsoft.com/fwlink/?LinkId=49251">http://go.microsoft.com/fwlink/?LinkId=49251</a>”</p> </blockquote> <p> </p> <p>It took me several days with no real solution until I found a reference to <a title="http://support.microsoft.com/kb/957944" href="http://support.microsoft.com/kb/957944">http://support.microsoft.com/kb/957944</a>  </p> <p>Apparently there is a bug with VS2008 and Sql Server Express 2008 in that some of the files aren’t properly registered, so it doesn’t realize that you have a valid sql server install.  And to make matters worse for finding the solution, it only happens if you are using x64 everything.  </p> <p> </p> <p>You’ll have to email Microsoft to get the Hotfix, or install 32bit sql server express.</p> <p>For me, the Hotfix did work.</p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-11366701152774494852009-05-18T20:04:00.001-06:002009-05-18T20:04:41.374-06:00nunit and VS2008<p>I’ve recently started using NUnit on some of my side projects, and the one frustrating thing has been the lack of ability to debug the unit tests.  </p> <p>I know, I can see the “run” external app on the unit test project to point to the nunit directory, or I can run nunit, manually attach to process, etc.  But those seem kinda hacky.  Or I could shell out money for other solutions.</p> <p>Well, codeplex has once again saved the day:</p> <p> </p> <p><a href="http://nunitit.codeplex.com/" target="_blank">NUnitit</a> is a project that adds a new tools menu that will allow you to debug VS projects in NUnit without having to set the execute remote, or attach process.  It in will auto detect the NUnit install, so if you have NUnit installed in a different directory, you’ll still be fine.  And you aren’t forced to always use NUnit.  You can set your projects up for MSTest and NUnit and be able to debug both.  I hope it’s </p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-37531774549769495392009-05-15T14:14:00.001-06:002009-06-05T13:36:32.639-06:00Top 1 in a subquery…<p>So I came across an interesting sql problem.  I have a list of devices that could have multiple customers attached to the device.  And on the admin page, i need to list the devices and at least one customer attached to the device.</p> <p>I didn’t want to display multiple rows in the table each with the same device but multiple customers.  This is how I solved it:</p> <div id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">select</span> * </pre><br /><!--CRLF--><br /><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">from</span> devices d <span style="color: #0000ff">left</span> <span style="color: #0000ff">outer</span> <span style="color: #0000ff">join</span> customers c <span style="color: #0000ff">on</span> d.id = c.deviceid </pre><br /><!--CRLF--><br /><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">and</span> c.id = (<span style="color: #0000ff">select</span> <span style="color: #0000ff">top</span> 1 id <span style="color: #0000ff">from</span> customers <span style="color: #0000ff">where</span> deviceid = d.id)</pre><br /><!--CRLF--></div><br /></div><br /><br /><p> </p><br /><br /><p>The first left outer join, insures that if i have a device with no customers, I’ll still get the device results back.  If I have multiple customers, I’ll get the first one returned.  I could put other “filtering/sorting” in the subquery if i wanted, but this seemed to work enough for my purposes.</p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-53224562482991364652009-05-14T18:31:00.001-06:002009-05-14T18:31:00.787-06:00Bugged by FindControl….<p> </p> <p>I’ve always been bugged by the “FindControl” method on the Gridview, or any part of the page (I mainly use it on a gridviewrow after selecting).  So I wrote a little Generic method.  This can be added to a utilties class, or just on the codebehind page itself:</p> <p> </p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">public</span> T FindControl<T>(Control searchControl, <span style="color: #0000ff">string</span> controlId) <span style="color: #0000ff">where</span> T : Control {</pre><br /><!--CRLF--><br /><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> <span style="color: #0000ff">return</span> (T)(searchControl.FindControl(controlId)); </pre><br /><!--CRLF--><br /><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> }</pre><br /><!--CRLF--></div><br /></div><br /><br /><p>To use the new FindControl:</p><br /><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br /> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> Label foo = FindControl<Label>(gvTest.SelectedRow, <span style="color: #006080">"myIDLabel"</span>);</pre><br /><!--CRLF--></div><br /></div><br /><br /><p>This is instead of doing something like: </p><br /><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br /> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">((gvTest.SelectedRow).FindControl(<span style="color: #006080">"customerId"</span>) <span style="color: #0000ff">as</span> Label).Text</pre><br /><!--CRLF--></div><br /></div><br /><br /><p>Well, at least it seems cleaner to me in code.  I’m sure that there are better ways, but this works for me for now.</p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-46602104397751661032009-05-12T10:24:00.001-06:002009-05-12T11:22:48.123-06:00Amazing tool for VS 2008 and Sql Server<p>I was just told by a friend that I need to check out what he called “Data Dude”, which is an add-on for Visual Studio 2008.  </p> <p>It adds a Database Schema compare so that you can compare two different databases.  I ran it on our beta db and dev db, and found several differences that I didn’t expect.  </p> <p>Everything from triggers, indexes, columns, etc.  </p> <p><a href="http://lh3.ggpht.com/_TkVdO4y2QtA/SgmwYYyw1PI/AAAAAAAABVo/DHVR8niWvqM/s1600-h/dd1%5B1%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="dd1" border="0" alt="dd1" src="http://lh3.ggpht.com/_TkVdO4y2QtA/SgmivtGjOoI/AAAAAAAABVs/LPTHFvo-XMo/dd1_thumb%5B1%5D.jpg?imgmax=800" width="390" height="46" /></a> </p> <p>It’ll let you drill down into the dependencies, allow you to make the updates, or create new items, etc:</p> <p><a href="http://lh4.ggpht.com/_TkVdO4y2QtA/SgmiwGpGgCI/AAAAAAAABVw/SO44OZeOySI/s1600-h/dd2%5B2%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="dd2" border="0" alt="dd2" src="http://lh3.ggpht.com/_TkVdO4y2QtA/SgmiwYMkEWI/AAAAAAAABV0/O1s3JAtP61g/dd2_thumb%5B1%5D.jpg?imgmax=800" width="418" height="64" /></a> </p> <p>You can easily see the differences:</p> <p><a href="http://lh5.ggpht.com/_TkVdO4y2QtA/SgmjXPebXhI/AAAAAAAABV8/4mq_i7QckaY/s1600-h/dd3%5B1%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="dd3" border="0" alt="dd3" src="http://lh6.ggpht.com/_TkVdO4y2QtA/SgmjXWC7DTI/AAAAAAAABWA/iRA8ExvgI-I/dd3_thumb.jpg?imgmax=800" width="416" height="74" /></a> </p> <p>Here’s the Link:</p> <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&displaylang=en</a></p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-17330633311929850182009-05-12T09:29:00.001-06:002009-05-12T11:46:41.428-06:00Windows Live Writer<p>My first post from windows live writer.  This is suppose to make blogging easier.  So we’ll see.  </p> <p> </p> <p><a title="http://download.live.com/writer" href="http://download.live.com/writer">http://download.live.com/writer</a></p> <p> </p> <p>Update:  Adding plug-ins are cool.  I’ve added a code snippet, and this is what it looks like for formatting:</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 66px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">foreach</span>(bar b <span style="color: #0000ff">in</span> foo) {</pre><br /><!--CRLF--><br /><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100.24%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 16px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span> b.SayHello();</pre><br /><!--CRLF--><br /><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> }</pre><br /><!--CRLF--></div><br /><br /> <p></p><br /></div><br /><br /><p>And this is what the Code Snippet window looks like:</p><br /><br /><p><a href="http://lh3.ggpht.com/_TkVdO4y2QtA/Sgm1p_7CChI/AAAAAAAABWc/OrBojWY4hmw/s1600-h/image%5B4%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_TkVdO4y2QtA/Sgm1qeoH9kI/AAAAAAAABWg/ybZNGxNDTwM/image_thumb%5B2%5D.png?imgmax=800" width="405" height="311" /></a> </p><br /><br /><p>You can copy and paste images from the clipboard (as I just did), and this makes blogging awesome.  </p><br /><br /><p> </p><br /><br /><p>So 2 cool tools today!</p> Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-19188111899905654012009-04-22T11:21:00.005-06:002009-04-22T12:56:50.192-06:00How to Resize a VMWare DiskI use VMWare, and one problem is that the default save being 16gb often runs out of space. After googling for an easy method for increasing the size, I've found several solutions involving using Linux boot CDs, tools etc. This is how I did it:<br /><br />First, use the VMWare command*:<br /><pre><br />C:\Program Files (x86)\VMWare\VMWare Workstation\vmware-vdiskmanager -x 32Gb "x:\Dir\DiskFileName.vmdk"<br /></pre><br />Or where ever your VMWare workstation is installed<br />This will increase it to 32gb<br /><br />Then go to http://www.partition-tool.com/personal.htm and you can use their free version to increase the primary drive.<br /><br />the free version only supports 32bit OS, so if your vm is 64, you might look at mounting the linux iso at www.sysresccd.org to increase the partition.<br /><br />Hope that helps.<br /><br />* one thing to note, I read somewhere that you should not have any snapshots of the drive sitting out there. Also, back everything up first before trying (I made full clones, just in case).Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com1tag:blogger.com,1999:blog-6296121391225960895.post-49341407375209953792008-09-02T10:38:00.004-06:002008-09-02T10:47:18.893-06:00A nifty program...Here is a very nifty site for formatting code for HTML:<br />http://www.manoli.net/csharpformat/<br /><br />what makes this really good, is that you can nest the css into the document, so for sites where you can't link the css, you can still use it. <br /><br />I use the output of this for our internal wiki with sql.<br /><br />Here is a screenshot of the output : (unfortunately, blogger is overriding the css)<br /><br /><a href="http://3.bp.blogspot.com/_TkVdO4y2QtA/SL1tjbmipuI/AAAAAAAAA_U/Irir6gctof0/s1600-h/Capture.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_TkVdO4y2QtA/SL1tjbmipuI/AAAAAAAAA_U/Irir6gctof0/s320/Capture.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5241465996801386210" /></a><br /><br />So, hopefully someone can tellme how to override the css in blogger, so that it works. However, for the Sharepoint Wiki that we use, it's great.<br />And the source is available, so that you can fix some of those bugs, such as no space after a -- causes the comment to not be formatted.Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-15818722967098308872008-06-09T11:22:00.003-06:002008-06-10T15:34:32.799-06:00remote webservice debuggingI was given this link by a friend, that shows how to enable the debuging forms for webservices in an app: <a href="http://geekswithblogs.net/juang/archive/2005/11/28/61437.aspx">http://geekswithblogs.net/juang/archive/2005/11/28/61437.aspx</a><br /><br />All you have to do is add:<br /><pre><code><br /><configuration><br /> <system.web><br /> <webServices><br /> <protocols><br /> <add name="HttpGet"/><br /> <add name="HttpPost"/><br /> </protocols><br /> </webServices><br /> </system.web><br /></configuration></code><br /></pre><br />to your web.config and now you can call the webservice from a different machine and get the test form. Now you don't have to have fiddler installed on your servers to view info.Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com1tag:blogger.com,1999:blog-6296121391225960895.post-90985181114867721662008-04-09T07:32:00.006-06:002008-11-13T10:33:28.681-07:00Vista USB Drive Annoyances and a Solution<div>I'm not sure if it's Vista64, VMWare, Maxtor, or something else entirely, but over the past 9 months, I've had an working, not working issue with the "Safely Remove Hardware".</div><br /><img id="BLOGGER_PHOTO_ID_5187245956153209938" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_TkVdO4y2QtA/R_zMtsMX9FI/AAAAAAAAAAs/JJBncIu3CqE/s320/Arg.JPG" border="0" /><br /><div>I run VMWare workstation on my External Maxtor Turbo edition Drives. They run all my development tools in xp. And my base os of course is Vista 64 Business edition. Well, depending on the version number of VMWare, for a while, I was always able to Safely remove the drives after shutting down all of my vms and exiting the program. However, a couple weeks ago, I installed an update to VMWare as well as SP1 to Vista. Oh, and I added a docking station to the mix as well. </div><br /><div></div><br /><br /><div>Now it seems that I can't ever safely remove the drive. To remedy the situation, I closed down all the programs I had open, killed tasks but to no avail, it still doesn't work. The only way to remove it is to shutdown the computer.</div><br /><div></div><br /><div>Are there alternatives out there? Appearently there are. I found a nifty program called <strong>USB Safely Remove</strong> at <a href="http://safelyremove.com/">http://safelyremove.com/</a> and their program actually does what Microsoft <a href="http://2.bp.blogspot.com/_TkVdO4y2QtA/R_zKnMMX9EI/AAAAAAAAAAk/qpSUtxCdgBE/s1600-h/SR.JPG"><img id="BLOGGER_PHOTO_ID_5187243645460804674" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_TkVdO4y2QtA/R_zKnMMX9EI/AAAAAAAAAAk/qpSUtxCdgBE/s320/SR.JPG" border="0" /></a>should have offered in the beginning. It tells you what programs are running against the drive if it's unable to remove the hardware. That is a really nice feature. </div><br /><br /><br /><div></div><br /><br /><br /><div>What I also like about it, is that it hides itself in the task bar, replacing the windows remove icon, so I don't have to run a separate program. The interface is a lot cleaner, and fewer clicks to find what devices I want to remove. </div><br /><br /><div></div><div>With the program, I was able to find that my Maxtor drive had a process using it with different admin level that what's current running has access to the drive. And that's why I'm not able to remove it. My other USB devices show up fine and can be removed without a problem. And I don't end up with the generic "This device is in use" message. I actually get something kind of handy.</div><br /><br /><div></div><div>Here is a link to their usage guide. <a href="http://safelyremove.com/scr_guide.htm">http://safelyremove.com/scr_guide.htm</a></div><br /><div></div><br /><div>Another thing that I like, is that they have a ton of options. You can force a device to shutdown. And you can even build command line scripts! You can change icons for each of your devices, hide or show devices in the list, and it tells you how many are currently hidden. The interface is intuitive and clean. They also appear to be updating every month or two, so you know the developers love there program, and are constantly trying to improve it (that means a lot to a fellow developer like me).</div><br /><div></div><br /><div>So, if you find yourself often getting the can't remove device now, use this program. You'll be able to figure out what is causing the lock on the drive, and be able to remove it quickly. </div><br /><div></div><br /><div>It's pretty inexpensive, and it will save you a ton of headaches if you swap out a lot of usb devices. You can download it for free and get a 30 day trial.</div><br /><br /><br /><div></div><br /><br /><br /><div></div>Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-29997427636724153232008-03-18T14:42:00.005-06:002008-03-18T15:19:34.979-06:00Team Foundation Server 2008I have a fresh install of Windows Server 2k3, just installed Sql Server 2k5 and Sql Server SP2. I'm getting ready to install Team Foundation Server 2008.<br /><br />And then I get the ubiquitous error: 320000<br /><br /><br />The Commandline '"C:\...\TFRSConfig.exe" /setup /install /s "servername" /u "NT Authority\NetworkService" /buildInIdentity /l "1033" /verify /ignoreExistingIISArtifacts /instancename "MSSQLSERVER" /appPoolName "ReportServer" /reportServerUri "<a href="http://localhost/ReportServer">http://localhost/ReportServer</a>" /reportManagerUri "<a href="http://localhost/Reports">http://localhost/Reports</a>" /h "servername"' returned non-zero value: -2147022676.<br /><br />I've seen other sites with this, tried the click retry 4 to 8000 times, and nothing. I finally killed the install. Then I remembered, when I was installing Sql Server and IIS i had switch a flag for some other error I was getting in IIS:<br /><br />The fix was to go to open IIS, right click on Web Sites, select properties, select service tab, then check Run WWW service in IIS 5.0 isolation mode.<br /><br />Figuring that there wasn't much else I could do, I unchecked that field, and went back through the TFS install.<br /><br />What do you know? It worked. (oh and I had to restart IIS).<br /><br />So, at least I've gotten it installed. Now to play with it.Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-28712648346500972562008-03-11T08:28:00.003-06:002008-03-11T08:31:23.706-06:001 old and 1 new feature of Gmail.<a href="http://gmailblog.blogspot.com/2008/03/2-hidden-ways-to-get-more-from-your.html">Official Gmail Blog: 2 hidden ways to get more from your Gmail address</a><br /><br />I just found on the GMail Blog two neat features you can do with your gmail addresss. One I've known about for years, and that is using a period in your email address. so <a href="mailto:example@gmail.com">example@gmail.com</a> is the same as <a href="mailto:ex.amp.le@gmail.com">ex.amp.le@gmail.com</a>, and you can use that to figure out where spam is coming from, if you place the period in different places of your email. That's of limited use, unless you want to be spiffy any have a period separating words in the email address. The other item that I didn't know about and was really interesting was using the + in your email. So you can send email to <a href="mailto:exampl+orders@gmail.com">exampl+orders@gmail.com</a>. Then create a filter for the +orders and have all your orders labeled. I've started using +spam, +orders, etc. I then know if someone starts to sell my email address to other companies, I can just start blocking the +.<br /><br />I use this with my google domain email, and it works great!Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com3tag:blogger.com,1999:blog-6296121391225960895.post-28756784078602216922008-02-25T11:48:00.002-07:002008-02-25T11:51:59.695-07:00cwbx info on connection poolingWell, I talked on the phone with IBM's .net Support. And the cwbx definitely does not do any kind of pooling. It's a batch/queue setup. So multiple calls into the dll will stack up one after the other until they are all done. <br /><br />To get around this I created a simple Object Pool, that would instanciate the object's connection to the 400, and then when I need the object, get it from the pool, use it and return it. Pretty slick!<br /><br />As for the connecitons on the 400, they just sit in a status of TIMW until they are used. I do have a limit on the number of connections in the pool, so if I get too many in there, I close the oldest one down.Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com3tag:blogger.com,1999:blog-6296121391225960895.post-78034475967483215632008-02-14T13:59:00.002-07:002008-02-14T14:04:53.074-07:00cwbx help filesWell, I wrote an application that I was getting the objectdisposed exception in, and that was using IBMs .net provider to talk to the as400, call a stored proc which called a program.<br /><br />Unfortunately, that wasn't fast enough for me, so I started searching around for help on calling programs directly. I found a dll, that you can reference in your project, which will give you access to calling 400 programs directly. This opens up a whole new world because you can start passing complex types back and forth (suposedly, I haven't tried this myself). The downside, is that there is only one real other blog that actually has info on it.<br /><a href="http://www.netsplore.com/PublicPortal/blog.aspx?EntryID=13">http://www.netsplore.com/PublicPortal/blog.aspx?EntryID=13</a><br /><br />And the program works great. However, I needed to know what some of the values mean, because even though this method is faster than the .net provider, i'm still slower than running websphere for the same calls. <br /><br />It took some reasearch, but for all you out there, who need to know, you can find the cwbx.dll help files in the following directory on your windows system:<br /><br /><p>C:\Program Files\IBM\Client Access\Mri2924\cwbx.hlp</p><p>that last directory having to do something with the version of your client access.....</p><p>This basically a help file on what all the values, types, methods, objects, etc mean for that dll.</p><p> </p>Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com2tag:blogger.com,1999:blog-6296121391225960895.post-37290463174974897712008-02-14T13:54:00.002-07:002008-02-14T13:59:33.952-07:00objectdisposedexception Fixed!I found the problem, and posted the solution on a comment field in one of the previous posts. But here it is. Our server was running the latest fixes, however, my client access was not updated to the latest service pack. Our Operations manager, gave me this link to IBMs site to install the service pack on my local windows machine, and it works.<br /><br /><a href="ftp://ftp.software.ibm.com/as400/products/clientaccess/win32/">ftp://ftp.software.ibm.com/as400/products/clientaccess/win32/</a><br /><br />Then select v5r4m0 (or what ever version you are running), servicepack, and si29771.<br /><br />Download si29771.exe and run it on your system. Poof! Now you no longer get the objectdisposedexception, and no more errors with ThreadPool.RegisterWaitForSingleObject<br /><br />Hope this helps!Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-51158725168985241692008-01-22T19:08:00.000-07:002008-01-23T18:41:25.157-07:00web.config appsettings and updatesWell, I finally figured it out. If you're like me, you have some settings in your website that you want to be able to update, but you don't want to bounce the app domain, yet, your values need to be displayed as changes.<br /><br />I figured out how to do it. First, give the <appsettings>section of your web.config a config source. This will point your web.config to a separate file that you can use to store your settings. Since, it's this other file that is updating, your app domain shouldn't bounce every time you change a setting<br /><br /><appsettings configsource="appsettings.config"></appsettings><br /><br />Once you've added that line,<br /><br />then add either in a separate class, partial, or wherever the following:<br /><br /><code>private void SaveSetting(string SettingName, string SettingValue)<br />{<br />//connect to the webconfiguration file<br />Configuration config = WebConfigurationManager.OpenWebConfiguration("~");<br /><br />//get the setting that you want to update<br />KeyValueConfigurationElement setting = config.AppSettings.Settings[SettingName];<br /><br />//assign the new value to the setting<br />setting.Value = SettingValue;<br /><br />//save the configuration changes<br />config.Save(ConfigurationSaveMode.Minimal, false);<br /><br />// Force a reload of the changed section.<br />ConfigurationManager.RefreshSection("appSettings");<br /><br />}<br /><br /></code><br /><br />This will get the key that you are looking for, update it. You can actually see when this happens, if in Visual Studio you have the file open. It will prompt you that a change has been made to the file, and ask if you wish to reload it.<br /><br />Edit: Note, that even when you force the RefreshSection, from what I understand, that'll only refresh the web.config section to reload. Appearently, it won't always refresh external files. So your changes may not show up right away. ARG. <br /><br />If anyone has a solution to this, I'd appreciate it.Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-50654513975515778512008-01-17T07:50:00.000-07:002008-01-17T07:53:57.771-07:00.net framework debuggingIt's finally out. On ScottGu's blog, he posted information on how to read the .net framework source code!<br /><br /><a href="http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx">.NET Framework Library Source Code now available</a><br /><br />You do still have to enable it, but at least it's available.Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0tag:blogger.com,1999:blog-6296121391225960895.post-62898356976165688282008-01-17T07:13:00.000-07:002008-01-17T07:17:43.666-07:00Free Microsoft books.I just found 3 free microsoft books that you can download as a PDF:<br /><br /><a href="http://csna01.libredigital.com/">Microsoft Press</a><br /><br />Once signed in, you can download <span style="font-style: italic;">Introducing LINQ, Introducing ASP.NET AJAX, </span>and <span style="font-style: italic;">Introducing Silverlight 1.0</span><br /><br />You can preview a couple of chapters, or download the whole book in PDF format.<br /><br />Enjoy!Mikehttp://www.blogger.com/profile/08510534397033993815noreply@blogger.com0