Monday, March 16, 2015

Shrink Vmware Workstation Ubuntu guest's VMDK file size physically on Windows host

I will be short on the topic as you too only seeking the resolution to the problem in the title.

This tutorial is based on using Vmware Workstation 11 on Windows 8.1 host using an Ubuntu 14.04 guest. Note: you have to have the vmware tools, client additions installed on the quest machine!

First go to the Vmware client's terminal when you are ready to shrink it down and type:

sudo vmware-toolbox-cmd disk list

This will give you the mount points that can be shrinked individually.
For me I will only go with shrinking the main disk with "/" (root).

First lets wipe the free space clean so the shrinker will know what is free to get rid of:

sudo vmware-toolbox-cmd disk wipe /

To shrink:

sudo vmware-toolbox-cmd disk shrink /

That's it, after the process in my case I've had a 4.4G file shrinked down to 1.7G, which is much closer to what the client OS saw (1.5G).

Friday, March 6, 2015

How to create Jenins CI compatible JUnit report XML

Currently I use Jenkins version 1.6x. For the most curious here is an example XML that shows the structure. For those of the visual types there will be some treats after the code.




Ok now, let's see how these tags translate on the report UI.

First we are seeing failed results.



These are either failures or errors.


When looking at the test report main page, we'll see a minimal summary.


Let's look at a failed test now, where we also supplied and output (e.g. STDOUT).


Let's see how this is put together in code. I have also pointed out the components of the heading.


The heading can have another component too:



Errors are also failed tests, but you really should add an extra error output to the report for them:



And finally the passed code is a plain entry. Still, you may supply a normal output to it via the element.



Conclusion

The source XSD file I used to figure out how the JUnit XML should look like can be found here. Although the XSD suggests a far more feature rich XML structure, only a minor portion of that information is used by Jenkins. :(

Monday, November 17, 2014

Language injection in Ruby strings with Intellij / Rubymine

I have just discovered that Rubymine was also capable of language injection for strings, even if this is hardly documented:



The trick here is to use the correct heredoc format with defining the language inside the string.

Monday, October 20, 2014

Byobu automated window setup

I am recently working all day in a multiple virtual machine environment and became very tired of typing repetitive commands. The most irritating was to always recreate the default Byobu (with tmux) window setups, running the initial servers in them, etc. So I have asked the question on ServerFault. As a result I have created my 6+ window Byobu automator script and live happily ever since |^_^|

Here is a small GIST example for a simple, non-splitting window setup:

Friday, August 15, 2014

Windows 8 blurry/fuzzy text

Recently I have bought a new machine that came with Windows 8.1 pre installed. To make the story short the texts and some icons were super blurry an fuzzy, edgy. I have spent some hours on the net and found a clue that says new Win8.1 has sometimes the text size increased by default. So what you'll need to do to restore 100% size is:

1. Go to the Control Panel and open Display





2. Then see if you have an automatic selected, if so then have it overridden





3. The default is always 100% so make sure it is selected that way, hit Apply then log out and log in


Monday, September 9, 2013

Recreating Google Docs automatic "Saving..." status display

Developing a new Warcraft guild website gave me a handful of good opportunities to construct and recreate/imitate some edge features used in modern apps today. One of them is a "Saving" status display when you are editing a Google document. So here are the steps I wanted to mirror in my own app:

  1. when the app is constantly saving what the user inputs
  2. when it is just done saving every piece of data
  3. when some time passed and it wants to inform the user about real time status information

These are the steps for the frontend side. On the server side, well just look at this network traffic below, this absolutely has to be custom tailored to everyones infrastructure

Let's look at my original code that was born to recreate this action


The above code looks like this in the browser (sorry, it's the Hungarian version)


Now let me sum up the crucial points in the above code. Javascript is good in using callbacks, async calls. This behaviour could lead to tricky "bugs" or some hours of search on Google. When using setTimeout() with AJAX hand-in-hand then we have to think about AJAX's async nature, where calls are not finished one-by-one in a numbered row. They will finish independently on different timeframes, some fired later but finishes earlier. To overcome this I use an array to store the timeout ids and clear all of them out when the user sends more input. Now there will be no race to clear all living timeouts in time :)

I hope this little code gives some of you more ideas. Please bare with this code as it is premature and not yet ready for production (I believe).

Thursday, March 28, 2013

Ubuntu: add personal path to the global path

My best choice when I want to extend the system path is to create a profile shell script in the /etc/profile.d/ directory with and extension of .sh. The content is something like this:
export PATH=$PATH:/home/ikon/bin
This way my ~/bin directory is added to the system path.  Check it with
$ echo $PATH

Saturday, February 9, 2013

Problem installing debugger on 1.9.3 and RVM

This is a recent problem now, so if you are reading it years later try to adopt your numbers on these lines.

Version ruby 1.9.3-p327 using RVM, debugger and debugger-linecache restisted the bundle install command.
Workaround:
gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=\$rvm_path/src/ruby-1.9.3-p374

gem install debugger -v '1.2.3' -- --with-ruby-include=\$rvm_path/src/ruby-1.9.3-p374

Wednesday, February 6, 2013

Vboxheadless and bridge nic trouble

I wanted to have my VM built on Windows to be hosted on an Ubuntu linux Virtualbox headless. The VM had a bridged interface and when I tried to fire it up after a plain import I got this:
Error: failed to start machine. Error message: Configuration error: Failed to get the "Trunk" value (VERR_CFGM_NOT_ENOUGH_SPACE).
Failed to attach the network LUN (VERR_CFGM_NOT_ENOUGH_SPACE)
The solution is simple:
  1. check the host's main network interface name (or the one you want to bridge to), e.g. eth1
  2. modify the VM's bridge interface to that with:
vboxmanage modifyvm vm_name --bridgeadapter1 eth1
After this adjustment is done and the bridge interface knows where to point to the VM will surely fire up.

Friday, November 23, 2012

Missing menubar in (K)Ubuntu 12.10

After updating to and installing 12.10 of Kubuntu my GTK apps are missing their main menubars. Somewhere I read a cool solution that seems to work right offthe bat:
sudo apt-get purge appmenu-gtk appmenu-gtk3 appmenu-qt

Monday, September 10, 2012

ORACLE JDK on Linux

This is a small summary for anyone who struggles often - on Ubuntu recently - to get the so called "Sun Java JDK", now belongs to Oracle onto their system. My strategy is to exclude any kind of Java packages from my installation and download only the self extracting JDK from the Oracle website. Once downloaded and extracted into my home directory I can easily  reference that directory in the various global variables that my softwares are searching for.
On Ubuntu I use a dumb-simple shell script that is put into the /etc/profile.d directory with the extension of .sh. The content of my version is like this:

export WEBIDE_JDK="/home/ikon/app/jdk"export RUBYMINE_JDK="/home/ikon/app/jdk"export SMARTGIT_JAVA_HOME="/home/ikon/app/jdk"export SMARTSYNCHRONIZE_JAVA_HOME="/home/ikon/app/jdk"
Here the /home/ikon/jdk is where I extracted the JDK to. The variable names can be looked up from the starter shell scripts of the softwares. This way I even made those softwares "portable" :)

Thursday, August 30, 2012

Using the same icon theme for GTK under KDE

I wanted to use Clearlooks on both Kde and within Kde all the GTK apps. But GTK apps started to use the default, ugly gnome icon theme. So I made this change to the following file, called .gtkrc-2.0-kde4 and back to business, using Oxygen icon theme everywhere ^_^.

Monday, August 27, 2012

Create desktop launcher in Ubuntu 12.04

There is a certain flaw in usability for power users in the new Ubuntu 12.04 out-of-the-box. I cannot create a desktop shortcut as easy as it was used to be.
Instead, I have to install gnome-panels package and then use this command:
gnome-desktop-item-edit Desktop --create-new
to get a popup that was so natural it is a crime to miss it.

Thursday, May 31, 2012

Find files and do something with them

  • Find removed (deleted) files still in use via /proc:
# find -L /proc/*/fd -links 0 2 > /dev/null
  • Remove .svn folders recursively. (I have seen solutions using the -exec switch, but it is too slow, so I use find's own delete option here)
$ find . -name ".svn" -type d -delete;
  • Find and delete files with multiple choice of names:
$  find /path -name '.DS_Store' -or -name '._*' -delete
  •  Finding file in .h with "raoul" in it ( the "-n" is for displaying line number ):
$  find /path -name "*.h" | grep -n "raoul"
  • Find empty folders:
$  find /path -type d -empty
  • Find empty folder and list:
$  find /path -type d -empty -ls
  • Find empty folder and save result in temporary file:
$  find /path -type d -empty -fls /path/to/tempfile.txt

Saturday, April 14, 2012

How to configure a local subdomain development with Linux

Note

In the following scenario everything is done within one machine. This setup can be recreated with more then one machine as well. Use your imagination!

Task

I want to have subdomains like static.mydomain or whatever.mydomain.

Ingredients

  • any host OS that is capable of running Virtualbox, VMware or your favorite virtualisation software
  • a linux distribution that uses/supplies a small kernel, like Ubuntu server, Fedora without X, Arch or any of your choice, preferably one that you are familiar with. Of course if you are not a linux guru you can  still use a gui, just give enough memory for your guest linux.

Setup process

  1. have your virtualisation software set up on your host
  2. install your linux distro of choice as a guest, it is best to use at least one "Bridged" (my choice) or "Host only" network adapters that every other guest machine can see too if you later need it. 
  3. set up your /etc/resolv.conf file to have your nameservers in the following order:
    (NOTE: only the first one has to be your localhost, the remaining two is your choice of providers)

    nameserver 127.0.0.1
    nameserver 8.8.8.8
    nameserver 8.8.4.4
  4. install the package that has dnsmasq in it or compile it from source.
  5. setup dnsmasq according to the example below:

dnsmasq configuration

Generally the config file is at /etc/dnsmasq.conf.
Let's say you want to have a domain that is resolved by your machine -who take part in the development- as one of the dev machines address on the local network. For example I want to have the domain ikondev to be resolved to the ip address of VM1 (Virtual Machine 1 on the above image). This way we can have several subdomains for ikondev without updating /etc/hosts file each and every time we add a new subdomain to our webserver to listen to.

In your dnsmasq.conf set the following lines: (these lines has to be uncommented too)

  • domain-needed
  • bogus-priv
  • strict-order (this will make this local DNS server to be the main nameserver)
  • address=/ikondev/192.168.1.101 (this is the entry for the ikondev domain to point to the machine with 192.168.1.101. You can set up several more entries like this of course)
  • interface=eth0 (eth0 has to be changed to your network interface which connects to the development network)
  • no-dhcp-interface=eth0 (eth0 has to be the same as the one for the previous setting as we do not want to set up a dhcp server)

Final touches

Now all we have to do is restart the network and the dnsmasq services and set all the dev machines primary nameserver to be VM2's ip address as it will be serving our local and mainstream resolves.
Voila! all subdomains typed for ikondev will be resolved as VM1. :)

Thursday, March 29, 2012

Access a remote service localy via ssh

This will be just a short reminder for myself not to forget how to forward a remote service's port to a local one through ssh. Here is the schema:
ssh -i .ssh/ssh_keys/root -L 55432:localhost:5432 root@thinks.iamallama.com
With -i we use a private key to the remote host's user named root at the end. Next we say we want to access a local port -55432- and send the data through that one to the remote port -5432-. We want to use our localhost to address the service which is hosted on the thinks.iamallama.com machine.

This wraps it up. ^_^