Robert Pogson

One man, closing all the windows.

Using The Power Of GNU/Linux is Childsplay

technology

Using The Power Of GNU/Linux is Childsplay

It’s pretty easy to set up a desktop system with most distros. I use Debian GNU/Linux because it has been around a while and has a huge repository of software. Let’s look at doing other kinds of things with your PC.

Suppose you are a collector, a hobbyist or small business person. Using IT to hold and to manage your information is priceless. It’s fast and reliable.
Many people buy a licence for some package of software and the cost may be just a few $dollars to $thousands. With GNU/Linux one can do the same work for $0. In addition, you are in total control instead of some distant corporation jerking you around with complex licences, expiry dates and other restrictions. GNU/Linux and many of its applications are shipped with no strings attached. You get to run it on as many systems as you want, examine the code, change it and even distribute it the way you got it. You download stuff for $0 and away you go. Simple.

Here is an example. I want to set up a server to keep track of ammunition I reload, inventory, load information and batch information. This way, no matter how long I live or how much stuff I deal with my PC can handle it. I could just install this stuff on my desktop PC but I will put it in a virtual machine so the configuration would work in any PC or server.

First, I need a virtual machine. In GNU/Linux I have KVM and it is simple to create and run virtual machines. I will use a Debian GNU/Linux installation CD that gets files from the network for the installation and I have another server caching those files so it is a very fast process, just a few minutes.

dd if=/dev/zero of=disk.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 14.6711 s, 73.2 MB/s
kvm -hda disk.img -cdrom debian-wheezy-DI-b4-i386-netinst.iso
kvm -hda disk.img -net nic -net user,hostfwd=tcp::5555-:80

Easy, eh? Those lines typed by a normal user made a 1gB file to hold the virtual machine. I could use a much bigger file but for what I need to do it is enough. The second line boots the machine from an installation CD downloaded from Debian and I just accept the defaults mostly and get what I want. I don’t select any of the standard installations (desktop, server, etc.) and get a really minimal system with hundreds of MB left over. The third line starts the installed machine and it boots in seconds. Local port 5555 on my pc will be routed to port 80 on the virtual machine so I don’t interfere with my current server. That will get me an “It Works!” at http://localhost:5555/.

Now I want to install PostgreSQL database and a PHP script to use it to create and to manage databases on Apache web server. I type these commands after logging in as root. It only takes 63MB more space in my virtual machine.
apt-get install apache2 php5 php5-pgsql postgresql phppgadmin

Because we are forwarding the requests, we have to reconfigure the server to allow requests from all or the IP address of our virtual machine. Remove the # at the front of # allow from all in /etc/apache2/conf.d/phppgadmin and restart the server with /etc/init.d/apache2 restart.

Presto: From the host PC we get
SetUpDatabase

We need to create a user for the database.
su postgres
psql
CREATE USER fred with PASSWORD 'somepassword' ;

Now, I can click on PostgreSQL to log in and get
logged_in

I click on Create Database and fill in a name.

create_db
Then I create a few tables as needed.
create_table
insert

With this simple setup you can quickly calculate total lead put down-range, number on hand in different calibres. Of course you can add more columns with dates, accuracy and such. To use it you have to learn a bit of SQL:
select diameter,sum(number) as on_hand from bullets group by diameter;
select sum(-weight*number/7000.0) as pounds_fired from bullets where number<0 ;

You can store frequently used or important SQL queries as “views” and browsing those views is just a couple of clicks rather than any typing at all.
view

One can create tables of different kinds and gather information from multiple tables in a single report. Thus you can put static information in one table and cross-reference it from another table with a query. We could put the bullet information in one table and give it an ID number which could be used in another table of targets shot, accuracy etc.

The same sort of activities can be done with a spreadsheet but rather than having to scroll around, we can gather reports by simple commands and clicks and it scales. When a spreadsheet is scrolling down the hall and around the corner such a database will just be getting warmed up.

2 Comments

  1. oiaohm

    bw this shows you don’t know firearms.

    In fact it is a very good idea to keep an inventory list of ammo.

    The 2 100 percent critical reasons.
    1) expiry dates. Yes ammo does not last forever in perfect condition. Expired ammo has risk of hang fire. Hang fire can lead to people getting hurt like a bullet being ejected out of gun and exploding on ground. Yes this could be a bullet you left in a clip or magazine that is no longer in it box. Ammo list will tell you that you have a few extra bullets not accounted for that are expired to track down.
    2) product recalls. Every now and again there is a dud batch of bullets produced. These also can be hang fire problems.

    So only a careless person with firearms does not maintain an ammo list or log book of ammo usage.

    The empty box method is really how to get hurt. Its the part full boxes, clips and magazines that are going to kill you. Yes a proper ammo log includes what you have loaded into your clips and magazines.

    2 boxes of ammo for 1 gun is enough to get you into trouble. You have just used out one box except the last few bullets from that box go into a clip or magazine. You go out buy a new box. You forget old bullets are in the magazine or clip so you use those bullets. You go out and end up ejecting a hang fire round due to the round being expired that explodes in your face now you are blind. This is a real chain of events that happen to some people who are too stupid to maintain an exact inventory of ammo or use log book of ammo so they know exactly what is in their magazines and clips.

    So you don’t need lots and lots of ammo to get hurt. Low volume usage is more likely to have expired rounds than high volume. Yes ammo tracking is more critical to low volume users.

    You will forget to bring the box back when its used and there are no more in the box. So you get back and you are like what were those they worked well. Also what are these last few in the magazines and clips because you forgot to bring back the empty box. Different makers different performance and life span. Even batch to batch there are differences.

    Yes the shake the box it empty does not tell you if you have used all of that bullets. Preferred is to only dispose of box once every round has either been fired or disposed of. Include the rounds in magazines and clips that came from that box. Yes there should be empty boxes at times in your ammo storage. Yes you should be able to return any bullets in a clip or magazine to the box they came from. Problem is human error does creep in and boxes get dumped when they should not have been because of the box is empty problem.

    The weight fired on a firing range can be useful. To know what percentage you have recovered.

    Yes there are pen and paper ways of doing the same thing. There are ammo log books. These are slow and painful to use.

    If you are not making records of your ammo you should not have guns. Because the lack of records and tracking those records hold will see either you or someone near you hurt due to malfunction of ammo.

    dw I would like you to tell me how do you know from an empty box without searching all the clips and magazines you have that all the bullets from that box are used.

    Remember you only have to miss 1 clip or 1 magazine with 1 bullet in it to possible be hurt due to hang fire rounds.

    dw can you see it now the only safe way is do something like Robert is doing either electronically or in paper. Yes it is a good thing to serial number you clips and magazines. X rounds from Y box into Z clip/magazine with D expire date. That is about the min record you should do. Mind you if I am doing paper I normally do a page per clip/magazine makes it simple to check what the last load is and I obey the rule of never fill up a clip or magazine until its fully used. Mixing rounds from different boxes is another hazard.

  2. bw

    Child’s play? Maybe for the Rain Man’s child!

    If you need a server to keep track of how many bullets you have, then you are truly some sort of gun nut. I just shake the box. It’s empty.

Leave a comment