Convert Dynamically Sized VirtualBox VDI Hard Drive to Fixed Size

The Problem

You have got a dynamically sized, VDI virtual hard drive in VirtualBox and would like to convert it into a fixed size hard drive.

You are using Windows.

The Solution

  • Locate VBoxManage.exe on your machine. It should be in the VirtualBox program directory (usually found under C:\Program Files\Oracle\VirtualBox) .
  • Open a command prompt (e.g. by searching for “cmd”+Enter Windows 7 or 8).
  • Go to the directory in which VBoxManage.exe is located by typing something like:

cd “C:\Program Files\Oracle\VirtualBox”

  • Convert your dynamically sized hard drive to a fixed size harddrive using the command:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe clonehd <path-to-source-vdi> <path-to-destination-vdi> –variant Fixed

This might take a while depending on the size of your drive. You probably have used this drive as part of a virtual machine. In order to use the new hard drive you need to go through a few more steps.

  • Open the virtual box manager, go to settings for your machine and remove the old (dynamically sized) drive from the SATA controller for this machine.

  • Go back to the command line and display a list of your currently registered hard drives:

VBoxManage.exe list hdds

  • Manually remove your old drive from the list by running the command:

C:\Program Files\Oracle\VirtualBox>vboxmanage closemedium disk <UUID of your drive> –delete

ATTENTION: This will delete your old hard drive file. You may want to make a backup copy of the image before running this operation.

  • Rename the new (fixed size) hard drive file to the name of your original vdi file. For instance, if your old drive’s name was ‘myhdd-10GB.vdi’ and your new fixed size drive’s name is ‘fixed-10GB.vdi’, rename ‘fixed-10GB.vdi’ to ‘myhdd-10GB.vdi’
  • Go to the VirtualBox Manager and add the freshly renamed drive to the SATA controller for your VM.

Now you should be able to start your VM with the new drive and (hopefully) enjoy the performance benefits of a fixed size drive.


HOWTO: Convert VDIs Between Fixed-Sized and Dynamic In VirtualBox

Stackoverflow – Convert VirtualBox dynamic VDI disk image to static, fixed VDI

coderwall - Purge deleted hard disks from Virtual Box


Improving Voice Recording with Audacity

Audacity is a powerful and free tool to edit all kinds of audio files. However, the many features it offers can be overwhelming for beginners and more advanced users alike. This guide contains some tips how to go about doing a very specific task with audacity: Improving the quality of recorded voice, for instance for podcasts or voice overs.

This guide is especially meant for situations where you do not have a very good microphone and other professional recording equipment.


Things to remember while recording:

  • Hold the microphone close, but not so close that there will be cracking and/or overemphasized explosive sounds (such as when speaking the letter ‘p’).
  • Try to find a small room with few flat and hard surfaces (such as a wall). Rooms with plenty of curtains and carpet are better.
  • Try to find a place for recording which you will be able to access again (such as a room in your house). If you record yourself in a different location, your voice might sound noticeably different. WHERE you record is as important as HOW you record.
  • Make sure that there are a few seconds of silence at the beginning and/or end of the recording.

After you have done the recording, post production in Audacity may commence.

Remove Background Noise

  • First, select 1 to 3 seconds of the silence at the beginning and/or end of the recording.
  • Play the selection and assure that it is homogenous. That is, it contains hissing or other kinds of background noise, which does not change (e.g. gets louder or is interrupted by other noises such as clicking a mouse, breathing, etc.).
  • Go to menu Effects / Noise Removal (keyboard shortcut: Alt + C à‘N’ à Enter)
  • Configure the settings as follows (or play around with them for better results):

  • Click on [Get Noise Profile] (keyboard shortcut: Alt + G).
  • Select your whole recording (keyboard shortcut: Ctrl + A).
  • Apply the noise removal by using menu Repeat Last Effect (keyboard shortcut: Ctrl + R).

Note: You might want to repeat this process once more while selecting another region of ‘silence’ – this can help to reduce the background noise even more.

Make the Voice ‘Warmer’

When using cheap microphones, your voice might often sound metallic. To remove this effect, apply this simple filter.

  • Apply the effect

Make the Recording Louder

Applying the previous effect will have made the recording overall less loud. You should now be able to amplify it to make it louder without causing distortions.

  • Select the whole recording
  • Go to menu Effect / Amplify
  • Set the amplification to 2 db to 4 db (NOT as much as you can without causing cropping.

And More

There are plenty of more effects you can apply to a voice recording, for instance, compression or normalization. However, keep in mind that any effect that you add also reduces the quality of your sound file and makes it less authentic. So, only apply effects if you can hear they make a noticeably positive difference (without negative side effects).

Note that you can create an Edit Chain for the equalization and amplification to apply the effects conveniently to many files. While you can use the Noise Filter in an edit chain as well, I would not recommend it, since there are often subtle differences in the background noise between recordings (even if they are recorded in the same room) and the Noise Filter can only apply one noise profile to all files which are to be processed.


How to Make Vocal Audio Sound Better in Audacity

#1 Audacity Tutorial: Warm & Clear Voice

The Conscious Mind as Trainer

It might be that our subconscious mind ears often in our urban and large-scale world. It might be that reason and traditional intelligence are the most useful devices to navigate this world.

I’m reading ‘Thinking Fast and Slow’ from Kahneman at the moment and what I’ve read so far seems to have a bias towards our higher mind of reason. Specifically, various instances are discussed in which what humans intuitively feel is the correct answer is logically and/or mathematically false.

However I think it is better to think of our subconscious, automatic mind as a prodigy. Somebody with great potentials but also great flaws. It is our job to be the guide of this prodigy. Thereby not understanding our conscious, reasoning mind as being more trustworthy or superior to our subconscious mind, but understanding it as a facilitator, a manager. The conscious mi d is not the rock band, which amazes millions, it’s the boring guy in the background, which assures that the catering is cared for.

Because our conscious mind is weak – it might give us the illusion that our reasoning mind is us – that we could be the voice talking in our had and deliberately going through the steps of calculating 34 * 15 – but this voice is not who we actually are, it’s a small, insignificant part of what constitutes us; our intuition, the thoughts and processes we are not aware of are much more us – importantly they set the boundaries of what our conscious mind can accomplish.

The conscious mind however can also work as a coach. It can observe the team, send it through drills and training sessions, set the strategy; however, when the real action happens, the conscious mind, just like a coach, stands on the side lines with very little influence.


A good or a bad trainer can make a crap team into a sterling one. But only a trainer, who accepts his team, and accepts his role in the periphery of the game can accomplish such.

Such I believe the conscious mind should progress, with humility, patience, love and determination.

Steve Jobs and Leadership

There is something wrong with the way Steve Jobs led people. The biography from ‪Isaacson‬ is full of examples how Steve Jobs exercised excessive control, restricting the autonomy of talented employees, or outright abused employees in an inhumane way.

Research suggests that people work better if they are not driven by fear or monetary incentives but by a desire for autonomy and by the desire to become better at whatever they are doing.

Consequently, having a leader like Steve Jobs should be detrimental for any business, preventing employees to realize their full potential. However, it is difficult not to see that Steve Jobs was indeed good for Apple, leading it to unprecedented successes. This contradiction has puzzled me for a while: how can Jobs have exercised such bad leadership, yet be so successful. I think one possible answer might lie in that Jobs did some things outstandingly right, mitigating the effects of his bad leadership style. I think one of these things was that Jobs was a leader to inspire.

Jobs did not led his company through following a carefully justified strategic plan. He led his company through a number of strong visions, which resonated both in his personality as well as in his actions. Some of these visions were:

  • building great products through simplicity, control over end-user experience, and great and delighting design (a product is not ready yet, if it does not surprise and delight)
  • building a company which can last generations
  • building a team exclusively made of top performers

I think this aspect of Jobs’ persona is rather well known and documented. Jobs was a man of the Why, the purpose behind what is done, rather than a man of the How, the way something is achieved. Visions are a powerful psychological instrument, connecting with people’s feelings rather than their logical mind.

Although Jobs led successfully through visions, it should not be forgotten that visions can also be extremely harmful. Hitler was a very skilled leader, leading by grand visions and emotions rather than rational arguments – with well-known devastating outcomes. This is not to say, of course, that Steve Jobs was like Hitler, he certainly was a totally different person. However, I believe, as powerful as visions can be, they can also be dangerous.

James Collins in his book ‘Good to Great‘ suggests that the research of his team into lastingly successful companies revealed that all of these companies were led by so called ‘Level 5 Leaders‘. These leaders, though highly successful, often shun publicity and always emphasize that it is their team driving the success of the company and not them. They are also very passionate about the success of their company. The main factor which distinguished these ‘Level 5 Leaders’ from celebrity CEOs in the data observed by Collins and his team was that companies of Level 5 Leaders continued to be successful after the leaders left.

Apart from an obvious lack of compassion, this could be another downside of Steve Jobs’ leadership style. Will Apple prevail to be as successful as they have been with Jobs at the helm? In any case, however great a leader Jobs was, I do not think that he is a good role model for future leaders. Since, looking at the descriptions in ‪Isaacson‬’s biography, it appears that some of his success was built on compromising the dignity of subordinates; and dignity, in my point of view, is something that should never be compromised on no matter how ‘great’ the endeavour (as should be the law).


Picture Credits:

Why the Ideal Task is Necessary, Rewarding and Fun

When it comes to organizing our lives, structured and logical approaches are in no short supply. Divide large projects into small tasks. Prioritize what is more important over what is less so. Identify the critical path of tasks leading most surely to success. All these are activities of the conscious and deliberate mind.

Some psychologist like to call this dimension of our mind System 2. System 2 takes care of conscious reasoning and helps us to think through things logically. As might be implied from the very designation of this system, there is a corresponding System 1. This system is generally responsible for subconscious and automatic activities of our brain; which helps us to drive cars and climb stairs without us having to ‘think’ about it explicitly. Some people also like to call these two aspects of our mind the conscious and the subconscious in a dramatic simplification of scientific terminology.

However, notwithstanding the terminology employed, System 1 and System 2 don’t get very far without each other’s help. If we would be consciously thinking about every action we have to take, we would move as fast as a computer from the 1960s rendering If we wouldn’t be consciously thinking about anything … well, no need to think too much about that.

It is concerning then that modern methodologies to organize our work rest firmly on the principles of system 2. Anybody who has employed these systems on any significant scale certainly can relate to the picture of being stuck moving at a speed which feels like it could be so much faster. System 1 is undoubtedly the system with more raw power; even if this power is often not directly available to us. However, there are various ways how we can harness the abilities of system 1 – especially if we speak its language of values and emotions.

Thus, I have a proposal here how we could bring a bit of System 1 into the way we organize our tasks. Specifically, I propose that for every task we need to undertake we assess the following three dimensions:

  • Necessity: Does this task need to be done.
  • Reward: Do I expect that completing this task will feel personally rewarding.
  • Fun: Do I think it will be fun to complete this task.

Depressingly, I have little doubt that many of our To Do items will score heavy on the first dimension, necessity – while being less accentuated for the latter two. All the more reason to think carefully about these dimensions and asses their impact for our well-being and productivity.


If we do not do what needs to be done, we won’t progress in life. Increasing the level of necessity of our tasks is an exercise in reduction. Cutting out the tasks which are really not that important to have more time for what really matters. There are many systems available to accomplish this, for instance the very popular Getting Things Done.


We all had these days were we are running around like crazy all day working on one important matter after the other. Only to be rewarded with the stale feeling at the end of the day that really we haven’t accomplished anything at all. On the other hand, sometimes we do something small and seemingly unimportant – such as sending a short message to our loved one or finally sending off this message to Aunt Mary -, which leave us with a feeling of grand satisfaction with ourselves and our life. A lot of the research in the field of Positive Psychology has looked into the various aspects which moderate what leaves us feeling good and what doesn’t.

To some degree it is our individual preferences which affect how rewarding a task feels. Is family the most important for you in your life? Then picking up your daughter from school will certainly feel rewarding. Do want to become the most successfully mergers and acquisitions lawyer in history. Then putting in another hour for the next big case will feel rewarding without a doubt. However, while we are usually quite good at figuring out which tasks will be necessary and which not when we put our mind to it (that is system 2, of course), we are often complete failures at figuring out what tasks will be truly rewarding. Also, just as necessity is not fixture and can change based on our goals, how rewarding something feels is not unalterable. It depends to a large degree on our attitude towards the task.

Keeping this in mind, I have assembled a few rules of thumb to make the tasks we need to do more rewarding and to figure out ways to identify tasks which are rewarding:

  • Do things for others.
  • Attempt difficult things.
  • Think about how a task relates to your life goals (Surely, there’ll be some connection).


We are usually quite good at indulging in things which are fun to do. Watching our favourite drama show with a good cold beer, go out drinking and bet on horse races, checking the latest gossip about Aunt Mary on Facebook – the opportunities are endless. Unfortunately, many activities linked to issues of greater import in our life, such as family chores and – behold – work, do not overlap with what we consider fun (the exceptions proving the rule).

Unfortunately, we are not great experts in fun either (that is after passing into the second decade of existence). Since, often what we consider fun in the beginning quickly turns into a habit – until we forgot why we started doing it to begin with (think watching television, drinking and betting on horse races and checking Facebook). Thankfully, how entertaining an activity is not only determined by what we do but also by how we do it. Clearing out the rain gutters just becomes this much more fun if you do it with your best buddy while wearing fish masks.

Thus, here a preliminary short list of ideas how any tasks can become more fun.

  • Do things with others.
  • Do things differently or with different tools.
  • Do new things.
  • Do little things in a weird and stupid way.

You might have guessed the punchline of this article from its subtle title: Key to a successful organization of your tasks is to maximize how necessary, rewarding and fun your tasks are. This would assure you are getting more done while being more productive and altogether more happy.

However, this is easier said than done. Thus, if we cannot find tasks that fall within each of these categories, at least we should try to have a healthy mix of tasks falling within the different categories. For instance, to assure that in a day or week, we have some tasks which are necessary but also some tasks which are fun and rewarding.


Get the Exact Position and Size of a Window in Windows


You would like to know the exact pixel position and size of a window in Microsoft Windows.


Use the very useful utility Sizer. You can download it for free from the page below:

I downloaded the portable version (download the Zip Package).

Launch sizer.exe from the extracted zip package.

Then right click the title bar of the window of which you would like to know the position and size.

Select the option Resize/reposition from the context menu. Select ‘New entry …’

Now, you can see the width and height as well as the top and left offset for your window:

Remove Duplicates from Array in CoffeeScript


You have an array in CoffeeScript, which contains equal elements multiple times such as:


You would like to have only unique values in the array. Thus, transform it into:



You can use the following method to accomplish such:

removeDuplicates = (ar) ->
  if ar.length == 0
    return []  
  res = {}
  res[ar[key]] = ar[key] for key in []
  value for key, value of res



This solution is based on this approach (with a few minor issues fixed).

Cross-Domain Requests in GWT with JSONP

GWT RPC is built upon AJAX requests and thus is subject to the Same-Origin Policy. However, it is really easy in GWT (as well as in other JavaScript applications) to circumvent this policy using a method called JSON-with-padding (JSONP).

Unfortunately, there are a couple of issues one needs to consider before utilizing JSON-P:

Amount of Data Send from Client to Server

The biggest limitation of JSONP is that it uses GET and not POST requests. Thus, all data send from the client to the server needs to be encoded as URL query parameters such as:

These URL parameters can only hold a limited amount of data. I couldn’t find a conclusive upper limit on this, but most sensible suggestions seem to indicate that parameters should be limited to between 2,000 or 4,000 bytes. Please note that many sources here discuss the limit of characters which can be put into a browsers address bar. This limit is not the same as the limit for GET requests triggered from within JS code.

Reliance on GWT RPC

It is a non-trivial (but not impossible – I’ve done it!) endeavor to channel GWT RPC requests through JSONP. Thus, if your application is deeply dependent on GWT RPC, it will probably involve a lot of work to make it JSONP ready. Good news is that if you use the Request Builder API things will be far easier.

Other than these two issues there is really nothing stopping you from writing GWT client applications, which can communicate with multiple servers. I believe that this decoupling from client and server is far more valuable than the added security derived from restricting requests to one domain. After all, the browser is a client application which is by design meant to communicate with many different servers. If you have a choice, consider the two factors above and architect your GWT applications from the very beginning in a way which enables JSONP requests.


GWT JavaDoc – JsonpRequestBuilder

Wikipedia – JSONP

GWT 2, JSONP and Javascript Overlays with JsonpRequestBuilder

Insert Text at Caret Position in Summernote Editor for Bootstrap


Using the very useful Summernote Editor component for Bootstrap, you would like to insert some text at the current caret position programmatically.


The Summernote API does not provide any dedicated methods for inserting text. However, that’s not a problem since we can use the JQuery/native DOM API to insert text into the editor. Thankfully, the content of the Summernote editor is nothing but vanilla HTML/DOM elements. Thus, we can insert text at the current cursor position as follows (if the Summernote editor is focused):

To Insert at the End of the Current Paragraph


To Insert at the Current Cursor Position

var selection = document.getSelection();

var cursorPos = selection.anchorOffset;

var oldContent = selection.anchorNode.nodeValue;

var toInsert = “InsertMe!”;

var newContent = oldContent.substring(0, cursorPos) + toInsert + this.substring(cursorPos);

selection.anchorNode.nodeValue = newContent;

Note: You probably will have to work some magic with the document.getSelection() call. The problem is that once you would click a button or trigger the action in some other way, the selection would change. Thus, I save a reference to the document.getSelection() upon every focus and key press event on the editor.


MDN – Selection.anchorNode

Stackoverflow – Get caret position in contentEditable div

Stackoverflow – Inserting Text at Cursor Position using JS/JQuery

Stackoverflow – JQuery Plugin for Inserting Text at Caret




CoffeeScript Fat Arrow (=>) explained

Anyone who has worked with JavaScript for anything but a very short time will have come across the problem that the meaning of ‘this’ is often ambiguous at best. CoffeeScript attempts to mitigate this problem somewhat by introducing the Fat Arrow operator (=>). This operator can be used as a replacement for the thin arrow operator (->) used extensively in CoffeeScript for defining functions.

Unfortunately, it is not easy to understand what the fat arrow operator does.I hope the following rules provide some guidance on how to use this operator in CoffeeScript:

Rule 1: You Don’t Need the Fat Arrow If You Don’t Use: class, this, and @

If you are a beginner in JavaScript and/or CoffeeScript, I would recommend keeping your hands of the language constructs ‘this’, ‘class’ and ‘@’. You can implement any application you like without having to use these constructs and it will make your applications more robust and bug free.

Rule 2: Use the Fat Arrow when You Use @ in a Callback Definition in a Method

If you use classes in your code and you want to create a new anonymous function to be passed as a callback (such as to listen to an onclick event or to defined setTimeout function), define this function with the fat arrow operator. This will assure that you still have access to the methods and properties of the class you are working with.

The fat arrow will ‘override’ the default meaning of the @ operator as follows, to assure that ‘this’ refers to what we would expect it:


delayedAction = =>  

setTimeout(delayedAction, 100);


delayedAction = (function(_this) {
  return function() {
    return alert(_this.messsage);

setTimeout(delayedAction, 100);

Rule 3: Don’t Use Methods as Callbacks and Avoid the Fat Arrow Operator in All Other Circumstances

There is one more use case for the Fat Arrow operator, which is that it has a special meaning when used for the definition of class methods. This is useful when the methods of a class are to be passed as a callback. I personally don’t think that’s a very useful feature and it’s better to define an anonymous function to handle a callback and then call a method of your class/object from within this callback. Following this rule enables us not having to worry about whether to define a method with a thin or fat arrow – which is otherwise tricky since the right choice here is external to the class we are writing.

More Reading

Karl Seguin – Ten Features I Like About CoffeeScript

Michael Kramer - The Simplified Fat Arrow Guide for CoffeeScript

Azat Mardanov - Understanding Fat Arrows (=>) in CoffeeScript

Giang Nguyen - Coffeescript: Fat arrow vs thin arrow