modesetting instead of xf86-video-intel plus benchmark

Today I stumbled upon this reddit-article.

It speaks about using the modesetting driver shipped with xorg instead of the xf86-video-intel driver. I did a benchmark with the xf86-video-intel and the modesetting driver to see which performs better in order to decide if I will drop xf86-video-intel. Here are the results:

Unigine-valley Basic preset @xf86-video-intel:

FPS: 14.4
Score: 604
Min FPS: 8.2
Max FPS: 33.1

Unigine-valley Basic preset @modesetting:

FPS: 23.5
Score: 984
Min FPS: 11.8
Max FPS: 40.3

It doesn’t really matter what hardware I’m using, all that matters is that the situation improved. But for reference: Intel HD Graphics 5500.

So my choice is simple, I’m ditching xf86-video-intel in favor of using modesetting, which was already installed on my system together with xorg-server.

backlight issue

because of the switch to modesetting driver the xbacklight utility does no longer work. Using a xorg config file with the Backlight option set to intel_backlight also does not work as a workaround. So I installed light-git (from the AUR) which allows me to control my laptop backlight once again.

Goodbye Firefox (at least for now)

Because of things like this I will stop using Firefox today. The article I linked to is about the file picker in Firefox, which is really lacking in many areas. My particular use case is as follows:

I use dropbox camera uploads to upload each and every photo/video I take. So on my laptop I have a folder containing thousands of photos and videos named in a “Y-M-D H.M.S.jpg” format. Now when I want to upload a few photos via Firefox, I do not get a thumbnail/preview for a jpg if the file is larger than 2MB(or has it got to do with a longest side of over 4096 pixels? either way no preview for me…). Another fun fact: 99% of my photos is larger than 2MB. So in order to find the photo that I want to upload I have to open up a file explorer and search in thousands of photos. Then I have to remember the name in the awkward format. Then I can head back to FF in the hope I still remembered the filename. This effort is only for uploading one photo… Imagine when I want to upload more than one photo. In short, usability is hard to find in Firefox when uploading photos.

For me this one (little?) thing is so annoying that FF is no longer usable for me. This annoyance have been present for over 10 years now!

Well done Firefox developers!

Maak een Ubuntu 16.04 live usb-stick met Rufus

Ubuntu 16.04 LTS is op 21 april 2016 uitgekomen. LTS staat voor Long Time Support en daarom is dit een versie van Ubuntu die het waard is om de komende tijd te gebruiken door middel van een live usb-stick.

Met Rufus een Ubuntu 16.04 LTS live usb-stick maken

Dit artikel legt je uit hoe je met behulp van Rufus een Ubuntu 16.04 live usb stick maakt. Volg de stappen:

  1. Ga naar www.ubuntu.com
  2. Klik op Download (rechtsboven, links naast zoekveld)
  3. Klik op “Ubuntu Desktop >”, je komt nu op een pagina waar staat Ubuntu 16.04 LTS
  4. Klik dan op de oranje Download knop
  5. Nu willen ze dat je gaat doneren, scroll helemaal naar beneden en klik op “Not now, take me to the download”
  6. De download start in paar seconden
  7. Ga naar https://rufus.akeo.ie
  8. Scrol een beetje tot je Download ziet en kies dan voor Rufus 2.8 Portable
  9. Start rufus. Er wordt gevraagd of je online wilt zoeken naar programma updates. Klik maar op nee. Het programma start verder op. Doe je usb stick van 4GB of groter in je computer… even wachten tot je computer de usb stick herkent.  Kies je Apparaat (usb stick) in de eerste dropdown, vul de rest in zoals de afbeelding weergeeft. Het veld Clustergrootte wordt automatisch ingevuld. Klik op het icoontje met een cd+drive om te browsen naar de ubuntu-16.04-desktop-amd64.iso. Het veld Nieuwe volumelabel wordt nu automatisch ingevuld.
  10. Druk nu op Start.
    afbeelding van Rufus waarmee een Ubuntu 16.04 LTS live usb stick gemaakt wordt
    Rufus instellingen om een bootable Ubuntu 16.04 LTS live usb stick te maken

    (Het kan zijn dat er gevraagd wordt om een paar bestanden te downloaden die met syslinux te maken hebben, klik dan op Ja, zodat rufus deze automatisch voor je download.)
    Er wordt nog een laatste keer gevraagd of je echt wilt doorgaan, klik op OK als je zeker weet dat je het juiste apparaat hebt geselecteerd.

 

Start nu je computer opnieuw op en start op vanaf de usb stick die je net hebt gemaakt door in je bios de boot order zo in te stellen dat je USB device bovenaan staat. Sommige computers geven ook een boot optie aan om tijdens het booten eenmalig de opstart disk te kiezen, dit is handiger dan de vorige optie omdat je nu geen bios instellingen permanent hoeft te veranderen.

partclone restore exit error

Over the last three years I have made a lot of disk clones with clonezilla. I did this before reinstalling another OS or just to backup, but I always did it quickly. That means I just cloned the disk and never looked at it again. I only had to restore two or three times.

The problem is that because I did not really document anything about what is in the image, I now have no clue if I still want to keep image X or image Y. I need to see what is in the images…

So I’m restoring  images by cat’ing together the compressed pieces of my images and decompressing them and piping that stream into partclone restore utility.

Now I keep getting this very obscure error:
Partclone v0.2.80 http://partclone.org
Starting to restore image (2013uncompressed.img) to device (2013.iso)
UID is root.
source=2013uncompressed.img, target=2013.iso
open source file/device 2013uncompressed.img
open target file/device 2013.iso
device (2013.iso) is mounted at
error exit

I have no clue what to do with that. So I downloaded an old version of clonezilla that contained the same version of partclone that the cloned image was made with. That gave the same error. Then I found an answer on askubuntu with zero rating. Just create the file first before you issued the partclone.restore. So to summarize:

touch /dir-to-new-image/partition.img
sudo cat /dir-to-images/partitionname.gz.* | sudo gzip -d -c | sudo partclone.restore -C -s - -O /dir-to-new-image/partition.img

So in the end this was super easy and I did not even need a clonezilla live usb. I could just do this from arch linux using partclone 2.80.

Thanks to:

Are you copy pasting too? Maybe this is something for you then! COPYDROID

Copydroid Mascotte
The fierce Copydroid

Today I finally released my android application called Copydroid. Copy-what? Yes Copydroid, as the name implies this is an android application that copies something.

So let me explain to you what this app does: it lets you copy and paste between your computer and android device! How cool is that? No more e-mail sending or android cable searching to quickly transfer some text from phone to computer. You can now install Copydroid on your android device and a client on your desktop/laptop and setup a link between these two. After setting up you are ready to go! Just type some text on your computer, select it and copy it (CTRL+C!!!)… voila the text is now available on your phone or tablet or whatever android device you have that is connected to the internet.

It also works the other way around, so you could select for example a link in your favorite android browser, copy it. Go to your computer if you are not allready sitting in front of it and then paste (CTRL+V).

How nice is this? I already like it a lot, that’s why I made the app!

The app is available at the Android Market a.k.a. Google Play:

Update 08-03-2016: At the moment this app is unavailble because I have no time to maintain it.

GrabIt – Repair it – out the name of the par2 file from the command line

Is your GrabIt newsgroup leecher not unpacking your downloads anymore? Does it flash the following warning at the bottom of the screen:

Repair it - out the name of the par2 file from the command line

If you have this problem, then I have your solution! Check your download folder and see if any foldername ends with “.par2” or “.PAR2” or “.par” or “.PAR” or anything like that. If you found folders ending with “.par2” you should remove that from the folder name, so just rename it and remove the .par2/.PAR2/.par/.PAR from the folder name. It is a folder and not a par file, so it should not have this extension in the folder name.

Note: You should only change the foldername when GrabIt is DONE downloading/extracting, or change a folder name GrabIt is not currently using to download to or extract from. If you do this anyways you will mess things up and I will not take responsibility for it…

When you resolved all folder names to be without .par(2) extensions the repair and extract now functionallity will once again work like it has before!

What GrabIt does is checking all files/folders in the download folder and checks to see if the file/foldername has some kind of .par extension. Because it can’t handle a folder to use as par file you will receive the error message stated above.

Good luck resolving your problems!

Happy downloading!

Server refused our key

I have been trying all day to set up SSH keys on a linux server and Windows 7 client, finally with succes.

The way I managed to finally do it is like this:

  1. Log into your linux server
  2. Type:
    ssh-keygen -t dsa
  3. Accept default filename
  4. Provide a strong passphrase
  5. The keygen will create two files: id_dsa.pub, and id_dsa. The first one is the public key (.pub), the second one it the private key, copy this to your Windows 7 client.
  6. While stil on your server, now put the contents of id_dsa.pub into ~/.ssh/authorized_keys
  7. Make sure you
    chmod 600 ~/.ssh/authorized_keys
  8. Now move to your Windows 7 client and run puttygen.exe
  9. Load the id_dsa you have copied from the server
  10. Enter the passphrase
  11. Now use the save private key button to save the private key in putty .pkk format
  12. Now open putty and go to: Connection » SSH » Auth and browse for the .pkk to use as private key
  13. Now click open and you should be able to login into your server without the text: Server refused our key

If you followed the above and it still shows the text: Server refused our key, just read on…

Bonus steps that might solve your problem:

  1. In your server console issue the command: hostname
  2. Your hostname will be shown now, write it down or remember it
  3. Now start putty and in the Host Name (or IP address) input field enter that hostname (I am assuming you have allready set up a working hostname)
  4. With the .ppk selected as in step 11 press Open and you will be able to login without the text: Server refused our key

The first 13 steps are quite obvious, but it took me some time to notice that you really have to use the hostname. Before when I was just using a local IP address like 192.168.178.100 I could still login with putty, but the key would not be accepted, now that I’m using my hostname I can succesfully login on the server. There are a lot of tutorials like this one on the web, but none of them told me to use the hostname you have set up on your server!

PHP Singleton

Singleton Design Pattern for PHP5.3

I would like to share a very simple Singleton class with you. I’ve created this long time ago, but since I decided to continue blogging again, I will just copy paste this with some explanation to make a start at blogging again:

First take a look at the code, then read the explanation that follows.

<?php
/**
* Very simple Singleton object
*
* @author Dino Hensen
*
*/
abstract class Singleton
{
/**
* Member variable holding an Singleton instance
*
* @var Singleton
*/
protected static $_instance = null;
/**
* Returns new or existing instance of Singleton.
*/
final public static function getInstance()
{
if(null === self::$_instance) {
self::$_instance = new static();
}
return self::$_instance;
}
/**
* Prevents external object creation
*/
final private function __construct() { }
/**
* Prevents object cloning
*/
final private function __clone() { }
}
?>

Singleton code Explanation

A class for which you want only one instance to exist at all times is very common in software systems. It is called a Singleton!
A Singleton design pattern ensures that it is never possible to create more than one instance of a class that extends the Singleton class defined below.

By using a private constructor you ensure that no other class will be able to create an instance of Singleton class. By adding final to all functions you ensure that no extending class will be able to override this functionality and thus hack your Singleton class.

The getInstance function works as follows: the first time the function is called a Singleton object is instantiated for which protected static $_instance holds a reference to this object. The next time you call getInstance the instance already exists so the reference to the instance is returned. Remember, PHP5 does not pass objects by-value anymore, but instead passes by-reference.

Notice

The Singleton code relies on using PHP5.3 because of something called late static binding.

self::$_instance = new static();

new static() in PHP 5.3’s late static binding refers to whatever class in the hierarchy which you call the method on. We need this because PHP needs to know which object to instantiate, that is a ‘Singleton’ or ‘Boss’ object. You can read more about late static bindings at: http://www.php.net/manual/en/language.oop5.late-static-bindings.php

Usage

And this is how you use it:

<?php
require_once "singleton.class.php";
class Boss extends Singleton {
/**
* Returns a bossy text
* @return string
*/
public function whoIsTheBoss()
{
return "I am the boss!";
}
}
$boss = Boss::getInstance();
echo $boss->whoIsTheBoss();	//I am the boss!
?>

You can create a new class which extends Singleton and give it some functionality. Then you can create the object using the public static getInstance function which returns a reference to a Boss object. You now safe the reference in the variable named $boss. When running the code it shows you who’s the boss!

PHP Tutorial 2 – Basic syntax

Hello this is tutorial #2!

This tutorial will teach you basic PHP syntax. Any PHP scripting block always starts with <?php and ends with ?>, although some server configurations allow <? for a starting tag, I recommend always using <?php as a starting tag for maximum compatibility. So we always start and end like this:

<?php
//some code here...
?>

In my code fragment above you might have noticed ‘//some code above‘ The two forward slashes mean a comment is following. This kind of comment is called a single-line comment and is terminated when you insert a newline character.
For multi-line-comment use this construction:

<?php
/* Multi Line Comment started...
You can continue on this line...
and even on this line...
But after the multi line comment stop, things you type will be interpreted as code again
*/
echo "This is a little bit of code that will be executed";
// echo "This line wont be executed because it's commented!";
// So after the */ you can type code again
?>

So now that you know basic php syntax for starting and ending a php scripting block, I will finally introduce you to using variables! Continue reading PHP Tutorial 2 – Basic syntax