Rumble Radar Released!

by rhernandez 4. December 2012 12:28

 

Recently, motivated by the launch of Windows 8 and the recent seismic activity on the Mid-Atlantic region.  I began to work on a very simple project, a Windows 8 Store application that showcases recent significant seismic activity worldwide using the data provided by the United States Geological Survey (http://www.usgs.com).  I am proud to announce that the first version of my app “Rumble Radar” is available now for download from the Windows 8 Store.

 

PromotionalImage

 

Click here to download:

http://apps.microsoft.com/webpdp/en-us/app/rumble-radar/22e0199e-c221-4554-9301-ad28af7e821c

 

Features

- Geocodes and groups significant earthquakes, as designated by USGS, for the past 7 days.

- Color encodes earthquakes using alert level, as assigned by USGS.

- Links to detail information at USGS Website.

 

Roadmap/Future Enhancements

- Expand dataset to include all earthquakes of magnitude 2.5 and greater for the past 30 days.

- Interactive map of all earthquakes.

- Generate date based statistics per region.

Rumble Radar Released!

by rhernandez 4. December 2012 07:56

 

Recently, motivated by the launch of Windows 8 and the recent seismic activity on the Mid-Atlantic region.  I began to work on a very simple project, a Windows 8 Store application that showcases recent significant seismic activity worldwide using the data provided by the United States Geological Survey (http://www.usgs.com).  I am proud to announce that the first version of my app “Rumble Radar” is available now for download from the Windows 8 Store.

 

PromotionalImage

 

Click here to download:

http://apps.microsoft.com/webpdp/en-us/app/rumble-radar/22e0199e-c221-4554-9301-ad28af7e821c

 

Features

- Geocodes and groups significant earthquakes, as designated by USGS, for the past 7 days.

- Color encodes earthquakes using alert level, as assigned by USGS.

- Links to detail information at USGS Website.

 

Roadmap/Future Enhancements

- Expand dataset to include all earthquakes of magnitude 2.5 and greater for the past 30 days.

- Interactive map of all earthquakes.

- Generate date based statistics per region.

WinJS: Do I have internet access?

by rhernandez 27. November 2012 07:18

 

Odds are the new shiny Windows Store application you are writing will pull some information from the internet for your users to consume.  In fact, the default templates that Microsoft provides already make that assumption. That makes it very likely that you will want to know if the device your application is running on has an active internet connection.  Well Microsoft provides us with a very rich Network API (click here for more info) that you could use to answer such a question. But if want to write less code or want to provide an abstraction layer from WinRTs API, then you could write something similar to this:

 

(function() {
    "use strict";

    var networkInfo = Windows.Networking.Connectivity.NetworkInformation;
    var networkConnectivityInfo = Windows.Networking.Connectivity.NetworkConnectivityLevel;
    
    WinJS.Namespace.define("Internet", {
        isConnected: isConnected,
        ifConnected: ifConnected
    });
    
    function isConnected() {
        var connectionProfile = networkInfo.getInternetConnectionProfile();
        if (connectionProfile == null) {
            return false;
        } 
            
        var networkConnectivityLevel = connectionProfile.getNetworkConnectivityLevel();
        if (networkConnectivityLevel == networkConnectivityInfo.none
            || networkConnectivityLevel == networkConnectivityInfo.localAccess
            || networkConnectivityLevel == networkConnectivityInfo.constrainedInternetAccess) {
            return false;
        }
            
        return true;
    }
    
    function ifConnected(action) {
        if (isConnected())
            action();
    }

})();

 

A very basic sample would look like:

 

if (Internet.isConnected()) {
    // Do Something.
}

 

Or my favorite style:

 

Internet.ifConnected(function() {
    // Do Something.
});

TIP: Nokia Lumia 920 Internet Sharing //Build

by rhernandez 6. November 2012 07:59

Disclaimer: This post does not imply that the Internet Sharing feature will only work if you have the Spanish keyboard installed. It only implies that the build on the Windows Phone 8 devices handed out at //Build/ had an issue that prevented users on the ATT network to use Internet Sharing. My guess is that by adding a keyboard (any keyboard probably) to the device we are also triggering an update that solves the Internet Sharing issue.  

Update (11/26/2012):  If the issue happens again installing another keyboard does the trick (I used Vietnamese).

 

I was very excited to receive a Nokia Lumia 920 while attending the //Build conference last week, but was extremely disappointed that the Internet Sharing feature was not working even though my ATT plan supported it. Obviously, that was one of the first things I wanted to do since I wanted to share the Data Plan on the device with my brand new Microsoft Surface.  Well, by sheer luck, I was able to get it to work just follow the instructions bellow to enable it on your //Build Nokia Lumia 920 device:

 

1) Go to Settings
2) Go to Keyboard
3) + Add Keyboards
4) Select Spanish (Spain)
5) Click on the checkmark icon to install.

 

The only reason why I found this workaround is because I write a lot of messages to my family in Spanish and I hate the fact that the English keyboard tries to autocorrect Spanish using an English dictionary as I type. But, little did I know that it was going to have this wonderful and unexpected side effect.

Automating EF 4.3.x Data Migrations in your Build

by rhernandez 13. March 2012 08:55
I was asked to clarify what I meant by “some combinations of parameters not working” so I took it upon myself to rewrite the post to be a bit more specific about the problems that I had when using the migrate.exe tool. https://twitter.com/#!/julielerman/status/179736371353747456

If you are looking for a way to automate the execution of your Entity Framework data migrations in your build process the data team has provided us with a command line tool, migrate.exe,  that exposes all the commands available to us in the Package Manager Console in Visual Studio.  The tool is already conveniently part of the Entity Framework’s NuGet package tool folder.  the tool works as advertised, but it does have some quirks, but first let me show my two favorite ways to utilize the tool. If you are totally new to EF data migrations do visit David Hayden’s blog post with a very basic tutorial on the topic which is simple and to the point, or visit Pluralsight and purchase Julie Lerman’s amazing 1 hour tutorial on the topic (see the details here).

 

Two ways to use Entity Framework’s Migrate.exe

Option 1 – Reusing the app.config

This is the most straight forward option as you are reusing the settings in your applications app.Config to execute the migrations from the command line so the margin for error is relatively small.  The downside is, if you have different connection string settings for all the different environments you want to target with the database migration tool then you will have to come up with a strategy to modify the settings of the app.Config, one possible solution is, if you are working on top of a Web Application project, like an MVC application, you could use web.config transformations during the build process to change application settings.

 

@rem run_db_migrations.cmd
SET CurrentPath=%CD%
SET ConfigFile=%CurrentPath%\Data\App.config
SET MigrateExe=.\packages\EntityFramework.4.3.1\tools\migrate.exe

%MigrateExe% Data.dll /StartUpDirectory:%CurrentPath%\Data\bin\Debug\ /startUpConfigurationFile:"%ConfigFile%"

 

The following table explains the data being passed to the command line tool.

Options Comment
Data.dll The assembly with the DbContext and migrations to be executed.
/StartUpDirectory This is the directory where your assembly is located.
/startUpConfigurationFile This is the path to the configuration file that holds the connection string to be used.
/verbose [Optional] use this option to have the tool output all SQL being executed or generated to the command console.

 

Option 2 – No app.Config

This is by far my favorite approach as you will not need to write complex scripts to modify your app.Config to accomplish targeting multiple environments. I don’t believe there is really a downside to this approach.

 

@rem run_db_migrations.cmd
SET StartUpDirectory=%CD%\Data\bin\Debug\ 
SET ConnectionString=SERVER=.\SQLExpress;DATABASE=Rsvp_Test;TRUSTED_CONNECTION=True
SET ConnectionStringProvider=System.Data.SqlClient
SET MigrateExe=.\packages\EntityFramework.4.3.1\tools\migrate.exe

%MigrateExe% Data.dll /StartUpDirectory:%StartUpDirectory% /ConnectionString:"%ConnectionString%" /connectionStringProvider:%ConnectionStringProvider%

 

The following table explains the data being passed to the command line tool.

Options Comment
Data.dll The assembly with the DbContext and migrations to be executed.
/StartUpDirectory This is the directory where your assembly is located.
/ConnectionString This is the full connection string for your target environment.
/connectionStringProvider This is the ADO.NET provider type to be used when executing against your target environment.
/verbose [Optional] use this option to have the tool output all SQL being executed or generated to the command console.

 

Complaints

I attempted to learn how use this tool by using the command line executable and just messing with the parameters to see which ones where needed and that approach backfired as in some scenarios I wasn’t getting much feedback from the tool as you can see from the following screenshot.  Now, I admit I made the mistake of not providing the connectionStringProvider to the command line tool but I expected it to handle this more gracefully.

image

 

Conclusion

Automating your Entity Framework data migrations in your build server is extremely simple and flexible, so feel free to go version and manage your database the efficient way.

The Author



Roberto Hernández

 

Currently a Developer Extraordinaire at InfernoRed Technology based out of Northern Virginia. I have been architecting and building software solutions using Microsoft technology for the past 14 years. I was awarded a Microsoft MVP award for C# in 2007,2008 and 2010. I am originally from the Dominican Republic, and the proud father of two beautiful daughters that make my life special. You can track me down on twitter (@hernandezrobert) and on this blog at http://www.overridethis.com.


 

Stack Overflow profile for Roberto Hernandez at Stack Overflow, Q&A for professional and enthusiast programmers

INETA Community Speakers Program

 

 

Recent Posts