.net programming, computers and assorted technology rants


Perfecto – Mobile App Testing Inside Visual Studio

Courtesy Adrian Bridgwater, DrDobbs.com

Perfecto mobile joins the consecrated cognoscenti at Microsoft Build 2014

Microsoft Build wasn’t all about Microsoft this year; well, that’s not true, obviously it was, but a few "Microsoft approved" partners got a look in, too. Amongst the sanctified this year was Perfecto Mobile, with its public preview of a MobileCloud for Visual Studio Plugin for testing mobile apps on real devices inside Visual Studio.

Perfecto argues that by extending Visual Studio with its MobileCloud product, developers can execute manual (and automated) tests on "real mobile devices" directly from Visual Studio.

Software application developers are able to use C# and manage device automation control with Microsoft Team Foundation Server (TFS).

The company sells its wares based upon a promise of this being a "significant jump start" for .NET web teams transitioning to mobile.

"By utilizing the MobileCloud Platform, Visual Studio [developers] can use existing expertise and write automation tests in C# that are executable across any mobile operating system (Android, iOS, Windows Phone) or app style (web, native, hybrid), all with a single test script. Users have instant and always-available access to globally distributed real devices to support testing throughout the code-build-test cycle," said Eran Yaniv, CEO, Perfecto Mobile.

Perfecto’s software provides always-available devices-as-a-service and mobile-ready automation directly from within Visual Studio. Combined, these two capabilities deliver cross-platform mobile app testing that is fully managed by TFS.

Microsoft is apparently happy to back Perfecto’s claims to fame and says that Perfecto’s Mobile App Quality Platform is a "valuable complement" to Microsoft’s suite of mobile development, testing, and ALM tools.

Mitra Azizirad of Microsoft has said that, "By providing extensive mobile test coverage with its globally distributed, mobile device cloud, MobileCloud for Visual Studio empowers development and test teams to deliver better mobile apps faster and meet customers’ quality expectations."

MobileCloud for the Visual Studio solution allows accelerated testing so teams can execute unattended automated testing on remote iOS, Android, and Windows Phone apps without requiring USB connections or driver downloads. System-level control of devices under test enables full interoperability testing (e.g. call, text, change settings).


Windows Phone Preview for Developers Released

Courtesy Keith Ward, VisualStudioMagazine.com


The wait is over for Windows Phone developers anxious to get their hands on a copy of Windows Phone 8.1 so they can start updating their apps. The Windows Phone Preview for Developers was released by Microsoft this morning. 

A blog entry by Microsoft’s Cliff Simpkins announced the release. He added that the Windows Phone Store is starting to take app submissions and enable app linking, all of which allows the building of universal Windows apps. They allow an app to work across Windows 8 devices whether they’re on a desktop, laptop, tablet or phone (and, eventually, Xbox). Universal Windows apps were first announced and previewed at last week’s Build developer conference.

The preview version of Windows Phone 8.1 is important for developers since some aspects of apps need to be tested on a real device, rather than just an emulator. Simpkins, for example, wrote that he uses an emulator for testing whether the code works properly, while using the app on a working Windows Phone provides valuable information about an "app’s real-world usability (e.g., touch target sizing, load times)."

As a supplement to the Windows Phone Preview for Developers, MSDN published a reference app to help developers learn how to integrate their apps with Cortana, the new voice assistant that’s also part of Windows Phone 8.1. The app, called MSDN Voice Search, provides voice-enabled search capabilities to documentation and source code for building Cortana functionality into new or existing apps.

There are a few requirements to get the Windows Phone Preview for Developers. A developer either needs to register as a Windows Phone developer, which is $19 annually, or register as a developer with App Studio, which is free. The other option is to download the developer tools to register and "developer unlock" a Windows Phone (Microsoft provides instructions on how to do this).

Asynchronous Processing in EF6 and .NET 4.5

Courtesy Peter Vogel, VisualStudioMagazine.com


There’s one feature of Entity Framework (EF) 6 that’s only available in the Microsoft .NET Framework 4.5 or later: asynchronous processing. In this column, I’m going to look at some typical scenarios where you can use EF asynchronous processing and show how you might use it.

First Scenario: Processing Multiple Requests in Parallel
Often, when you first display a form or a page, you need to display some initial set of data and also fill some combo boxes or dropdown lists. With asynchronous processing you can issue the request for the grid’s data and, while waiting for that data to show up, go on to issue the requests for the combo box data, overlapping the requests. Even if the database server processes your requests sequentially, you’re no worse off than if you submitted the requests in sequence. But, if the database server does process your requests in parallel, your users might get their data considerably earlier. Best of all, this is a scenario that doesn’t add much complexity to your application. This could be your first big win in asynchronous processing.

But … EF doesn’t support processing multiple requests through the same DbContext object. If your second asynchronous request on the same DbContext instance starts before the first request finishes (and that’s the whole point), you’ll get an error message that your request is processing against an open DataReader. I’ll look at some ways to handle this issue after looking at how to issue overlapping asynchronous requests.

A little pre-retrieval work is required. First, you’ll need an Imports or using statement for System.Data.Entity to pick up the asynchronous extension methods that EF6 supplies. You should also disable the controls you’re filling so the user can’t interact with them while you’re loading data.

Read More…http://visualstudiomagazine.com/articles/2014/04/01/async-processing.aspx

Build your own Siri

Courtesy KLINT FINLEY, Wired.com


n the Iron Man movies, Tony Stark uses a voice-controlled computer assistant called J.A.R.V.I.S. It manages the lights and security system in his home, helps him pilot his Iron Man suits, and even assists with his research. Some of this is still very much in the realm of science fiction, but not all of it. Inspired by the Iron Man movies, two Princeton students have built a J.A.R.V.I.S. for the real world.

“That was even the initial project name — ‘J.A.R.V.I.S.’ — until we decided that it was too unoriginal,” says one of the project’s creators, Charles Marsh. Instead, they now call it Jasper.

It’s like Siri, but instead of running on your smartphone, it operates from a small, stand-alone unit with a microphone and an internet connection

No, Jasper isn’t as sophisticated as its science fictional inspiration. It’s more like Siri or Google Now, but instead of running on your smartphone, it operates from a small, stand-alone unit with a microphone and an internet connection. And it’s open source, meaning anyone can take the designs and build their own and modify it as need be.

Jasper acts as an “always on” system. When you say its name, it will respond with a beep indicating that’s it’s ready for instructions. So far, it can do things like tell you whether you have new Facebook notifications or Gmail messages, play songs from Spotify and, of course, tell you what the weather is like. It also offers a developer interface that lets outside programmers add new tools that can be triggered by additional keywords.

Marsh built the tool alongside a fellow Princeton student named Shubhro Saha. Most of the development happened over the summer, while Marsh was interning at Microsoft in Seattle and Saha at an online advertising outfit AppNexus in New York City. “Every night after work, we’d hold a Google Hangout to discuss design decisions, bugs, TODOs, and everything else we needed to get done,” Marsh remembers.

But like most open source projects, Jasper stands on the shoulders of existing open source code. Much of the voice recognition system, for example, is built on CMUSphinx, CMUCLTK and Phonetisaurus. “We saw Jasper as a great way to show developers what’s possible within the realm of open source,” he says. “We were amazed by how far we could get with these free, open solutions, and we wanted others to be similarly inspired.”

If you’re inspired, one option is to help the two expand the reach of Jasper. You can build your own with little more than a Raspberry Pi mini-computer, a speaker, and a microphone. Jasper’s source code has only been out for a day, but Marsh says they’ve already heard from several developers interested in building on top of it. “One individual mentioned that he was looking into powering his entire home with Jasper after wiring it with microphones,” he says. “Another asked us about automating vehicles in his factory with Jasper-powered voice control. Another even mentioned using Jasper in the classroom as a tool to teach kids about programming.”

For the time being, Marsh says, he and Saha have no plans to build a business around the tool. They simply wants others to join in. “When we were planning out the Jasper vision, what we really saw was a platform for hackers: its beauty lay in its extensibility,” he explains. “Nothing excited us more than to see what other programmers could do with the device.” Such is the beauty of open source.

Mike Judge & Silicon Valley, Ya Gotta Love It

Courtesy Bryan Bishop, TheVerge


There’s no surer sign that a subculture has entered the mainstream than when it ends up on a TV show, and over the last few years the startup scene has crossed the threshold. We’ve seen a deplorable Bravo reality show and a comedy from Amazon, but nothing’s reached beyond easy jokes or lowest common denominator appeal. Given the track record, it’s easy to be wary of Mike Judge and HBO’s new show Silicon Valley — but the creator of Office Space and Beavis and Butt-headgets it completely right, resulting in an extremely funny show that will appeal both to broad audiences and the tech world insiders it’s so adept at mocking.

Richard (an awkwardly charming Thomas Middleditch) lives with several friends in a hacker hostel run by dotcom millionaire Erlich (T.J. Miller, in a hilarious breakout performance). Richard’s dream is to build a truly terrible music site named Pied Piper, but a pair of feuding tech billionaires discover that the compression algorithm he’s using is a potential goldmine. A bidding war ensues, and Richard has to decide whether to go for the $10 million acquisition or build his own company with his housemates.

Read More…http://www.theverge.com/2014/4/3/5578804/silicon-valley-review

.NET Native Dev Preview, Fast as C++, Easy as C#


Courtesy Keith Ward, VisualStudioMagazine.com

A difficult choice is often faced at the beginning of a new development project: should the language be native, like C++, for the power and performance it provides, or managed, like C#, for speed of development? Microsoft has a new answer to that question, in the form of Microsoft .NET Native.

Microsoft claims that .NET Native, now in developer preview, can provide both: C++ performance with the managed-code benefits of C#. Subramanian Ramaswamy and Andrew Pardoe, senior program managers on the .NET Native team, blogged today that Windows Store (i.e., Windows 8) apps "start up to 60% faster with .NET Native and have a much smaller memory footprint."

The developer preview is a compiler that allows test and dev of new apps. It works for Windows Store on ARM and x64 architectures (with hints that x86 support is coming). Microsoft says that .NET Native optimizes Windows Store apps for device scenarios "in all stages of compilation." The magic happens in the .NET Native runtime, which uses the Microsoft VC++ back end in the compiler. It refactors and optimizes .NET Native libraries as part of the process.

Even though it’s at the dev preview stage, Microsoft pointed out that some popular Windows Store apps, like Wordament and Fresh Paint, are running on .NET Native right now.

The preview release supports only C# currently, because it’s the most popular language for Windows Store apps, Microsoft said in a FAQ. But it’s open to F#, VB and other languages in the future. In addition, Windows Phone app support for .NET Native is "in progress," according to the FAQ.

Using .NET Native requires Visual Studio 2013 Update 2 RC, released yesterday.

Java 8 is Here

Courtesy Andrew Binstock, Dr. Dobbs.com


One of the biggest updates ever to a major language finally ships, delivering many new and very interesting features.

Today, Oracle rolled out Java 8, which for all Java programmers — regardless of their occupations and interests — is a major event. The release is unarguably the most important version since Java 2 last century and, as I’ll explore shortly, possibly more important than that release, which assured the prominent place the language and platform have enjoyed ever since.

What makes Java 8 so compelling is its embrace of the functional programming metaphor. This embrace has two primary expressions: the use of closures (or as Java calls them, “lambdas”) and the adoption of composition as a central approach to development. Lambdas, while not quite full first-class functions, enable passing code as a parameter to a function, within limited contexts. By limited, I mean only the mechanics of it, not the opportunities to do so. As Brian Goetz of Oracle explains, once the syntax of lambdas had been finalized and its implementation completed, the Java team found numerous opportunities to use lambdas to streamline the standard libraries. They discovered that not only was the code clearer, but the performance better. Implicit is that latent defects were removed, too, as code size was reduced.

The new streams feature in Java 8 enables composability. This language trait, recentlyexplained by Walter Bright, enables software to be implemented using a model that operates like this: data source → algorithm → data sink. This model is highly desirable on today’s platforms where such computational streams can be run in parallel and thereby make full use of multicore processors. It is also an excellent fit in processing Big Data.

Purists will argue that these two changes, even when taken together, don’t make Java a functional language. They’re correct, but that was hardly the goal. The idea, which looks like it’s been achieved elegantly, is to give OO developers functional capabilities in ways that are immediately usable and useful, without imposing a significant learning curve or rewiring of the way they’ve previously written code.

Other new features include the ability to add defined default methods to interfaces and to define static methods in interfaces — both of which will save a lot of code and make interfaces considerably more useful.

The libraries contain many upgrades: improved I/O and NIO, parallel options for arrays and other collections, a completely revamped Date and Time library, and so forth.

Finally, there is the complete replacement of the former Rhino JavaScript engine with Nashorn. Since Java 6, the JVM has enabled scripting engines to be called by Java programs. The default language has been JavaScript, although others (such as Groovy) exist. The engines enable developers to give their users the ability to configure and program their software package, in much the same way Tcl did and Lua does for C programs. The problem was that Rhino was slow. Nashorn is a faster rewrite whose generated code is JITed, meaning that it is now possible for developers to write larger parts of their original Java program in JavaScript, without suffering a performance penalty. And, likewise, their users will see considerably better performance for the extensions they write.

The only major feature that did not make it on board the Java 8 train was Project Jigsaw, which would allow smaller Java binaries to be shipped with an application by introducing profiles. However, this feature has been promised for the next major release.

It is tempting to argue that many of these benefits previously existed in other JVM languages, such as Groovy and Scala. This is largely true. Their adoption by Oracle shows a welcome appreciation of technology not originally developed by the company itself. But to be clear, by adding them to Java, Oracle has improved the features by eliminating the side-effects of those languages, such as Groovy’s lesser performance or Scala’s lengthy compilation cycles.

I’ve already downloaded the Java 8 bits and begun using the new features. The more I do so, the more impressed I am by how much Oracle has included in this release. In terms of fundamental changes, there are few counterparts to upgrades of so large a scope to a language in such wide and active use.

I think this release is so important that quick adoption will deliver important benefits right away. It would not surprise me if we soon look back at pre-Java 8 code as a kind of legacy artifact in the same way we view pre-ANSI C.