Dave Noderer's Blog

South Florida does .NET!

  Home  |   Contact  |   Syndication    |   Login
  203 Posts | 0 Stories | 363 Comments | 28 Trackbacks

News

Twitter












Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

.NET Community

Life at the Beach

My Blog Friends

Saturday, December 20, 2014 #

Recently I was using Entity Framework 6.1.1 to implement functionality for a windows service.

I had used code first, that is creating a class in code then attaching to a db context and migrating it into a table on SQL Express 2014 but these had been small projects without a lot of data and hosted on full size sql servers and most projects start with an existing SQL Server so code first is not used.

This time through testing processing a dozen or two transactions was no problem and I was not worried about database size. The code is reading a csv file from a secure web service then importing and processing. These transactions include signature pad data whose fields can be quite lengthy, over 10kb in some cases as it is base64 encoded. The text and data are transformed into fields on a form including .jpg bytes for the signatures and then exported as a .tiff file.

During testing I kept asking for production file samples but only got the odd test transaction or two.. so when a large production file (over 20k transactions) hit there were problems, no surprise!

After handling a few other issues the program would error out after importing 300-400 transactions.

One issue is that the signatures were bigger than the test articles but the main problem is that if you make a class in code first like this:

public class foo()

{

public string text1 {get; set;}

public string text2 {get; set;}

}

In the database you end up with a table foo and all the fields are nvarchar(max). Even this is not so bad if you only have a small bit of data in the fields and the row fits within an 8k database page.

The problem is that with multi-kilobyte fields additional pages are allocated for each row in multiple tables and disk space quickly expands.

The error was that the database was filled which happens when SQL Express hits 10 gigabytes (SQL Express 2014).

Luckily this is easily fixed by annotating with the MaxLength so my classes now look like:

 

public class foo()

{

[MaxLength(50)]

public string text1 {get; set;}

[MaxLength(100)]

public string text2 {get; set;}

}

Run the database migration commands and now all 20k transactions fit in a few hundred megabytes.

Note that I’m not too worried about longer term storage, this information will be quickly purged and only has to handle a day or two of transactions at a time. If that changes we can always upgrade to a standard sql server instance…

Simple fix and common sense but some of us learn hard!!


Monday, November 17, 2014 #

When using ajax to load data from the server it is useful to display a “loading” animation to let the user know that something is happening.

These bits of code and this gif spinner will do the trick!

ajax-loader  you can find a number of alternative spinners or make your own!

Position the following div wherever you want it on your page.

Then in javascript turn it on when loading the page and  when re-fetching data (say after filtering):

$("#loading").css({ 'visibility': 'visible' });

Then turn it off on either successful return or data or an error:

$("#loading").css({ 'visibility': 'hidden' });


Sunday, August 25, 2013 #

I am converting some of the APIMASH projects from c# to vb.net and having to translate between the two.

You can find the APIMASH projects at: https://github.com/apimash/StarterKits

This is part of inheriting behavior of the System.Net.WebClient, for Windows Phone 8.

The c# code looks like this:

DownloadStringCompleted += (s, e) =>
{
    if (e.Error == null)
    {
        tcs.TrySetResult(e.Result);
    }
    else
    {
        tcs.TrySetException(e.Error);
    }
};

I tried two c# to vb.net conversion tools, DevFusion: http://www.developerfusion.com/tools/convert/csharp-to-vb/ and Telerik thttp://converter.telerik.com/.

Simple code converts fine but this example that does not, both do the same thing, could be the same engine:

DownloadStringCompleted += Function(s, e)
                               If e.[Error] Is Nothing Then
                                   tcs.TrySetResult(e.Result)
                               Else
                                   tcs.TrySetException(e.[Error])
                               End If

                           End Function

The lambda function works ok but that is not how event handlers are written in vb.net, this works much better:

AddHandler DownloadStringCompleted, Function(s, e)
                                        If e.[Error] Is Nothing Then
                                            tcs.TrySetResult(e.Result)
                                        Else
                                            tcs.TrySetException(e.[Error])
                                        End If
                                    End Function


Monday, August 5, 2013 #

A couple of months ago my esteemed Microsoft Developer Evangelist, Joe Healy visited our user group and spent some time going through the APIMASH starter projects the DPE’s have been working on. I was impressed!!

It looked like fun and thought that members of my user group would respond to these fairly simple but complete examples for Windows 8, Windows Phone 8 and now Windows 8.1.

Being a Visual Basic .net MVP I noticed that none of these were done with vb.net and know that there are millions of vb programmers out there looking for samples.. so I volunteered!

I started with Bob Familiar’s Chuck Norris c# starter kit, downloaded it from github and tried a few approaches to porting it.  You can read about Bob’s original starter kit here: http://theundocumentedapi.com/2013/06/06/apimash-chuck-norris-starter-kit/

There are two libraries, APIMASH_CNorrisVBLib and APIMASHVBLib plus the main windows 8 project.

Being the lazy developer, I tried to bulk convert c# to vb.net. Two I tried were http://www.developerfusion.com/tools/convert/csharp-to-vb/ and  http://converter.telerik.com/. Neither really did a complete job and both left some c# remnants and just plain errors. In the end I used the DeveloperConfusion throughout just so I would get use to what it was doing. In retrospect I should have keep more detailed notes and will next time. Three areas I remember having to rewrite the code was for adding event handlers, lamdas and overrides.

The two libraries were pretty straight forward and I was able to get them to compile and look correct pretty quickly. There were no tests and I did not tackle that task.

What took me longer was the actual windows 8 app. Trying to convert the code behind and past it into the xaml forms did not go well. In the end I created a fresh windows 8 project and spliced in and ported pieces. The main problem was that the namespaces got confused and mixed up so that the code behind was not recognizing the few controls on the page.

Once I was over that hump the project worked!

I’m sure that there are many improvements that could be made and hope to hear from you.

The project can be found on github under the Windows Starter Kits: https://github.com/apimash/StarterKits


Tuesday, February 26, 2013 #

I finally downloaded the html client preview 2 to give it a run, had not had a chance to look at Lightswitch since last summer…

http://blogs.msdn.com/b/lightswitch/archive/2012/11/12/announcing-lightswitch-html-client-preview-2.aspx

I ran into a few problems…

When trying to create a Silverlight html/c# client I got a dialog box:

Before installing this version of Silverlight, please close all browser windows and uninstall the current version of Silverlight.

Installed version: 5.1.10516.0

Requested version: Silverlight 5 (5.1.10411.0)

I un-installed the newer version of Silverlight, installed the recommended version and got past that error.. I searched around and did not see this problem in the forums but could have easily missed it…

A couple of other minor problems but then was stuck with a build error indicating Lightswitch could not access the localdb\v11.0:

Error    1    An error occurred while establishing a connection to SQL Server instance '(LocalDB)\v11.0'.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start.
)    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v2.0\Microsoft.LightSwitch.targets    146    10    ContosoMoving

After learning more than I wanted to about localdb over a couple of days, what was consistent were errors of this kind shown below from the localdb log if I let Lightswitch create the localdb\v11.0 instance:

FCB::Open failed: Could not open file e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\MSDBData.mdf for file number 0.  OS error: 2(The system cannot find the file specified.).

Note: I don’t have an E drive normally, these might be remnants of an installation disk.

These logs and the database system and other files can be found here: C:\Users\{your user name}\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0 on my Windows 8 installation.

Although localdb\v11.0 was created, I could not connect to (localdb)\v11.0 via sql management studio (or visual studio).

Final solution was to delete what was there and create / test (LocalDB)\V11.0 before trying to start/compile a Lightswitch project.

To delete an existing V11.0 and create a new one use the sqllocaldb (.exe) utility which should be mapped already if you use you visual studio developer command prompt. The sequence I used was:

cd c:\users….\Instances (see full directory above).

delete the v11.0 directory

run this sequence of commands:

sqllocaldb delete v11.0

sqllocaldb create v11.0

sqllocaldb start v11.0

After I verified I could connect to the localdb\v11.0 then I was able to run Lightswitch without problems.

Dave Noderer

Software Developer / Microsoft MVP

Cell: 954-270-1186

Company: http://www.computerways.com

Win Phone Beach Riser Pro: http://bit.ly/BeachRiserPro


Note to self… when changing source control on a solution you need to remove the workspace associated with the old source control, connect to the new server and add / check in to the new server.

This is after frustratingly “change source control” which will unbind but not allow you to rebind / connect to a different server.


Wednesday, February 20, 2013 #

We held out 9th annual South Florida Code Camp on 2/9/2013. Unlike past years, instead of stuffing bags with brochures and papers from the vendors, we bought 700 2gb USB keys and had all the vendors send us information, software, links and files to put on the USB key.

This was a great success.. but how about making it public too?

I setup a folder on my skydrive:

image

Then I renamed the new folder, selected it and clicked on the sharing button at the top:

 

image

By clicking on “People with a view link” I created a link I could share with all the code camp attendees to allow them access to the content. If you click on “Shorten” you will be a very usable and short link. After you copy the link, you can click on “Done” and distribute or post the link.

Then I realized there was more I could put there. Besides the USB content from sponsors I created directories for the speakers and a place to put all the photos we collect.

image

This was quick and easy, now I’m wondering why I did not do this before!

Feel free to browse the code camp skydrive here with the shortened link: http://sdrv.ms/122eAdh


Wednesday, October 31, 2012 #

Just a heads up from DevFish (http://devfish.net), a free book on writing applications for Windows 8using html, css and javascript by Kraig Brockschmidt .

You can find the book here:

http://blogs.msdn.com/b/microsoft_press/archive/2012/10/29/free-ebook-programming-windows-8-apps-with-html-css-and-javascript.aspx

I have not finished reading this but so far it looks like it will be a great resource if you have any interest in trying the windows 8 javascript programming model.

Besides all the aspects of controls, library support and animations the book also talks about how to make your own components in c#, vb or c++.


Tuesday, October 30, 2012 #

Great keynote and I don’t like keynotes..

Seeing the great breadth of large and small devices and the number of manufacturers along with the software vision for Windows 8 and Windows Phone 8 was inspiring.

Jordan Rudess demonstrates Tachyon on Windows 8

Then he played for a while too..

 

I especially liked Steve Balmers 82” slate!! Can I have one!

 

WP_000419

And best of all, they finally released the Windows Phone 8 SDK.

http://www.microsoft.com/en-us/download/details.aspx?id=35471

Off to sessions…

 

Stay tuned for more!


Saturday, November 19, 2011 #

Herve Roggero, SQL Azure MVP,  has created a virtual community to focus on Azure. Here is the outline from Herve:

 

User Group Name:  Azure Florida Association

Purpose: Start a virtual Florida user group that targets the Azure platform

Venues: Most meetings will be virtual; however I plan to host a few physical events across Florida if possible from time to time; physical events may be a few hours long with potentially more than one speaker

Possible Topics: The topics will touch Azure generally speaking, but can have a wide array of concern such as Integration, Data Migration, Hosting, Security, Scalability, Mobile Device integration, successful ventures/lessons learned, cross cloud integration patterns, testing in the cloud, deployment management, reporting…

Target Members: Architects, Developers, IT Managers

Membership: Membership will be free; virtual events will be free; physical events may involve a minimal cover charge

Speakers: If you are interested in speaking or if you have topic ideas, please let me know

Frequency: Initially these meetings will be held every other month

 

The first meeting will be held on January 25, 2012 at 4PM EST. Vikas Sahni, SQL Azure MVP, will be presenting on Demystifying SQL Azure. Vikas will introduce SQL Azure, value proposition, usage scenarios, concepts and architecture, what is there and what is not, including Tips and Tricks. 

The actual meeting link will be available in January but please join the linked in group now to be kept informed of this and future events: http://www.linkedin.com/groups?gid=4177626.


Wednesday, August 31, 2011 #

From Joe Healy’s Dev Fish Blog but worth repeating!!

 

mango-iheart

What’s a Windows Phone Camp?

For those who went to our "Windows Phone Garage" series last year, its one of those. For those new to the scene, its a free, full day event chocked full of everything you need to know to develop a Windows Phone application. Whether you’re a seasoned veteran or just getting started with phone app development this full-day event is for you.

Interested in profit? We’ll also lead discussions on how to monetize your applications and generate profits with your apps.

Don’t miss the new Windows Phone 7.5 (codename "Mango") features as well - with detailed sessions in the afternoon around Fast Application Switching, Multitasking, Live Tiles, Push Notifications, and more.

The day will be capped with an open lab hands-on session and prizes for apps completed. This is the perfect opportunity to begin work on your dream application, or finish that app you’ve already started, with Windows Phone experts there to guide you every step of the way. Bring your own laptop to join in the fun and show off your killer app!

Agenda

9:00 AM

Welcome Campers

9:15 AM

How to make money with your Windows Phone App

10:00 AM

Frameworks for fun and profit > Silverlight and XNA

noon-ish

Canteen > Install Fest

1:00 PM

Hands-on lab

3:00 PM

Cool stuff your app can do

4:00 PM

To the Cloud

4:45 PM

Be What's Next > Peoples Choice Awards

Not only is the content great, but we've got a ton of locations coming up. Note that we are not only hitting the traditional Microsoft facilities, we are hitting a ton of campus locations as well. Students can attend Microsoft facilitiy events, and professionals / entrepreneurs are more than welcome to drop in on the on-campus locations as well. Mix, mingle, network.

Don't see your geography in the list? Located in the East Coast USA? Reach out to us and let's see if we can line up a Windows PhoneCamp "community edition".

Schedule

9/20/2011

Charlotte, NC

Registration

9/22/2011

Atlanta GA

Registration

9/27/2011

Malvern PA

Registration

9/29/2011

Reston VA

Registration

10/12/2011

Cambridge MA

National Event - Two day - Registration URL pending

10/18/2011

Chevy Chase MD

Registration

10/19/2011

New York City, NY

Registration

10/25/2011

Tampa FL

Registration

10/27/2011

Champlain College, Burlington VT

Registration

11/2/2011

NCSU, Raleigh NC

Registration

11/4/2011

Fort Lauderdale, FL

Registration

11/8/2011

UCF, Orlando FL

Registration

11/10/2011

Univ of Miami, Coral Gables FL

Registration

11/10/2011

SUNY (New Paltz), New York

Registration

11/15/2011

Virginia Tech

Registration

11/17/2011

Howard University, Washington DC

Registration

11/29/2011

Pittsburg, PA

Registration

12/1/2011

Hofstra, Long Island NY

Registration

12/8/2011

Georgia Tech, Atlanta GA

Registration

Prerequisites:
Bring a notebook computer and identification. Also check out the APP HUB where you can get developer tools, learn about application features, understand common task for Apps and register and load your APP.

Notes:
This event is brought to you by Microsoft and is free of charge. However, you are responsible for booking and paying for your own travel and accommodations

Update: 2011/08/31 - new agenda online in event registration


Tuesday, July 26, 2011 #

As of today, the official release of Lightswitch is now available. Visit: http://www.microsoft.com/visualstudio/en-us/lightswitch or you can download from your MSDN subscription.

What is Lightswitch?

It is basically a simple to use application generator that can be used to build applications within minutes in many cases.

If you have an existing, well structured (primary keys, relationships) SQL Server database you are just a few clicks away from an administration tool and well on the way to a full fledged app!

One limitation is that you must be using SQL 2005 or above. I did verify this by trying to attach to a SQL 2000 db. Once the standard database connection dialog is passed you will recognize the entity framework screens.

There will also be lots of third party and community extensions that will simplify making full blown applications.

Code generated can be either VB.net or C#.

In many ways this reminds me of the ease of Access but brought to the level of professional development and extensibility.

Definitely check it out, a very powerful new tool!!

To get started even if you have limited programming experience, check out Beth Massi’s videos: http://msdn.microsoft.com/en-us/lightswitch/gg604823


Saturday, May 28, 2011 #

This past week was an interesting experience. My first trip to Washington DC on Washington business.

As part of the Association for Competitive Technology (http://www.actonline.com) I joined 27 other small software developer company owners from around the country to visit and educate congressional staffs.

I already knew 1/2 dozen of the people attending from my activities in the Microsoft developer community and had the pleasure of renewing friendships with them and making new friends with others. Lots of interesting stories from around the country.

One common thread is, no surprise, that mobile devices are exploding at a rapid pace and will dominate software development landscape for the foreseeable future.

The ACT “fly in” (common to all lobbyist groups) is a chance to get real world people in front of the congress people and their staff.

The first day was basically briefings on top issues, what to expect (a number of us were 1st timers) and some media training.

There were three major issues being covered… Internet Privacy, Intellectual Property and cellular bandwidth.

Although the topics were covered and discussed by the ACT leaders and staff, it was really up to each of us to come up with stories and what it meant to us personally and to our respective businesses.

The one that I was most interested in was the bandwidth question. I know how bad the cellular service can be, especially since I had to pull a number from Verizon to ATT last fall so I could get a Windows Phone 7. It is a very very fragile system, easily overloaded and broken by just a few dozen users at a particular location.

Within a few years, the majority of internet access will be via mobile devices and currently the US is ninth in mobile broadband adoption.

One interesting group there were a few developers / entrepreneurs associated with each other by an organization “Moms With Apps” (includes some Dad’s with Apps too), http://www.momswithapps.com.

On Tuesday we broke up into small teams. Typically 3 business people and 1 ACT person to visit various congressional offices. Each group was a different mix but one common thread was that there was a constituent of the congress person in each group. The last meeting our ACT “handler” did not show but by that time we were all pro’s and knew what to do.

For me, in all but one case, I met with legislative assistants. This makes sense anyway because in each office an assistant is assigned to be the expert in a particular area of legislation. I had six meetings, 2 senate and 4 house. Met with staff of Sen Kirk (R/IL), Sen Nelson (D/FL), Rep Hastings (D/FL), Rep Paulsen (R/MN), Rep Frelinghuysen (R/NJ) and one actual congressman, Brian Bilbray (R/CA). All the meetings went very well allowing us to discuss the issues, how they affected our businesses and what direction we would like to see the government take.

We also had a lunch with the “IP Caucus” (Intellectual Property) which is a group of congressional members, aids and lobbyists that are interested in how we can enforce copy write and patent protections across national borders. At least one of our group had a story of how popular his game is in chat rooms in China but has only sold one license there. These caucuses are similar to committee’s in that they have some dedicated staff to help them run.

I definitely learned a lot. All the congressional offices are very approachable. Appointments are needed but it is likely that if you want to take the time and effort any voter can get someone to listen to their story!!

I could also see evidence of many threads of relationships and coalitions that run throughout the congress, staffs and interested parties that shape our laws and regulations.

There was lots of food and socializing which allowed all of use to get to know the others.

WP_000794WP_000799


Thursday, March 31, 2011 #

I’ve been meaning to read this book for a while and finally did!!

Don’t let the title fool you, it could have been “Modern Object Oriented development with .NET”. In the context of improving an existing active project (brownfield) this books walks you through separation of concerns, isolating dependencies, test driven development and many other concepts in a very practical and easy to understand way.

They also cover many of the political, cultural and personality issues you will face working with any company or team and suggest ways to work around, mitigate and sell new ideas into a situation. It is very easy to go with the flow but having the confidence to buck the flow on occasion can be a big win for everyone!

This was a good book for me. I was trained as an electrical engineer and spent 20 years designing computers before taking a turn into application development 17 years ago. I read constantly, listen to podcasts and hang around a lot of very smart people so have picked up most of the modern software design patterns. The advantage of applying particular patterns is not always clear so it takes a while to work new things into my development methodology.. mostly a good thing.

I thought the book did a good job of putting many concepts into a more comprehensive context than is normally presented. This approach has given me many good ideas about how I can better apply the techniques and motivation to investigate a few things I have ignored.

Brownfield Application Development in .NET

Kyle Baley and Donald Belcham
Foreword by David Laribee
April, 2010 | 416 pages
ISBN: 1933988711


Friday, February 4, 2011 #

Always happy to yap about community!!

http://cloudplumbing.com/episode/dave-noderer-interview