Linux.com

Community Blogs



grnotify in den Jaunty Quellen

Die Vorgeschichte: Neben Linux besitze ich noch eine weitere Sache des WWW, welche mich sehr interessiert und wo ich mich auch etwas auskenne: Google. Da liegt es nahe, wenn man versucht diese beiden Sachen zu kombinieren. Da ich mich, wie bereits erwähnt, sehr mit Linux beschäftige, lese ich jeden Tag etliche Nachrichten und Blogs mit Linux als Themenschwerpunkt - und das an verschiedenen Standpunkten. Also brauche ich einen Feedreader im Web: der Google Reader.

Die Programmvorstellung: Diesen kann man sehr leicht und sehr gut mit einem Linuxdesktop verknüpfen: das in den Ubuntu-Quellen enthaltene Paket "grnotify"ist ein Applet, welches sich so lange ruhig verhält, bis es neue Feeds gibt. Diese kann man dann aus dem Applet heraus öffnen. Das geniale daran: es prüft die Anzahl der ungelesenen Feeds vom Google Reader. Also kann man auch im Google Reader Feeds lesen und bei der nächsten Abfrage verringert sich die Anzahl der ungelesenen Feeds in grnotify. Hat man also 10 ungelesene Feeds und öffnet fünf aus dem Google Reader heraus, weiß auch grnotify, dass es nur noch fünf ungelesene gibt.

 Das Problem: In der Version die in den Jaunty Paketquellen enthalten ist aber gibt es mit grnotify ein Problem: Es will nicht mehr starten. In der Fehlermeldung heißt es, das Modul "GoogleReader" würde nicht gefunden werden, es ist aber da. Ob es ein Bug im Programm oder in Python ist, ist mir nicht bekannt, aber wie man es umgeht: Man nutzt einfach eine ältere Version, da das Programm schon immer zum Feedabrufen gedacht war, funktioniert also auch eine ältere Version, und sogar noh besser als die Aktuellste: sie startet nämlich. Auf  gnomefiles.org gibt es diese funktionerende Version von grnotify. Die Versionsnummer (1.0.2) zeigt: sehr nahe an 1.0, also bestimmt stabil. Kann ich nur bestätigen ;-).

Viel Spass

 

Fsniper

Fsniper is a tool to watch for files, and execute commands on them. It can be aquired by anyone running archlinux via these commands

 wget  http://aur.archlinux.org/packages/fsniper/fsniper/PKGBUILD

sudo makepkg -i

 

and that's it. Installed. To start fsniper use the fsniper binary. This will start in the foreground by default, which negligates it's use. Instead of executing it with a "&" appended, we just use the --daemon option. This executes it as, you guessed it, a daemon. Don't execute it yet though, as we have no configuration file

Fsniper uses one configuration file, located in ~/.config/fsniper/config. It  has a very simple structure, but it is a bit littered with curley brackets, so be carefull. Here's the layout:

  watch {

                Directory/you/want/to/watch {

                                 files {

                                       handler = comand you want to execute on file

                                  }

                  }

}

 

The files can be defined via name or mime type. The program takes wildcards (* and so on) aswell as enviroment variables. For the handler, "%%" is the full file path, while "%" is just the file name.

  As you can see, it's a simple setup, but hugley usefull. Here is my configuration file:

 watch {

                $HOME/bin {

                                * {

                                               handler = chmod 755 %%

                                 }

                  }

                $HOME {

                                 Desktop {

                                                    handler = rmdir %%

                                 }

                 }

}

The first one makes every new file in my bin directory executable, and the second one deleats the Desktop folder everytime it is created (kde desktop keeps making one)

 

I can't see much more to say about fsniper apart from one thing, DON'T use it on file types you are likly to download with firefox (*.tar.gz, *.zip, *. jpg ect, ect,) as they are first put into a *.*.part file, while a seperate *.* file is created, meaning that the *.* file is acted upon, but before it has had any data inputed into it from the *.*.part file.

 

Youtube-audio

Over the past few weeks, I've been working on a script that downloads files from youtube, and then extracts the audio from them. Well, it dosn't actualy, it just acts as a wrapper for several different programs that actualy do the work. It adds several fetures though:

Interactive execution 

Search function

Tagging

Previews

Renaming and moving files

 Its dependencies are:

 youtube-dl - actual downloads the .flv files

pacpl - encodes the files

id3 - tags the files

 All of these can be install via one command on archlinux systems:

 sudo pacman -S id3 youtube-d; yaourt -S pacpl

once you have done that, you need to get the actual script. For this, we use git (pacman -S git) to download it. Once that is installed, we can fetch an up to date copy with the following comand.

git clone  git://github.com/bluepeppers/Youtube-audio.git

Once that has been done, you will have a new folder called Youtube-audio in your current directory. Inside that will be another file called youtube-audio. That is the actual script. You can copy that to your personal bin directory, or if you want it to be acceseible globaly, to /usr/bin. Just remeber to make it executable with chmod 755.

 Once that has been done, we can actual use the program. To execute it, just type youtube-audio into a comand line (Gui coming later). You will be asked if you want to enter the url of the video you want, or want to search for it. I suggest searching. You will be prompted to enter your search queary, and a list of the top 5 results will apear. After that you will go though a dialoug that will let you tag the file, rename it, and move it to some where apropriate. The program is still very immature, so let me know if any finds any problems.

 

Galiza-Linux

¡Benvidos a Galiza-Linux!

Un novo blog no que impulsar a expansión de Linux en galego.

 

Kids and Linux

Hey, Just got back from my daughters Pre-K graduation program and seeing the technology section in their class reminded me of time her and I built an Edubuntu box. I feel children should be fully exposed to technology. There a some really great projects out there for children, Edubuntu, GCompris, Tux Paint to name a few.

Edubuntu is a great project for all ages. When I first introduced it to my daughter (she had just turned 4) it was its own distro for the most part but now its an add-on of packages for an existing Ubunutu install. Now, not to knock it by any means, but if you don't want to dedicate a whole computer for your child's use I recommend installing a couple of packages individually. 

Two of my favorites are GCompris and Tux Paint .  GCompris teaches your child all kinds of things from algebra to shapes and sounds.  While Tux Paint is an enhanced paint program with a really cool stamp tool. 

 So lets say you don't want to install any of these packages on YOUR computer. Why not remaster Knoppix with GCompris, Tux Paint, and whatever else. Nothing better than a live CD/DVD for the little one to play with.

What's your take on this? Feel free to share your favorites.  

 

 

The Begining

This is the begining of my blog that will follow my Linux journey as well as give useful tips and tricks to others in the community.
 

The Disadvantages of Linux.com's New Guru Point System

It is in terribly poor taste, in my opinion, to come into someone else's home and denigrate or criticize them for the way they do things in their own home. This posting is going to give me a bit of that feeling. I don't make a habit of this as a new member of a community. However, in this instance, I think it's necessary to point out a few things that I am witnessing here at the new Linux.com. I apologize if feelings are hurt in the process. It's not intentional, I assure you.

=====

I don't know who came up with the new Guru points/rewards program here at Linux.com, but it has a downside. To me, a guru is someone with above average knowledge about a certain subject. Being a guru does not always mean that the person is going to be forthcoming with their knowledge or helpful to others. However, in the GNU/Linux/Opensource communities, we usually take for granted that someone labeled as a "guru" is someone who takes extra time and effort to help those in need in these communities.

The new Linux.com Guru points/rewards program, while being kinda' cool and giving members a goal to work toward, is not promoting the kind of guru this community deserves. I've seen many members here blatantly manipulating their actions here at Linux.com just to increase the Guru points tally. That's great! They're going to get a laptop autographed by Linus. Hell, I'd like to have one of those too. Yet, are these people the knowledgeable and helpful gurus that we've come to know and love in our communities? Probably not.

Just because joeblabberface2002 and janehacker13 create 23 Groups and join 119 more between them doesn't make them gurus, in my estimation. It makes them cheating manipulators of a system set up with honest goals and intentions, but faulty foresight of human behavioral patterns.

Solutions? Good question. I know Linux.com is still in flux and will be for some time. That is the nature of a new and evolving website. I'm sure others have made the same observations as I have here. I wouldn't be surprised to hear that something to solve this issue is already in the works. There must be a fairer way, I'd say. There are many, many intelligent people here from all over the world. I should think a bit of brainstorming and discourse could work out for the betterment of Linux.com and the entire community.

This wasn't my original plan for today's blogpost, but hey... it needed to be said.

Until next time...

V. T. Eric Layton

***Tempus Fugits***

 

 

Using Perl to print Avery labels.

This blog will discuss how to use the Perl module PostScript::MailLabels to print Avery labels.

The basic design is to have your user(s) run the following BASH shell script, which will then call a Perl script that builds a postscript file, then the BASH script will send the postscript file to the printer.

Here is the shell script your user(s) will run.

 #!/bin/bash

#####################################

#This shell script is used to print address labels.#
####################################

#Must export default printer environment variable
#in order for lpr to function correctly.  The rest
#will be executed from a Perl script.

#declare variables
FILEPATH="/home/user1/"
DATE=`date +%m%d%y`
MYPERL=`which perl`
SCRIPT=${FILEPATH}'print_addresses.pl'

#get name of file user wants to process
echo "What printer do you want to print to?"
read PRINTER
#echo "Going to process: $DEFAULTPRINTER"

#set default printer to DEFAULTPRINTER
export PRINTER=$PRINTER

#call perl script which builds a postscript
#file sends it to user's printer.
perl $SCRIPT

#send postscript file to the printer
`cat ${FILEPATH}$DATE | lpr -P $PRINTER`

exit 0

 The BASH script basically asks the user what printer they want to print to,  set's the user's DEFAULT printer, then calls your Perl script using the modulePostScript::MailLabels to build a postscript file, then the BASH script  sends it to the user's printer.

Here is the Perl script which does most of the "heavy lifting."

#!/usr/bin/perl -w

##########################################

#This script will open a file containing a list of                  #
##addresses, use the addresses to build a postscript file, #
##and send that file to a printer.                                           #
##########################################

#import required modules
use strict;
use PostScript::MailLabels;

#declare local variables
my $labels;
my @addresses;
my $filename;
my $filepath = '/home/user1/';
my $date = `date +%m%d%y`;

#get name of file from user
print "Enter name of file you would like to process:  ";
$filename = <>;

##inform user of progress
print "Creating postscript file ...\n\n";

$labels = PostScript::MailLabels->new;

#create file handle for reading
open(NEWADDRESSES, "$filepath$filename") or die("Unable to open file: $!");

#read file one line at a time
while () {

    #delete first line containing name;street1;street2;citystzip$
    next if /^name;/;
n
    $labels->labelsetup(
        Avery       => $labels->averycode(5961),
        PaperSize   => 'letter',
        postnet     => 'no'
    );

    $labels->definelabel('clear');

    $labels->definelabel(0,'fname','lname');
    $labels->definelabel(1,'street');
    $labels->definelabel(2,'city','state','zip');


    #Match lastname, firstname, and address.
    my $pattern = '^(.+),\s+(.+);(.+);(.*);(.+),\s+(\w{2})\s+(\d{5}|\d{5}-\d{4})';

    $_ =~ /$pattern/;

    my $lname = $1;
    my $fname = $2;
    my $address1 = $3;
    my $address2 = $4;
    my $city = $5;
    my $state = $6;
    my $zip = $7;

    my @record;

    push @record, $fname;
    push @record, $lname;
    if ( $address2 !~ /^$/ ) {
        push @record, "$address1, $address2";
    } else {
        push @record, $address1;
    }
    push @record, "$city,";
    push @record, $state;
    push @record, $zip;

    #print $labels->makelabels( $addresses );
    push (@addresses, \@record);

#close while loop
}

#open file handle for writing
open(PRINTADDRESSES, ">$filepath$date") or die("Unable to write file: $!");
 #write postscript file
print PRINTADDRESSES $labels->makelabels( \@addresses );

#close filehandle
close(PRINTADDRESSES);

#close filehandle
close(NEWADDRESSES);

#notify user of file completion and get printer name
print "Postscript file named $date has been created successfully.\n";

#exit cleanly
exit 0;

The Perl script basically asks the user what's the name of the file they want to print, reads in the file (; delimited in this case), outputs a postscript file.

Obviously you will have to make some changes in order to get these scripts to work in YOUR environment!

Note: This is for Avery labels with Avery code 5961.  Please review  PostScript::MailLabels's documentation on CPAN to see if the module supports your particular labels or not.  You will also probably have to tweak the  "labelsetup" and "definelabel" parts to fit your needs.  Also note that the file this script reads is in the format of name;strete1;street2;citystzip$ semicolon delimited with a trailing $.  You will have to tweak the regex if your file is in a differet format.

Disclaimer:  This blog entry comes with NO expressed warranty, guarantee, support, or maintenance of any kind!  Use at your own risk!  

Good luck and happy printing!

 

Novice user of obvious choice.

I started using Linux back in around 1998and have been rather stuck ever since. In the start it was har and i jumped back and forth between Linux and Windows but one day i decided to learn this "new" (to me) system so i through out Windows all together and started to use Linux 100%. Ever since that day i've been stuck. Most of the people in my surrounding are using systems like Windows and MacosX which makes it rather hard for me. I see Linux as such a natural choice that its hard to even perform everyday tasks such as bank-errands online using e-identification, sending office-documents to people (allways have to think about converting them to .doc or .pdf documents for them to be able to read them) and so on.

I am no guru on Linux really. I like to contribute with what i can, i use linux 100% and i like to learn. Its just fun to see how quickly Linux (even though some ignorant people say Linux cant do everything other popular systems can) can become the only natural choice.

It's been quite some time since i stopped arguing with people on why to use Linux or not. Its up to ever person to use the system they feel is the best choice for them. However, i would wish that more people would have the guts to actually try out new systems. If it is Linux or some BSD-system or MacosX or what ever, doesn't matter. Its a fun experience and it can change quite a lot.

 

Oh well, now i've written quite a few rows about nothing special at all. Feels like i stole a part of your life with nonsens :-)

 

Take care!

 

Simply Kruisin' ...

Wot a gem ...

 Krusader that is ... i use the PCLOS distro and have only recently moved from GNOME to KDE, the reason being that when PCLinuxOS was upgraded to version 2009.1 i could NOT get my GNOME installation to follow it .... i encountered inconsistencies and could not get networking to work as it had been.

SOooooo, installed KDE and have been using and exploring it for the past six weeks or so. My system is a small peer to peer home LAN in which two workstations act as a fileserver, for storing dynamic data, and the other as an internal LAMP server, on which i mirror my genealogical site.

On top of my workstation, which is a dual boot machine [Linux and XP], there are two other workstations on the network, one XP the other WIN2000, which the rest of the family use.

Consequently i am forever requiring access to the file systems of five internal workstations plus the remote host where i publish my blogs, genealogy, resumes etc., and until i found Krusader, it was all a bit of having to use a variety of programs to cover all the bases.

However, having fully discovered Krusader i stand in awe of this wonderful file management tool. Not only does it have a 'Command Line' and 'Terminal Emulator' built in, it has two side by side panels which can show different file systems, either local or remote, and each of those panels are tabbed!!! You can connect ftp, fish, samba, sftp.

Of course the functionality on the menu is fully integrated to support moving and comparing files between the two ... you can bookmark locations ... recall locations visited historically ... and the list goes on!!

But hey, you all already know all this dont you?? *smile* ....

... but just in case there is another NOOB out there who does a lot of file management ....

Krusader IS the answer!!

 

Recording your 3D Games Made Easy

From the glc website: “glc is an ALSA & OpenGL capture tool for Linux. It consists of a generic video capture, playback and processing library and a set of tools built around that library. glc should be able to capture any application that uses ALSA for sound and OpenGL for drawing. It is still a relatively new project but already has a long list of features.”

The question now is: How do we install glc on our Arch Linux systems? It isn't available on any of the main repositories, but like many useful tools it is on AUR. This, my friends, is the perfect time to introduce you to the yaourt package.

yaourt is a wrapper for pacman that allows you to easily install packages from AUR. But be cautious, packages from AUR are user contributed, you have to make sure the package is from a user you trust and that you have examined the package yourself and trust the code it contains. Otherwise you may end up installing a package that seriously compromises your system.

For the installation of yaourt we need to add the [archlinuxfr] repository to the end of our pacman.conf file:


# nano -w /etc/pacman.conf

And add:


[archlinuxfr]
Server = http://repo.archlinux.fr/i686

Now, after syncing our repositories (pacman -Sy) we should be able to install the yaourt package:


# pacman -Sy yaourt

We can now proceed with the installation of glc.


$ yaourt -S glc
or, if you like using the latest and greatest:
$ yaourt -S glc-git

Yaourt will automatically download the PKGBUILD from AUR, run makepkg, create the package, and install it for you. This is an interactive process; you will be prompted to review the PKGBUILD (to ensure it doesn't contain a shady download link or nefarious command like rm -rf / which will wipe out your entire hard drive), and your sudo password, among other confirmation dialogs.

Thanks kumyco for providing us with these high quality glc PKGBUILDs.

Here are some useful commands that will hopefully get us started with a basic knowledge of what glc does and how. We shall proceed by capturing a 3D application, in this case the Battle for Wesnoth game.


$ glc-capture -o /home/myusername/glc-videos -r 0.5 -s wesnoth

Let us parse the above command to see what all those options stand for. First, we have -o, which stands for output, it specifies the directory in which we want to save the .glc video we are about to capture. Then we have the -r 0.5 option, which resizes the video to half, for example glxgears being a 300x300 size window will be resized to 150x150 on the .glc video. This is very useful if the window size of the application is large. Otherwise we would end up with a very big .glc video file. I once had a video of less than three minutes that was almost a gigabyte in size!

And finally, the -s option tells the application to start recording as soon as Wesnoth is launched. If you don't want this, shift + F8 is the key combination to start and stop glc-capture recording capabilities. However, this won't work if the game has that exact key combination assigned to something else.

Now, we should have a video, let us play it.


$ glc-play filename.glc

Esc key stops playback, f toggles full screen and Right key seeks forward.


$ glc-play myvideo.glc -o - -a NUM | lame -hV2 – audio.mp3

This will separate the audio and make it into a .mp3 file. Then we can go about encoding the video and mix it with the audio file we just made ourselves.


$ glc-play myvideo.glc -o - -y NUM | mencoder -demuxer y4m - -nosound -ovc x264 -x264encopts qp=18:pass=1 -of avi -o video.avi

$ glc-play myvideo.glc -o - -y NUM | mencoder -demuxer y4m - -audiofile audio.mp3 -oac copy -ovc x264 -x264encopts qp=18:pass=2 -of avi -o video.avi

If all went well, we should have the video.avi, with sound. I hope you have enjoyed your game capturing so far, and will continue to do so in the future.

 
Page 117 of 130

Upcoming Linux Foundation Courses

  1. LFD320 Linux Kernel Internals and Debugging
    04 Aug » 08 Aug - Virtual
    Details
  2. LFD405 Embedded Linux Development with Yocto Project
    04 Aug » 07 Aug - Santa Clara, CA
    Details
  3. LFD312 Developing Applications For Linux
    18 Aug » 22 Aug - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board