comiXology Promo: Download all of the comics

April 12th, 2013 2 comments

While sitting in a particularly long meeting today I happened to receive an email from comiXology inviting me to claim my “over 700 free comics”. While this is an extremely cool promotion it is somewhat limited in that to get all of the comics (I read a lot and I also don’t have time to sift through all of the comics to find the ones that I want) you have to click “Buy” on each one.

So, what does a developer stuck in a meeting do when struck with such a problem? 30 minutes later we have the solution to both problems – https://github.com/nachmore/grab-comixology

Grab the download, run the app, stick in your promo url and your password and watch the browser (IE) come to life in front of you and add all 723 comics to your cart. All you have to do then is check out! You can find the complete FAQ here.

Have fun reading!

Oren Categories: Uncategorized Tags:

HOWTO: Run Bastion on Windows 8

July 29th, 2012 5 comments

After playing the Bastion demo in Chrome’s Native Client I recently picked up a full copy care of  Humble Bundle, only to have it crash immediately on startup on Windows 8.

Turns out the culprit is a missing XNA redistributable - you can install it directly from Bastion’s install directory (C:\Program Files (x86)\Bastion\xnafx31_redist.msi).

Happy Hunting!

Oren Categories: Windows 8 Tags:

Last Minute Perf Video for Mango

July 10th, 2012 1 comment

I had the opportunity to join Microsoft Research and this year’s Interns at a recent XAPfest event (a regular internal Windows Phone development event) and give a performance talk for Mango / Tango (i.e. WP 7.x) – here’s hoping it’s the last one before we move on to Windows Phone 8!

To check it (and my bad hair day) skip to 1:23:30 at http://research.microsoft.com/apps/video/default.aspx?id=168593&l=i or listen from the start if you’re new to Windows Phone development in general for a great overview from Shawn Henry.

Oren Categories: Uncategorized Tags:

WP Emulator Crashing on Windows 8? Here’s a Fix

June 25th, 2012 237 comments

Don’t you just hate it when you upgrade to a new OS (even when it’s a beta) and everything works amazingly well, except for that one critical bit of infrastructure that just fails? That’s kind of how you might be feeling if you boot up your brand spanking new Windows 8 install, install VS 2010 and the WP 7.1 SDK, followed by the 7.1.1. update to get the emulator and Tango support, boot up your project – hit F5… drum roll… emulator crashes. Sigh.

Luckily, there’s an easy fix!

Rename all of the *.dess files under %systemdrive%\programdata\Microsoft\XDE and restart the emulator, and all should be good.

What’s going on?

For some reason the saved state of the emulator is getting corrupted, by renaming these files (which could probably be safely deleted) you’re forcing the emulator to recreate them (shutdown may be a little slower the first time you close the emulator).

Oren Categories: Uncategorized Tags:

HOWTO: Download Boot Camp 4.0

January 24th, 2012 8 comments

I recently (this afternoon) found myself having to install Windows 7 on a large number of mac mini’s, without an OS X installation CD. Downloading the software through Boot Camp assistant didn’t seem to work eitherso I went ahead and installed Windows anyway while hunting for a way to get at the drivers without a CD.

Turns out this isn’t the easiest thing in the world. The only downloads on Apple’s site are updates, and not Boot Camp itself. Some further digging turned up this post which points towards an Apple update catalog. Once you have that, getting the Windows software is easy:

  1. Grab a copy of 7-zip
  2. Search through the catalog for product 041-0694
  3. Download the pkg file (it’s around 600mb)
  4. Extract the pkg file with 7-zip
  5. Here’s the fun part – keep extracting the largest files as you go (Payload,  WindowsSupport.dmg etc) until you hit 0.APPLE_ISO
  6. Rename 0.APPLE_ISO to 0.iso and extract that with 7-zip and run setup.exe
    1. Alternatively you can simply burn the iso file onto a CD

Good Luck!

Oren Categories: Apple Tags:

Got Phantom Menus? RefreshScreen is here to help

November 8th, 2011 2 comments

The fact that my (full updated)  video card will occasionally blue screen my screen after playing Flash videos aside, my next biggest video card related gripe is floating phantom menus:

Floating Phantom Menus

You know the ones – those ones that stick around, in front of everything, after you click on a random menu item. They only seem to go away when you restart your system or force a screen resolution change. Since that involves multiple clicks and a dialog I’ve written a tiny, one line, screen refresher. Run it to exorcise those menus!

Note: Unfortunately this doesn’t solve the actual problem that causes this, so you’ll probably get more phantoms afterwards.

Grab the EXE

Grab the Project (VS2010, C++)

P.S. For reference, all the code does is call ChangeDisplaySettings with (NULL, 0) in order to refresh the screen settings from the registry.

Oren Categories: Tips & Tricks Tags:

Windows Phone Power Tools 1.1

September 20th, 2011 3 comments

Grab them here

I received a fair amount of feedback about the first version of the Power Tools mainly focused around the UI (people like modern today) and around “bug #1“, which prevented files from uploading to the correct path in IsolatedStorage.

I’ve just pushed a major UI rehaul to something somewhat more Metro-ish, loosely styled off Zune. It uses a combination of custom styles that you can find in the source tree and MahApps.Metro. I’ve also fixed the upload bug and other miscellaneous bits of polish here and there. This probably should have been a 2.0 or a 1.5 but it seemed to soon :)

As always, feedback is welcome, though a reminder that this is not a Microsoft official tool.

Oren Categories: Dev Tips, Windows Phone Tags:

Windows Phone Power Tools

September 13th, 2011 1 comment

Necessity may be the mother of invention, but it’s also often the mother of Open Source tools which are not really reinventing the wheel, but perhaps make our lives just that little bit easier (or more functional). A common pain point, especially as more and more developers move their apps to Mango is testing update scenarios and exploring the IsolatedStorage of a developer app, both extremely handy debugging tools to have that either don’t exist (updating developer apps is not really possible) or are very basic (the IsolatedStorage Explorer tool that ships with the SDK).

To this end, I’ve published a little Open Source app that I’m dubbing the “Windows Phone Power Tools” that allow you to do just that – update developer xaps, visually explore the IsolatedStorage structure of your apps and a bunch of other small, but handy, features.

You can check it out on codeplex: http://wptools.codeplex.com

Oren Categories: Dev Tips, Windows Phone Tags:

Windows Phone App Lookup Tool

July 12th, 2011 3 comments

Ever ended up with an application’s GUID but not with the app’s name?

Probably not, but just in case you do ever need to reverse lookup a Windows Phone’s app name from its GUID, you can grab App Lookup. It’s also Open Source (i.e. not official Microsoft), so feel free to grab it, fork it and send through pull requests!

How’s that for a short one? :)

Oren Categories: Windows Phone Tags:

Getting Started with Node.js and Mango (Sockets)

July 6th, 2011 9 comments

It’s been a while since I’ve found time to blog – but it’s not like I’ve left you in cold hands. Rohan has been doing a great job posting on the Silverlight for Windows Phone Performance blog (check it out if you haven’t yet).

On a completely non-performance related topic (we’ll get to those in the next couple of blog posts), I’ve been meaning to play around with Node.js for a while, and when a colleague posed a question about using it with Mango, I thought it might be a great excuse to polish off the Beta 2 tools (get them while they’re hot!) and do some Socketing!

First things first – grab 7zip (if you don’t have it already), and Node.js binaries for Windows (or build it yourself). Extract these to a convenient location and you should be good to go.

We’re going to use the Hello World sample ripped straight from the Node.js homepage, with one extra debugging addition (highlighted in yellow) and a practical change (highlighted in green – see “gotcha!” below):

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
 console.log('Sent message'); }).listen(1337, "192.168.2.125");
console.log('Server running at http://192.168.2.125:1337/');


Gotcha Warning!

A common mistake at this point is to stick with the sample’s use of 127.0.0.1 (locahost). This will work great from your browser, but not from the emulator or your device (regardless of whether it is connected to WiFi or tethered via Zune). This is because the emulator and the device join the network as *new* devices which means they get a newly assigned IP address and they act just as though they were a machine on the network. This leads to 127.0.0.1 pointing back to themselves, which is not allowed, leaving you with a “NetworkDown” network error. Instead, make sure to set your IP to your local LAN address (usually starts with 192.168.X.X or 10.X.X.X). You can find your exact IP address from cmd by typing “ipconfig” and looking for the address that corresponds to your local network.

Testing the Server

Now, save your modified script somewhere somewhere convenient (I saved it to c:\nodejs\bin\servers\helloworld.js) and then launch the server with a simple:

C:\nodejs\bin>node servers/helloworld.js
Server running at http://192.168.2.125:1337/

Note the use of UNIX style paths… If you see any errors at this point it’s most likely path related. Fix your path so it is relative to your binary and you should be good to go. Need to verify that everything is working? Fire up your browser and enter http://localhost:1337 and you should see “Hello World!”.

Note: When launching the server you may get the Windows warning dialog about a program accessing the network, feel free to set the settings to whatever you are comfortable with, just note that Node.js will need at least local network access so that you can talk to it from the emulator / a device over WiFi.

Let’s get me some Windows Phone!

We’re up and running, so time to get our hands dirty with some C# code. Open Visual Studio and start a new C# Windows Phone application targetting “Windows Phone 7l.1″ (which is the code target name for Mango). The project that we create is going to do something extremely simple – it’s going to open the socket, send a request for data (it’s really a dummy request since this server isn’t really waiting for a real request) and then displays the response, verbatim, on the screen.

Once you have the project created add a button (btnStart), which will kick the whole process off, and a textblock (txtServerResponse) to contain the server response. We’re not going to use binding to simplify the sample, but you can certainly do that instead. Add a Click handler to the button by double clicking on it and add the following code to MainPage.xaml.cs. The code is heavily documented so should answer any further questions you might have. I’ve also stuck a zipped version of the project (including the mini-server) which you can use to experiment with.

private Socket _socket;

private void btnStart_Click(object sender, RoutedEventArgs e)
{
    // the message to send to the server
    byte[] message = UTF8Encoding.UTF8.GetBytes("GET / HTTP/1.1\nHost: localhost\n\n");

    // the address we'll be connecting to
    IPAddress address  = new IPAddress(new byte[] {192, 168, 2, 125});

    // an endpoint translates into the complete destination - address + port
    // you can also use a DnsEndpoint to look up an IP address from a hostname
    IPEndPoint endpoint = new IPEndPoint(address, 1337);

    // all socket operations are asynchronous on the phone so you must set up 
    // a SocketAsyncEventArgs object to let the socket know how to act
    SocketAsyncEventArgs args = new SocketAsyncEventArgs() { RemoteEndPoint = endpoint };

    // don't allow multiple clicks before the request finishes
    btnStart.IsEnabled = false;

    // create our socket, note that it isn't connected yet
    _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

    // set up the call back to be called when we finish connecting to the socket
    args.Completed += new EventHandler<SocketAsyncEventArgs>(OnSocketConnected);

    // neat trick - setting the buffer of a socket before it connects will cause the socket to send
    // that data as soon as it connects
    args.SetBuffer(message, 0, message.Length);

    // boom! we're off
    _socket.ConnectAsync(args);
}

void OnSocketConnected(object sender, SocketAsyncEventArgs e)
{
    if (e.SocketError != SocketError.Success)
    {
        // don't forget that we're now on a background thread so anything that interacts with
        // the UI thread (MessageBoxes, updating UI etc) has to be dispatched back
        Dispatcher.BeginInvoke(() =>
        {
            MessageBox.Show("(Connect) Socket error! " + e.SocketError.ToString());
        });
        return;
    }

    // we're done with the connect + send, time to receive

    // create a buffer for the respone
    byte[] buffer = new byte[1024];

    // create the Socket event args for this receive
    SocketAsyncEventArgs args = new SocketAsyncEventArgs();

    // set a buffer for the receive - the size will be the maximum amount read
    args.SetBuffer(buffer, 0, 1024);

    // we have to come back somewhere after the receive completed
    args.Completed += new EventHandler<SocketAsyncEventArgs>(OnSocketReceive);

    // kick off the actual receive
    _socket.ReceiveAsync(args);
}

void OnSocketReceive(object sender, SocketAsyncEventArgs e)
{
    if (e.SocketError != SocketError.Success)
    {
        Dispatcher.BeginInvoke(() =>
        {
            MessageBox.Show("(Receive) Socket error! " + e.SocketError.ToString());
        });

        return;
    }

    // the response comes back as a byte array, so convert it to a string
    // Note: usually you would read from the buffer and then call _socket.ReceiveAsync(e)
    // again until e.BytesTransferred == 0 (signals end of the receive), for this example
    // we're going to keep it simple
    string response = UTF8Encoding.UTF8.GetString(e.Buffer, 0, e.BytesTransferred - 1);

    // we have our response now update the UI thread
    Dispatcher.BeginInvoke(() =>
    {
        txtServerResponse.Text = response;
        btnStart.IsEnabled     = true;
    });
}

What does it look like?


Questions?

Feel free to leave comments below – Good Luck!

Download the solution + js file

Oren Categories: Dev Tips, Silverlight, Windows Phone Tags: