CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Eric Wise

Business & .NET

July 2004 - Posts

  • I really enjoyed this article

    an interesting essay on programmers and psychology brought to my attention by Grant Killian.  I agreed with the majority of the article, in spite of a bit of anti microsoft sentiment (seems to be saying open source coders ala python are more elite than java/microsoft).

    I particularily liked the productivity comments where the more elite coders pound out many times the volume of work that other coders do.  I experienced this recently when working on a government project.  I was told by some of the other developers to “pace myself” so as not to make them look bad.  By the end of the project I was literally doing 5-10 hours of real work in a 40 hour week and was getting heaps of praise by management as someone who gets the job done!

    How about you guys out there in blog land?  How “hard” do you have to work to meet the expectations set by your employers?  I've always found the expectations to be rather low, but I don't consider myself an elite coder by any means either.

    Also, what would you say would be the #1 benefit that would entice you away from your current position?  Anytime I've changed jobs in the past it was about technical growth.  I've started to feel pretty confident with my technical skills though and now I find that interesting projects and money (now that I got married and am planning a family) are more attractive.

  • I now hate reporting services

    What a waste of my time. 

    It's all sorts of messed up just because I don't run my IIS development on port 80. 

    It tells me I don't have permission to build reports when I'm logged in as administrator. 

    There's no apparent way to change the datasource on the fly.

    I guess it would be a great thing if I was serving these reports on a LAN and everything ran on port 80 and only windows authentication was used.

    Fed up with it now though, I'll just dispay report data in the damn datagrid.

  • Set Foo = Nothing Explained

    Much credit to Sjoerd Verweij

    Setting Objects to Nothing

    Set X = Nothing does not destroy the object, it destroys the reference to it.  This holds true for VB6 and VB.NET.  Understanding the difference in how Garbage collection works in VB6 and VB.NET is a good thing to know.

    VB6

    In VB6 it's a variable going out of scope does the same thing.  There is a reference counter for the variable, which gets set to 1 when the object is created, and incremented every time something starts pointing to it.  Conversely, whenever something stops pointing to it, or that something gets destroyed (for example, when exiting the Sub the variable was declared in), the value is decremented.  If it hits 0, the object is cleaned up. So, if all goes well: 

    Private Sub X

       Dim Y As New Z ' 1

       Dim A As Z 

       Set A = Y ' 2

       Set A = Nothing ' 1

       Set Y = Nothing ' 0

    End Sub 

    It's inconsequential in this case, since: 

    Private Sub X

       Dim Y As New Z ' 1

       Dim A As Z 

       Set A = Y ' 2

       Set A = Nothing ' 1

    End Sub ' 0 

    Has the exact same effect.   Sometimes, in VB6, you do want to do it, for example when you stop using something half-way through a procedure and want to free memory or resources: 

    Private Sub X

       Dim Y As New Huge

       ...

       Set Y = Nothing 

       For I = 1 To 50000

          ...

       Next

    End Sub

    Now there is an interesting problem that can occur when something else starts pointing to it:

    Dim A As Y

    Private Sub X

       Dim Z As New Y ' 1

       Set A = Z '2

       Set Z = Nothing ' 1

    End Sub

    Since A does not go out of scope and is therefore still alive, the instance of Y is still hanging around.T  hat's fine as long as you realize this is happening.  However, X might be 300 lines long, and it might be far from obvious that A is still pointing to the instance of Y when it exits.  Reading the code, you might be deluded into thinking that the object is destroyed when it is not.

    VB.NET

    With garbage collection, the object does not have the counter "how many people are pointing to me".When an object is created, it's created. If a variable goes out of scope it does not affect the object itself.Whether or not you do Set X = Nothing, the object will not be destroyed.  So how does it go away? At a certain time in the future (yes, that's vague), a garbage collection will be performed.At that time, the collector will look at the heap, and see an instance of a Y object.It then starts to look at all currently active variables outside of the heap (called roots) that point to it.If nothing points to it, Y is destroyed. GC only fires when the main heap has no free space and needs some to perform an operation.Finalize is called during GC and may never be called until your application quits.Also Note that GC will not clean up resources you set such as file pointers that you leave open.You must close these upon dispose.  This means two things:    

    1.  Since you no longer know when an object is destroyed, you have to clean up manually if you want to be sure that Y closes the database connection it opened.But keep in mind that like outlined above, in VB6 it might not go away as planned either.You can destroy explicitly by implementing IDisposable.Dispose.    
    2. This forever solves circular references. If you have X, Y and Z on the heap, which all point to each other, with the VB6 scheme it's hard to figure out to get all reference counts to 0 so everything will be cleaned up.The .NET garbage collector, however, can just see that nothing outside the heap is pointing to them and destroy them.
  • Set foo = Nothing?

    It's my understanding that because the .NET Garbage collector looks at the heap, and checks to see if any variables on the heap are in scope that setting an object to nothing at the end of a function in VB .NET really doesn't gain you anything yet I see code like this often:

    Try

          'Do Stuff

    Catch

    Finally

          'Set a bunch of objects = Nothing

    End Try

    Is there a valid reason to do this in your methods that I'm missing?  Or is this just a habitual holdover from VB 6.0 programmers?

  • Empower ISV Rocks

    $400, I have MSDN Universal, I received the media after a week, had access to subscriber downloads in 3 days, and a free MSDN Magazine subscription to boot.

    If you have the means, don't pass up the Empower ISV Program, it's been nothing but joy.

  • SQL Server Reporting Services Install Warning

    If you don't run your IIS on the default port 80 you should switch it to port 80 before installing reporting services else the install program gets very confused.  (It ended up creating a second default website in XP for me which wouldn't start, I had to copy the two virtual directories from that space to the actual running space my other sites are on)

    I have it working now though in the VS IDE, my only disappointment is I haven't figured out how to switch the connection string for a report at runtime.  Each of my customers has their own sql server space and so I'd like them to be able to log in, and have that login information determine the datasource the reports use.  I'm also having some difficulties getting it to render in an ASP .NET page but I think that is more due to improperly setting my report path.

    I haven't really had time to explore these issues.  Probably won't until next week since I'm going home to visit the folks in Ohio this weekend and interviewing for some local jobs there (Funny how getting married and the thoughts of starting a family make you homesick).  I'll post a follow-up when I resolve the issues.

  • Couple Upgrade Questions

    Can I install visual studio enterprise architect over VS professional or do I have to uninstall VS pro first then install EA?

    Same question for SQL Server personal edition, I'd like to move to developer edition so I can start playing with SQL Reporting services.

    If no one knows for sure I'll just try it later today and post on the results.

  • A tiny ray of joy

    I need to send this link to the programmers I've mentored.

  • Want to raise your blood pressure?

    Check out yesterday's slashdot article about PHP5 vs ASP .NET.  The article and the comments are both appalling.  If you're going to slam a product, at least have the decency to know facts about it first.

    Some of my favorites:

    - The licensing costs for .NET are too high.  (Cause you all know the .net framework costs so much to download, and webmatrix costs an arm and a leg)

    - A comparison between php code and .net code doing some oracle stuff in the article.  The sample code for the two examples doesn't do the same task yet the author construes it as a fault in .NET.

    - The article itself is hosted by oracle... that immediately makes me trust its contents.

    - The usual OSS goo about how wonderful it is that PHP is free where Microsoft isn't.

    And the best one of all:

    - If you use a great GUI tool like visual studio, you're just hiding the fact that you're an incompetent programmer because you don't type everything in text pad.

    http://slashdot.org/article.pl?sid=04/07/19/1230205

     

    How is it that I'm having difficulty finding a contract when buffoons like this have jobs?

  • Licensing Agreements

    Anyone have any experience with licensing/selling the rights to software they've written?

    I have two scenarios developing for my business as follows:

    Company A may be interested in reselling my product to their customers.  Not a typical reseller though as they would want to integrate my product into their business and use it as a tool to give them a competitive advantage over other companies in their geographic location.  Company A is not a software company.

    Company B is a software company.  They may be interested in either reselling my product or integrating it into their suite of products.  I'm assuming if they wanted to integrate it that I would have to sign over exclusive rights and give access to sourcecode for X number of years or something.

    I'm really just looking for comments from people who have been in this situation before, what I should expect from each company in each scenario.  Basically what I should be sure to do so as not to get ripped off since I'm new to the negotiation process! =)

  • VB .NET 306 Exam passed

    Passed it this morning in spite of lack of sleep from stress about my contract position being off-shored.  They ask some weird trivial questions on these things for sure!

    So once again I'll post that if anyone has any .NET developer openings for someone with 2 yrs .NET experience and is *almost* a MCAD feel free to contact me.  =)

    eswise@yahoo.com

  • *sigh*

    Lovely, *walks into meeting*.

    Manager: You contractors have been doing a fine job, yadda yadda yadda.  However to cut costs we've decided to offshore contracting positions to russia.  If you have any personal belongings at your desks, you will be escorted there and then out of the building.

    So yeah, I guess I'm available now if anyone out there has a need for a VB .NET / C# developer specializing in ASP .NET (2 yrs total .NET exp).

  • My First 10 minutes on whidbey

    I'm happy to report that the 2005 beta 1 install went off without a hitch! I started off by creating a new web project to do a sort of "hello world" advanced version which involved me connecting a datagrid... excuse me... dataVIEW control to the authors table of the pubs database.

    ** Cool thing #1- when I created the connection using the smart tag (each control seems to have a smart tag menu that pops open to the side which lists common tasks) a message popped up that said "Hey, you created a new connection, you want to add this to the web.config?" Of course I do! It created the key (I notice it's not a general appsettings key anymore, it made a tag specific to connection strings) and linked up the connection to the key. Not exactly mind blowing, but it's one of many of the nice little touches I've seen so far.

    Anyway back to the gridview. I grabbed a few columns from the authors table, it generated the column list automatically which I formatted using the "Edit Columns" item of the smart tag. Then I checked the allow sorting button on the smart tag and hit the debug key. Off to the races. First thing I noticed was the virtual web server popped up with a little notification in my tool bar (nice, no more IIS needed for my laptop) It actually loaded and ran the project surprisingly fast considering its a beta and my laptop is nice but by no means a beast (2.0ghz athlon xp, 512mb ram). All the sorting and display was good, and I didn't write a single line of code!

    Ok that's not so impressive, I've seen the demo of that done before and I was just validating that it worked. I didn't have a lot of time so I quickly changed the state column to a template, opened the edit item, slapped a dropdownlist in there and bound it to a unique listing of the states in the authors table. Then I bound the text property to the state in the list and threw an edit button column on the grid. It worked like a charm! On edit the combo box bound and set itself to the current value and updated the database on apply. Not a single line of code...

    I'm impressed. I'll post more when I get more deeply into whidbey. Probably won't be until later this week, I'm schedule to take the 306 exam (vb .net desktop) for my MCAD. I've finally decided to just go get certified just to put the letters on my card/resume. Hopefully I don't have too much trouble since I'm pretty much exclusively an asp.net guy!

  • Empower ISV Accepted

    Woo, got my MSDN Universal subscription activated tonight. Downloading VS 2005 beta 1... 3588.1 MB though. =( I guess I'll have to install and play with it tomorrow, it's not going to finish before bed. *sigh*
  • Express Tools Concern II

    Seems that my good friend over at Caustic Tech agrees with me on the Express Tools Concern

    Take that Jon!  (J/K)

More Posts Next page »