Monday, December 31, 2012

PS Quick Tips: Check if screen saver is enabled for the current user

PS D:\> (Get-WmiObject win32_desktop -Filter "Name Like '%$([Environment]::Username)'").ScreenSaverActive

Or:
PS D:\> (Get-ItemProperty -Path 'HKCU:\Control Panel\Desktop').ScreenSaveActive

How to disable Windows screen saver from the command line

Open command prompt and type:

Reg add "HKCU\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f

You need to log out to enforce the changes.

Friday, December 28, 2012

Show Whitespace Characters toolbar in Eclipse

To show the toolbar associated with white space character, from main menu do Windows | Customize Perspective.... Then select/enable Tool Bar VisibilityEditor PresentationShow Whitespace Characters.

Customize Perspective
Note that you may have to make Editor Presentation available through Commands Groups Availability like below.
Command Groups Availability


Thursday, December 27, 2012

Split a line into multiple lines using Notepad++

Say you have a document like below.

And you want to split "hello world" into multiple lines. Doing this using Notepad++ is easy. Bring up Replace dialog (Search | Replace... or CTRL+H), in Find what use hello world\r\n. This matches the entire line including carriage return and linefeed character. In Replace with replace the string with the intended multi-line data, for example, hello\r\n\world\r\n, will replace the line into two. One is hello, followed by world in the next line. And of course, for this to work you need to select Regular expression in the Search Mode.

Eclipse TFS support

To install TFS support within Eclipse do:
  1. Open Eclipse
  2. Do Help | Install New Software....
  3. In Install software dialog, select Add....
  4. Give it a name like "Eclipse TFS Plugin".
  5. In location, type http://dl.microsoft.com/eclipse/tfs then hit on OK button.
  6. Select Team Foundation Server Plug-in for Eclipse, see below.
  7. Select Next to proceed with the installation. 
  8. In Installation Details, select Next again.
  9. In Review Licenses, select I accept the terms of the license agreements.
  10. Then hit on Finish.
  11. Select Yes on You will need to restart Eclipse SDK for the changes to take effect. Would you like to restart now? dialog.
Oh the integration is awesome, head to Installing the Team Foundation Server Plug-in for Eclipse for more details. Tested with Eclipse 4.2 on Windows 8 using JRE 7 update 10.

Remove blank lines using Notepad++

Say you have a document as shown below.

And you want to remove the blank lines - represented by {CR}{LF}. To do this using Notepad++, bring up Replace dialog (Search | Replace... or CTRL+H) and use ^\r\n in Find What and blank for Replace. In Search Mode, change it to Regular Expression. See below for an example.

What it does it use regular expression to search for carriage return and linefeed characters and match only if it is the beginning of the line (^). And of course replace it with a blank character.

How To: Modify VirtualBox virtual HD so that it is not affected by snapshots

There are cases where you want to persist data between different snapshots in VirtualBox. To accomplish this, do:

C:\>path=%path%;"c:\Program Files\Oracle\VirtualBox"
C:\>vboxmanage modifyhd Persistent.vdi --type writethrough

Thursday, December 20, 2012

Show whitespace characters in Eclipse editor


From main Eclipse menu do, Windows | Preferences. Then General | Editors | Text Editors | enable Show whitespace characters (configure visibility).

Show whitespace characters



Cannot move tool bar icons in Eclipse 4.2 Juno


Searching for tool bar actions in Juno shows that user should be able to unlock tool bar for customization. Unfortunately this function is not working, see bug 340695.

If you really wanted to move the icons there is a workaround. Change the theme to Windows 7 and restart. You should now be able to move items around.

References:
http://stackoverflow.com/questions/11301795/how-to-unlock-toolbars-in-eclipse-4-2-juno


Eclipse 4.2 Juno default configuration is very slow - how to make it a little faster

Eclipse 3.x series performed pretty good enough that I use it for XML and Python editing. But the latest Eclipse 4.2 Juno release is pretty slow on virtual machines. Few minor tweaks made it bearable for me.

Open Preferences dialog (Window | Preferences). Expand to General | Appearance, then change Theme to Classic and disable Enable animations.

Preferences - Theme to Classic

Wednesday, December 19, 2012

Locked down ecosystem can be a double edged sword

Microsoft has been trying to copy Apple's strategy of designing there own hardware and software combination. This works pretty good in Apple's walled garden for long while but they did get bitten by their maps disaster (see https://www.google.com/search?q=apple+maps+disaster).

For Microsoft's case, Mozilla and Google are not in a hurry to support the Modern UI. In fact they probably are not going to write one as Win RT is restrictive on what apps can do.

Now in relation to browsers, I been using Microsoft Surface for more than a month and lately some of the websites stopped to work or display data properly. In Android land, I have many choices. I used Dolphin Browser, the default Android browser, Google Chrome, and Firefox, I can switch as the need arises. With Surface, no other option.

I am using my Surface now because I wanna immerse with the platform otherwise my TF101 Transformer still rocks.

Can't get Windows 8 split screen to work

I have been trying to get immersed with Windows 8 lately. The more I use the modern UI on a non-touch interface the more I don't like it. There is just too much impedance between using mouse/keyboard for an interface designed for touch input.

Anyway, I read somewhere that the Modern UI interface supports splitting applications. I took me a while to learn that for it to work you have to have at least 1366x768 screen resolution. This is maddening..... argh. First, I couldn't open apps on screen resolutions below 1024x768. Now splitting needs higher resolution.

Microsoft looks like is in identity crisis as of late. They don't just get what user needs. Or maybe people involved in the project do understand but management have a different agenda. Good luck Microsoft, you guys will be in for a difficult time against competition.

References:
http://it-diary.com/windows/windows-8-new-features-screenshots/

This app cannot open - The screen resolution is too low for this app to run

So I installed Windows 8 in VirtualBox, the host machine is laptop with 1280x800 screen resolution. Running a guest not in full screen only have 1280x736 real state. In this configuration, I am not able to run Modern IU (Metro) apps. See below for the error message.

Not able to run "Store" app
It seems like Windows 8 requires at least 1024x768 to work with the modern applications. This is interesting because they are making fun of original Android tablets as not flexible, like you know running weird screen resolution. The layout capabilities of WPF applications is suppose to be flexible, what's going on Microsoft! So this also means that netbooks with smaller screen will not work properly with Windows 8.

References:
http://superuser.com/questions/396846/force-windows-8-metro-apps-to-run-lower-resolutions-below-1024x768



Tuesday, December 04, 2012

What to change after cloning a Ubuntu guest

When cloning a Ubuntu guest machine, you need to take care of few details to make it work properly. Below are the key items to change:

  1. Update /etc/hostname, change it to the new machine name
  2. Update /etc/hosts, change one of the loopback name to the new machine name.
  3. Modify /etc/udev/rules.d/70-persistent-net.rules so that eth0 (generally) points to the updated MAC address of the virtual machine.
References:
https://forums.virtualbox.org/viewtopic.php?f=3&t=7749&sid=89e480f0dfb234c062a058995976a424

Change hostname of Ubuntu machine

To change Ubuntu(Debian/Mint) machine hostname, edit /etc/hostname. You may have to reboot machine for the changes to take effect. Note that for the new name to resolve locally, you need to edit /etc/hosts. The line that contains 127.0.0.1 below localhost should match with the hostname.

Saturday, December 01, 2012

List installed packages on Ubuntu system

To list installed packages on a Ubuntu (Debian/Mint) system, do:

$: dpkg -l

Change group owner ownership of a file or folder in Ubuntu

To change group ownership of ~/tmp and folders and files below it to say www-authors do:

$: sudo chgrp www-authors ~/tmp -R

Adding a group account in Ubuntu via console

Below adds a group called www-authors

$: sudo addgroup www-authors

Reference(s):
Manpage

How to detect if reboot is required after running apt upgrade

So you have a Debian based installation (i.e., Ubuntu, Linux Mint and of course Debian itself), how would you know if you need to reboot after running apt-get upgrade?

Well, this should be as easy as checking for the presence of the file /var/run/reboot-required

Tags:
apt, apt-get, upgrade, reboot, required

References:
http://askubuntu.com/questions/28530/how-can-i-tell-what-package-requires-a-reboot-of-my-system
http://serverfault.com/questions/92932/how-does-ubuntu-keep-track-of-the-system-restart-required-flag-in-motd