Wintellect Blogs

Writing Cross-Platform Mobile Apps with Visual Studio 2015 and Xamarin Forms

Jeff Prosise

26 Feb , 2015  

Calculator-Group.png

I love writing apps for Windows and Windows Phone. But the rest of the world doesn’t share that love with me. You can write the coolest mobile app in the world, but unless it runs on iOS and Android, few people will care.

Since 2011, Xamarin has offered a compelling solution to developers who write mobile apps but lack the time or wherewithal to port them to all the popular mobile operating systems. With a heritage rooted in Mono, MonoTouch, and Mono for Android, Xamarin allows developers to write mobile apps in C# and compile them into native apps for iOS, Android, Windows Phone, and other popular platforms. Xamarin apps utilize APIs that derive from Microsoft .NET APIs, but also enjoy the ability to invoke native platform APIs when the need arises. A typical Xamarin app consists of per-platform UIs backed by a shared code base written in C# and compiled into a Portable Class Library (PCL). Developers who are familiar with Microsoft .NET find themselves immediately at home in Xamarin because they’re largely insulated from the underlying operating system’s native APIs. Much of the learning curve comes in learning how to build UIs using idioms specific to each platform.

In 2014, Xamarin introduced Xamarin.Forms (hereafter referred to as “Xamarin Forms”), which allow UIs to be shared across platforms, too.… Read more

, , , ,

Wintellect Blogs

Software Development Guidelines to Live By

Tony Sneed

19 Feb , 2015  

shutterstock_226410193

Not too long ago I posted a tweet that immediately went viral. (OK, it’s all relative – to me 66 retweets and 120 favorites is viral.)  It referred to Microsoft’s Engineering Guidelines for contributing to its open-source repository on GitHub for the next version of its web development platform, ASP.NET 5.

eng-guidelines

You may be familiar with other C# Coding Guidelines.  And generally I’m a huge fan of picking a set of guidelines, making necessary adjustments, and sticking to them as a team.  But what I appreciate about the ASP.NET 5 guidelines is that they not only cover coding guidelines, but also include other vital aspects of software development, such as source code management, product planning and issue tracking.

One of the first things listed is the guidelines for submitting pull requests and a description of how they are reviewed and approved (using an emoticon!).  Their Git branching strategy is also described, as well as the solution and project folder structure and the assembly naming pattern.  It’s notable that xUnit is used for all testing and is indicative that xUnit has now supplanted both MSTest and NUnit as the preeminent testing platform.  (In other words, just use it.)  It’s also worth noting that to use xUnit you no longer need to install a Visual Studio extension – adding the xUnit NuGet package is all you need to do for tests to show up in the Visual Studio Test Explorer. … Read more

, , , ,

Wintellect Blogs

FileNotFoundException When Looking for YourAssembly.resources.dll? Here’s Your Fix!

John Robbins

13 Feb , 2015  

missing-piece

I happened to be working on a C# Roslyn code analyzer and being cognizant that not all the world speaks English, I went through the five minutes of work to internationalize the analyzer DLL. Add the .RESX file and you’re pretty much done. All my unit tests ran perfectly as did the tests of running the analyzer as a .VSIX. However, when I ran the tests with the analyzer in a NuGet package, I kept getting the compiler crashing with a FileNotFoundException trying to load the <assemblyname>.resources.dll file. After spending several hours trying different attempts at working around the problem, it finally dawned on me, I had run into this same bug many, many years ago.

Even though you have the resources in the assembly, that’s not the default place .NET looks. To tell .NET to look in the assembly, you have to specify in your Assembly.CS file the following:

[assembly: NeutralResourcesLanguage(“en-US”)]

That’s all there is to it. Why .NET resource searching doesn’t always look in the assembly by default is beyond me. Now that the Core Framework is open sourced, maybe I should submit a patch!… Read more

,

Wintellect Blogs

Implementing Interfaces in F# Using Object Expressions

Jonathan Wood

10 Feb , 2015  

Plug-connection-1127202925

To expand on another topic that was mentioned in the F# Infographic is that F# also has the ability to use any .NET library. From that, you may be wondering, “what about implementing interfaces that may come in other libraries?” Of course, you can create classes in F# if you need but there’s a more elegant solution – object expressions.

Let’s take a look and implement one of the most use interfaces in .NET – IDisposable.

let dispose() =
 { new System.IDisposable with
 member x.Dispose() =
 printfn "Disposed..." }

As you may tell, we’re declaring a function dispose and implementing the IDisposable interface on it. Now let’s make use of this method.

let callDispose() =
 use d = dispose()
 printfn "Calling dispose"

And now we can just call the above in the F# interactive and we get the following results:

> callDispose();;
Calling dispose
Disposed...

Now compare the above implementation to what you would have to do in C#.

using System;

namespace ConsoleApplication1
{
 class Program
 {
     static void Main(string[] args)
     {
        using (var d = new DisposableClass())
         {
         Console.WriteLine("Calling dispose");
         }
      }
  }

 class DisposableClass : IDisposable
 {
     public void Dispose()
     {
         Console.WriteLine("Disposed...");
     }
 }
}

And, of course, running this we get the same results.… Read more

, , ,

Developer Lifestyle,Wintellect Blogs

Modern Web Development 101

Dave Baskin

8 Feb , 2015  

world-wide-web

Maybe you’ve heard the term “Modern Web” before. It embodies the idea of a constantly evolving, exciting platform that unique and powerful user experiences can be built upon. It is a platform that new capabilities are added to regularly, not waiting for long release cycles.

And maybe you’ve been asked to build a “modern web application”.

So what does that mean exactly? Perhaps you’ve already got a few HTML pages, some nice-looking CSS along with pleasing images, and some Javascript to give the pages that extra little pizzazz. What else do you need?

Let’s look at what a Modern Web Application might look like, considering only the pieces that are loaded into the browser (the client-side pieces), putting aside for now the whole story about what is running on the web server itself.

Client-Side Code

Javascript is the language that the browser knows how to speak. It is a dynamic language, meaning that it doesn’t get compiled first, like a Java or C# application would. A compilation step helps identify certain types of errors in your code, but with Javascript, you’ll need additional help in determining whether your code is correct or not.

Some choose to do this with the language itself.… Read more

, ,

Wintellect Blogs

Cmder: Making the Command Line Your Best Friend

Tony Sneed

5 Feb , 2015  

cmder-main

Now that I’ve jumped fully on board the Git and GitHub bandwagon, I’m spending a lot more time at the command line.  In fact, I find myself working with both Visual Studio and the command prompt simultaneously, constantly switching back and forth between the two.  The main reason is that, while Visual Studio 2013 makes a great Git client and tools such as TortoiseGit are a great help, there are some Git commands, like stash and rebase, that either aren’t supported well by the tools or are just easier to perform at the command line.  Besides, most of the online Git tutorials list Git commands.

cmder-main

DOWNLOAD Cmder here: http://bliker.github.io/cmder.

Another reason why I find myself more on the command line is that I’m working with ASP.NET 5, which requires the use of a command prompt for managing versions of the runtime and generally embraces command line tools as a first class citizen.  Finally, there’s Chocolatey, for easily installing tools at the command line, and, of course, PowerShell for automating actions with scripts.

As my need to work at the command line has increased, so has my frustration with the standard windows command prompt. Thankfully, I’ve run across a very nice command prompt replacement called Cmder, which combines the console emulator, ConEmu, with cmd enhancements from Clink and Git support from msysgit. … Read more

, ,

Wintellect Blogs

Why You Should Be Writing ECMA Script 6 Now

Josh Carroll

22 Jan , 2015  

JavaScript

If you are reading this article then you have probably at least heard of ECMA Script 6, the next version of JavaScript, and are curious about what it means for you or your organization. You might be wondering how ES6 is different, if it will affect your existing applications, or if it will affect your ability to write new ones that make heavy use of JavaScript.

Those are valid concerns, however, there is another reason to care about ES6 right now that simply isn’t on most people’s radar.

I’ll get to that.

How is ES6 different?

The jump from ECMA Script 3 to ECMA Script 5 brought with it some very nice features to JavaScript, but It wasn’t revolutionary. There was a deliberate effort not to introduce any new syntax into the language. It was a pretty natural progression from 3 to 5 if you were a developer.

ES6 is different because it introduces new syntax. A lot of new syntax in fact.

These changes are a very welcome, and very needed update to the language that will help to meet the demands of ever larger and more complex applications written in JavaScript. However… writing ECMA Script 6 will be fundamentally different than all previous versions before it.Read more

, ,

Wintellect Blogs

When Should You Make the Move to Entity Framework 7?

Tony Sneed

21 Jan , 2015  

question-mark-clock-620x250 (1)

The next version of Entity Framework will be called “Version 7” and will be released as part of the next version of ASP.NET, called “ASP.NET 5.” If you’re currently on EF6, you might jump to the conclusion that you should upgrade to EF7 as soon as it hits the streets. But the EF team has made clear that you’re going to want to hold off upgrading to EF7 for a while:

“We won’t be pushing EF7 as the ‘go-to release’ for all platforms at the time of the initial release to support ASP.NET 5. EF7 will be the default data stack for ASP.NET 5 applications, but we will not recommend it as an alternative to EF6 in other applications until we have more functionality implemented.”

This means that the initial release of EF7 won’t include all the features a real-world ORM (Object-Relational Mapping) tool should support (for example, inheritance mapping). But if you can live without those features, or if you are developing an ASP.NET 5 app that needs to target CoreCLR, then feel free to make the move to EF7.

So when might you want to upgrade from EF6 to EF7?

For some folks the answer will be, “Maybe never.” That’s right.… Read more

,

Wintellect Blogs

Less Defects with F# Units of Measure

Jonathan Wood

31 Dec , 2014  

tape-measure

One of the most powerful things that F# has is its ability to create custom units of measure. F# allows you to set an explicit type to a unit. That’s right…you will get compile time checking on any of the units that you use within your application.

If your application does use any type of units, then determining what type of unit the input or output is expecting can be tricky. Even NASA has had this problem before. With the compile time checking of any discrepancies for the units, then these types of bugs will disappear all together.

For the most used units Microsoft already has them built in and can be directly used.

open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols

let meter = 1<m>

But for custom units they can be easily defined using the Measure attribute.

[<Measure>] type pixel
[<Measure>] type inch
Read more

,

Wintellect Blogs

Single Stepping a PowerShell Pipeline

John Robbins

11 Dec , 2014  

shutterstock_135487823

As I was building up a moderately complicated pipeline in PowerShell, I was having some trouble and really wished there was a way to single step the pipeline so I could see the state of each item as it was processed. I wasn’t sure this was possible, but it is and I thought others might find it helpful. The magic is in the super powerful Set-PSBreakpoint cmdlet.

Because Set-PSBreakpoint can create breakpoints on not only lines and variable reads/writes, but also commands, I thought I’d try setting a breakpoint in the PowerShell console on one of the commands in the pipeline and it worked great! In the example below I will set a breakpoint on the Get-ChildItem cmdlet and when the breakpoint is hit, use the command line debugger to step through parts of the pipeline (the ‘s’ command is step into)

  1. PS C:\Junk> Set-PSBreakpoint -Command Get-ChildItem
  2.   ID Script   Line Command        Variable    Action
  3.   – ——   —- ——-        ——–    ——
  4.    0               Get-ChildItem
  5. PS C:\Junk> Get-ChildItem *.exe | ForEach-Object { $_.Name }
  6. Entering debug mode. Use h or ? for help.
  7. Hit Command breakpoint on ‘Get-ChildItem’
  8. At line:1 char:1
  9. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  10. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. [DBG]: PS C:\Junk>> s
  12. At line:1 char:38
  13. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  14. +                                      ~
  15. [DBG]: PS C:\Junk>> s
  16. At line:1 char:40
  17. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  18. +                                        ~~~~~~~
  19. [DBG]: PS C:\Junk>> s
  20. Foo.exe
  21. At line:1 char:48
  22. + Get-ChildItem *.exe | ForEach-Object { $_.Name }
  23. +                                                ~
  24. [DBG]: PS C:\Junk>>
Read more

,