Archive

Posts Tagged ‘linux’

Prezi Offline in Linux
1 star2 stars3 stars4 stars5 stars
(no votes yet)
Loading ... Loading ...

May 7th, 2010 9 comments

For creating my GameStore talk at LinuxWochen Wien I decided to use new and hip tool called Prezi. I’m not going to write about its features, you have to try and see for yourself. :-) What I can say is that I really like the tool, but it has one big disadvantage – it’s written in Flash.

During the event we had a wireless connection available, but it was rather unreliable, so it was no option for me to present the talk online. I started to investigate the offline options. Either you can download the full blown Prezi Desktop, which is available if you subscribe the service, or you just download the Prezi “Player”. But wait, the page claims it is compatible only with Windows and Mac OS X. Let’s see. I downloaded the ZIP archive and indeed – it contains data folder with your presentation, Windows application (prezi.exe) and Mac OS X application (prezi.app).

Let’s get hacking! Mac OS X application is in fact just a directory structure. I copied the file prezi.app/Contents/Resources/movie.swf to the same location as my data directory and tried to run flashplayer movie.swf. Wow! The presentation started to load, but unfortunately it stopped after few seconds and I ended with this:

I tried straceing the process, but found nothing unusual (like failed open calls). Then I downloaded the debug version of Flash Player, run the command again and got this exception:

An ActionScript error has occurred:
Error #2044: Unhandled SecurityErrorEvent:. text=Error #2140: Security sandbox violation:
file:///.../movie.swf/[[DYNAMIC]]/1 cannot load file:///.../data/fonts/LiberationSerif-Regular.swf.
Local-with-filesystem and local-with-networking SWF files cannot load each other.

Aha! Locally stored SWF files cannot load other SWF files, neither local ones, nor remote ones. That’s the problem. Ok, let’s change the standalone player settings. But how?! I tried various command line switch with no success. After couple minutes of searching I found that standalone Flash Player settings could be changed via Flash plugin that loads Settings manager from the Internet? WTF?! :-)

I will make it easier for you: let’s google for “flash global security settings content creators”. The first result at the time of writing this article was this one. Go to this URL, wait until the Settings manager is loaded and then click on the “Edit locations …” button.

After that select “Add directory” and choose local directory where you store your presentations. From now on you enabled standalone Flash player to run your Prezis. Congratulations!

Even though I like Prezi, I would be ecstatic if they dropped Flash and used SVG instead as its presentation and interchange format, probably using the uber-cool SVG-edit as the core. :-) It would also enable iPad users to use the tool. And yes, I know about JessyInk, but that’s not exactly what I have on mind …

Wrong usage of LD_LIBRARY_PATH
1 star2 stars3 stars4 stars5 stars
(no votes yet)
Loading ... Loading ...

October 19th, 2009 4 comments

Lots of programs that bring their own libraries use the following snippet in their wrapper scripts:

export LD_LIBRARY_PATH="/my/special/librarypath:$LD_LIBRARY_PATH"

This allows linker to find the needed libraries, even if they are not located in the standard directories (which are defined by /etc/ld.so.conf). At first, this seems OK, but it creates one problem, though. When the $LD_LIBRARY_PATH was empty before the assignment, the new value ends with a colon. When we run the program wrapper, linker splits the variable into substrings and ends up with one empty path. This indicates to search for libraries in the CURRENT working directory, which can cause problems or even a security threat.

So, what’s the correct way of defining the library path? Of course, we could check if the variable is empty before the assignment like this:

if [ -n "$LD_LIBRARY_PATH" ]; then
    export LD_LIBRARY_PATH="/my/special/librarypath:$LD_LIBRARY_PATH"
else
    export LD_LIBRARY_PATH="/my/special/librarypath"
fi

but there is one neat shell trick we can use (should work on all POSIX shells). The description says:

${parameter:+word}
Use Alternate Value. If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.

In the end we have:

export LD_LIBRARY_PATH="/my/special/librarypath${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

which is not much longer than the line we started with, but does the assignment correctly. (The first colon belongs to shell syntax, the second one is a part of the value being appended).

Daisy Plasmoid – A dock for KDE 4
1 star2 stars3 stars4 stars5 stars
(votes: 3, avg: 5.00)
Loading ... Loading ...

August 13th, 2009 3 comments

From time to time I use Mac OS X and I really like the application management with its dock. I came across several different implementations for KDE 4, but they were usually too immature and not very pretty. I was very surprised when I finally found a decent implementation called Daisy. I immediately dropped the default KDE taskbar and started to use Daisy in conjunction with desktop effects “Box Switch” and “Present Windows” a.k.a Exposé. You can look at my setup here (only bottom 64 pixels are shown, the rest is usually occupied with maximized application):

Daisy + Tray

Daisy detects running instances of applications by Window Class, so it doesn’t try to start another instance, it rather activates the already running one. The experience is very similar to the Mac OS X one, but still, there are three problems:

  • I still have to use the panel for Battery Monitor and Device Notifier widgets
    • Daisy could act as a host for other widgets and show them as icons
  • Applications started manually (e.g. with KRunner) do not appear in the dock
    • Daisy could act as a taskbar and show icons of all running windows
  • Applications like instant messengers or IRC clients use tray for notifications
    • Daisy could act as a tray and replace the launcher icon with the one added to tray by application after its start (so it will flash in the dock)

Once these three points are met, Daisy will become a complete counterpart of Mac OS X dock. I’ve already written these suggestions to Lechio (upstream developer), but I’m not sure if this is the direction he wants to go and whether it is possible to do without any extra hacks at the KDE/Plasma side. (I’m sure that Lechio will accept any help :-) ) Anyway, have a look at the project page, KDE-Look page or try the plasmoid from the Build Service. The package is called plasmoid-daisy and is present in KDE:KDE4:Community project.

Pencil project – Sketching and Prototyping with Firefox
1 star2 stars3 stars4 stars5 stars
(no votes yet)
Loading ... Loading ...

April 22nd, 2009 No comments

pencil

A few years ago, me and four of my friends were doing an university project, which was basically a web portal. While designing our application we needed a tool for creating mock-ups and screen prototypes. There are a lot of options like Wireframe Sketcher, Cleverlance Petra, but finally we ended up with Axure RP. Now I’m not sure why, but at least we had the motivation to finish the prototype early (trial period was only 30 days :D ).

Today, I was again looking for the alternatives and found – Pencil. No, I don’t mean the office aid, but the Pencil Project. It lacks some important features like creating hyper-links between the components and thus exporting to HTML pages, but these are planned and I can say that I really like this tool. And not to forget – it is open source! You can install it as a Firefox extension or download it as a standalone application. Unfortunately upstream tarball contains the whole XULRunner, so I decided to create a package for openSUSE. It is available from our Contrib repository and is only 330kB large! (Big thanks goes to Wolfgang Rosenauer for helping me to tame XULRunner.)

Pencil right now supports common shapes like rectangles or bitmaps, annotations, GTK widgets and Windows XP widgets. The widgets (or rather stencils) are simple SVG files, so if we help Duong Thanh An, the author, we might see Qt, iPhone or Yahoo stencils as a part of the Pencil in the future! Wouldn’t that be sweet? :)

Update: I just found Graffletopia – with hundreds of stencils (or so-called graffles) for Mac OS X tool OmniGraffle and some of them are really great. How about a converter ? :)

LinuxExpo 2009
1 star2 stars3 stars4 stars5 stars
(votes: 3, avg: 5.00)
Loading ... Loading ...

April 17th, 2009 No comments

On Wednesday I attended the biggest Linux event in the Czech Republic called LinuxExpo (more particularly its first day). I also took some photos for your viewing pleasure :) Comments for each photo are under the enlarged versions shown after clicking on the thumbnails.

a.m.

IT Crowd IT Crowd Konq with Eyes plasmoid Microsoft Surface displaying openSUSE screenshots ;-) IT Crowd IT Crowd Even Red Hat people are interested in openSUSE :-) Happy community members SleepWalker and Marex at the Hack&Dev Booth SleepWalker and Miska at the Hack&Dev Booth

contest

Contest People waiting ... ... for Kendy and Marek to draw the winners ... ... of our fabulous prizes :) IT Crowd

lunch

Hungry developers and community members waiting for their lunch Hungry developers and community members waiting for their lunch Hungry developers and community members waiting for their lunch Hungry developers and community members waiting for their lunch Hungry developers and community members waiting for their lunch Hungry developers and community members waiting for their lunch

p.m.

Two Jirkas drawing the lucky winners Two Jirkas drawing the lucky winners IT Crowd IT Crowd

Update: Bubli has written a commentary about the day 2.

The Ugly Duckling called $XDG_CONFIG_HOME
1 star2 stars3 stars4 stars5 stars
(no votes yet)
Loading ... Loading ...

March 29th, 2009 4 comments

Let’s take a look into my home directory:

[stick@spectra 0 ~] ls -F
Applications/  Documents/  google.txt    reverse-ssh*
Desktop/       Downloads/  public_html/  work/       

[stick@spectra 0 ~] ls -AF
.0verkill             google.txt              public_html/
.adobe/               .grails/                .pulse/
.android/             .gstreamer-0.10/        .pulse-cookie
Applications/         .gtk-bookmarks          .pyhistory
.AtomicWorm/          .gtkrc-2.0-kde4         .qt/
.bash_history         .gvfs/                  .rawstudio/
.bashrc               .hplip/                 .recently-used
.bouml                .htoprc                 .recently-used.xbel
.boumlrc              .hugin                  .repoconfig/
.bzr.log              .icedteaplugin/         reverse-ssh*
.cache/               .inkscape/              .rnd
.cddb/                .inputrc                .rpmpatch_macros
.cedega/              .IntelliJIdea80/        .rpmpatch_rpmrc
.civclientrc          .IntelliJIdea8x/        .scummvmrc
.civserver_history    .irssi/                 .signature-gk2
.config/              .java/                  .signature-gmail
.crack-attack/        .JxBrowser/             .signature-suse
.cxgames/             .kde/                   .skel/
.darkplaces/          .kde4/                  .Skype/
.dbus/                .kderc                  .smc/
.designer/            .kinorc                 .springrc
Desktop/              .ktorrent.lock          .sqlite_history
.directory            .lbrc.conf              .ssh/
.dmrc                 .lesshst                .strigi/
Documents/            .links/                 .subversion/
Downloads/            .liquidwarrc            .teeworlds/
.dvdcss/              .local/                 .thumbnails/
.eclipse/             .loki/                  .thunderbird/
.emacs                .macromedia/            .ufrawrc
.esd_auth             .mc/                    .ultramixer/
.fbhighlevelshistory  .mcop/                  .vendetta/
.fbhighscores         .miro/                  .viminfo
.fblevels/            .mixxxbpmscheme.xml     .vimrc
.fbrc                 .mixxx.cfg              .VirtualBox/
.fontconfig/          .mixxxmacros/           .vlc/
.fonts/               .MixxxMIDIBindings.xml  .vnc/
.fonts.conf           .mixxxtrack.xml         .w3m/
.gajim/               .mozilla/               .Wammu
.gconf/               .mplayer/               .wapi/
.gconfd/              .mysql_history          .windows-label
.gegl-0.0/            .mysticmine             .wine/
.gem/                 .netxrc                 .winetrickscache/
.gimp-2.6/            .nexuiz/                work/
.gitconfig            .ooo3/                  .Xauthority
.gnome/               .opera/                 .xim.template
.gnome2/              .osc_cookiejar          .xine/
.gnome2_private/      .oscrc                  .xsession-errors
.gnupg/               .profile                .y2usersettings
.google/              .psi/
.googleearth/         .psql_history

Out of 148 entries in my $HOME, there are only 12 of them I really want to see! How much nicer would it be, if it looked like this:

[stick@spectra 0 ~] ls -AF
Applications/  Documents/  public_html/    .signature-gmail
.config/       Downloads/  reverse-ssh*    .signature-suse
Desktop/       google.txt  .signature-gk2  work/

This is very simple to achieve, if only applications followed the XDG Base Directory Specification. Unfortunately, lots of them don’t. When you start using the following piece of code in your new awesome applications:

config = getenv("XDG_CONFIG_HOME")
if (!config) config = getenv("HOME") + "/.config"
config = config + "/my_awesome_app"

instead of the old-school one:

config = getenv("HOME") + "/.my_awesome_app"

users will gain two great advantages with nearly no extra effort:

  • trying application without overwriting the existing configuration
    XDG_CONFIG_HOME=/tmp/ my_awesome_app
  • maintaining multiple configurations of the same application
    XDG_CONFIG_HOME=~/.config/awesome3 my_awesome_app

So, please, don’t ignore the ugly duckling called $XDG_CONFIG_HOME, I’m sure it will mature into a beautiful swan. :)

Parallel command execution with limits
1 star2 stars3 stars4 stars5 stars
(no votes yet)
Loading ... Loading ...

February 16th, 2009 No comments

Randy_sk asked today on IRC if we had any idea how to run commands in parallel, but he also wanted to limit the number of the concurrent processes. I immediately responded: “use make”. I started to shape my idea further until I came to this Makefile:

tasks := $(shell seq -s ' ' 1 `cat commands.txt | wc -l`)

all: $(tasks)
    @echo Done

%:
    @echo `sed '$@!d' commands.txt`
    @eval `sed '$@!d' commands.txt`

This expects you had the file commands.txt prepared, which contains one command per line. If you want to call the same command over and over again, just replace commands.txt with values.txt and eval with the command you want to run.

Using this approach you can limit both the number of concurrent jobs: make -j 5 and the maximum load: make -l 2

Others ideas were to use the shell with & and wait, or to use the following one-liner:

while sleep 1; do [ "`ps ax | grep your_cmd | wc -l`" -gt 6 ] || your_cmd &; done

but I really like mine solution the most :D