Archive for the ‘posix’ Category

LAMP

Tuesday, July 1st, 2008

Wow, I just learned there’s a quick label out there that sums up some of what I do.. LAMP.. Linux, Apache, Mysql, Perl (or php… phhhfffttt… ).
I’m so tickled happy, those are all my favorite little creatures.. :-)

I would be willing to change mysql to sqlite, depending on the problem at hand-Or perl for python or lisp say.. depending on job- again.
But Linux and Apache are no argument.

That reminds me how much I hate it when people ask me to make my cpan shit work on other platforms. The bastards!
Am I going ape or is perl being embraced more and more by the lost children?
Either that or only the lost children are using my shit, which would just be one more heartbreak in my life.. Or.. maybe the unixy people don’t have problems so I hear nothing. Sheesh.

intro to scripting in linux tutorial

Thursday, June 26th, 2008

I’m all about speeding things up. Letting the computer do what I don’t want to have to do.
I think that little things can add up.
In linux, the command line is king. You can add commands to your system by creating scripts.

A script in this case is just a text file that has code, and gets treated as a program- just as find and ls and cd are available to you, you can create as many new commands as you want.

You can use various languages to code a script to do something.
One of the most powerful aspects of living with linux is that you can add these scripts and customize the system to your liking. In fact, various people can on the same system without conflict! But that is another matter…
(more…)

cli pdfmerge

Friday, June 6th, 2008

I have a working release of pdfmerge.

My goodness! Why another pdf merging thingie!!!!

This one counts how many pages are in all docs, then compares to output, etc.. Anyhow, it’s somewhat safe.
And it’s a simple call. Instead of looking up how to use xpdf or something to merge pdfs, you can use pdfmerge via the command line. Yes, there *is* another pdfmerge out there. In fact like 2. One requires extra moolah for the ‘full’ version.. pleeezzz…
(more…)

problems using a canon powershot s70 with linux

Thursday, June 5th, 2008

I bought a camera I researched through and through.

It’s a canon powershot s70.

I fired up gphoto2 but got this error:

[root@localhost caps_canon]# gphoto2 -P

*** Error ***
An error occurred in the io-library ('Could not lock the device'): Camera is already in use.
*** Error (-60: 'Could not lock the device') ***

So.. what’s up??

After much pain.. I tried running udevsettle as root.. and voila.. it works.

gphoto2 -P

update

No, it doesn’t work. It was a freak incident, that it did.
Boy oh boy.. this is troubleshome. After MUCH reading, I think it’s a udev permissions problem.
Messed with /etc/udev/rules.d/ files and hmm…. it’s iffy.
More to come…

CPAN search firefox plugin

Sunday, April 20th, 2008

I look up things on cpan pretty often. I seem to be using firefox a lot. So.. I would like to have a dropdown entry to CPAN in the search plugins toolbox.
Doing so is pretty easy.

Look for your firefox installation searchplugins dir.. it may be something like /usr/lib/firefox-2.0.0.12/searchplugins

Place this file (CPAN.xml) in /usr/lib/firefox-2.0.0.12/searchplugins/CPAN.xml and restart firefox.

Paul Graham

Tuesday, April 1st, 2008

I’ve been reading Hackers and Painters. Amazing.
This guy Paul Graham has some inspiring ideas about the computer industry and the future of code.
Incredible reading material.

Some of the things that stand out for me- so far..

Software is moving away from the Desktop, to the server.
It’s becoming less relevant to code in the fashion of the day languages.. It will become more acceptable to choose a language by its usefulness to the project at hand instead of for portability and miscellaneous reasons.

A way to make money with software is to offer services online. Forget distribution.
When a project is assigned value (sponsored by a parent company), the count of users is a worthy meter.

Languages that will evolve and survive will likely do so for convenience, not speed.
The speed of processors is exponentially evolving, (see moore’s law). It will be more useful to save the programmer time then to save computer time.

Valuable languages are python, perl, ruby.. High level languages.
Graham makes a compelling sell for Lisp. Personally, I’m sold- that this is the next language I will become profficient in.

What should you work on?
Pick a hard problem that affects many people. Offer ways to solve it. It can be a hack at first- get the damn thing running. Don’t take shortcuts, solve things the right way- use your judgement.
Work yourself to the bone. After that comes the soul.

Oh, and.. fuck microsoft. Did I mention that?

Paul Graham worked on Viaweb, which was one f the first 3 online applications online (browser independent, and nothing to install). Yahoo bought this ecommerce tool a long time ago.
He’s also responsible for something called the Bayesian spam filtering method.

Paul Graham is an incredible inspirational figure. His writing makes me feel like taking on the problems of the world and kissing babies.
I see a parallel between him and Richard Stallman. Who by the way- touts Lisp as the preferred language of the GNU.

copy part of movie

Wednesday, February 6th, 2008

I wanted to cut a chunk of footage from a video file.
Mencoder does this wonderfully, but, the command is not intuitive.

First, the example. This command goes to 10 minutes after the movie starts and takes 30 seconds after and spits out to ‘out.avi’..

mencoder ./filein.avi -ss 00:10:00 -endpos 00:00:30 -o ./out.avi

More practical example:

Fire up a terminal emulator.. open your source movie with mplayer.
You’ll need to see where in the movie you are, press ‘o’, get a pen and paper. This tells you the time elapsed.
You want to start your video selection at 00:14:24, that is, 14 minutes, 24 seconds.
And you want to stop at 00:15:24.
What you need to figure out is how much time there is betwen the start time and the stop time, in this case, one minute.

So our -ss seek/start time, will be 00:14:24
Once the movie is being copied, the end position (inside the copy movie) will be 00:01:00 (one minute).

Let’s put the command together..

mencoder ./in.avi -ss 00:14:24 -endpos 00:01:00 -o ./out.avi

Wait! Where is the stop time of 00:15:24?? RTFM, remember? endpos is telling mencoder where to stop, this is the target duration of the output movie we are making.

how to join movie files

Wednesday, February 6th, 2008

Examples

mencoder ./a.avi ./b.avi -oac copy -ovc copy -o joined.avi

Basically, there are three sets of parameters, in whatever order..

1) a list of files to join (paths)
2) -o the name of the output file (path)
3) settings for how to deal with audio (-oac) and video (-ovc)

There are a lot more settings then this, for that please see man mencoder.

how to make an avi smaller

Wednesday, January 30th, 2008

Sometimes I have a divx file that is way too big to fit into a cd.
How the heck do you make an avi smaller?

I ripped a copy from dvd to an avi, and got it to under 700 megs, great. That fits in a cd. But then I had a 10 meg subtitle file! So, it didn’t fit! I needed to get the avi a little smaller.

If you look up info on mplayer, mencoder.. there’s a LOT to read.
So here’s how, in no way complete.
Just one way to solve the problem.

   mencoder in.avi -o out.avi -ovc lavc -oac copy  -lavcopts vbitrate=400:vpass=1

Now, what’s very cool about mencoder, is it gives you stats on progress..

   Pos: 101.5s   2435f ( 0%) 213.30fps Trem:  27min 628mb  A-V:0.036 [320:32]

‘Trem’ is rime remaining, and the mb count is the guess for how big it will be.
As the progress gets further along (beyond 10%), the stats will be more precise.

Downloading Images from a Camera with Linux

Tuesday, January 29th, 2008

Ingredients:

  • Linux distro (Fedora Core 4)
  • Camera USB (Kodak Easyshare LS743)
  • gphoto2

So I get a camera, and take pictures.. now what? I got linux. I thought this may be complicated.. But guess what..

Step 1

Make sure gphoto2 is installed. If not.. open shell cli prompt (whatever) and become su, then # yum -y install gphoto2, wait for it to complete..

Step 2

Make your dir to receive photos, change to it.. then # gphoto2 -P

Step 3

All your photos are downloaded to your current working dir. Now, delete the photos.. # gphoto2 -DR .. All the photos are deleted from your camera.

Done. That's it. No mouse clicking. No stupid dialogues. Wow.