My Take on the Monsanto Madness

It seems like Wikipedia doesn’t have a dedicated article yet, which is strange because it’s being heard by the United States Supreme Court… But anyways here‘s the monsanto article. And here’s a quick summary:

1) monsanto develops & patents a herbicidal resistant strain of soybeans
2) they sell said soybeans to farmers as seed under the condition that the farmer not plant any future generations
3) farmer buys seed from grain elevator
4) farmer plants said seed & uses monsanto herbicide
5) some of the farmer’s soy plants grow, some are killed by herbicide
6) monsanto sues farmer for illegally using seed

Now in reality the farmer was almost certain that a reasonable fraction of the seed he purchased from the grain elevator would be resistant since monsanto crops compose about 80% of the total soybean yield in the United States. But, the farmer was employing a technique used frequently in biology to identify mutants. Organisms are grown in an environment which is hostile to normal growth, any individuals which have beneficial mutations allowing them to grow in these conditions proliferate wildly. It usually takes a few generations & some uv light to get something interesting, but at issue is you’re doing work to identify individuals with a certain trait, in this case herbicide resistance. Say he started with random seeds instead of monsanto seeds in order to do this sort of selective breeding and grow soybeans which are especially salt resistant. Would he be infringing on monsanto patents? What would the best source of seeds for this sort of an experiment be, maybe a mix of a bunch of different strains, something like what one might find in a grain elevator?

Of course, it’s kind of sad, because it does appear he’s going to lose. Which means gene patents galore, bad news bears.

Building XFCE from Git

I recently tried to build an XFCE package using the git source (because I wanted to apply a patch).  Something I couldn’t find except in an ancient mailing list archive, was that you frequently need to pass either autogen or configure “–enable-maintainer-mode”, I passed it to both just to be safe.  Have fun building xfce.

The Original Minesweeper

The Original Minesweeper

Probably the high point of anything made by microsoft.  Works perfectly in wine.

Posted in Games. Tags: . Leave a Comment »

Pogoplug & Autofs

Autofs is able to mount drives over sshfs on the fly. This allows you to seamlessly use a drive that you’re accessing over a local network or even over an ocean.

Pogoplug is a new dropbox-like cloud storage solution. Interestingly, and unlike dropbox, they do not work by mirroring data on your local disks. This means that the storage space offered is truly additive. Much like sshfs.

So I was of course curious if I could have autofs mount pogoplug seamlessly on access. Now I’m not sure how stable the connection is, so perhaps it would be better advised to do this once at login and not worry about it. But, anyways, a pseudo working solution (it seems to hang the first time it’s accessed, but a ctrl+c will return to the terminal and it will be mounted). It would be a huge help if someone could help me figure out that last niggle.

I attempted to keep user credentials separate from the script, and currently this banks on them being stored in ~/.ssh/pogouser & ~/.ssh/pogopass.

My auto.master:
#/etc/auto.master
/mnt/pogoplug /etc/auto.pogoplugfs --timeout=300,--ghost,nodev,nosuid

my auto.pogoplugfs:
username -fstype=fuse,nonempty,rw :/usr/local/bin/pogoplug_wrapper

And finally pogoplug_wrapper, you need to put pogoplugfs in your path. I put it in /usr/local/bin. This does some minimal logging to ~/.cache/pogoplugfs.log. You can comment out any of those lines if you’re not interested.
#!/bin/bash
#pogoplug_wrapper

mkdir -p $1
mountuser=`basename $1`
mountuserhome=$(getent passwd $mountuser | cut -d: -f6)
cd $mountuserhome/.cache
echo "$mountuser:$mountuserhome" >> pogoplugfs.log
uid=`id -u $mountuser`
gid=`id -g $mountuser`
echo "" >> $mountuserhome/.cache/pogoplugfs.log
date >> $mountuserhome/.cache/pogoplugfs.log
chown $uid:$gid $1
chmod 755 $1
pogouser=`head -n 1 $mountuserhome/.ssh/pogouser`
pogopass=`head -n 1 $mountuserhome/.ssh/pogopass`
mountcommand="pogoplugfs --mountpoint $1 --user $pogouser --password $pogopass --fuseopts $3"
echo "$mountcommand" >> $mountuserhome/.cache/pogoplugfs.log
sudo -u $mountuser $mountcommand &
sleep 3 # give the command time to finish
exit 0

Saving Data to the SD Card on Droid RAZR M

I recently became annoyed with my phone when I tried to shift some music onto it. It downloaded a few songs and then it stalled. “Out of space” or somesuch. I knew I had a 32gb card in there and not nearly that much music, so I was a little surprised. Anyways after a little investigation I found that the phone had two mount points named sdcardX, namely:
/storage/sdcard0 and
/storage/sdcard1
which is not ideal, especially since /storage/sdcard0 is not actually an sdcard, or at least it’s not replaceable. I’m sure this made sense to someone at some point thinking, “oh, well internal memory is faster so we’ll just emulate an sdcard and that’ll be swell”. And it is, until someone (me) decides to save a bunch of data that doesn’t require fast access to the sdcard. Because the internal 4.5 gb, which already has some photos and dropbox & app backups & …, quickly runs out of room when you try to put a music library that easily fits onto a 32 gb card in the remaining space. So I spent a little bit of time trying to figure out how to mount the external card in a way so that amazon music or google music would save music there. I got some leads, which suggested modifying the fstab (file which tells where to mount which things), but my fstab didn’t look at all like the ones that they were describing, so I was left in the void.

Eventually, after much futzing around, I discovered a solution. Not an ideal solution, but a passable one. Namely after the system boots use tasker to run a shell command which mount/bind’s the external sd card to the mountpoint of the internal one. On the downside you do lose the 4.5gb internal space, or at least it becomes much less accessible. On the upside this phone comes with a 32gb card I believe, and according to reports despite it being not officially supported it should work with up to a 64gb card (128gb micro cards aren’t available at the moment, so no news there). So you’re trading
4.5gb + 16/32/64 gb half working storage for
4.5gb less than half working storage + 16/32/64gb
which seemed fair to me.

How it’s done.
1) your phone must be rooted
2) get tasker. It’s a paid app, only a few bucks and totally worth it. I have it toggle my wifi off when I’m somewhere I can’t connect so it’s not futilely scanning for a signal nonstop. I also have it go into airplane mode overnight, saves a bunch of battery, and prevents the phone from waking me up (I don’t plug my phone in every day).
3) make a new task and make it run a shell command using root permissions, and the command is “mount -o bind /mnt/external1 /storage/sdcard0” then make a new task & add the context at boot (new task -> event -> system -> device boot) & add the task you just created.
done.

The next time you boot your phone if you go to applications/storage you’ll see that where it says internal storage you have 16/32/64gb available. Though you’ll also see the exact same amount reflected in the sdcard storage. A decent trade in my opinion.

Before doing all this you might want to copy the data from your internal partition onto the sdcard (which I did for all my data, photos and so on), but for apps I found it worked a little better to just uninstall/reinstall. And on reinstall everything will be written to the sdcard properly.

Posted in Tech. Tags: , , . 2 Comments »

Splitting Fortran Files into Subroutines

Coding in fortran, I often find it easier to work with numerous files each containing a single subroutine.  This can make it easier to compare two versions of files in which order of subroutines may have changed (since each subroutine is compared instead of the files all at once), it makes compiling faster as less code needs to be recompiled on every edit, it makes it easier to use a text editor, since you can see a greater fraction of the file at once.  It’s not all good though, sometimes it’s nice to have subroutine clustered together in a module.  But on the whole, I’d rather deal with 100 duck sized horses.  So the question is then, how can I quickly and easily go from one giganto file to many one subroutine files.  Answer, a couple of options:

1) f77split – This was probably the first one I tried, works pretty well.

2) f90split – For newer fortran.

3) Homebrewed: Fair warning, haven’t used this in a little bit, but it was useful the last time I did, and I believe this is the most recent version.  Also, it’s not pretty, it’s not really supposed to be.  It’s supposed to accomplish a fairly simple task as simply and with as little effort as possible while being theoretically simple.

#!/usr/bin/perl
use strict;

my $filename = $ARGV[0];
chomp($filename);
my $basename = $filename;
$basename =~ s/(.*)\..*/$1/; # chop off until the end of the line

system("mkdir -p $basename"); # make the file for one
my $current_subroutine_title = '';
my $file_open = 0;

open SOURCEFILE, "<", "$filename" or die $!;

while(my $fileline = )
{
chomp($fileline);
# print "$fileline\n";
if($fileline =~ m/^\s+subroutine\s+(\w+)/i)
{
print "now reading subroutine $1\n";
if($file_open > 0){close(SUBROUTINEFILE);}
open SUBROUTINEFILE, ">", "$basename/$1.F" or die $!;
$file_open = 1;
}
if($file_open > 0)
{
print SUBROUTINEFILE "$fileline\n";
}
}

if($file_open > 0){close(SUBROUTINEFILE);}
close(SOURCEFILE);

eBay RSS Missing

Sadly in the redesign of eBay one of the things that got the axe was rss feeds from searches.  Anyone have any good ideas for good alternatives?

Posted in Tech. Tags: , . Leave a Comment »