Feed on
Posts
Comments

Get the best HLSL Book available for XAML developers

A comprehensive guide to creating HLSL pixel shaders for WPF and Silverlight applications

Really, this will be a must have book for hardcore xaml people. ... this is the best shader content I’ve seen to date. 
   
-- David Kelley

Dude this is great stuff!  A for interesting, A for correctness)!
  
--Jeremiah Morrill

I really like the chapter now, Really good content. :) 
   
--Rene Schulte

Reading the early release of @waltritscher 's HLSL for XAML developers book. Very good so far.
   -- Kris Athi

Learn more about shaders, get the book

HLSL and Pixel Shaders for XAML Developers


Until now, there has been no easy way to interact with MIDI devices in a Windows Store App.  But that changes today.  You can install the Windows Runtime API for MIDI Preview Nuget package in your project and start using MIDI in your app.

History

Unless you are music synthesizer devotee you probably don’t know much about Dave Smith.

image 

He was big force in the early days of digital music, founding the pioneering Sequential Circuits company in 1972.  During his tenure at Sequential Circuits he designed and built the first programmable polyphonic synth. He was also responsible for writing the first digital communication protocol specifically targeted at music instruments.  That protocol, named  MIDI (Musical Instrument Digital Interface) was ratified by the music industry in 1983 and it changed the way musicians, producers and studio engineers worked with their tools.

What is MIDI?

First and foremost it is a serial protocol that defines how to send messages between devices.  If you want to explore the geeky details of the specification check out the midi.org site.  MIDI also defines what types of messages are allowed.  Some common examples are note-on, note-off, note-pitch, pitchbend, volume, controller-info (footswitch, knobs, sliders, pressure, velocity), program-change, time-code and clock.

Instrument Explosion

Nowadays MIDI is built into numerous devices. 

  • Music Keyboards
  • MIDI controllers
  • Rack Mounted synthesizers
  • Drum machines
  • Computer music interfaces
  • Electronic drums
  • Hardwar Sequencers
  • Wind Controllers
  • Digital Audio Workstations

 

This universe of devices is now available from your Windows Store App.  Essentially you can find attached devices and then read inbound data from a controller, or send control information back to the device. As a keyboard player I find this very exciting.  What do you think?

Beta API

At the moment, the Windows Runtime API for MIDI Preview is in Beta and Microsoft is actively seeking your input on what enhancements should be added to the API.

The Microsoft Build 2014 conference is this week. There is an avalanche of information flowing from the Redmondites on the future of Microsoft products and the changes to developer tools. One announcement caught my ear, the changes in the Windows 8 sandbox for Windows Store Apps.

Sandbox

Windows 8 store apps run inside a sandbox, which force the application to use approved WinRT APIs and prevent the application from damaging or infecting the host operating system. This is a good strategy for consumer apps but it limits what you can do with corporate applications. For example you can’t call certain .NET libraries within a store app.

The solution is to avoid making store apps and develop desktop appications instead. Now you have access to the powerful WPF GUI system and the full .NET framework. But you are missing out on some of the innovations available in the Store APIs and are prevented from using the new Windows 8 features. For example the touch system is much easier to work with in the modern libraries.

Improvements

The forced separation of WinRT and .NET ends with the release of Windows 8.1. Now developers creating corporate apps can use any .NET library from within their WinRT apps. This is good news. It means that you have access to all your custom .NET libraries written for your existing projects. Plus you get access to the huge world of third party .NET code written during the last twelve years.

Now you can leverage your custom business layers written for .NET, and build a modern, sleek, touch friendly front end for your existing systems.

The Fine Print

You only get this “interop feature” if you side load the application. You cannot distribute your app through the Windows Store. That, of course, means that you have to have a way to sideload apps onto employees computers. Usually that entails having a Intune subscription for your company or buying packets of 100 sideload keys. This is a contentious topic, the past couple years have seen a lot of complaints about the current sideloading costs and limitations in the developer community. But those stipulations are changing too.

My sources at Microsoft confirm there are changes in the sideloading licensing costs and restrictions but details on the changes have not been announced.

Update:

Microsoft has released some information regarding the changes to sideloading. Rocky Lhotka tells the story on his blog.

Microsoft has now radically changed the cost of step 1. This blog post from Microsoft contains the following statement:

Enterprise Sideloading– In May, we will grant Enterprise Sideloading rights to organizations in certain Volume License programs, regardless of what product they purchase, at no additional cost. Other customers who want to deploy custom line-of-business Windows 8.1 apps can purchase Enterprise Sideloading rights for an unlimited number of devices through Volume Licensing at approximately $100. For additional information on sideloading licensing, review the Windows Volume Licensing Guide.

For those of you still using Internet Explorer.

This is the page I see when I create a new Tab in IE.

image

The other day I accidently click on the Remove this page button in the corner of one of the items on this page.

Unfortunately, it was a link to a  testing page I use all the time.  Now I’ve done this before, about a year ago, so I know that that link will never, ever appear in the list again. 

I knew there was a registry hack that could bring back the item.  I took me awhile to find it, here it is.

image

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing\NewTabPage\Exclude

Note, delete any entries in this section.  There is no readable information in the keys so you are working blind.

Don’t blame me if this fix breaks your computer.  You should know how risky registry hacks are by now.

I’ve been using my HTC 8x Phone for about six months.  I had to get a replacement for the phone last week, due to some issues with the microphone.

After a brief call to customer support Verizon replaced it, sending me another phone via next day air.

This is the saga of my what happened when I started the new phone for the first time.  If you are expecting a angst filled post describing the #FAIL of the winphone ecosystem, then you’ll be disappointed.  The experience was first rate, from start to finish.  The windows phone OS did a great job getting me back to my apps and data in a short period of time.  The apps themselves?  Well, let’s just say that they could learn something from the way the phone handled the update.

Setting up the new phone

After unboxing the phone, I extracted my SIM card from the old phone and transferred it to the new device.  A few minutes later I turned on the phone and waited for the initial welcome prompt.

I’ve been through this process many times, with my developer phones.  This was my first time doing it with my personal phone with existing accounts and apps installed.

I entered my Microsoft account ID at the prompt, then entered my password.

A few minutes later the phone was done with setup and I was ready see what else needed to be done.

Setting up Email accounts

I use three email addresses on the phone. The OS discovered my other email accounts that I was using on the old phone and added them to the new phone.  I was prompted to reenter my password for the other email accounts when I launched the mail program, but it only took a few minutes before I was reading my inbox.

So within 10 minutes of starting the phone I was back in business with my email and people hub back to normal.

Wireless

The next step was to connect to the local wireless.  I enabled the wireless connection and added my network. 

Apps

Once that was done,  I decided to check out the app situation.  Good news!  While I was configuring the passwords for the two additional email accounts the phone had been quietly downloading all my apps from the store.  By the time I looked at the app menu all the apps were installed and ready to go.  NICE!

I noticed there were some updates pending in the Store so I open the Store app to see what was happening.  There were four apps in the marketplace that couldn’t be updated.  Hmm. I spent some time investigating why the apps weren’t installed or updateable.  After all, the rest of the process had gone so smoothly.

The reason the apps were not installed is because they were no longer available in the marketplace.  For whatever reason, the apps had been discontinued, so there was no way the phone could install them.

I’m not sure how long the apps have been unavailable on the old phone.  My understanding of the system is that in most circumstances once you download an app to your phone, its is available on that device, even it it later pulled from the store. 

Logging into Applications

At this point the phone was  nearly identical to the old device I’d turned off thirty minutes beforehand.   I decided to check out some of my favorite apps.  Here is where the upgrade story gets discouraging.

Very few apps on the phone use the Microsoft account ID, Facebook or Twitter accounts for login.  This became apparent when I opened Rowi the first time.  I had to enter my Twitter credentials before I could read my tweet stream.  This happened over and over again as I opened each networked app.  Thankfully, I use LastPass, so it was easy to lookup each apps login information.

Game progress and application settings

What about my games?  The XBOX titles were the best.  Obviously, all my XBOX achievements were intact.  Games like Wordament were no problem.  Since it’s a live puzzle game, I just started with the next available puzzle.  Some of the other games remembered my progress and started me at the last conquered level.  But sadly most of the game didn’t.  For example. Angry Birds started the game from the very beginning. 

Application were similar.  Some were great about remembering me and my data, others were less helpful.  Since OneNote uses Skydrive it had all my notes ready for me to view.  CardStar one the other hand, remembered nothing. I use CardStar to keep my loyalty card information on the phone.  Apparently they’ve never heard of the cloud, because I had to reenter all my information.

Conclusion

The phone is masterful in the way it handles my account information.  The startup process was simple and the phone reconfigured itself seamlessly to match my old device.

Once I got to the third party apps it was a less joyous story.  While all my apps were installed, I spent an hour or more opening the apps and logging into their individual servers.

As we move our lives and data into the cloud it is imperative for app developers to integrate their apps and our data into a seamless experience.  I believe this will happen in most apps eventually, but we are not there yet.


Building Windows Store Apps Essential Training
A comprehensive and through treatment of Windows 8 Store Apps
Video training on Lynda.com

I have a touch screen laptop I use for Windows Store App development.  It’s hooked up to a two big monitors.  There is a set of keystrokes I use when debugging to get the App and Visual Studio on the monitors I want.

Moving Visual Studio to a Different Monitor

Move the focus to Visual Studio, then use WindowKey-LeftArrow or WindowKey-RightArrow to move Visual Studio to the monitor you want. Press WindowKey-UpArrow to maximize.

Moving the App to a Different Monitor

Move the focus to the Windows Store App, then press WindowKey-PageUp or WindowKey-PageDown to move it to the monitor you want.

 

Simple tip.

Learning a new API is fun and full of false steps.  How many times have you found a solution for a problem that seems overly complex.  Perhaps you write a wrapper class to simplify the API calls.  Then one day, looking through the documentation (or reading another developers code) you find there is a simpler way to accomplish the task.  It’s been there the whole time, tucked into an unexplored corner of the API.

 

A few weeks ago I saw some code in a open source library for reading the contents of text file.  The code was using a URI to access a file in the app temporary folder.

            var localFolder = Windows.Storage.ApplicationData.Current.TemporaryFolder;
            var folder = await localFolder.GetFolderAsync("game");
            var file = await folder.GetFileAsync("player.txt");
            var fs = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
            var inputStream = fs.GetInputStreamAt(0);
            DataReader reader = new Windows.Storage.Streams.DataReader(inputStream);
            await reader.LoadAsync((uint)fs.Size);
            string data = reader.ReadString((uint)fs.Size);
            reader.DetachStream();

I knew there was as simpler way.  The PathIO class has the ReadTextAsync method which reduces this to a single code line.

 

  string contents = 
     await Windows.Storage.PathIO.ReadTextAsync("ms-appdata:///temp/game/player.txt");

Other methods you may find useful in PathIO:

AppendLinesAsync

AppendTextAsync

ReadLinesAsync

WriteBytesAsync

WriteLinesAsync

WriteTextAsync

 

Windows 8 Secrets by Paul Thurrott

Many developers were surprised to learn that Visual Studio 2012 dropped Macro support. Microsoft says they dropped the feature because it was only used by a tiny fraction of VS programmers.  Guess what. I’m one of those developers and  I’m still mourning the loss, as I had a library of custom macros created during the last ten years.

My favorite macro was my CleanCurrentDoc macro which, as the name implies, performed some common code cleanup tasks.  One feature of the macro was the ability to remove two adjacent blank lines.  I’m not against having blank lines my code. I like to leave single blank lines in my editor, to delineate blocks of code, but I never want to see two or more adjacent blank rows.

In other words, I want to take this code:

  Line 1
  <empty>
  Line 2
  <empty>
  <empty>
  <empty>
  Line 3

 

And format it into this:

  Line 1
  <empty>
  Line 2
  <empty>
  Line 3

Use QuickReplace to solve the problem

Someday I’ll create a Visual Studio Extension to solve the problem, but the immediate solution is to use the Quick Replace tool. Visual Studio can use Regular Expressions in the Search operations.  That’s the key to making the replacement work.  If you are a veteran of earlier versions of Visual Studio  (prior to VS 2012) be warned that the Regex syntax has changed.

Apparently the older version of Visual Studio used a application specific Regex syntax. Here is the necessary Regex.

^(?([^\r\n])\s)*\r?$\r?\n^(?([^\r\n])\s)*\r?$\r?\n

Beautiful, isn’t it?  Disappointed smile

image

 

Regular Expression Books

Visual Studio Training

The NTFS file system is something most Windows users take for granted.  First implemented for Windows NT 3.1 back in 1993 NTFS is much appreciated for its journaled approach to file integrity. Short story, NTFS ensures that file copying and other task are transactional and safe.

Microsoft has updated NTFS over the years to handle new scenarios (like external USB drives) which helps to keep it robust and relevant. 

If NTFS is a robust journaling file system, why do you have to be careful when using it with a USB thumb drive? 
post from Raymond Chen

We Need Another File System?

File System research continues at Microsoft.  They have teams researching and developing new systems all the time; remember WinFS? Not many of these ideas make it into the Windows OS but that doesn’t stop the ongoing research.

The Resilient File System

I was interested to see the Resilient File System (ReFS) in early builds of Windows 2012.  ReFS is an alternate to NTFS, you can format a drive with one or the other.  At this time you can only use ReFS on Windows Server 2012 computers. 

It is similar to NTFS but it is a different system, with a different use case. It is optimized for network file servers.

Built-in resilience

All file writes are created in a new location, they never overwrite the existing file location. Files are repaired on the fly.  Every time a file is accessed a checksum is generated and compared against the checksum stored when the file was last written. The historic checksums are stored in a separate location for safety. If the checksums are different then the file is considered corrupt and might be automatically restored.

 

When configured to do so, checksums are used against written data and updates are done using copy-on-write. You may enable Integrity Streams on particular folders, volumes, or even granularly on a per-file basis. When coupled with redundancy through Storage Spaces, it is default behavior for Integrity Streams to be enabled for the entire volume.

Storage Spaces and ReFS complement each other. When coupled with a mirrored Storage Space, duplicate copies of data will automatically be leveraged by ReFS. With this configuration, if corruption were to be encountered, ReFS can immediately leverage redundant data within Storage Spaces to expediently address the issue. One other example of how Storage Spaces compliments ReFS would be how ReFS periodically scrubs file system data to look for differences in an event to combat bit flips that can occur over time due to data stored over a long period of time in the same location. [1]

Huge storage available

Since ReFS is optimized for file servers it can handle HUGE amounts of data.  I learned from Martin[1] that it can store over 10^24 bytes or one quadrillion GB.  Now that’s a lot of data!

[1] Martin Lucas has a detailed post about ReFS

 

Windows 2012 Server books

Windows Store XAML elements are similar to the Silverlight XAML elements in many areas.  For example, you can use the RichTextBlock and RichTextBlockOverflow to flow text from one element to another.

Don’t set the TextWrapping property in the originating RichTextBlock to “NoWrap” otherwise the text will never overflow to the RichTextBlockOverflow element.

Connecting to to a wireless network in Windows 8 is easy, it’s about the same as connecting a network in Windows 7 (though some of the screens have the modern Win8 UI). 

Many of the new smart phones released in the last few years support connection sharing. Sharing your cellular data connection with another device is often called tethering . On Windows 8 phones, it is officially called Internet Sharing and it provides a simple way to turn your phone into a mobile hotspot.

I currently have a new HTC 8x (Windows 8 phone).  It is an AT&T phone that has an data plan, including tethering.   My day-to-day phone is on Verizon (where I don’t have tethering yet).  I was anxious to try tethering, as my current phone has never had that capability.

The Movie

I recorded a short video that demonstrates how I connected the Microsoft Surface tablet to my Windows 8 phone.  Details about how to make the connection are later in this post.

If you cannot see the video in the post:
  either refresh the page or go to http://vimeo.com/52988939

Yes, I keep saying click, instead of touch and PC instead of tablet in the video.  Old habits die slowly.

 

Setting up the Phone

Start by opening the Settings application on the phone.  On the System tab, touch the internet sharing item.

wp_ss_20121031_0003

Figure 1 – Settings

 

On my phone, the sharing is turned off.  This is the default setting.  Also, if the phone detects that no devices are connected, it turns off the sharing after a short interval.  This is nice, as is preserves your battery life, and prevents your phone from inadvertently inviting connection stealing.

 

wp_ss_20121106_0001

Figure 2- Internet sharing, off

 

Touch the Sharing slider to turn on sharing.  As you can see in the Figure 3, the phone shows the access point name (HTC PM23…) and the connection password.  In order to use the shared connection you need to provide the password when making the connection.  On the bottom of the screen you can see the number of current connections.  Since I hadn’t connected when I took the screenshot there are no current connections. As you can see, my phone allows up to 8 simultaneous connections.

wp_ss_20121106_0002

Figure 3 – The connection name and password.

 

You can rename the connection and change the password, just touch the setup button and enter the new values in the setup view.

wp_ss_20121106_0003

Figure 4- Change the name and password.

 

Connecting the Surface tablet

The phone is configured and ready to receive connections.  Here are the steps to connect the Surface to the phone.

Start by swiping in from the right side of the Surface screen to open the charm bar, then choose Settings.  On the setting pane, the network connection shows that there are available connections (see Figure 5). Touch the network icon to continue.

 

Connect0

Figure 5 – Touch the Network icon

 

In the Networks screen, touch the access point name (HTC PM23…)

Connect3

Figure 6 – The HTC access point

 

Touch the Connect button to connect to the phone. YOu can also choose to automatically connect to this shared connection  in the future by checking the Connect Automatically checkbox. 

Connect4

Figure 7 – Connection settings

 

Next, Windows shows the status of the pending connection.

Connect5

Figure 8 – status report on pending connection

 

Now it’s time to enter the connection password.  BTW, I love the new “eye” icon in Windows 8 that lets me check the hidden password. 

Connect7

Figure 9 – Enter the connection password

 

Finally, you have to specify the sharing options for this connection.

Connect8

Figure 10- Choose your sharing options

 

That’s all there is to it. Now the Surface is connected to the phone.

Connect9

Figure 11 – Successful connection

 

Real world testing

The initial setup on my phone and Surface took about 10 minutes, mostly because I hadn’t done any prior tethering with these devices and I wasn’t sure about the proper steps.  Now that it’s configured, it usually takes less than a minute to complete the connection.  I haven’t tried in on a long trip yet, time will tell.  I did use tethering on a twenty minute drive to town this week and it worked flawlessly.

Older Posts »