Archive for the ‘How To’ Category

July 12th, 2010

Uninstalling Windows Phone Developer Tools CTP

Today I decided to upgrade to the Beta of the Windows Phone Developer Toolkit, however the uninstall process wasn’t working.  It kept asking me what I wanted to install every time I choose the uninstall radio button.

So after a couple failed attempts at uninstalling in different ways, I decided to go to the source, in my case that was:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Microsoft Visual Studio 2010 Express for Windows Phone  CTP – ENU

After in the folder, I just had to right click on the vs_setup.msi file and select Uninstall, after that the process worked like a charm and I could then install the beta.  Hope this helps someone besides me.

Tags: ,

Posted in How To, Programming | kick it on DotNetKicks.com | Bookmark | View blog reactions | 7 Comments »

June 17th, 2010

Run Cassandra As A Windows Service

One of the main issues that comes up over and over again for Cassandra is:

How do I run Cassandra as a Windows Service?

In this post I am going to answer that question and in the process demonstrate how to do it in less than 10 minutes.

Background

Cassandra is mainly developed by Linux developers so very little attention has been paid to the Windows developer or administrator as far as Cassandra goes.  So as Windows developers we have to hop through a couple more hoops than just clicking on an install.exe file and and letting it do all the work.  However lucky for us, those hoops are easy and quickly hopped through.

Step 1

If you haven’t done so already please read my jump start for Windows users on install Cassandra, this guide will get you ready for the next steps.

Step 2

The second step is also an easy one, you need to download a package called RunAsService, which provides the ability to run any program as a Windows Service.

After you have downloaded the file extract the contents to a directory of your choosing.  (I extracted it to c:\RunAsService)

Note: RunAsService was originally developed here, however I recompiled it to run on .NET 2.0.

Step 3

To install RunAsService open up a command prompt with Administrative privileges and run this command.

cd c:\RunAsService
install networkservice

This registers RunAsService with your Windows Service.  Make sure to keep your command prompt open because you will need it for the 5th step.

Step 4

To configure RunAsService for Cassandra open up the RunAsService.exe.config file in your favorite text editor and replace <service.settings> section with the following so that it looks like this:

<!-- Services configuration -->
<service.settings>
    <!-- Run Cassandra as a service -->
    <!-- My Cassandra install path is C:\apache-cassandra\ -->
    <service>
        <name>Cassandra Database</name>
        <executable>C:\apache-cassandra\bin\cassandra.bat</executable>
        <parameters></parameters>
    </service>
</service.settings>

After you have finished, save the config file and exit your text editor.

Note: My Cassandra install is in c:\apache-cassandra\ you will have to correct the config above for where you installed it if different than mine.

Step 5

The last and final step of this process is to start the RunAsService service.  You can either do it through the Services control panel or just type the following in to your command prompt.

net start runasservice

You should see a response in the command line saying that the service has been successfully started.  To verify that Cassandra has been started you can use the cassandra-cli.bat file:

cd c:\apache-cassandra\bin\
cassandra-cli.bat
connect localhost/9160

It should report that it is connected to the server if the service is running.  And with that we are done, and I told you it would only take about 10 minutes.

Tags: ,

Posted in How To | kick it on DotNetKicks.com | Bookmark | View blog reactions | 7 Comments »

June 13th, 2010

Using LINQPad to Query Stack Overflow

In case you haven’t read, Stack Overflow and the rest of the Stack Exchange sites are now able to be queried using OData.  This is great because as Jeff points out in the blog post:

…if you just want to play with the data, it’s kind of tedious: you have to download the entire 700 plus megabyte archive, import it into some kind of database system — and only then can you even begin thinking about how to query out the results you’re looking for.

This hurdle has stopped me from performing some basic queries that I would like to know on the spot.  But that is no longer the case, and I am going to show you how you can get started querying Stack Overflow from a tool called LINQPad.

First Things, First

You need to download LINQPad, which is a general learning and development tool for composing and executing LINQ queries.  After you have downloaded and installed the application you will have a screen that looks like this:

LINQPad

Setting Up Stack Overflow OData

The next step is to add the OData endpoint for Stack Overflow, which is:

https://odata.sqlazurelabs.com/OData.svc/v0.1/rp1uiewita/StackOverflow

This is done by clicking on Add connection in the top left of LINQPad.  Which will give you a screen that looks like this:

Choose Data Context

Select WCF Data Services and click Next.  You will get a connection screen where you enter the endpoint for Stack Overflow that I described above:

LINQPad Connection

After entered click OK, and you will be taken back to the LINQPad application with a new connection to the Stack Overflow data source that lists all the available tables and fields that you can query.

LINQPad w/ Stack Overflow

Lets Have Some Fun Querying

Lets start with an easy query that we all should know.  Who is the number 1 Stack Overflow user?

Surprise it is Jon Skeet.

What about which user has the highest number of votes?

Not Jon Skeet, which is surprising.

What about down votes?

Another guy in the UK

Show my insightful comments with a score of 5 or greater?

I only have one :(

Conclusion

As you can see this is a very powerful way to get some quick answers out of Stack Overflow, and it is amazing that Microsoft, Azure, and Stack Overflow is able to bring all of this to us for free. 

Also if interested they also offer OData endpoints for all of the other major Stack Exchange network of sites:

Post some of your interesting queries below.

Tags: , , ,

Posted in How To, Programming | kick it on DotNetKicks.com | Bookmark | View blog reactions | 2 Comments »