Smokes your problems, coughs fresh air.

Category: Technology (Page 40 of 47)

My Window Maker “desktop” configuration

During the ten years of my love-hate relationship with X-Windows, I’ve often tried and enjoyed using full-fledged desktop environment (starting with KDE and later sometimes GNOME too), but, given time, I always gravitate back to WindowMaker.

XTerm

I’m not so big on the whole desktop metaphor thing. The longer I’ve been using Unix-like systems, the more dependent I’ve become on the command-line. My current Window Maker configuration is a testimony to this. If you look at my Main Window Maker Workspace, you’ll notice that I actually use an Xterm instead of a desktop. Also, I don’t have a wallpaper. No wallpaper, no icons: I just want my prompt, in a nice font.

I despise graphical file managers. It feels like having to type without fingers. I’m not advocating the use of a command-line shell for new users or anything but for somebody like me who is used to calling programs “by hand”, a GUI is pure torture. With a GUI, I end up having to find a specialized program for a lot of mundane tasks which can be accomplished in Bash with a simple loop and a few filters. Renaming a few hundred files springs to mind.

My Main Window Maker Workspace

My Main Window Maker Workspace

GNU Screen provides for “tabs” in my XTerms and some other features I’ve come to depend on. That’s why, upon login, my Main Workspace appears with xterm -e screen already started. The Windows Key + T fires up another XTerm with a fresh screen session. If I want to attach to a previous Screen session, I use Window+Shift+T. This starts an XTerm without Screen.

Starting applications

I don’t like the applications menu, but I’ve added a few applications to it anyway to be able to bind short keys to them (Win+F for Firefox and Win+T for XTerm). When I want to start any other application, I use the run dialog (bound to Win+R) or I execute the app from an XTerm window. I don’t usually start applications by clicking their App Icon.

File viewers (such as Mplayer, Gliv, Okular, xlview, and wordview) are always started from an XTerm or from Firefox, because that’s where all my file arguments originate. These apps don’t need App Icons, especially because I don’t see them as belonging to any particular workspace.

All keyboard shortcuts

Instead of Alt, I use the Window key (Mod4) a lot for my keyboard shortcuts.

cat /home/bigsmoke/GNUstep/Defaults/WindowMaker |grep -i key|sed -e 's/^\s*//'|sort
CloseKey = "Mod4+Q";
FocusNextKey = "Mod4+Tab";
FocusPrevKey = "Shift+Mod4+Tab";
HideKey = "Mod4+H";
HideOthersKey = "Shift+Mod4+H";
HMaximizeKey = None;
LowerKey = "Mod4+Down";
MaximizeKey = "Mod4+M";
MiniaturizeKey = "Mod4+period";
ModifierKey = Mod4;
MoveResizeKey = None;
NextWorkspaceKey = "Shift+Mod4+Right";
PrevWorkspaceKey = "Shift+Mod4+Left";
RaiseKey = "Mod4+Up";
RootMenuKey = "Mod4+A";
ScreenSwitchKey = None;
ShadeKey = "Mod4+minus";
ToggleKbdModeKey = None;
WindowListKey = "Mod4+W";
WindowMenuKey = "Mod4+Escape";
WindowShortcut10Key = None;
WindowShortcut1Key = "Mod4+1";
WindowShortcut2Key = "Mod4+2";
WindowShortcut3Key = "Mod4+3";
WindowShortcut4Key = "Mod4+4";
WindowShortcut5Key = "Mod4+5";
WindowShortcut6Key = "Mod4+6";
WindowShortcut7Key = None;
WindowShortcut8Key = None;
WindowShortcut9Key = None;
Workspace10Key = None;
Workspace1Key = "Mod4+F1";
Workspace2Key = "Mod4+F2";
Workspace3Key = "Mod4+F3";
Workspace4Key = "Mod4+F4";
Workspace5Key = "Mod4+F5";
Workspace6Key = "Mod4+F6";
Workspace7Key = "Mod4+F7";
Workspace8Key = "Mod4+F8";
Workspace9Key = None; 

One annoyance is that, when switching through the Windows in the current Workspace (in my case, with Win+Tab and Win+Shift+Tab), doesn’t disappear unless an additional key press is given (such as an extra Tab).

Another annoyance is in my configuration. My keyboard has some space after every 4 function keys. Also, like always, the function keys are a bit far removed from the home row on the keyboard. So, I should consider switching through workspaces with Win+1 through Win+7 instead of Win+F1 through Win+F7. I’ve now bound the Win+<number> keys to a Window 1 to 10, but this seems to be terribly broken anyway in Window Maker (I can only switch to the first window in the first workspace this way). Also, I probably wouldn’t use it even if it did work, unless if they displayed the window numbers on the app icons or something and if they did the numbering on a workspace basis instead of globally. So, I’m probably going to change this soon.

My Window Maker Workspace for Audio

My Window Maker Workspace for Audio

Workspaces

One of the things I’ve always like about X Window Managers is the support for multiple virtual desktops, called Workspaces in Window Maker. I use topical workspaces, one workspace per application category. It’s possible to configure app icons to always start the application in the correct workspace regardless of where it is started from. My Workspaces are called Main, Audio, Video, Down, w3dev and Image.

If I want to look at my downloads, I know that I just have to switch to Workspace 4 (Down) regardless of what I’m downloading. The same goes when I want to switch a song (be it in Mplayer (in an XTerm) or in the Last.fm Player): I press Win+F2.

Here’s a list of all the app icons divided over my different workspaces:

  1. Main: Window Maker Preferences, Google Earth, Skype, Filelight
  2. Audio: Rosegarden, Audacity, Hydrogen, Last.fm, Grip, Ardour, ReZound, Gnaural
  3. Video: Cinelerra
  4. Down: BitTorrent, uTorrent, Transmission
  5. w3dev: MSIE, Konqueror
  6. Image: Krita, Inkscape, GIMP, Color Schemer Studio

I have a widescreen laptop, so I display all these per-workspace icons (with the Clip) vertically at the top left. At the bottom left I display the “Icon List”. This is used by WindowMaker for icons that are not already in the Clip or in the Dock.

At the right I display the dock with the XTerm icon and the Firefox icon. There’s also an Emacs icon there from the time that I wanted to learn Emacs. (Sadly, I know VIM too well to change.)

Below that, also at the right, are the Dock Apps: wmsystray, WMWiFi, wmmixer, WMitime, wmbattery, and of course wmMoonClock.

Why Window Maker

With all this reluctance to click on icons, you’d wonder if I wouldn’t be better of trying something more keyboard centric such as StumpWM (the successor of Ratpoison).

If I will, I’ll let you know.

Mounting a MediaWiki installation with WikipediaFS for FUSE

Another one of those I-wish-I-had-blogged-about-this moments: I wanted to bulk-edit some pages in my Dutch Hardwood Wiki and I knew I had previously done some scripting using a FUSE filesystem for MediaWiki. However, I didn’t remember the name of the filesystem I had used before. Searching for “mediawiki fuse” didn’t help in any way.

I found the link again in the Wikipedia meta-space. Now that I know that it’s called WikipediaFS and not something like MediaWikiFS, I remember that this was the exact same problem as the last time when I was looking for this. But, alas, I’ve blogged about it now, so now I can safely forget the name again. 🙂

Extracting the MP3 stream from a Flash Video (flv) file

I wanted to convert an Flash Video (flv) file from YouTube to MP3. The first tip I found essentially streamed the original file into a different file:

ffmpeg -i filename.flv -acodec mp3 -ac 2 -ab 128 -vn -y filename.mp3

This is a bit awkward, because not all flv files have the same quality (some are mono, for example). I don’t want to have to look up the number of channels (-ac 2 in the example) for each file that I need to convert.

Luckily, most flv files include an MP3 audio stream and ffmpeg can simply copy that stream to a new file:

ffmpeg -i filename.flv -acodec copy filename.mp3

This works perfectly and is much faster than the other method.

MediaWiki problems with MySQL VARBINARY padding

I have been wanting to protect a certain page on my Dutch 15Monkeys wiki for weeks. I could install the ReCaptcha extension already (the best Captcha there is), but it’s just that one page that’s being spammed. So far, I’ve been unsuccessful in regaining my Sysop right for that wiki. I need these rights if I’m going to protect these pages.

In the previous post about this problem, I reported how there appeared to be padding problem caused by a MySQL upgrade. Fixing the padding didn’t solve the problem, however. If I look at the user list in MediaWiki, I notice that MediaWiki doesn’t seem to like it that MySQL returns all the \0x0 padding characters on SELECT:

15Monkeys MediaWiki NL user list with unrecognized characters

15Monkeys MediaWiki NL user list with unrecognized characters

The same problem in the EN wiki

The same problem in the EN wiki

BigSmoke ‎(bureaucrat������, sysop�����������)

Repair was suggested by the check operation in phpMyAdmin. (CHECK TABLE `mw_nl_user_groups`) I couldn’t find a repair operation (only OPTIMIZE), so I tried that and I was told that it went ok. In the database structure view, the repair option was available ; when I tried to repair all the tables belonging to this installation, I was told for this particular table (and one other) “The storage engine for the table doesn’t support repair”. I found out that the reason this error didn’t appear the first time because it appears quite randomly. Sometimes it just silently fails in true MySQL style.

Googling for the error message produced the advice to dump and recreate the table. Then, when recreating the table from my backup didn’t work, I found out that REPAIR really isn’t supported for InnoDB. Only CHECK is. If you want to repair an InnoDB table, you use OPTIMIZE or you have to restart mysqld with the innodb_force_recovery option enabled.

Then, it turned out that I misinterpreted the MySQL documentation for the VARBINARY type, although I still can’t figure out how I am supposed to deduce this from said documentation. Anyway, if I UPDATE the rows, all I can achieve is that whitespace is converted to \0 characters. But, if I reinsert them without the padding, it does work. 😕 Go figure…

Wget one-liner

Earlier today, I wanted to download all songs by this totally kick-ass rap outfit:

wget -q -O - http://www.assheads.nl/dehuilenderappers/?p=nummers \
| sed --quiet -e 's#^.*<a href="\(nummers/.*\.mp3\).*$#\1#p' \
| sort -u \
| wget -i - -B 'http://www.assheads.nl/dehuilenderappers/'

The same command-line, now using GNU long options to increase readability:

wget --quiet --output-document=- http://www.assheads.nl/dehuilenderappers/?p=nummers \
| sed --quiet --expression='s#^.*<a href="\(nummers/.*\.mp3\).*$#\1#p' \
| sort --unique \
| wget --input-file=- --base='http://www.assheads.nl/dehuilenderappers/'

Silent change in URLs of Ruby on Rails svn repository

I don’t know why, but everything associated with Ruby on Rails seems to change all the time, without notice, or (in the case of URLs) without redirect.

We used http://svn.rubyonrails.org/rails for our svn:external deployment of rails 1.2.6. But that suddenly stopped working. The Ruby on Rails weblog doesn’t contain any information on it (that I can find), going to svn.rubyonrails.org with my web browser yielded just the front page of the weblog and Googling didn’t help much. That is, until I accidentally found http://dev.rubyonrails.org/svn/rails.

So, I changed the svn:externals from “rails http://svn.rubyonrails.org/rails/tags/rel_1-2-6/” to “rails http://dev.rubyonrails.org/svn/rails/tags/rel_1-2-6/” and now it works again.

WordPress feed pagination

Wiebe uses his author Atom feed to generate a list of his blog posts here on his own website. WordPress feeds only display the latest 10 entries. He has written 16 so far. What he needs is a feed with all his entries.

First, I tried if pagination works for feeds. Appending “/page/2” (as is used an non-feed lists) to a feed URL gives a 404 so I was kind of stuck there. Four days ago, after Googling for some time, unable to find a solution anywhere, I asked on the forum. Still no answer today so I tried to find out which parameters WordPress accepts in the QUERY_STRING. The WordPress Codex does explain how queries are handled but not which parameters are accepted.

Digging into wp-includes/query.php, with much trial and error, I found out that I can append ?paged=2 to the URL to get the next page. At least I got that sorted then. There are a number of much more promising parameters supported by get_posts(), but these don’t seem to be parsed by parse_query(). Next time, I’d like to find out how how to use two of these: nopaging and posts_per_page.

Wiebe could complete his list by merging together all the pages of the feed, but I’d much prefer to find a relatively painless method to produce a feed with an unlimited number of posts.

Notes

  • http://codex.wordpress.org/Query_Overview
  • http://codex.wordpress.org/Function_Reference/WP_Query
  • http://codex.wordpress.org/Template_Tags/query_posts

Using ROT13 to circumvent Gmail’s .exe filter

Wiebe reminded me by mail to send him a Windows executable. I use Gmail. Gmail doesn’t allow me to send archives containing .exe files. Something to do with viruses on Windows. Wiebe doesn’t use Windows. He uses Wine. I just want to send the damn executable.

Last time I wanted to do this, I emerged net-mail/email. But that just wasn’t very cool. A while ago someone also suggested using a password-protected zip file, but I find that even less cool because I hate zip files. (I usually prefer bzipped tarballs.)

ROT13 is a variation of ROT3, the Ceasar Cipher, which is as old as it is insecure. For computer use ROT13 is even cooler, because you can decrypt just as you encrypt. Decrypt and encrypt are the same. Let’s grab the simplestshortest C implementation we can find, rot13-shortest.c:

main(a){while(a=~getchar())putchar(~a-1/(~(a|32)/13*2-11)*13);}

Compile it and use it as a filter to encode a file:

rot13-shortest < suspicious.tar.bz2 > suspicious.tar.bz2.r13

To decode (to “decrypt” is too grand a verb), just swap the input and output files:

rot13-shortest < suspicious.tar.bz2.r13 > suspicious.tar.bz2

Now, it’s time for me to hand in my Geek Card. Firstly, I confused ROT13 with ROT3 (even spending some time trying to find a ROT3 implementation). Secondly, I had never used ROT13 before, not even to by-pass a forum filter or to make a joke which is funnier if you wear a pen-protector. EBG13 wbxrf whfg nera’g shaal.

xwd, the best X11 screen grabbing tool

xwd (1) is my favorite screen capture program for X Windows. Usage is simple:

xwd|xwdtopnm|pnmtopng>/tmp/screen.png   # Or:
xwd|xwdtopnm|pnmtojpeg>/tmp/screen.jpeg

Entering one of these commands, will give you a special pointer to click on the window you want to capture. That’s how simple it is to grab an X window with xwd.

You can also grab the whole screen with -root or exclude the window borders with -nobdrs. The manual page contains more options.

I was pretty elated when I first discovered xwd. I didn’t like having to invoke the GIMP, just for taking a quick screenshot. KDE and GNOME come with screenshot utilities, but sometimes I prefer other window managers (e.g.: this machine has been running WindowMaker from day one). Also the GNOME utility lost the option to exclude the window borders (in GNOME’s noble quest to become an appliance). All in all, I was glad to learn about a tool that I could count on to be available on most machines that have X Windows installed. Except, Gentoo has stripped many of these useful, little tools from the base install:

emerge x11-apps/xwd

WordPress 2.7 administration panel changes

I really, really liked the new style of administration panel that was introduced in WordPress 2.5. In all the time since I’ve upgraded (and increasingly with every update), I’ve started to like it more and more. I hadn’t thought it possible but everything just felt at exactly the right place, while before 2.5, the whole always felt like it had been thrown together by a blind child. Had I written it myself, it would have at least felt as being thrown together by an adult (chimpanzee).

So I was happy. And I’m still happy. Yet, this time, it does take getting used to it. That’s a bit sad. Probably, it’ll be for all the better, with more space for more (plug-in) features and everything. Still… I will miss the old interface.

« Older posts Newer posts »

© 2024 BigSmoke

Theme by Anders NorenUp ↑