Thursday, March 31, 2016

OpenSUSE Tumbleweed does not boot to GUI after upgrade

OpenSUSE Tumbleweed kernel update as of 3/31/2016 does not boot to the UI anymore. This was observed on VirtualBox 5.0.16. Workaround is to pass iomem=relaxed to the kernel, see below for details.
  1. Reboot the machine.
  2. During the boot-up press e at the screen below.
  3. Look for the line with linux and add iomem=relaxed
Reference:
https://forums.opensuse.org/showthread.php/514436-X-server-not-starting-after-update

Install minimal GNOME shell on Debian Stretch

#: apt install gdm3 xserver-xorg-legacy
This will install just the GNOME shell, pretty lean and mean (for GNOME standard :)

Note:

  • This is a pre-release of Debian Strech
  • Need to add xserver-xorg-legacy otherwise it will not work, might be related to this bug.

Howto: Installing pywin32 on Python 3.5.1 64-bit

Installing Python for Windows Extensions on Python 3.5.1 64-bit
C:\>pip install pypiwin32

If you are getting the following error message in importing win32gui install VC++ 2010 redistributable.

>>> import win32gui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

Reference(s):
http://sourceforge.net/projects/pywin32/
https://www.python.org/downloads/

Sunday, March 27, 2016

Remove VirtualBox guest additions on Debian

# apt-get purge virtualbox*

Reference(s):
https://forums.virtualbox.org/viewtopic.php?f=3&t=54881

Install minimalist GUI on top of Debian Stretch netinstall

LXDE is pretty lightweight desktop environment. There are other lighter weight DEs out there mind you but for most practical purposes LXDE serves most of the modern x86 machines.

To install minimalist (just the core) LXDE on Debian Strech, do:

#: apt-get install lxde-core lightdm

Note:

  • This will also install a lighter version desktop manager LightDM
  • This is a pre-release version, it may change without notice.

VI Editor common operations

My commonly used vi shortcut keys:

CommandActionNotes
File operations
:qQuit VIThis will exit VI editor
:q!Force quitThis will exit VI editor even if buffers are dirty
:wSave current bufferSave currently active buffer
:bdKill current buffer
General
:set nowrapDon't wrap text
:set numberShow line number
:set nuShow line number (short hand)
Text Operations
vStart Visual Mode(for copying)
yYank/copy selected text
yyCopy line
2yCopy 2 lines from the cursor
pPaste _after_ the current line
PPaste _before_ the current line
xDelete char under the cursor
dwDelete the word under the cursorThis will also delete the space after it
3dwDelete 3 wordsThis will also delete the space after it
ddDelete lineDeletes the entire line
Navigation
0Jump to beginning of line
$Jump to end of line
bMove to the beginning of the word
eMove to the end of the word (punctuation considered part of the word)
geJump to previous word ending
gEJump to previous word ending, ignore punctuation
ggStart of file
GEnd of file
21GGo to line 22
Search and Replace
/{string}{ENTER}Search for string
:%s/foo/bar/gSearch for foo and replace with bar in the current buffer
Merging
Note** run vimdiff file1 file2
]cJump to the next difference
[cJump to the previous difference
doCopy line diff from _right_ buffer to the _left_ buffer
dpCopy line diff from _left_ buffer to the _right_ buffer

Tutorials
VIM Introduction and Tutorial (link)
VI Cheat Sheet (link)
VIM Tips (link)
Code Merging with VIM (link)

Allow changes to SQL Server table schema if the changes require table re-creation

Modifying an SQL Server table that requires the table to be re-created is not allowed by default using SQL Server Management Studio for good reason. For example, changing a column of type nvarchar from 10 to 20 will result with the following error:

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.

To allow schema change for the above situation using SSMS, do the following:
  1. Open SSMS (SQL Server Management Studio). I am using SSMS 2014. 
  2. For good measure, back-up the database.
  3. Navigate to Tools | Options
  4. Click on Designers.
  5. Remove the check box on Prevent saving changes that require table re-creation
  6. Click on OK
  7. Proceed with changing the table schema.
  8. Again for good measure, enable Prevent saving changes that require table re-creation to prevent accidental table schema change that might drop some information.
Reference(s):

~Enjoy.

Saturday, March 26, 2016

How to determine Hyper-V hostname inside the guest VM

On Hyper-V virtual machine with integration services installed the host machine can be identified by reading HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters\Hostname on the guest machine itself.

Reference(s):

Enable logging of .Net assembly binding via registry

You have a .Net application that fails to load and you are suspecting that it may have to do with assembly dependencies. On a development machine fuslogvw.exe will aid you in collecting failed assembly binding but fuslogvw.exe is not normally available on production environment. So what do you do?

Logging of assembly binding can be enabled via the Registry, to do so navigate to HKLM\Software\Microsoft\Fusion. Add the following keys with corresponding values:

Key
Type
Value
ForceLog
DWORD
1
LogFailures
DWORD
1
LogResourceBinds
DWORD
1
LogPath
String
C:\FusionLog\









You need to restart the .Net application under test for this to take effect. The log files will be saved in C:\FusionLog.

Reference(s):
http://stackoverflow.com/questions/1012252/using-fuslogvw-exe-on-a-machine-with-no-visual-studio-installed


Monday, March 21, 2016

How to install Squeak 5.0 on Ubuntu 15.10 64-bit

Squeak 5.0 stable as of this writing (3/21/2016) only supports 32-bit on Linux. To get this to work on 64-bit install follow the instructions below.
  • Download Squeak 5.0 from http://squeak.org/
  • Extract to location, e.g., ~/apps/
    • Open a console
    • $: cd ~/Downloads
      $: unzip Squeak-5.0-All-in-One.zip -d ~/apps/
      
  • Get 32-bit libraries
    • Use the Squeak built-in script to get most (not all is installed)
    • $: cd ~/apps/Squeak-5.0-All-in-One
      $: Squeak-5.0-All-in-One.app/Contents/LinuxAndWindows/install-libs32
      
  • This will fail with the error message below (at least on Ubuntu 15.10)
    • Fail with the following error message:
      E: Unable to locate package lib32bz2-1.0
      E: Couldn't find any package by regex 'lib32bz2-1.0'
      E: Unable to locate package libgl1-mesa-dri-lts-utopic
      E: Unable to locate package libgl1-mesa-glx-lts-utopic
  • Let us fix this by running command below:
    • $: sudo dpkg --add-architecture i386
      $: sudo apt-get update
      $: sudo apt install lib32z1
      $: sudo apt install libuuid1:i386
      $: sudo apt install libgl1-mesa-glx:i386
      $: sudo apt install libsm6:i386
      

Enjoy~

View library dependencies in Linux

I was trying to get Squeak VM 5.0 running on Ubuntu 16.04 beta 1 and got the following:

/home/timus/Downloads/Squeak-5.0-All-in-One/Squeak-5.0-All-in-One.app/Contents/LinuxAndWindows/Linux-i686/bin/squeak
could not find display driver vm-display-X11; either:
  - check that /home/timus/Downloads/Squeak-5.0-All-in-One/Squeak-5.0-All-in-One.app/Contents/LinuxAndWindows/Linux-i686/lib/squeak/5.0-3397//vm-display-X11.so exists, or
  - use the '-plugins <path>' option to tell me where it is, or
  - remove DISPLAY from your environment.
./squeak.sh: line 1:  8289 Aborted                 (core dumped) ./Squeak-5.0-All-in-One.app/Contents/LinuxAndWindows/squeak.sh

To view library dependencies in Linux, do:
$: ldd Squeak-5.0-All-in-One.app/Contents/LinuxAndWindows/Linux-i686/lib/squeak/5.0-3397/vm-display-X11

This should display library dependencies of vm-display-X11.

Sunday, March 20, 2016

Hyper-V enhanced session mode supported guest OS



Enhanced session mode in Hyper-V allows redirection of local devices and resources from computers running virtual machine connection. This is very convenient functionality as it allows the same level of interaction as remote desktop connection. In fact, it seems like it is a modified version of RDP from the way it works.

To use it you need to have host OS running Windows Server 2012 R2 or Windows 8.1 Enterprise or later. The guest OS has to be Windows Server 2012 R2 or Windows 8.1 Pro or later.

Saturday, March 19, 2016

PS: Download using Powershell

Download files using PowerShell
PS A:\> $wc = New-Object System.Net.WebClient
PS A:\> $url = "https://eternallybored.org/misc/netcat/netcat-win32-1.12.zip"
PS A:\> $output = "a:\netcat-win32-1.12.zip"
PS A:\> $wc.DownloadFile($url, $output)