UEFI Windows 8 Install on Asus N56VJ

First thing I always do on a new computer is fresh installation of Windows from USB. With Asus N56VJ I had an issue. Everything worked when I used BIOS compatibility mode, but UEFI boot failed.

In order to create USB installation media I used Microsoft’s Windows 7 USB/DVD download tool. Use of that tool results in NTFS on USB. UEFI usually requires FAT32 installation media. Therefore I had to create bootable medium myself as I used to do..

Procedure is actually simple. Just write DISKPART on start screen and you will be greeted with security prompt after which you will have old-fashioned textual interface. In my case USB was disk 3 (you can deduce it based on size) but your case will probably differ. Double check which disk you are selecting because DISKPART does destroy data:

DISKPART> LIST DISK
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          476 GB      0 B        *
  Disk 1    Online          931 GB      0 B
  Disk 2    Online         7168 MB      0 B
  Disk 3    Online         7648 MB      0 B

DISKPART> SELECT DISK 3
Disk 3 is now the selected disk.

DISKPART> CLEAN
DiskPart succeeded in cleaning the disk.

DISKPART> CREATE PARTITION PRIMARY
DiskPart succeeded in creating the specified partition.

DISKPART> FORMAT FS=FAT32 QUICK
  100 percent completed

DiskPart successfully formatted the volume.

DISKPART> ACTIVE
DiskPart marked the current partition as active.

DISKPART> EXIT

Assuming that your, newly created and empty, USB drive is under letter U: and your Windows installation disk is at W:, you can use XCOPY to transfer files. Press + to get a prompt where you can enter following command:

[PID]
Value=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

After copy finishes, we have a Windows installation USB on our hands. Since Asus stores its Windows key in a BIOS you will have an issue if you want to apply your own Windows key - setup just never asks for it. One solution is to create PID.txt under U:\sources. It should have following content (with XXXXX-XXXXX-XXXXX-XXXXX-XXXXX being your key):

[plain] [PID] Value=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX [/plain]

Next step is to boot machine while pressing <F2> to enter BIOS. Since boot is extremely fast, I always need a few attempts to get inside. :)

In BIOS we just select USB disk under Boot Override on Save & Exit tab. Once setup starts, proceed as normal. Windows will create GPT disk and all needed partitions itself.

[2014-09-20: Same procedure works for Windows 8.1 too]

Death and Its Consequences

My love/hate relationship with HP 6730b ended in ultimate death for one of us last Thursday. I cannot say it came as a surprise because it started acting up after (accidental) fall off a desk in a lab.

From that time on it would sometimes power off if tilted or shaken. Since I used it mostly as my work desktop, I just took care not to tilt it and I was golden. My goal was to prolong its life until I get back home. I almost succeeded.

Since Friday was a working day, I had to find suitable solution before morning was up. To make things worse, installation I needed was in bootable Windows 7 vhd on top of a Windows 8 system.

I took my other laptop and swapped hard disk nervously awaiting Windows 8 boot loader to give me some nonsense about incompatible drivers. Windows 7 booted up, detected new chipset and graphics card, and rebooted. Next boot brought me to perfectly working desktop.

Yes, Office did complain about license. Yes, passwords for wireless networks were forgotten. Yes, not all drivers were in order. But, you know what? I survived my work day just fine.

Last time I did this procedure it was on Windows XP and it was a pain-in-the-ass to sort everything out. It is nice to see that Windows boot and driver handling has improved tremendously during years.

QText 3.50

It is time for new QText again.

Nothing much happened, just some maintenance. I added support for few more keyboard shortcuts (zoom and plain-text clipboard) and some minor bug-fixing was done.

As always, you can download new version directly from www.medo64.com or use built-in upgrade menu.

PS: If you are curious what exactly was changed and/or you want to use new features as I create them, you can check source code repository at BitBucket. There I will put latest pre-release binaries.

Inline Sorting

Sort is something that is almost mandatory when dealing with user-facing data. Everybody is so used to have items sorted that unsorted list really sticks out.

Assuming that we have list named myList, sorting is really easy to implement. Just call myList.Sort(). This method will search for IComparable interface (somewhat simplified view) and use it to compare elements. But what if we want order other than one defined in IComparable? And what can be done if there is no way to implement such interface (e.g. no source code for class)?

You can count on our friend delegate and Sort overload. Assuming that we want to do sort according to property DisplayName, code is:

drivers.Sort(
    delegate(MyClass item1, MyClass item2) {
        return string.Compare(item1.DisplayName, item2.DisplayName);
    });

Yes, I know that code is old fashioned and that Linq is sooooo much better. However, this code will work on .NET Framework 2.0. And it doesn’t look that bad. :)

Movie Maker and Mp4 Audio Sync

It all started when I used Microsoft’s LifeCam under Windows 8 to record a bit of video. At the end of this quite easy process I was greeted with MP4 file. All that I had to do is to import it in Movie Maker to do some processing. How hard can that be?

Well, quite hard actually. As I imported video in Movie Maker, I noticed that sound was not in sync with video. At first I was thinking that input video had an error but every video player worked correctly. For some reason only video editing software had an issue. What followed was few hours of swimming through Internet and learning everything possible about variable frame rate and how it can make your life a misery. Here is how I got this mess sorted out.

First tool I used was a GraphStudioNext. Once I opened my video this tool showed me processing graph my video goes through. I just went in and deleted last step in audio processing (Default WaveOut Device). That left AC3Filter with unconnected out pin. I used File -> Save As Graph to get MyVideo.grf.

Next in line was AviSynth. Once it got installed, I created file MyVideo.avs with following content:

video=DirectShowSource(&quot;C:\MyVideo.mp4&quot;, audio=false, fps=29.97, convertfps=true)
audio=DirectShowSource(&quot;C:\MyVideo.grf&quot;, video=false)
audio=AssumeSampleRate(audio, 44100)
audio=TimeStretch(audio, pitch=108.8435)
AudioDub(video,audio) 
EnsureVBRMP3Sync()

This deserves a bit of explaining. First line loads video with constant frame rate of 29.97 which coincides with my camera’s output. After that it loads audio (sampled at 48 kHz). And no, I could not use DirectShowSource to open both audio and video together because audio would sped up for some reason. To get everything back in sync, next line assumes that audio is 44.1 kHz. Notice that this is not true and it will make voice sound very deep. However, it will fix sync. TimeStretch will bring back pitch of our voice while preserving sample rate (value 108.84 is simply 48000/44100*100).

File MyVideo.avs can now be loaded in any video player. Only program that refuses to load this file is Movie Maker. It was time to cheat a bit. I used VirtualDub to open MyVideo.avs and and then I just exported audio (File -> Save WAV).

Last step was to load original video in Movie Maker and mute video volume. Then I used Add music to insert MyVideo.wav as a track. And with that Movie Maker had everything it needed to export final video.