Programming

This about sums it up…

Posted in Programming on March 11th, 2009 by Jon Edmiston – Be the first to comment

One quote that sums up most everything I’ve learned about developing applications:

“People don’t know what they want until they see it.”
-Steve Jobs

T4 It Ain’t Just a Movie

Posted in Programming on February 1st, 2009 by Jon Edmiston – Be the first to comment

image I’ve been diving into some of the new Microsoft programming technologies of late (MVC, Entities, Linq2Sql, etc.).  It’s been quite a trip, read frustrating, but I’ve enjoyed the learning.  One thing I just learned about was the T4 templating capabilities in Visual Studio.

T4 is basically CodeSmith built into Visual Studio.  With the integration you can do some pretty cool things, like auto-generating classes that get immediately added to your project.

Here’s a intro video that’s pretty good (except for the random use of VB and C#).  Also here’s a T4 editor extension for Visual Studio to add syntax highlighting.  Finally, here’s another blog with some good resources and samples.

Based on the price alone (free) it might be worth the move to T4.

Can You Ever Have Too Much Innovation?

Posted in Programming on January 13th, 2009 by Jon Edmiston – Be the first to comment

image I love new things… new technologies, new ideas, new… everything.  When it comes to innovation I think Microsoft has been dropping the ball for years (dare say since the dawn of the Internet).  That is in all areas except one… their programming frameworks.  There in the last five years the .Net Team has been on an innovation binge. 

Not only has the framework moved through rapid innovation (1.0, 1.1, 2.0, 3.0, 3.5…) but they’ve also release so many related technologies, Windows Presentation Foundation (WPF), Silverlight, MVC, Linq, Linq to Entites, Windows Communication Foundation (WCF), Micro Framework, and on and on…  What’s a developer to do?

I wonder though if all of this is a good thing.  Are other developers as stress out as I am about falling behind (anyone have kids too)?  I spent the Christmas break working on a MVC / Linq to Entities application that uses jQuery and is managed in SVN.  I was a ton of fun learning all these new technologies, but at the same time I felt a sinking feeling as though I was struggling to stay afloat, but knowing that once work started again I’d have a tough time keeping up the pace.  Man… I don’t think I’ve even master all of the functionality in .Net 3.0 yet…

I’m not saying the Microsoft should slow down in this area (or maybe I am)… but at the very least I think they need to be aware of the psychological effects the rapid innovation is having on their developer base; especially with the confidence of their skills.  I’ve entertained the thought of switching over to Rails for PHP just to catch my breath (plus I could ditch my PC).  But alas… I think I’ll stay… for now… 

Better get back to that app…

T-SQL Improvements in SQL Server 2008

Posted in Programming on August 11th, 2008 by Jon Edmiston – Be the first to comment

image I’ve talked before about some of the great new features coming in SQL Server 2008, especially spatial queries.  Here’s a few very cool additions to T-SQL.  None are game changing, but they are some real nice productivity improvements.

  • Assign variables at time of declaration (this has always been a pet peeve of mine)
        DECLARE @HomeAddress varchar(200) = ‘123 Elm Street’

  • Compound assignment operators
        @DECLARE @Counter int = 0
        SET @Count += 1
  • Multiple inserts in one statement
        INSERT INTO TestTable VALUES
            (1, ‘Test 1′), (2, ‘Test 2′), (3, ‘Test 3′)
  • Merge statements that allow you to merge two tables into one without duplicating data.

These tips were outlined in the most recent issue of SQL Server Magazine.  If you’re a developer and don’t get this magazine you might consider a subscription.

SQL Server Indexes

Posted in Programming on August 11th, 2008 by Jon Edmiston – 4 Comments

I was reading a copy of SQL Server Magazine the other day and ran across an ad for Idera’s SQL Defrag Manager.  I decided to install the demo and take a look at our Arena database.  Looks like quite a few indexes that could use some rebuilding.  I’m really impressed with the product.  Not only does it provide some nice visualizations of the state of your indexes, but it also provides some great tools to intelligently rebuild your indexes over time.

image001

The only problem is the price tag.  While $1,100 is certainly a fair price, it’s a bit steep for us and our needs.  I did a bit of research had found a script I could modify to rebuild all of the indexes in the Arena database.  It’s a bit heavy handed as it rebuilds all of the indexes whether they need them or not, but for a database our size it’s probably OK (the script could be modified to check the fragmentation level too).

If you’re interested here’s the script.  It assumes your database name is ‘Arena’.  You’ll probably want to run this after hours to avoid any performance issues.

 


   1:    
   2:  DECLARE @Table VARCHAR(255) 
   3:  DECLARE @cmd NVARCHAR(500) 
   4:  DECLARE @fillfactor INT
   5:   
   6:  SET @fillfactor = 90
   7:   
   8:  SET @cmd = 'DECLARE TableCursor CURSOR FOR SELECT table_catalog + ''.'' + table_schema + ''.'' + table_name as tableName  
   9:                  FROM Arena.INFORMATION_SCHEMA.TABLES WHERE table_type = ''BASE TABLE'''  
  10:   
  11:  -- create table cursor 
  12:  EXEC (@cmd) 
  13:  OPEN TableCursor  
  14:   
  15:  FETCH NEXT FROM TableCursor INTO @Table  
  16:  WHILE @@FETCH_STATUS = 0  
  17:  BEGIN  
  18:   
  19:     SET @cmd = 'ALTER INDEX ALL ON ' + @Table + ' REBUILD WITH (FILLFACTOR = ' + CONVERT(VARCHAR(3),@fillfactor) + ')' 
  20:     EXEC (@cmd) 
  21:      
  22:     PRINT @Table
  23:     FETCH NEXT FROM TableCursor INTO @Table  
  24:  END  
  25:   
  26:  CLOSE TableCursor  
  27:  DEALLOCATE TableCursor 

 

The only catch to this script is that if it hits a deadlock it will stop in it’s tracks.  I’ll have to look at how to handle that gracefully in the near future.  In the meantime we’ll probably run this script weekly.  If you can afford the money though the Idera tool is definitely the way to go!

AIR Springs a Leak (at least for me… maybe)?

Posted in Programming on May 19th, 2008 by Jon Edmiston – 2 Comments

image I’ve been playing around with Adobe Flex/AIR for the last few days.  There’s a lot I like about the product and direction.  My favorite feature is that you can create a cross platform desktop application that is a cinch to deploy and is very very engaging from a design perspective.  But…here’s a few issues I have….

  1. The documentation and samples leave a bit to be desired.  My first app (after Hello World) was to consume a basic web service and display it’s results.  There’s several ways to do this, but the documentation is a bit weak in showing you all the options.  They give you a few examples, but they never quite do what you want…
  2. Bit buggy… in playing around things still seem a little shaky… one example.  I pointed Flex to a WSDL and had it create ActionScript objects for me.  The main object contains custom instructions on how to use it from ActionScript and MXML.  Problem is that custom sample code it provides didn’t work (had some case issues with some of the method calls).  I was able to resolve it, but it kinda stinks with the code they generate for you doesn’t work.
  3. This one might be picky, but it’s a deal breaker for Arena development (at least the way it stands today).  Currently, there is no way to call a Web Service that is secured using Basic Authentication.  Doh!  All of our Arena Web Services are protected in this manner.  we could open them up and require that a person’s username and password be pass on each call (I’ve seen a few Web Service APIs do this).  I’ll have to talk to David and see what he thinks…

So I we could go back to plan A, Silverlight… but it can’t create a desktop application.  From what I’ve read and seen (and correct me if I’m wrong), Silverlight is meant to be run from the browser.  While this is fine for most things, I was hoping to create a small desktop app that would allow for simple searches.  Something that I was planning on building as a Vista/iGoogle/Widget.  AIR is a much better alternative if being cross-platform is important (and it is). 

I do have to say Silverlight’s XAML XML presentation layer is much more powerful than AIR’s MXML.

I hope we can still figure out a way to use AIR, I still think it’s a viable option.  If not now, perhaps in the future.