Steenbe.nl

Jun/10

18

Ubuntu: Ctrl-Alt-Backspace X restart

Ever since Ubuntu 9.04, one can no longer press the Ctrl-Alt-Backspace to force a restart of X by default however Ubuntu luckily offers a easy way to restore this functionality.

* From the main menu select “System”->”Preferences”->”Keyboard”
* Next choose the “Layouts” tab and hit the “Layout Options” button.
* Look up “Key sequence to kill the X server” extend it and enable the checkbox “Control + Alt + Backspace”.

· ·

Like many other web developers I am not working an a windows box but prefer a Linux or Mac OS X machine hence I primary write and test all my code under Firefox and Chrome. Internet Explorer’s global market share still accounts for > 50% so I use the IE Application Compatibility VPC Images provided by Microsoft in combination with VirtualBox to test whether my coding is compatible with Internet Explorer.

However my friends at Redmond have forgotten to included the Windows password on their website so I did a little bit of Googling and found the answer ..

username: IETester
password: P2ssw0rd

· · · · · · · ·

Ubuntu 9.10 / 10.04 offers you the new option to turn off or turn on Bluetooth from the Bluetooth icon in top panel. This makes life a lot easier but what I real want is an option in the preferences of indicator panel to disable Bluetooth at system startup.

The best way I discovered to disable Bluetooth at start up was to use rfkill
Navigate to System> Preferences> Startup Applications and add the following line
sudo rfkill block bluetooth

To unblock:
sudo rfkill unblock bluetooth

Enabling/disabling the wireless network can be done just as easily:
sudo rfkill block wifi

To unblock:
sudo rfkill unblock wifi

The man page of rfkill says it can also handle UWB, WiMax and GPS but you will have to tried those yourself since my laptop does not include these technologies..

· · · · · ·

May/10

23

Save A File In Vim / Vi Without Root Permission

To save a file, simply type the following command:
:w !sudo tee %

:w – Write a file.
!sudo – Call shell sudo command.
tee – The output of write (vim :w) command redirected using tee. The % specifies the current open file. In other words tee command is run as root and it takes standard input and write it to a file represented by %. However, this will prompt to reload file again (hit L to load changes in vim itself)

· · ·

May/10

16

Optimizing Canvas pixel manipulation

During experiments of my master’s thesis I found out that the performance of Canvas that a noise dive when I tried to rotate an image with a grayscale or inverted colors effect applied. Selim Arsever came up with the following code to improve performance with according to his claims 40%.

canvas = document.getElementById("canvas");
context = canvas.getContext("2d");
image = context.getImageData(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
var pixels = SCREEN_WIDTH*SCREEN_HEIGHT;
var imageData = image.data; // The hack: detaching the pixels array from DOM
while(--pixels) {
    imageData[4*pixels+0] = r; // Red value
    imageData[4*pixels+1] = g; // Green value
    imageData[4*pixels+2] = b; // Blue value
    imageData[4*pixels+3] = a; // Alpha value
}
context.putImageData(image, 0, 0);

· · · · ·

Apr/10

23

Video – High Performance JavaScript

Nicholas Zakas, Stoyan Stefanov, Ross Harmes, Julien Lecomte, Matt Sweeney giving a talk on High Performance JavaScript at Yahoo YUI theather

· · · · ·

Ubuntu Opportunistic Developer Week Result

Starting last Monday the developer week resulted in a better understanding of python/glade/pygtk with the ‘QuicklyUI’ program as a result.

Quickly:
Given the richness and variety of the Linux platform, programming on Linux should be easy and fun. However, it's not easy and fun because it is too hard to learn. It is too hard to learn because there are too many choices, and too much information to wade through. Quickly strives to make programming easy and fun by bringing opinionated choices about how to write different kinds of programs to developers. Included is a Ubuntu application template for making applications that integrate smoothly into the Ubuntu software infrastructure.

I decided that it needed a tool for starting programmers to learn the commands via a GUI, so I build QuicklyUI. It basically is a terminal with buttons that print the commands for you. So instead of typing “quickly run” all the time you can press the button “Run” and it will send the command to the terminal.

It sure isn’t perfect and complete but i have used it to develop itself.

QuicklyUI Bar

This is the main view of the QuicklyUI, a small bar containing the buttons you need (hardcoded now but should use the API).
Run,Save,Release,Share|Edit,Design|Log,Todo|Terminal,Settings,Help
The Log button prints out the Bazaar log to see what has happend and the Todo does a search in all the files for TODO: or FIX:.

QuicklyUI with Terminal and Settings
Coding without a terminal is possible, but most of you will want one. And there is a settings button to change project and in the future other settings (for example license of the program).

QuicklyUI showing Todo/Fix and settings
And a small example of the Todo button.

I only worked for 5 hours on it without any prior knowledge of Python or Glade so it is a bit hardcoded and ugly but it works.

On the TODO list of this app are:
- use the Quickly API instead of hardcoding
- learn why VTE terminal cannot fork the command quickly and some parameters (vte.fork_command(“quickly”,["run"]) doesn’t work
- Implement all buttons correctly (Save has no GUI for a message but uses the terminal)
- Add the Python Documentation link that Glade has
- GUI for the log/Todo instead of printing in Terminal
- Option to use the quickly branch code and PATH setter

No tags

Feb/10

27

Howto: Install the latest stable Firefox on Ubuntu

One of the minor issues I had as web developer with every Ubuntu release is that whenever a new stable version of Mozilla Firefox it is made available
via the package manager until a new version of Ubuntu is released every 6 months. Since I am very impatient and always anxious to try out the latest features and greatest what web technology has to offer I want to upgrade my Firefox earlier than the official Ubuntu release cycle.
Luckily this is actually quite easy using the PPA system just follow this instructions and you will be always be guaranteed to have the latest version of Firefox running on your Ubuntu box

1. Add the PPA of the Mozilla stable
$ sudo add-apt-repository ppa:mozillateam/firefox-stable
or alternatively if you want the latest nightly build:
$ sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa
2. Next we ask the package manager to update itself and install Firefox 3.x again (where x is the latest stable version)
$ sudo apt-get update && sudo apt-get install firefox-3.x && sudo apt-get upgrade

· ·

Feb/10

21

Ubuntu 9.10: Installing Komodo Edit

Ubuntu 9.10: Installing Komodo Edit

After using numerous editors on various operating systems I think I have found my new favorite editor although it’s not a small editor in filesize it does do everything I want from a editor after some tweaking. You might ask what on my list of must-haves for any editor well:

* Syntax highlighting for the most common programing languages
* Code folding and completion
* Tabs for navigating between files
* File browser and server support e.g FTP, SFTP and FTPS so I can directly edit on a server

Nice to have
* Cross platform support since I use OS X, Ubuntu and Windows when ever it suits me
* Open Source so features that users want will eventiually end up in the program
* VI-emulation to keep those skills up to a descent level
* Active community that can provide you with assistance if needed

Komodo Edit hits all of these boxes for a full overview have a look here

Installing Komodo on Ubuntu is done old-school style with a manual install instead of a nice DEB package.
Like me a lot of Komdo users are still waiting on a nice PPA or respository since this will make upgrade to a newer version a lot easier.

Get your copy of the program from http://www.activestate.com/komodo_edit/downloads/

From your download directory use the following terminal command to extract it if you not using the archive manager
$ gunzip -c name_of_komodo_linux_package.tar.gz | tar xopf -

The above command will extract the contents of the compressed file to a new directory with that name of the package
Next to install just run installer on execution of the insatller you will be asked for the installation directory where you want to put the program
$ ./install.sh

· ·

Nvidia setting, the tool I used to configure my graphics card to do dual screen, kept on giving my a “Failed to parse xorg.conf” and it crashes with a segmentation fault. After some digging on the Web the fix was relatively straightforward:

1. Make a backup of the current X11 configuration file
$sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
2. Remove the current X11 configuration file completely
$sudo rm etc/X11/xorg.conf
3. Now will will use nvidia-xconfig tool to recreate a new X11 config file that nvidia-settings can parse
$sudo nvidia-xconfig
4. Start nvida-settings and change you display settings saving to xorg.conf should now work out of the box
$sudo nvidia-settings

· · · · ·

Older posts >>