Greg

(15 comments, 105 posts)

This user hasn't shared any profile information

Home page: http://www.greglincoln.com

Jabber/GTalk: admin

Posts by Greg
greg_icon

Loopback success

0

I had one of those geekpride moments last night when trying to deal with a problem I was having with a Minecraft server running ModLoader. Modding Minecraft is not as easy as it could be, but since it is written in Java, it is not as hard as it could be either. A number of clever folks have built compatibility layers and wrappers to improve mod maintainability and compatibility. ModLoader is one of these wrappers widgets.

Its developer recently (well, somewhat recently anyway) added a feature that would merge zipped jar like class collections from a mods subdirectory into the classpath, preventing the need to edit minecraft_server.jar for each and every mod as you had to do in the past. It loads these in “random” order, which turns out to be alphabetical on some platforms, and in less easily manipulated order on others. Linux falls into the latter category, naturally.

When I looked to fix this, my first thought was to change ModLoader’s behavior so that it always loaded in alphabetical order. This would be trivial to do if I had the source for ModLoader, but less so without it. I don’t have much experience with Java decompilers and just didn’t feel like messing with that.

Instead, I implemented a fun easy hack that anyone running Linux can do. I created a small vfat loopback filesystem for the mods subfolder. This produced the expected alphabetical loading order and took a minute or two to set up. Here’s how you do it:

First, create a zeroed out virtual “disk” file to mount, using dd.

dd if=/dev/zero of=diskimage.100mb bs=1048576 count=100

dd stands for data description, but you don’t really need to know that. It looks more complicated than it is. The if and of parameters are “in file” and “out file.” Since we want a file filled with zeroes, we use /dev/zero (a convenience ”device” that returns zero) as the “in file.” Next, we have bs, for which the snarky among you will instantly have a definition in mind. However! It is actually “block size,” and determines the size of each copy block, or step in bytes. As I wanted a file that was roughly 100MB, I used the size of a megabyte here. Lastly, we have count, which simply determines the number of “bs” blocks to write. (Yes, yes, BS blocks)

Now! We have a nice empty file to use. Let’s format it. This is super easy.

mkfs.vfat diskimage.100mb

We use vfat because it is fast, simple, and Windowsy. Also, it worked.

Last step! We need to mount it. In Linux, there are no pesky drive letters. One can mount a filesystem anywhere. Everything lives as a child of root, which is simply /. So let us assume our Minecraft server lives in /home/minecraft. The mods folder needs to be /home/minecraft/mods. So create the empty folder first. (Move your existing mods folder out of the way if needed.)

mv mods mods-old (if needed)
mkdir mods

And the mount: (You need to be able to run things as sudo/root to do this. Discussions about sudo are outside of the scope of this article.)

sudo mount diskimage.100mb /home/minecraft/mods -t vfat -o loop,owner,group,umask=000

The gist of this is probably obvious. The flags tell mount the type of the filesystem and to map all the files as 777 (readable and writeable by all) since vfat does not support these things natively. It’s fine for our needs, though not secure enough for some other situations, such as a folder accessible via the web, so make sure you understand the implications of this before you use it elsewhere.

Now, you are set! You can copy your mod zip files and rename them so that they are in the order you’d like and it will Just Work(TM). Hooray!

One last thing. If you want this to mount automatically, you will need to edit /etc/fstab, adding this: (all on one line)

/home/minecraft/diskimage.100mb /home/minecraft/mods vfat loop,owner,group,umask=000 0 0

I’ll leave the details of this to you to read about. Have fun!

 

Android is Insecure By Design

0

Android’s security situation is pretty dire. Considering how well Google architected Chrome, I know they understand how to create a secure system. Perhaps Google don’t care about security on Android?

If a user needs to worry about downloading malware on Android Market, which has apps that leak or maliciously steal personal data, and others that send spam SMS messages, among other nasty things, something has gone terribly wrong.

Asking users to review a complex and obtuse permissions list is not even close to the answer. Time and time again, we’ve seen that this sort of thing can’t be left to the users by default. They will always click yes.

Google has not learned this lesson, obviously, and as such, I expect the Android platform will turn into the Windows of old, where nearly every smartphone is jam-packed with Spy/Malware.

Hopefully I’m wrong and Google will wake up.

phpBB3 and add user mod

0

If you use the add user mod with phpBB3 with new user registration disabled you may find it is not sending passwords in the user welcome email. To fix this, you’ll need to edit the language template for the user welcome email to include the password token.

You can find the tempate in language/en/emails. WIth user registration disabled, the one you want is user_welcome.txt. Use _inactive.txt or admin_welcome_inactive.txt as appropriate if you use those registration modes.

All you need to do is add “Password: {PASSWORD}” somewhere (the token is the important bit) and you’ll be set. You might need to clear your board’s cache by clicking the “clear cache” button on the main admin window.

I hope this helps you if you find yourself in the same puzzling predicament.

iPad?

0

So far, this thing has not left my side. I can almost touch type with this keyboard. What I hadn’t expected was for it to replace my iPhone in my mind such that I am puzzled by the tiny screen when I use my iPhone.
I think this means Iphones need a higher res screen.

My box can has shinies!

1

Found on a forum:

I think of my inner world like a child holding a box of
their most precious treasures and when they show it to
someone the person laughs and teases that that they
aren’t treasures, they are worthless knickknacks and
stones. What hurts isn’t being told that they are
worthless, what hurts is that something so wonderful
could not be shared. What doesn’t do any good is locking
the box up and showing no one ever again. You have to
learn to show someone else and keep doing it until you
find someone who appreciates it just as you do.

Hackintosh success, Dell Inspiron 530, Mac OS 10.5.6

27

Today is a happy Mac day, for I have successfully installed Mac OS 10 on my Dell Desktop. Many folks have achieved this before me, so I’m not claiming to be some sort of amazing talent, but considering how non-obvious the process was, I’ll put down some notes here for you to peruse at your leisure.

(more…)

You must watch this right away.

4

Really. Dr. Horrible’s Sing-Along Blog

Awesome. Watch now. Thanks.

Reverse a dictionary

1

Have you ever wished your dictionary of <K,V> was in fact of <V,K>? I might be the last person to figure this out, but with LINQ (and a couple lambdas) you can do this with one magical line of code:

var newDict = oldDict.ToDictionary(l => l.Value, l => l.Key);

Neat, eh?

I hate Subversion

3

I really really hate it. Every time I try to do anything USEFUL with it, like try out an idea in a new branch and then merge the bits of that branch that worked out back to my main line, it barfs all over me with totally crap-ass error messages that nobody could ever, EVER understand.

Also, despite their claims to the contrary in the documentation, svn will happily shit all over your working copy when a switch fails. So much for atomic operations.

I’ve had it. I’m switching to Mercurial.

Become a Jedi with Resharper

0

If you work in C# or VB.net on a regular basis, you really owe it to yourself to try out Resharper. This tool saves me countless hours.

James Kovacs put together some fantastic screencasts on “Becoming a Jedi” that show it in action, if you are curious.

He hasn’t covered the features that make it a boon for test driven development yet, but there’s another great screencast that shows that off, and this post provides some additional details on “coding in reverse” with Resharper.

Greg's RSS Feed
Go to Top