Weekend project based on youtube-dl

youtube-dl is a great open source project. It works with quite many web sites and is very simple to use.

But I don’t seem to have it installed most of the times when I need to save some youtube, facebook or ted video for inspiration later on. After getting offended by the crazy web apps on the internet for this simple purpose, I wrote my own:

It’s simple and with no ads or any hassle. Better yet, wget is always installed on macbooks and ubuntus. So you don’t even need to use the browser. Just type this on your command line:

$ wget<URL HERE> -O video.mp4

and it will save the file to video.mp4. Simple.


Posted by on January 20, 2015 in annoyances

Leave a comment

Window Phone 8 development on a Macbook

Quite amazing that Microsoft has put Windows 8 as a requirement for Windows Phone 8 development, and on top of that you need a “modern” computer, modern here really means a computer with a CPU which supports hardware assisted virtualization. Namely such features as:

1. 64-bit processor that supports Second Level Address Translation (SLAT)
2. Extended page tables
3. VMX, XD ..
4. blah blah …

full list here:

My macbook does support all of these, but I don’t really want to install Windows 8 on it. I would rather get a Surface pro when it comes out. This macbook stays as it is. So I choose the option of running Windows 8 in VMWare.

Install VMWare player, and for the new Win8 virtual machine make sure you give it following VM settings:

1. Settings -> CPU and memory -> Advanced: checked “Enable hypervisor applications in this virtual machine”
2. Settings -> CPU and memory: alteast 2 cores, I had a i7 Quad core, so I gave away 4 cores. and 4 GB of RAM.
3. Settings -> Advanced: Preferred virtualizationn engine: Intel VT-x with EPT

After you are done with the installation of Windows 8. Stop your VM, close VMware player, look for the .vmx file for your Win8 VM and do this:

Add or check that the following lines are present in .vmx file:

hypervisor.cpuid.v0 = “FALSE”
mce.enable = “TRUE”
vhv.enable = “TRUE”

All this info from here:

Once you are done, proceed with installing the WP8 SDK.

So after this the emulator will run. I placed all the VM files on my SSD so things were not that slow. But it seems Windows 8 has problems with some old Zyxel access points. I just replaced it with a newer Buffalo one and emulator had no network issues after that.


Posted by on November 6, 2012 in programming, Windows Phone

Leave a comment

Tags: , , ,

Sublime Text.

If you are going to buy just one software this year. Make it Sublime text.

You can buy it at

for example, consider the multiple selections feature offered by sublime text:

Multiple selections let you make sweeping changes to your text efficiently. Any praise about multiple selections is an understatement. This is why:

Select some text and press Ctrl + D to add more instances. If you want to skip the current instance, press Ctrl + K, Ctrl + D.

If you go too far, press Ctrl + U to deselect the current instance.


Posted by on August 15, 2012 in programming

Leave a comment

Tags: ,

Insane to the power of (

Lately I was looking for a new challenge. So I started writing a 2D game, with XNA it proved to be very easy task. Just a bit mundane, but quite easy. Not satisfied by the challenge I came across something at work which is proving to be a worthy adversary: Scheme, the programming language.

Let me present a small code sample from Scheme:

	(public (cleanup f)
		(let loop (( i (length internal-stack) ))
				((= i 0) )
				(else (f (pop)) (loop (- i 1) ))

That is how a loop is done in scheme! And people complain about the C++ syntax and the use of curly braces.


Posted by on July 24, 2012 in programming

Leave a comment

Tags: , ,

Animations in Windows Phone, from a Qt Quick developers perspective.

Coming from QtQuick the XML nature of XAML feels like too much noise. What in QtQuick takes a couple of neatly arranged lines, takes a bunch of XML with so much boilerplate code.

The idea for using XML for everything needs to be killed. Microsoft should clean up XAML, learn from QtQuick.

Here is a simple example for fade in & fade out animation in a user control’s resources:








And to trigger these animations:

                        Storyboard fadeOutStoryboard = (Storyboard)Resources["fadeOutStoryboard"];
                        fadeOutStoryboard.Completed += new EventHandler((object fob, EventArgs args) =>
                            Storyboard fadeInStoryboard = Resources["fadeInStoryboard"] as Storyboard;

                            image.Source = aNewBitmapImage;


While XAML annoys me a lot, I enjoy using C#.


Posted by on March 22, 2012 in Windows Phone

Leave a comment

Tags: , , ,

Qeddit, reddit for Symbian & Nokia N9

I had earlier written a Qt based reddit client library, and now I finally got around to making the UI in QtQuick for both Symbian and Nokia N9. You can get a self signed sis file for Symbian at The Nokia N9 version I will also put there but later.

I am thinking of porting this version for both iPhone & Android, a reason to finally use the Qt ports for iPhone & Android. The code will also be open sources when I get around to it.

Here is the video demo, working on a Nokia 808 pureview using Nokia’s remote device access service for developers. The bad frame rate is because of video capture + using a remote device.


Nokia N9/N950:


Posted by on March 10, 2012 in nokia, Qt


Tags: , , ,

QtQuick style property bindings in XAML

XML makes every thing complicated. Things which are very easy and intuitive in Qt Quick require some google and reading documents which implementing in XAML. One of these is property bindings, while XAML has a good binding system for all sorts of things, it makes simple things a bit difficult.

So here is how to bind properties of two objects or controls in XAML:


Posted by on February 21, 2012 in programming, Qt, UI

Leave a comment

Tags: , , , , ,

Cross compiling samba-3.6.1 for ARM

After some googling I figured out how to compile samba for ARM, the device I am compiling samba for is “chumby one” ( look at to get the compiler toolchain for it )

Here are the steps:

1. Download the sources, obviously.
2. export these env vars on your build machine:

export LD_LIBRARY_PATH=/usr/arm-linux/lib
export LDFLAGS=-L/usr/arm-linux/lib
export CPPFLAGS=-I/usr/arm-linux/include
export CC=arm-linux-gcc

3. edit your configure file, look for this:

if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
# getaddrinfo is broken on some AIX systems
# see bug 5910, use our replacements if we detect
# a broken system.
if test "$cross_compiling" = yes; then :

change it to:

if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
# getaddrinfo is broken on some AIX systems
# see bug 5910, use our replacements if we detect
# a broken system.
if test "$cross_compiling" = no; then :

why this? more info here:
I made a guess and it works for me.

4. invoke the configure script like so:

./configure --host=i686 --target=arm-linux samba_cv_CC_NEGATIVE_ENUM_VALUES=yes ac_cv_file__proc_sys_kernel_core_pattern=yes --prefix=/mnt/usb/samba

5. edit the makefile, change this:

CPPFLAGS=-DHAVE_CONFIG_H -I/usr/arm-linux/include -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/popt -I/usr/local/include

to this:

CPPFLAGS=-DHAVE_CONFIG_H -I/usr/arm-linux/include -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/tevent -I./librpc -I./.. -I./../lib/popt

I am not a linux guru so I dont understand why it is including /usr/local/include when I am cross compiling, Samba project needs to fix these small issues, specially for ARM, with ARM gaining foothold in the server market.

6. run make


7. Copy files to chumby
I didnt do “make install”, obviously. i copied the bins in the /samba-3.6.1/source3/bin in the samba source folder on build machine to /mnt/usb/samba on chumby

scp * root@CHUMBY-IP:/mnt/usb/samba/

8. update the LD_LIBRARY_PATH on your arm device, chumy in this case.

export LD_LIBRARY_PATH=/mnt/usb/samba:$LD_LIBRARY_PATH

9. Test *

ssh root@CHUMBY-IP
cd /mnt/usb/samba

10. make some required folders in /mnt/usb/samba

mkdir private
mkdir var
mkdir var/locks

11. run smbd and give it the conf file

./smbd -i --configfile=/mnt/usb/samba/samba.conf -S

12. tip: use -d 10 for more incase of errors

./smbd -i --configfile=/mnt/usb/samba/samba.conf -S -d 10

13. you can put the samba.conf in /mnt/usb/samba/lib

mv /mnt/usb/samba/samba.conf /mnt/usb/samba/lib/

14. sample samba.conf file:

workgroup = WORKGROUP
netbios name = CHUMBY

path = /mnt/usb/samba_share
guest ok = yes
read only = no

path = /mnt/usb/torrents_share
guest ok = yes
read only = no

15. add samba user, we will use root since chumby comes with this only and there is no useradd command on the device.

smbpasswd -L -a root
smbpasswd -L -e root

16. test on other computers, enter root as user and password you set as the password.

Good luck, you are going to need it.

* works for me ….


Posted by on January 4, 2012 in Chumby, programming


Tags: , , ,

Pakistan shutdown to mourn Nusrat Bhutto

Monday declared as a holiday and 10 days mourning period announced. 99% of the population does not know who she is. No need to even discuss that the people in power consider Pakistan as their personal state and make such childish decisions all the time.

This was also the front page news on Dawn. Which considers itself very liberal and forward thinking. We can think what ever we want about ourselves, it does not change the reality.

May she rest in peace.



Posted by on October 24, 2011 in pakistan, stupid

Leave a comment


Windows Phone app development and the significance of DSLs.

Computers were supposed to do all the work for all humans, but as programmers we often neglect that very basic purpose of these machines. So we go on writing code doing every little bit ourselves, sure there are libraries to do some of that but using libraries does not really solve the problem. Good design for software is important, but we should not be designing and thinking how to write code when we want to download a file from network, when we need to parse an XML file, or any other easy but mundane task.

I have always thought about domain specific languages as a way to not only boost productivity but also free our thoughts from these small menial and mundane tasks. I am so excited about domain specific languages that I have thought numerous times to continue some research studies in this area. Sadly I havent been able to find any good place yet in Helsinki.

QML or QtQuick is an excellent DSL for creating nicely animated user interfaces, not just for desktop computers but also for mobile devices. The productivity boost is immense, I wrote complete applications in Qt Quick in weeks which even iPhone developers took months to write. Still more wild that the Qt Quick app ran fine on N900, N8 and other Nokia Qt devices. Since that time I have been hooked on Qt Quick. I havent found a better DSL for UI’s than Qt Quick. It is so simple, no crazy xml syntax like in XAML. XAML might be more powerful but the power is lost in its complexity and IMO bad idea of using XML.

The second experience of DSL came with LINQ when I wrote my first app for Windows Phone. I had previously done similar app on Android, iPhone and Qt/Symbian where I needed to parse huge XML documents, so I had to spend weeks just to write the code to handle the SAX events and create a state machine. This code was fragile and just too much work. Thank god for json.

Coming back to the point, the experience of parsing XML with LINQ was quite the opposite, it was … pleasant and enjoyable. I was amused by the speed at which I wrote the code and how simple it was. It all made sense.

I think Microsoft is on the right path. They already have two DSL’s incorporated in Windows Phone development, writing apps therefore for WP is quite easy and fun experience.

I hope in the future DSL’s will become even more common and we will have write apps in DSLs which are then glued together by a general purpose language.


Posted by on July 27, 2011 in creative, nokia, programming, Qt

Leave a comment

Tags: , , , , , ,