Want to Learn Javascript.

How To Count Lines of Code in Visual Studio

22. November 2011 02:00 by Scott in Visual Studio, Tricks  //  Tags: , , ,   //   Comments (0)

Measuring programming progress by lines of code is like measuring aircraft building progress by weight. - Bill Gates

 

If your like me, then you want to know at times how many lines of code you have written over the years.  I have this one web site that I thought would be roughly 200,000 lines of code.  Its over at Utopiapimp.com.  I questioned today how many lines of code I have when I was in discussion with one of my coworkers.  He didn’t think that my website offered that much and well, I had to prove him wrong.  So in figuring out how many lines of code I wrote, I had two different ways.  Here are the ways.

When using Visual Studio Team System:

Analyze -> Calculate Code Metrics has the ability to count projects of code, but not actually web forms applications.  The problem with this, is that I actually have a website and not an actual C# project, So I used the second method.

Visual Studio Trick:

This method will will match every line that are not comments (//), a compiler directive (starts with #), a single opening or closing brace, or blank lines. So these are true lines of code.

  • Select Edit -> Find & Replace -> Find in files… or just press CTRL+SHIFT+F
  • Check Use and select Regular expressions.
  • Top Left Drop down using the Find in Files Selection
  • Type the following as the text to find:

for C#

^~(:Wh@//.+)~(:Wh@\{:Wh@)~(:Wh@\}:Wh@)~(:Wh@/#).+

for VB.NET (thanks Steve for the info!)

^~(:Wh@'.+)~(:Wh@/#).+

 

  • If you select Current project or Entire solution, you also need to specify the file types that will be included in the search.

Proceed with the “search” and at the bottom of the Find results window you will see the total line count.

The Best Damn Visual Studio Add-In Ever

14. December 2010 01:43 by Scott in   //  Tags:   //   Comments (75)

So way back when Scott Hansleman released RockScroll, I loved it.  Now that I have upgraded to Visual Studio 2010, it isn’t compatible.  So I went searching for another one just like it.  I found a tool called AllMargins and I must say its by far the best damn tool for Visual Studio!  I can’t get enough of it.  It adds on to your scroll bar give you vast amounts of information to view right away.  Its soo wonderful.  Go ahead and give it a try!  I sure did and love it!

 screenshot

Heroes Happen in Orlando, Florida with Microsoft

25. April 2008 17:08 by scott in   //  Tags: , , , , ,   //   Comments (6)

So here I am attending the heroes happen conference in Orlando, Florida. I left about an hour and a half early knowing I would get there on time. I was driving down the road and the first toll I come to, they said they won't take a company Amex card. I told them I didn’t have any cash so what happens now “do you take me to jail”? Here I was thinking I would have to pull off the side of the road and be talked to by a cop. Oh-boy, but he then spoke up and gave me a small toll violation sheet that says don't do it again.

I pulled off at the next exit and got $20. So right before I was about to get off at the final exit, I go over this small bridge and a cop was waiting on the other side. Seeing  that I was late, I was trying to make up time by going 77 mph. The thing I didn't know was this 4 lane highway had a speed limit of 55 mph.

Oh boy, I got pulled over and I now have to pay $200 to an Orlando sheriff’s office. So I pull in to the convention center and now running about 30 minutes late and for those who haven't been to the Orange County convention center. It is huge, no doubt about it. So after driving around, I thought I arrived at the concourse, so I got my stuff together and started walking. I asked a staff person where Microsoft was and of course he had to say “not in this building”. Oh boy not again. I get back in my jeep and I find the Microsoft conference. I’m in the home stretch. Not ten minutes goes by and I have LOST MY WALLET! I drive back to the other parking lot to look and don't find it. I decide I’m wasting time and I guess I’ll call all my banks soon to cancel my cards. I go back to the convention center and found out they require $10 for parking. I don't have my wallet and therefore don't have cash. I decided to drive over the curb to get in. I’m not proud of it and will likely regret this for a while, but maybe ill mail the convention center $10. So I’m finally in. I arrive and the developer session is getting ready to start. I grab one of those Microsoft handy dandy lunch boxes and go into the session. So anyone want to donate $200 to my cause? Email me at spoiledtechie (at) gmail dot com.

Microsoft Lunch box

The sessions are brought to us by www.Devfish.net.

Disclaimer: I was expecting to write an in depth article on what I learned, but these sessions were not able to go into learning new things, it was all about what Microsoft rolled out and so my points are brief.

Now on to the session:
They started off with a brief presentation and moved right into the changes with Visual Studio 2008.

Some features they listed off include:

Split view window
The split view allows for both your UI code and the UI display of the page to be displayed. It was one of those wonderful improvements that came with this upgrade.

JavaScript debugging
A big update for JavaScript which can let you go through the code and set breakpoints just like in your code behind page. This along with JavaScript intellisense is a HUGE improvement.

JavaScript intellisense
Just like the intellisense for the code behind page, they now have intellisense for JavaScript. This brings the entire library of JavaScript into our hands instead of looking through a book for them. Amazing!

Framework drilling
This feature allows you to change and upgrade your framework from 2.0 to 3.5 in just a few clicks. It is done by selecting the properties of the solution and clicking on the drop down in the display to select the framework.  Quite impressive.

Ajax control toolkit at codeplex.net
The toolkit now comes with both .NET 3.5 and Visual Studio 2008. Both of which is old news, but still very cool.

Next session: creating an outlook form control.
They talked on how to implement our code into office products. They used a web service for communication along with LINQ. The front end was built with regions and WPF.

They went on to discuss Sharepoint workflow's which looked interesting. They hit on about 20 steps in visual studio 2005 that needed to be completed in order to create workflow's. It looked extremely tedious, but now with VS 2008 It was only 3 steps.

Side note: if you know Microsoft, you know they love blogger's and if you know me, you know I am not the one to hold back. So in this session, they were probably told by Microsoft just what to talk about and probably got a lot accomplished on those topics, but they definitely need to look for better speakers next time that can code and speak at the same time.

Next session: smart client applications.

Presented by Russ Fastino with Microsoft and John Goodyear with aspsoft.

They talked about how to make client applications with a better user experience.

They asked about the weaknesses of what Microsoft is doing with WPF. I had to speak up and tell tem that my MSDN license doesn't allow me to use the Expression Studio. It costs too much for the average developer to ask his boss to upgrade to a better user experience.

Interesting point: WPF is offered in Visual Studio express and that means average developers can code with it and have it rendered.

They then showed off the tech preview for Expression Blend 2008. Awesome stuff. I already played with it and used it, but its always fun to see it again. Expression Blend 2.5 has full Silverlight 2.0 support.

Free Stuff received:
Microsoft Lunch box
Vista Ultimate
SQL Server 2008
Windows Server 2008
Visual Studio Standard 2008

Thanks for reading.

P.S. I found my wallet and $20.00 when I went back to look for it where I got pulled over. Interestingly enough, I found $20.00 in the grass and the wallet on the passenger side of the jeep.

If you liked this post, please be sure to subscribe to my RSS Feed.

Day 2 at DevConnections 2008

21. April 2008 18:56 by Scott in   //  Tags: , , , ,   //   Comments (10)

The second day at DevConnections was a bit more exciting than the first. On the first day, we had just basic keynote addresses from some pretty popular people.  On the second were a bit more hardcore and real sessions.  I was happy with the sessions I took, but clearly some developers cannot present well.  Before I talk about these sessions, please understand that these are my unique views and no one else's.  I know I will be giving a harsh critic on one presenter.

Sessions Taken:

A Lap around Visual Studio Team System:  Taught by Neelesh Kamkolkar, which is the Senior Project manager for Team System.  This is the only harsh critic I will give in this post and I am sorry for doing so, but in order for Microsoft to give better sessions, they must learn from their mistakes.  Neelesh spoke about the ins and outs of Team System.  He spoke in an extremely general topic which was dissatisfying.  It seemed to me that Neelesh wasn't prepared at all for this session.  Every test or application he tried to run, failed on him and not only did he NOT try to work on the problem and get it fixed so he can show us a working example, but every time he failed; he said okay lets move on to something else because of time.  I was just upset that we didn't see Team System work at all.  This to me was a very poor planned session and I hope Microsoft sees that he is a better manager than a presenter.  I do want to give him the benefit of the doubt seeing that he said he traveled to three different parts of the world in 7 days, but I imagine he can test app's on his laptop while on the plane. Am I correct?  The only true thing he got done was getting advice from one of his friends in the back (probably a developer at Microsoft) to tell him what to do on Team System.  It almost seemed to me that he had less than 20 hours on the actual application.  I would have rather had the person in crowd that was helping him present and fix his mistakes than him up there as the project manager.  Hopefully Microsoft will learn.

LINQ Deep Dives and Best Practices: This session was taught by Colin Meek.  Now let me tell you about an extremely intelligent programmer at such a young age.  This is your man.  He presented LINQ which didn't hold very many best practices actually he used bad practices, but I must say that he forewarned us that this is not a session on best practices.  The idea behind the session was to take about 15 lines of code to query a database and shorten it down to only 2.  Quiet an impressive goal if I may say and what's awesome is that he did it even with parameters for the query.  He started out going into pretty complex stuff which was a bit beyond me having not come from a CS background, but with a CE background.  He demonstrated what they do to get LINQ to actually work and example code of how they create LINQ. He then went on to actually show us a very basic LINQ query which if you used LINQ at all, you would have done these types of queries.  One thing I did take away from the Session if nothing else, was the point he made was the reason why they switched up the "from and select" syntax in LINQ from SQL. He said it was because they can't actually help you with intellisense against the query if they have the "select" first.  If the "from" is first, they can pull the information from the database and have it work with intellisense.  Pretty smart move if I must say so. Overall, I liked it a lot.

Introduction to the New ASP.NET MVC Framework: Taught by the one and only Scott Guthrie which many consider is an icon in to software industry.  From his keynotes, I saw people trying to get pictures with him and saying that he was a big talking point around the office.  As VP of Microsoft and in charge of ASP.NET, Silverlight, WPF, WCF, MVC and a few other off the top of my head, he is the man to talk to if you want a developers prospective.  At the session he discussed the things MVC framework has in store for developers.  He compared it to a "Car v.s. a Motorcycle" and he truly believed in that. Some people like the car and some like the motorcycle. he said, By no way do we need to switch over from webforms.  I saw only 2 truly real advantages over webforms.  MVC currently can be used for that avid testing bed of developers. It also has URL Re-writing built into it.  He said that ASP.NET will be implementing URL re-writing in the coming future so then the only difference will be the fact that it is easier to test in. That's it ladies and gents, that's the gist of it.  I hope you take that to heart, because that is the only difference.  I for one am glad to know that MVC will not be a new type of language I will have to continue in.

SQL Reporting Services: Advanced Report Design: Taught by Jason Carlson (Doesn't have a online profile).   This is one of the best sessions I have been to so far except for the MVC with Scott Guthrie.  I still think I am taking more from this session than any session so far.  Jason took a DEEP dive into Reporting Services and showed us how to create some pretty good looking reports which I am extremely happy with what I have taken back from this session because the reports I currently have on my application smell like a bad woman's perfume.  I could not say thank you more for showing me the light on reporting services.  I wish I could explain the depth we took, but it is too much information to be explained in one short paragraph.  Maybe later.

Things I learned today outside the sessions:

  1. MySpace.com runs completely on ASP.NET and has now for two years - Confirmed by Scott Guthrie after chatting with him for a few minutes, MySpace still has the CFM tags, but they made the switch over to ASP.NET 2 years ago. Scott told me to email him about a case study they did on the MySpace switch over so I did and will post that valuable information on my blog once I get it.  For a Stat, MySpace saw a 500% reduction of server resources when they switched over from ColdFusion to ASP.NET.  I was happy to hear that because its hard to find any facts on ColdFusion v.s. ASP.NET. This stat is comes from Scott Guthrie.
  2. ASP.NET, Silverlight, MVC, XAML and all the new technologies Scott's Team is coming out with are INTERCHANGEABLE! - What does this mean?  I can upgrade to ASP.NET 3.5 and already have a fully fledged application in production and I can add a XAML page developed in Expression Blend, a full Silverlight page and a complete MVC page running all on the same application with ASP.NET 3.5.  This is Impressive!  I can run all the developer technologies and integrate every single one, into one application that is already in production.
  3. http://memorabilia.hardrock.com/ is a MUST visit site for an awesome Silverlight application! - Hard Rock wanted to categorize all their memorabilia they had collected over the years so they brought it all together for a photo shoot using a 500MP Camera!  I ask you to just go check this site out.  When you Zoom in on the pictures, Really Zoom IN and when you zoom out, really zoom OUT. It is extremely impressive with what they did. I hope you enjoy it for I know I did.

Free Stuff:

  1. Everyone received a free copy of Visual Studio Standard.
  2. AT&T had a developer party and people walked away with LCD big screen TVs, AT&T Tilts and shirts along with free beer and food.

I think that's it and I hope I helped you out with what happened today at DEV Connections 2008.

Scott.
kick it on DotNetKicks.com

If you liked this post, please be sure to subscribe to my RSS Feed.