Man, I love my internet….

Posted in ubuntu-only on June 6th, 2009 by bperry


the internet in my apt.

Looking for a job in germany….

Posted in ubuntu-only on June 5th, 2009 by bperry

Hello Planet, I am hoping you can help me!

I am currently looking for a new job. I have always wanted to live and work in Germany. I know people in Germany read the planet, so maybe, if anyone out there in Deutschland is looking for a .NET programmer/Systems Administrator/All around computer tech guy and is willing to sponsor a work visa, let me know in the comments or email me at bperry.volatile[at]gmail[dot]com and I will get you a resume.

I have managed Linux and Windows servers for the past three years, written .NET professionally for about one and a half years, and have excellent recommendations!

Thanks a bunch!

Running SQL scripts in order from C# code

Posted in C#, mono, ubuntu-only on June 2nd, 2009 by bperry

I have a folder of SQL scripts being compiled as embedded resources. They are named as such:

01 FirstTable.sql
02 SecondTable.sql
etc…

so that way I can run them in the order they need to be run in when say, resetting a database. The problem I ran into was getting the resources through reflection gave them to me in the wrong order… the second script was trying to be run first and it relies on the first script, so that obviously didn’t work. Running Array.Sort() on the script list fixed this problem. The code ended up looking like:


public void Reset()
{
if (string.IsNullOrEmpty(ConnectionString) && Connection == null)
throw new Exception("Connection string and connection are null.");
else
{
if (Connection == null)
Connection = new MySqlConnection(ConnectionString);

Connection.Open();

MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = "DROP DATABASE SystemsLogica; CREATE DATABASE SystemsLogica; USE SystemsLogica;";
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = Connection;

cmd.ExecuteNonQuery();

Assembly asm = Assembly.GetExecutingAssembly();

string[] scripts = asm.GetManifestResourceNames();
Array.Sort(scripts);

foreach (string file in scripts)
{
Stream res = asm.GetManifestResourceStream(file);
byte[] resbytes = new byte[res.Length];

res.Read(resbytes, 0, (int)res.Length);

Console.WriteLine(file);
Console.WriteLine("-----------------");
Console.WriteLine(Encoding.ASCII.GetString(resbytes));
Console.Write("\n\n\n");

using (cmd = new MySqlCommand())
{
cmd.CommandText = Encoding.ASCII.GetString(resbytes);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = Connection;

cmd.ExecuteNonQuery();
}

}

Connection.Close();
}
}

This works great in mono. This was just a test method, so there is no real error checking, so be careful.

2 things

Posted in Uncategorized on May 5th, 2009 by bperry

Reset mac password without CD:

[Apple|Super]-S after chime
mount -uw /
rm /var/db/.AppleSetupDone
shutdown -h now

Office 2003 source doesn’t match installation source.

Uninstall from the setup binary on the CD.
Go to Control Panel -> Add/Remove programs -> Remove Office 2003. For some reason, it isn’t removed from this list. this causes many headaches later and took me a few hours to figure out.
Reinstall from CD.

Gdk.Color -> HTML hex string

Posted in ubuntu-only on April 22nd, 2009 by bperry

String.Format(”#{0:X2}{1:X2}{2:X2}”, (byte)(colorSelector.CurrentColor.Red >> 8), (byte)(colorSelector.CurrentColor.Green >> 8), (byte)(colorSelector.CurrentColor.Blue >> 8));

or a better way:

currentEntry.Text = String.Format(”#{0:X2}{1:X2}{2:X2}”, (int)Math.Truncate(colorSelector.CurrentColor.Red / 256.00), (int)Math.Truncate(colorSelector.CurrentColor.Green / 256.00), (int)Math.Truncate(colorSelector.CurrentColor.Blue / 256.00));

Can you spot the bug?

Posted in ubuntu, ubuntu-only on January 19th, 2009 by bperry

ClamAV Live CD being updated every hour! (+ script)

Posted in clamav, live cd, ubuntu-only on December 22nd, 2008 by bperry

So, I haven’t been doing my duty of updating the Live CD as much as I should have lately. Tonight, I set off to automate updating everything so I just have to set a cron to do everything for me. I have been asked numerous times to supply some kind of script to do this so the person asking didn’t have to re-download the whole iso over again. Here is the script (if you have any suggestions on how to do something better, feel free to suggest away):

START=$(date +%s)

cd ~/Projects/clamavlivecd

mkdir iso
mount ClamAVLiveCD2.0.iso iso/ -o loop

cp -R iso/ image/

echo "Decompressing SquashFS...\n"
cp iso/casper/filesystem.squashfs ./
unsquashfs filesystem.squashfs

echo "Setting up Live CD chroot...\n"
cp /etc/resolv.conf squashfs-root/etc/resolv.conf

chroot squashfs-root/ mount /proc
chroot squashfs-root/ mount /sys
chroot squashfs-root/ mount -t devpts none /dev/pts

echo "Refreshing and updating ClamAV virus definitions...\n"
chroot squashfs-root/ freshclam

#cleanup chroot
echo "Cleaning up chroot...\n"
chroot squashfs-root/ rm -rf /tmp/*
chroot squashfs-root/ rm /etc/resolv.conf
chroot squashfs-root/ umount -l -f /proc
chroot squashfs-root/ umount -l -f /sys
chroot squashfs-root/ umount /dev/pts

echo "Removing old SquashFS filesystem...\n"
rm image/casper/filesystem.squashfs

echo "Creating new SquashFS filesystem...\n"
sudo mksquashfs squashfs-root image/casper/filesystem.squashfs

echo "Finding and creating MD5 hash sums of files in image...\n"
cd image
find . -type f -print0 | xargs -0 md5sum > md5sum.txt

echo "Removing old old image and creating new old image...\n"
cd ..
rm ClamAVLiveCD2.0_old.iso
mv ClamAVLiveCD2.0.iso ClamAVLiveCD2.0_old.iso

echo "Creating new image...\n"
sudo mkisofs -r -V "ClamAV Live CD 2.0" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ClamAVLiveCD2.0.iso image/

#cleanup working directory

echo "Cleaning up working directory...\n"
umount iso/

rm -rf squashfs-root
rm -rf image
rm -rf iso
rm filesystem.squashfs

echo "Getting MD5 and SHA1 sum of image...\n"
echo "MD5: " > clamavlivecd.sums
md5sum ClamAVLiveCD2.0.iso >> clamavlivecd.sums
echo "SHA1: " >> clamavlivecd.sums
sha1sum ClamAVLiveCD2.0.iso >> clamavlivecd.sums

END=$(date +%s)

echo "\nDone at `date`. The whole process took $(($END - $START)) seconds!\n"

Well, now I should stop worrying about not having time for this project! yay

Useless comments

Posted in ubuntu-only, vista on December 10th, 2008 by bperry

I am researching why my Vista machine at work isn’t getting its updates and came across a pretty helpful post (not sure if it will help yet):

http://geekswithblogs.net/steveclements/archive/2007/04/18/Vista-Windows-Update-not-working-on-a-domain.aspx

One of the comments, however, really made me angry…


I haven’t the faintest clue what all this HKEY business is about. I am a Doctor, not an IT consultant. All I know is that my Vista won’t update.
Vista is a phenomenally expensive piece of software failing to run on a phenomenally expensive machine, and wasting a phenomenal amount of my time.
Next time I will buy a Mac.
And no, I don’t have a website.

Seriously, I don’t like Vista just as much as the next guy, but I wouldn’t take the time to post a comment on something I don’t understand, explaining why I don’t understand with a horrible excuse (I am a Doctor?) and insulting the author, especially if I had already wasted “a phenomenal amount of my time” trying to figure it out. It is a useless comment, helps nobody, and further wastes your time and mine.

What am I going to do?

Posted in life on November 14th, 2008 by bperry

I am 19 years old. I will be turning 20 at the end of January. All my plans for college so far have been blown to shit by recent life happenings, but I have a nice job right now. I work with great people and I can think of only a few jobs that I would rather have than the one I have now. I live in downtown Dallas in a nice apartment, I even have a backyard. I am a trains ride away from anything I could ever want.

I have the feeling I have grown up way faster than any of my friends. I also have no idea what I am doing. I don’t know how to manage my money, though I try and assume I am doing it right. I just make stuff up as I go, which works when you are 19, in college, still dependent on your parents, and have only your classes to worry about. That is something I have had to learn the hard way. I know I have probably pissed off some of my coworkers by taking the “throwing darts in the dark” approach to things, but that is always how I have handled things and it hasn’t failed me that often.

At every job I have had, I have been the youngest person there. At Joe’s Crab Shack, I start 2 days after I turned 17, 17 being the youngest you could start working there. After that, I moved on to Computer Care of Arlington, where it was me, a college guy named Kyle (a senior), and Chris (my boss) (eventually, Geoff came on after Kyle left, I am not sure who is older between the two of us). I left Computer Care after a year and a half to work at a place called VALID Systems. I was the youngest by 10 years-ish. I now work at a place called Institution Solutions with a bunch of great guys whom are, of course, considerably older than me (8+ years).

Sometimes I wonder if I did miss anything not working with people my age. Don’t get me wrong, I don’t regret any of what I did and would still do it over. In school, all I did was write programs, study computers, how they worked, why they worked, etc… instead of doing my school work, which pissed off a fair share of my fellow students (including my friends). I didn’t hang out with people very much, outside of people on the intertubes.

To tell you the truth, I am not even sure if I want to be a (professional) programmer for the rest of my life. I would much rather be a musician, and if I can make that happen, which I don’t see why I can’t, I will gladly take the job. I enjoy programming thoroughly. My problem is I don’t do well working on a single project for months at a time. I suck it up and do my best, but it certainly isn’t enjoyable to me.

I guess what I am trying to say is that, even though I have taken a radically different route than my friends, I have ended up in the same boat. I don’t know what I am doing or what I am going to do in the future. All I know is “let the chips fall where they may”. I have friends whom are entirely too concerned about who they are now that they aren’t paying attention to who they will be in ten/twenty/X years. They seem to be even more lost than I am.

So if anyone out there thinks that i had this planned all along, or that I have some kind of plan, you are completely, utterly wrong. And I wouldn’t have it any other way. It is too much fun :-) .

Eh, book meme :-)

Posted in meme, ubuntu-only on November 12th, 2008 by bperry

Here are the rules:

  • Grab the nearest book.
  • Open it to page 56.
  • Find the fifth sentence.
  • Post the text of the sentence in your journal along with these instructions.
  • Don’t dig for your favorite book, the cool book, or the intellectual one: pick the CLOSEST.

And the result:

Setting an images border property to none will remove those ugly borders.

From: “The CSS Anthology: 101 essential tips, tricks, and hacks” by Sitepoint