Ready Player One

redy player oneI just finished Ready Player One, wanting to reach the end of the story and dreading at the same time finishing it. The plot of story, the games played inside games inside games, the old computers of the 70's and early '80s, the fascination for the music and movies makes this book an instant recommendation. In fact, I listened to the audiobook, and with the great job of the narrator I would even recommended better the audio version.

Ubuntu 1 / Windows 0

ubuntu vs windowsAfter my brief fighting with Windows 8 on a friend's laptop, I though I would stayed clear from Windows for a little while.

No luck; my friend updated the system to Windows 8.1, and on the process something failed. He would then be welcome with an error message, and the system would enter recovery mode. Fortunately, I had created the USB recovery drive, so it was just a matter of recovering the system... Nope. The USB stick would not be recognised. I had created the recovery partitions, as expected, provided the system with a proper USB to create the recovery drive, and no errors had been raised. But, when needed, there was no way to recover the system with that drive. I changed the UEFI options to recognise the USB stick as a valid boot option, it started the recovery process, and then informed me that something was missing on the system. What? Well, probably, some of the recovery partitions: these were available, but, in truth, I do not know what my friend had done on his 8.1 upgrade.

So, doing some general user action (system upgrade), the recovery partition is (probably) lost, and the recovery drive cannot recover the system, and cannot either reinitialise the system to its pristine status.

Fine, then, what can be done? Of course, you can always reinstall Windows, right? Of course not. You can create a recovery drive, which seems unable to reinitialise the system. If there is no recovery partitions available, no matter how big is your USB stick, Windows just doesn't install all the information needed to restart the system. I cannot stop comparing this complexity with the utter simplicity of managing the installation of a OsX or Linux system and stare in total awe.

But wondering on these complications would not help my friend recover his system. On the short time he used Windows 8 he was all but happy, and having to wait now to get (and pay!) for the installation media from Asus didn't really excite him. I proposed him trying Ubuntu and he accepted. Installation took me minutes, and the system booted in perfect state. He has been using Ubuntu since then, and, for the time being, he seems content with the system. It is a very recent Asus -N7500JV-, with SSD, and the whole hardware is properly recognised. I know that there will be issues, like trying to run a Windows program that he forgot to mention, and that cannot run well in a virtual machine or using Wine, but for the time, the great recovery mechanisms of Windows have won a new Ubuntu fan. Go figure.

Rails 4

ruby on rails iconI was updating a website done in Rails 3 to Rails 4, following the usual guides to have a smooth migration, which helped definitely smoothing the update. A nasty problem I found was related to the way that model associations are now handled; in Rails 3, they return an Array, while in Rails 4 its is returned a CollectionProxy; nothing to object if the new class exposes the same interface (methods), but that is not the case.

So all the calls to the suddenly deprecated methods are naturally broken. Of course, there are always good reasons to such deprecation... isn't? This discussion sheds some light on the reasoning behind: Because it causes confusion where you think you are changing the relation/association and you actually do not. The database is still the same. So calling delete_if does not change the database, and the name is therefore confussing, so let's get ride of the method? Somebody replies here that the reasoning is ridiculous, people should know enough to save the underlying model after calling delete_if, but the answer only addresses the mention to ridiculous.... typical.

So if you have some code in Rails 3 doing something as:

model.has_many_assoc.delete_if{|c| ...}

You need to convert it to:

model.has_many_assoc.select{|c| ...}.each{|c| c.delete}

But only in some cases, as it depends in fact on the operation and association in place. Well, thanks for that, very helpful, guys!

Windows X

windows iconI had recently to help a friend moving a Windows 8 installation from HDD to SSD. He had bough the laptop, requested the SSD, and the morons just placed the SSD inside the laptop, but performed no installation whatsoever: the SSD was not even formatted and my friend would not see it from inside Windows.

I saw that there was the typical recovery partition, that little trick performed on the users to not provide additional media in case the initial Windows installation crashes. I committed the mistake to think that I would be able to reinstall Windows by creating a recovery USB disk, but after many tests I was only able to reach a point where I could do a clean installation, but where? Never mentioned. Perhaps to the SSD (unlikely), most likely to the HDD, again. Funny thing: if I physically disconnected the HDD, I was unable to reach any recovery point, saying that there was no recovery partition (which I had very specifically backed up to the USB stick, exactly as explained on the process to create the recovery media). I wonder what happens if the HDD really crashes.

Which would be the cost by Asus (in this case, but Dell, Samsung or Acer do exactly the same) to include a USB stick that could just reinstall the OS? Easy way, if you insert the USB stick and boot to it (not an easy task nowadays, anyway) and say yes to 3 or 100 confirmation messages. Windows is then installed from scratch with all the drivers required for that laptop -pristine installation, just what you get when you buy it new. But no, with the recovery partition trick, they use the hard disk purchased by the user, and worse, his/her time to perform that creation of recovery media. Even worse, why Microsoft makes the process so complicated? I cannot obviously compare a Windows installation to a Linux one, but I can definitely do the comparison with Os X; when I bought a new Macbook Pro, transferring the OS from HDD to SSD was a simple process, directly accomplished with the tools already provided in Os X.

At least I had the opportunity to see finally Windows 8 in action. The laptop was a very nice, sturdy, Asus N750JV, I was dutily impressed with both; Windows has come a really long way, and the interface has improved a lot. Moving between the tiles and the standard Windows interface was not so nice, but workable. Going through the process of updating the OS, not nice at all, and overall, I had the impression of incompleteness. I guess I will wait myself for Windows 9, or better, for Windows 10, which will probably be called Windows X, just to catch up.

Moving Windows 8 to SSD

windows icon Quick answer: make sure your SSD can hold the content from your HDD, removing any unneeded information (or just moving it to an external drive), then use the wonderful EasyUS tool.

The explanation below comes on my personal experience moving a new Windows 8 installation on an Asus N7500JV to SSD (being the advantage here that the HDD was practically empty).

  1. Install EasyUS Todo Backup (Free)
  2. Execute it, Select CLONE -> Disk clone. The source is the HDD disk, and the SSD, the target. In this laptop, the original HDD has 5 partitions (6 in fact, as a little spare space between 2 partitions is considered also a partition):
    • 100 Mb (EFI)
    • 900 Mb (recovery)
    • ~380 Gb : C Drive (System)
    • ~530 Gb : D Drive (Data)
    • 20 Gb (recovery)
  3. However, the C drive is mostly empty, and the D was still totally empty. Without having to manually shrink any partitions, just let EaseUS perform its magic. It creates the same structure, in only 120 Gb, as follows:
    • 100 Mb (EFI)
    • 900 Mb (recovery)
    • ~74 Gb : C Drive (System)
    • ~24 Gb : D Drive (Data)
    • 20 Gb (recovery)
  4. Ensure that the system boots from the SSD. This can be accomplished in two ways; booting to UEFI and select the SSD as first boot drive, or, more safely, by removing the HDD from the system (just unplug the connector).
  5. The system boots perfectly. Migration is complete, but the HDD still has a full Windows 8 installation, and both disks, the SSD and HDD have recovery partitions. Time to cleanup.
  6. It makes no sense having the recovery information on the SSD, we keep it on the HDD. Execute (press Windows-R) diskmgmt.msc. On the SSD, remove partitions D (Data) and E (recovery), and extend the partition C (Systems) to cover the whole disk. This drive will be now as follows:
    • 100 Mb (EFI)
    • 900 Mb (recovery)
    • 119 Gb : C Drive (System)
  7. Shutdown the system. If the HDD had been disconnected, reconnect it now, and boot again.
  8. Execute again diskmgmt.msc. The SSD will appear as C: unit, and the original C: unit in the HDD is now the D: drive. Remove the two big partitions in the HDD (original System and Data), and create new partition with all the space (~980 Gb), and assign it the letter D. The HDD remains as follows:
    • 100 Mb (EFI)
    • 900 Mb (recovery)
    • ~980 Gb : D Drive (System)
    • 20 Gb (recovery)
  9. In total, we are wasting 1 Gb of hard disk, as we have two recovery (900 Mb) partitions and the one on the SSD is not required. It is possible to check that recovery still works perfectly; as explained in this post, open a command prompt in administrative mode and execute:
    REAGENTC.EXE /Info
    It shows, among other details:
    Windows RE Location: 
    	\\?\GLOBALROOT\device\harddisk1\partition2\Recovery\WindowsRE
    Recovery image location:
    	\\?\GLOBALROOT\device\harddisk1\partition5\RecoveryImage
    In the same shell, doing
    GET-PARTITION
    should show:
    Disk 0
    1- 100 Mb System
    2- 900 Mb Recovery
    3- 128 Mb Reserved
    4- 118.1 Gb Basic   C
    
    Disk 1
    1- 100 Mb System
    2- 900 Mb Recovery
    3- 128 Mb Reserved
    4- 910.4 Gb Basic   D
    5- 20.01 Gb Recovery
    

Done! Thanks to EaseUS!

Hackintosh and hibernation

hackintosh icon[Permanent link] I use a SSD on my Hackintosh, with just 128 Gb plus a HDD for Music, etc. From the 128 Gb, I use in fact only 98 Gb in OsX, and the rest goes to a Linux partition.

It is a desktop, 32 Gb of memory, usually running for months before requiring a reboot, and most of the time sleeping.Waking up is very fast, works much better than my old Vista installation (unfair comparison), or even recent Linux installations.

Last days I started having problems putting the computer to sleep: it would start the process, switching off the monitor signal, audio, and then the computer itself, just to restart immediately. Then, a message started appearing complaining that my startup disk was almost full. Checking the space didn't show anything extraordinary: the normal scenario where more and more programs get installed, more work done, and the 128 Gb are suddenly too little.

Only one file called my attention: /private/var/vm/sleepimage, at 16 Gb, but removing it seemed out of place: this file is automatically created by OsX to keep the memory saved on disk, for out of power scenarios. In fact, this was probably the case why my box didn't manage to get to sleep; having 32 Gb RAM would have required storing 32 Gb on disk, and that space was just not available (in fact, this is not necessarily the case, as the dynamic pager can page out inactive pages prior to hibernation).

One possibility was moving the file to the HDD; going to sleep and waking up would slow down, but the SSD lifetime would probably improve, not to mention the SSD free space. But then I realized that I didn't need this file. You see, OsX has several sleeping modes, which can be set using pmset, such as:

sudo pmset -a hibernatemode 3

Doing man pmset shows the possible modes, with only 3 recommended values:

In my hackintosh, the hibernation mode was 3 (pmset -g hibernatemode), but, in case of a power loss, I had to reboot anyway the computer, so the best solution is:

sudo pmset -a hibernatemode 0

followed by

sudo rm /private/var/vm/sleepimage

Magically, my disk space usage went from 97% to 60%. And sleeping? Thanks for asking: works perfectly; in fact, somehow faster -no more needs to store 16 Gb, even on a SSD-