Freitag, 17. Februar 2012

No need for temporary variable (Javascript)

Assume you have a function, and that function has a param (called 'config' herein) which may be a string or an object. Inside your function, you check for the type and if it's a string, you want to make this strings value a property of your object.

My first, fast approach was this one:
var url = config;
config  = {};
config.videoLink = url;

My second approach looked like this:
var url = config;
config  = {videoLink: url};

I thought about what's happening in those statements and realized that the temporary variable 'url' is not needed, because javascript is executing the assignement from right to left, means I can override 'config' with an object that keeps the original value of config as a property. See this third & final approach:
config = {videoHash: config};

So Javascript builds the object, assigns the value of config (string) to videoHash and assigns this object to config, which now is a object as desired.

Mittwoch, 1. Februar 2012

xfce4-screenshooter 1.7.9 - Segmentation Fault on startup

When starting xfce4-screenshooter, there's an segmentation fault message and it (of course) doesn't start up. The solution is pretty simple:

touch ~/.config/xfce4/xfce4-screenshooter

Source: http://www.linuxquestions.org/questions/slackware-14/where-to-get-xfce4-8-goodies-etc-885538/#post4382696

Samstag, 21. Januar 2012

wicd-gtk / wicd-client (tray) not starting, glib.GError: Unable to connect to server

Start wicd-client with '-n' - disable notifications and everything is fine. See source below if you want to use notifiations:

Source: https://bbs.archlinux.org/viewtopic.php?id=108666

Freitag, 13. Januar 2012

Headphonejack not working on x121 w. Slackware 13.37 - Kernel 2.6.37-6

Use alsaconf to create config file. Edit the created config file /etc/modprobe.d/sound.conf , add the following line:


options snd-hda-intel model=thinkpad

Save and either reload modules or reboot.

Montag, 9. Januar 2012

Montag, 2. Januar 2012

Building latest Chromium on Slackware

Nice Slackbuild on Github, frequently updated:
https://github.com/yucatan/chromium

Edit: Don't forget to replace make with make -j2 in file chromium.SlackBuild on a dualcore system to use both cores. :)

Sonntag, 1. Januar 2012