Thursday, December 23, 2010

Still Alive

Finished graduating my course as of this December.

During the time I've been at school, I've also been working full time, so that leaves very little left over to work on my projects. Even less since I moved in October.

Not to worry, once I get paid I will be purchasing a domain to use strictly for gaming/programming projects, whereas this blog will probably include fixes for certain issues I face, cool ideas and things that peak my interest, as well as more anti-M$ rants... most likely. I may also get a little more political in my blog.

That last paragraph implies that I will be working more on projects, which I intend to.

I may be using sourceforge to host projects, Also, they will probably fall under the GPL 3 license.

There's a lot of cool ideas I'm holding in for now. In the meantime, I must rest.

Tuesday, October 12, 2010

Quickie bug fix

I was recently having the following issue while fiddling around with expect and spawn:

send: spawn id exp6 not open
while executing
"send "$password\r""
(file "changepw" line 9)

in a script to auto-change passwords for some work I'm doing.

The reason I encountered this error is because my file I was reading from (in the changepw plain-text file), there was no newline character at the bottom.
The fix for this is to always have a clean new line in the file that needs to be read in.

I realize I haven't done much blogging recently. There should be more to come later on, once I'm more settled.

Saturday, July 24, 2010

FFROGG - FFmpeg Recursive Ogg Encoding Script

What happens when you have thousands of songs that you want encoded, but either you

a) Have a command line system where no gui app can encode them for you?

b) Want more efficient use of your processor therefore do not use a gui?

c) are not good at computing and just want to get'r done?

This is one itch I just had to scratch. Now I'm aware of great apps like handbreak and I know amarok 1.4.x used to have a script to encode songs in a playlist. However, not only am I a big fan off ffmpeg, I needed to test out my bash-fu.

The scenario is this:

Joe user has tons of music spread out all over his hard drive. Lets say he has 10 000, none of which are contained in any one folder as more OCD folks would do. (Or an organized heirarchy of folders even)

Joe decides that one day, he wants to move to a patent-free codec such as .OGG format, but not only does he not have the time to FIND all his mp3's, he's clueless about how to encode them and knows of no gui apps (except for above mentioned in this article).

Joe user visits this article and decides that he wants all his files encoded into one folder on an external hard drive (which could be his mp3 player).

All Joe has to do is ensure that ffmpeg and libvorbis/libtheora are installed correctly on his *nix system and he can go about watching TV or playing with his dog/kids/wife while the machine does all the work.

Here's How:

1) Download the script @ [ http://www.mediafire.com/?lc023alg2bsfx9x ] to your home folder

2) Make sure it's executable, use chmod +x ffrogg.sh to do so.

3) Use the command sh ffrogg.sh --input=/home/$USER/ --output=/media/externaldisk/encoded --export --recursive (as long as your --input is linked to the top folder where your music is located, it should be fine)

4) Navigate to your output folder, in Joe User's case, it's /media/externaldisk/encoded/. There should be a script called "ffrogg-encodethis-[numbers].sh".

5) At his/your convenience, run the script. Example: sh ffrogg-encodethis-1279967631.sh

Technical Aspect:

Here's the really cool technical details of the script.

THIS SCRIPT IS CURRENTLY IN ALPHA, IT DOES NOT WORK 100%!

This script at its greatest potential will dynamically produce a script using the ffmpeg and theora-vorbis backend that can be run which will encode ALL RECOGNIZED AUDIO FILES that were found when it was invoked. It can recursively find all audio files starting at the specified input directory. Since this is alpha software, below is a list of what DOES work in the current version (0.01.05 ALPHA):

sh ffrogg.sh [commands]

  • --input=[folder or file]
  • --output=[folder only]
  • --logging (this is for debugging purposes only, can specify a folder with --logging=[folder] if directory is read-only)
  • --recursive (this flag is required to go into directories to find audio files. Otherwise it just looks at contents of specified directories)
  • --export (Create the script and exit. Omitting this flag will cause the script to encode before exiting, although it gives a period to exit before starting)
  • --force (No use for it yet, as the recovery handling bit is not quite implemented. Will remove temp files if they get in your way)
  • --help (Gives a list of options, some of which will not work yet)
  • --version (displays version of program)

This script creates a few temporary files which is inefficient, but this is by no means a professional work. It's also licensed under the GPL version 2 (although I may have omitted that in the script itself).

If the --output and --logging= and --save-state= flags are given without parameters, the current folder is automatically used "." .

Running the script without parameters will cause it to exit.

I may not get around to improving it much, and I do have a graphical user interface planned which would require basically a re-write of the script into a QT application, so it may not get past Alpha. Feel free to take it on yourselves as long as you give credit in the comments at the very least, to PeonDevelopments 2010.

Thanks, and happy listening.

Since I don't usually look at comments, send them to my gmail.

peon.developments --at-- gmail --dot-- com.

=-=-=-=-=
Powered by Blogilo

Friday, July 23, 2010

Scripting in Bash: Arrays, Files and Spaces

I recently encountered some strange behaviour in my bash shell while writing a script.

My script would take the contents of a folder and store them into an array. Sounds simple enough, as it should be. But it's not.

If you type verbatim:

" declare -a ARRAY=`ls -1 -x $directory` "

You will find that every space in every filename will produce its own entry in the array.

A file called "An Introduction To Bash.txt" would be seen in the array as

An

Introduction

To

Bash.txt

which is an abomination for what I need these the filenames for. It does make sense why this behaviour appears, but if we want the entire filename per entry, we need to take the filename before it's put into the $ARRAY variable and do something with it to ensure spaces either do not exist or do not denote the start of a new array token.

The former being the easiest and resourced method, I converted all spaces to underscores (temporarily) to prove my point.

The command is now " declare -a ARRAY=`ls -1 -x $directory | sed 's/ /_/g'` " and it will output filename entries properly, albeit with underscores, no spaces.

To ensure this effect is permanent and not just for show, one would need to rename (using the 'mv' command) all the files in that directory so no spaces are in the filenames.

Bash isn't one of my stronger languages, so I may have missed a blaringly obvious detail.

Also of note: I'm still working on the freeworld project, albeit slowly after gaining employment. My 1st revision document is approximately 70-80 pages, but that's not including proper use case tables and UML/flowchart diagrams. Least of all the prototypes for necessary components.

I hope to make another entry soon enough, in the coming couple weeks.

Peon out.

=-=-=-=-=
Powered by Blogilo

Sunday, May 30, 2010

Minimalism on a Tablet

I've been experimenting with minimalist environments lately. While I'm a KDE guy all the way, I do have a tablet that even with KDE 4.4 on Slackware, it feels a little sluggish and gets ~ 2 hours of battery. I'm a bit of a perfectionist so onward I search for the perfect tablet PC configuration.

I'm no expert, but I've been using Blackbox as a window manager on a Gentoo system and have been quite pleased with the results. My average cpu while idle is 0-1% and currently my ram is sitting at 7% usage, or 76 MB out of 1 GB. (Courtesy of Conky, a great system monitor app)

Computer stats:

IBM Thinkpad X41

1.5 GHz LV Centrino (Pentium M)

1 GB DDR2 Ram (probably 533MHz or 667 MHz)

Intel GMA 910 integrated graphics chipset

ICH6 Intel Motherboard

1024x768 px screen resolution

Wacom Penabled

Functionality varies, and a minimal system isn't for everyone. I just compiled bmpanel (which looks great with transparency) for my bottom panel. Right click is the menu and after installation of a program, it must be regenerated. Some things have to be configured by hand and to use awesome programs from KDE and GNOME, both sets of libraries must be installed which amounts to ~70-90 MB for KDE and about ~33 MB for GNOME.

One program I would recommend for tablets is the GTK-based character input application, Cellwriter. I've only played with it currently, but it looks good. Once I add some script functionality to get the screen to rotate, a system tray, and a customized monitor layout, all will be good. Will update with screen shots later.

=-=-=-=-=
Powered by Blogilo

Thursday, May 27, 2010

The FreeWorld Project *

It's time for the pre-introduction (unveiling) of a project years in the making. With an intermittant design phase of 7+ years and insight as a developer and programmer, PeonDevelopments presents a strong probability of a new multiplatform Java-based FOSS application dedicated to providng the greatest 2D Role Playing Game Engine to all Gamers, Casual Players, Developers, Marketers, Businesses and Educational Institutions interested.

Our mission statement is To provide developers and non-experienced users with a modular and FLOSS role playing game engine that performs reasonably well on multiple platforms and aids in the production of dynamic and advanced battle systems for the purpose of relating a story, plot or series of meaningful actions.

As the project is not mature and currently in vapourware status, I would like to remind readers that documentation is being developed to lay groundwork for the structure of the Engine. Expect a release of such documentation in 3 months of the posting of this article at the latest.

I will be posting a road map at a later date. I wish to produce a working proof-of-concept prototype with Installer before allowing others to work on developing this project. With that in mind, I have big expectations of this project and hope it will fill a niche that currently is not being filled to the extent it could be.

Projects such as Sphere do exist but are not maintained or as powerful as I want. More updates at a later stage.

Current documentaiton progress: At 40 pages. Expect 5x that.

* Not the official release name of the project, used as a placeholder

=-=-=-=-=
Powered by Blogilo

Friday, May 21, 2010

Technical-tainment

So as I'm sitting here at the table, drinking my light-roast coffee and feeling pretty good about life, it's time to let my readers know (all 1 of them, me) about some cool techy stuff that my mind is on.

http://kernelnewbies.org/Linux_2_6_32#head-935c2274be57c1585f23d91d185888ed0b6e0567

The above link is to the changelog for kernel 2.6.32 (which I currently use) and its improvements. Notably, some great improvements have been done in virtualization as with KSM (Kernel Shared Memory), a daemon process goes through page files determining which files are the same and merges them to reduce memory usage. That in itself is great but it doesn't put anything in perspective. Until you read the following:

"The result is a dramatic decrease in memory usage in virtualization environments. In a virtualization server, Red Hat found that thanks to KSM, KVM can run as many as 52 Windows XP VMs with 1 GB of RAM each on a server with just 16 GB of RAM."

If an XP machine was to be run under minimum requirements, using 128 MB of Ram, you'd get a barely functional OS and 52 of them would use a total of 6.656 GB of Ram. I've used XP in a VirtualBox VM using 512 MB of Ram and got some decent performance out of it. (Ran SAP and Borland Together in it; not at the same time) So assuming that each user is limited to a 512 MB Windows XP Pro OS, you'd be looking at a total of 26.624 GB of Ram required if these were dedicated machines. By sharing memory and having 52 XP machines running on a bare-bones Hardware Virtualization using Red Hat, each OS would require 307 MB of Ram if it were dedicated, but as it's sharing memory, the end result would mean more Ram to use. Assuming having shared memory resulted in each OS feeling as though it had 512 MB of Ram, that's a savings of ~10 GB of Ram, or an efficiency of 166.4% (2/3rds greater) over dedicated Ram resources.

And that's just one kernel improvement. I wonder how Windows kernel is doing in comparison.

The 2.6.32 kernel also has scheduler improvements in its CFQ low-latency mode.

Some people have had issues with KDE's Akonadi, getting a "Not Registered At DBUS" message. From my limited experience in dealing with this error, it generally only happens when trying to use an external SQL database. I believe that this is an upstream issue, as Akonadi is constantly being worked on during this time and big things are expected of it. (This has been tested on a KDE 4.3.5 and 4.4.2 system) The internal database doesn't seem to have this issue; it works at least, though sometimes produces a warning message. It may take a few more releases before this bug is dealt with,

In one Fedora forum, it seems that using an external sql database works under the root user. I wouldn't recommend this route.

Others say that it's an AppArmour issue, that it is blocking akonadi. It seems odd, as I still got this issue using Gentoo which doesn't have that firewall installed. The developer team which worked on it has been layed off as well.

http://news.cnet.com/8301-13580_3-9796140-39.html?part=rss&subj=news&tag=2547-1_3-0-5

There are some issues with Gentoo's KDE Unstable 4.4.2 release, though that's to be expected.

Sometimes closing Kontact does not completely close it and attempting to run it again will have no effect. The process must be killed before it can be sucessfully launched again.

Kile (2.1 beta 2 & 3) seems to have an issue where closing the program results in an unexpected error minutes later or if the program is left open, unattended for too long. It doesn't seem to impact my work (autosave it on) and is more of an annoyance. Still, it's a great program for working in LaTeX.

Umbrello is a nice UML modeller program, but I get segfaults semi-regularly. I'm not sure why that is and I still use it. This doesn't seem restricted to the unstable KDE release, but I thought I'd point it out anyway.

Some final thoughts on KDE 4.4.2: It's faster, looks better, and has more functionality. I'm getting used to tabbed file browsing and I like where the KDE team is headed.

A special thanks to Aaron J. Seigo, a KDE guru and expert. This guy is real inspiration and I hope to do some work on KDE in the near future.

=-=-=-=-=
Powered by Blogilo