Tag Archives: Development

Visual Studio 2010: Adding a Web Reference

In previous versions of Visual Studio, you could just right click on a project and choose “Add Web Reference” to add a reference to a asmx web service. In Visual Studio 2010, when you right click, you will see “Add Service Reference”… similar, but not the same. If you reference an asmx you will get some weird objects back in your proxy web service object, each method with Request/Response at the end. You may want this, you may not. If you want to get the legacy web reference back, here is what you need to do.

Right Click on a project, Add Service Reference, then click on Advanced, the Add Web Reference. Then you will be able to add your good old asmx reference like you used to in earlier versions of Visual Studio.

image

Development Need #1 – Multiple Monitors

What’s one of the first things that developers want/need/can’t live without? Multiple Monitors. In most cases this starts of with 2 or Dual monitors, but this should be a standard. More monitors means more screen real estate which means you can more things up in front of you which means you can get more done. 15-25% more done, easily.

So, something that simple, a 200-400 dollar investment, can make your developers more productive, you should make dang sure every one has dual monitors, same size, for sure. Using a laptop screen and a monitor doesn’t count as dual monitors. Having a 15 inch and 21 inch is a mess. Two 19’s or 21’s or even better, higher inch screens is going to make developers happy, it is going to make them more productive, and it isn’t going to break the bank.

Not even anymore in development, but just all over a company, people should have two monitors. From the receptionist to the CEO. Just makes sense.


Living Virtually: Running your Dev Process on Virtual Machines

Virtual Machines have been around for years. VMWare and Microsoft have been the main competitors for a while, both offering somewhat similar products. Parallels for Mac is another, and Virtual Box for pretty much everything. I have used them all. When it comes right down to it, VMWare, to me, is ahead of the rest, so I am going to focus on that. Heck, I did a P2V (Physical to Virtual) on my girlfriends wacked out laptop and that is working great, 2 months later :)

What is a typical scenario for most people? They go buy a machine, set it up, use it. It works great. It crashes or gets hosed. They lose most if not everything, spend a week redoing the machine and start the process over. This goes on for a few years, then they get a new machine, and start the cycle over

But…

What if you thought “virtually”? So, you go buy (or build) your beefy development machine. But then didn’t install anything but Windows Updates (of course), and VMWare Workstation. Now granted your want your physical box to have 8, 12, or 16 GB of RAM, and loads of fast disk space, but yeah, just need to have a beefy machine.

Now, you set up your actual dev machine as a virtual machine, you give it 8 GB of RAM. You install the OS, and take a snapshot (In VMWare). You install VS2010, take a snapshot. You install SQL Server 2008 R2 Dev, snapshot. You install each browser you need to test with, snapshot, snapshot, snapshot. You get the idea.

Now, if something is totally wacked, you can revert to a snapshot. You can even have multiple paths of snapshots, this type of thing is very VERY cool if you get it going correctly.

You can also just grab the entire VM hard disk and settings and copy off to your trusty 2 TB USB drive or whatever and you can do this once a week and you have a complete backup of your dev machine.

You can then set up another VM, say, “Web Server” or whatever you desire, give it 2 GB or whatever it needs to run, do the same thing. You can have both running, and do your testing. You can create a separate SQL Machine for testing. Try to set up your environment as you would for your development. If you need an Active Directory? Set that up, set up 3 VM’s or whatever, you don’t need to have them all running all the time. You need Exchange? Or SharePoint? Same thing. You have a Technet or MSDN Subscription, right? No? Go get one NOW.

What is even better then best, is that 3 years later, when you get an even better machine, you know what? You just install VMWorkstation, and copy or locate your VM’s and you are set. No resetting things up, etc, etc. It just works.

You want to create a smaller dev VM for holiday travel? Take it on USB, use Mom’s PC with VMWare Player and give your VM 1 GB of RAM. You just need enough to get by on. No laptop needed, just bring up your USB. You get the idea.. you can do pretty much anything you’d like.

If a salesperson came up to you and said “I have a way for you to configure multiple environments, multiple computers, setups, and have ways to revert back to things you did while configuring, and take backups of everything easily, etc, etc” How much would you pay? $1k? $5k? More?

How about roughly $200, for VMWare Workstation (if you already have Technet/MSDN – which you would have already). I’m sold.

If you really want to get complicated, you can set up VM Farms, and run VMWare Servers, and have multiple VM’s going and easily accessible. But using VMWorkstation to start is good enough, and good enough is fine :)


Facebook Graph API – Getting Friends and Gender in C#

I recently blogged about the Facebook Graph API and if you have the Facebook C# SDK you can start making applications.

After I had my Facebook app set up, I started making a C# Console application to just get my friends and see what I could do. Here is a snippet to get my friends and their gender.

       string token = ;

            Facebook.FacebookAPI api = new Facebook.FacebookAPI(token);

            JSONObject f = api.Get("/me/friends");

            KeyValuePair friends = f.Dictionary.ElementAt(0);


            for (int i = 0; i < friends.Value.Array.Count(); i++)
            {
   
                Console.WriteLine("Friend #" + i.ToString());

                JSONObject friend = api.Get("/" + friends.Value.Array[i].Dictionary["id"].String);

                Console.WriteLine(friend.Dictionary["name"].String);

                try
                {
                    Console.WriteLine(friend.Dictionary["gender"].String);
                }
                catch(System.Collections.Generic.KeyNotFoundException knfe)
                {
                    Console.WriteLine("No Gender Specified");
                }

                Console.WriteLine();
            }


            Console.ReadLine();

There is a probably a better way to do this, but getting the JSONObject back and then getting the values you get back from that, I just kind of brute forced it. Also, handling friends that don’t have information set, the quick and dirty way was to just catch the exception. I know there has to be a better way but for now it works.

Microsoft Silverlight PivotViewer: Getting Started and Business Case

I have been reading about Microsoft’s PivotViewer lately, and decided to try to get it going for myself. What is PivotViewer? Think of it as visual data slicing through a web page.

What you do is take some data, and then tie records to images, and then publish out your “collection” and you can consume it via a webpage using the Silverlight PivotViewer control. One awesome example of this is here http://netflixpivot.cloudapp.net/. But what I have been really trying to wrap my head around is how to use the as a “business” tool. Because, it is easily technically doable, but you have to have a *reason* to do it.

Working with widgets and customers and locations – what do you do? There are two things I could think of quickly. One – peruse your “master data” very fast and visually. The other is looking at some kind of metrics for your widgets, or logos of your customers you might sell too, or ? ..Well, you could..

  • Master Data/Catalog
  • Show pictures of your widgets, and create filters (they call them facets) for things like size, color, weight, model, etc. You have “one” of each and you just want to see what you offer. Almost could be a pretty sweet online catalog browser

  • Sales/Metrics
  • Do the same as a master data catalog but allow filtering by some kind of metric. Shipped items over a given time or something.

  • Something Else I Haven’t Thought Of?

Anyways, the first thing you should do before anything is get some kind of data feed. Run a query, get some data from somewhere. Start small to test. 500-1000 records.

Then the fun begins. Starting from absolute scratch..

Ok, yeah, tons of setup. Biggest thing is in IIS you need to set some MIME types: .cxml, .dzi and .dzc need to be “text/xml”

Once you have all that setup, you can do 2 things.. create your collection, and create your app. Create a blank silverlight project first:

Once you have that, there isn’t a ton you have to do to get things going with PivotViewer.

  1. MainPage.xaml
  2. Add in your MainPage.xaml, a namespace line for Pivot, and add the control

    Your end MainPage.xaml should look like this:

    
    
        
            
        
    
    
    
    
  3. Reference Assemblies
  4. For good measure, just reference them all, located here: C:Program FilesMicrosoft SDKsSilverlightv4.0PivotViewerJun10Bin

  5. Load Collection:
  6. pvWidgets.LoadCollection("http://localhost/SilverlightApplication1.Web/MyWidgets.cxml", null);
    

Note, you have to make your web part of your project IIS based instead of the build in web browser. Why? Because the .cxml HAS to be hosted on a web server, it just works that way.

Now, you need to create your collection.. you can use a cmd line tool they offer on the PivotViewer site, they also have a c# library for automating things, but it is best to first just do it manually. So I used the tool they have as an add on for excel. It adds a nice little “Pivot Collections” tab

You can use this to put some data in, you probably want to add more columns than what they give you by default. For my test I just used the same image for all records to get started. I have a feeling that the biggest barrier to entry to corporate BI teams and developers is going to be the imagery. You usually don’t have someone on your BI Team that knows how to use photoshop well and do all the high res imagery, so you are handcuffed there.

For testing sake, I Published my collection to the root of my website, with the name “MyWidgets”.

I loaded up my webpage, and I can slice and dice by all my columns I had in my collection, visually.. pretty dang awesome. (Note, I just made some fake data based on attributes I am used to seeing and with an image of a bike to see what it would look like – the goal was figuring out how would this work in conjunction with current BI offerings (cubes/Pivot Tables, SSRS, PowerPivot, etc))

Now, if you think where you could take this. Each “image” is clickable and brings up the image right in front of you. You could have all the specs of that widget there, and a link to “buy”, or deeper analytics for that widget.

Some other things I found out.. using the Excel tool for Pivot Collections is dog slow. Especially with a ton of records. It has to process the images for the “deep zoom” technology and it just takes a while. Like, hours.

There are tons of possibilities here with PivotViewer, both for an external website and also internal corporate business intelligence. It will give people another way to delve into the data and turn it into information.

Extreme Pair/Group Programming – The “Hive Mind”

Recently there have been a couple of bigger development/programming issues that have needed to get resolved where time was of the essence, and some kind of “short cut” was needed. Bring in the “Hive Mind”.

In Agile, there is Scrum, and XP .. pair programming. But what if you bring in 5-6 developers, put code up on the screen and say “help me”. The informal results I have seen are astounding.

What can result is in 10-15 minutes you have a problem solved, and everyone aware of the issue or code surrounding the issue.

Now, not to say you want to do this for every situation, but in some cases it can work wonders. I’d also want to note that the results I have seen could be unique – as always, your mileage may vary.

But the Hive Mind really does bring to light the power of many heads working together to collaborate and come up with a solution quickly. Very cool.

As usual though – pretty much common sense – more open communication and information sharing leads to a better result.

SQL Schema Source Control (CodePlex)

Source Control. In my eyes, one of the best inventions of development.

Software Developers have used it for years, and it allows them to easily develop in a team environment, and be less scared they will lose a change or not be able to see things they did historically.

I have blogged a few times about source control before..

SQL Server Schema Automatic Revision History using DDL Triggers and SVN
MSFT BI In a Team Environment
Visual Source Safe Sucks/
Source Control at Home with Subversion

But this was mostly for code. Developers. The SQL Community has kind of been shafted with source control. Yea you can tie in VSS to Management studio, and others. I have never found one that works, and just wanted something to work in the background.

I originally started doing this with DDL triggers as my <a href="“>post in November kind of outlined. It worked, but wasn’t reliable enough for what I wanted and was too much setup.

So I did what developers usually do, I wrote an app. SQL Schema Source Control http://sqlschemasourcectrl.codeplex.com/

At first it worked with one database, one server, everything was hardcoded. And then it progressed, and now it is all configurable for multi server/multi database, etc. I decided to put it up on CodePlex because I think it can be improved and made to work with other source control providers, like TFS.

The code itself isn’t anything crazy, some file operations and SMO operations to get the DDL and then some functions to add/update/delete and commit to source control.

For info on how to get it working, check out the documentation page on CodePlex, I can also answer any questions here, or on CodePlex.

I have been using the app for a few months now and it has saved headaches, accidental deletes, wanting to see changes over time by developers, etc.

The feature I like the most is that it logs the SQL Agent job changes, so if someone changes a job, you can see the history…

Now, there are competitiros out there. Redgate (http://www.red-gate.com/products/solutions_for_sql/database_version_control.htm) and others. But I wanted something free and open, so that is why I am putting this out there. I would be perfectly fine not putting anything out and just using it, but I think (and hope) others could benefit from using this app

So if you are looking for semi-easy way to get revision control on your SQL Schemas and SQL Agent jobs, check out the app. There is minimal setup, but once you have it working, it just runs.

Note at this time it works with SVN and SQL 2008. Also the solutions is VS2010. I originally had it working with 2005, but no need on my end anymore for that, someone could easily make a version for SQL 2005. VS2008 solution could be created pretty easily as well. Have fun!