arnekolja's current stuff http://www.arnekolja.de use the web you must, li'll padawan! posterous.com Mon, 16 May 2011 07:50:00 -0700 bookamat | einnahmen-ausgaben-rechnung http://www.arnekolja.de/bookamat-einnahmen-ausgaben-rechnung http://www.arnekolja.de/bookamat-einnahmen-ausgaben-rechnung
Check out this website I found at bookamat.com

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Mon, 16 May 2011 07:50:00 -0700 Archipel Project http://www.arnekolja.de/archipel-project http://www.arnekolja.de/archipel-project
Media_httparchipelpro_gyrdl

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Sun, 02 Jan 2011 10:04:00 -0800 One day, two Microsoft fails http://www.arnekolja.de/one-day-two-microsoft-fails http://www.arnekolja.de/one-day-two-microsoft-fails

It's a catch-22 with Microsoft. Being an "Apple Fanboy" (™) as many people call every Apple user I try to not criticize the MS world too much, to not get sucked into this simple world of hatred many people live in when it comes to those religious discussions. But sometimes, yeah, sometimes it's just so bad that I just can not shut up. And today I stumbled across two of those problems that make you tear your last hair, screaming out loud what a crap this company produces. Sorry about that, but it's just the truth.

Problem number one: Xbox 360, Windows 7, external hard drives.

The Xbox 360 has built-in support for USB storage, so you can play movies, music, photos from let's say an external hard drive. As I've bought a second Xbox 360 these days I wanted to connect an old 3.5 inch USB hard drive to the old Xbox, so it can be used as a media center. Yes, I know, streaming would be the better choice, but I didn't have the time to lay an ethernet cable yet and no WiFi adapter in sight.

So I connected this hard drive to my Xbox and - nothing. The Xbox didn't recognize it. Okay, no problem, think to remember that the Xbox doesn't support NTFS, so I reformatted it using a FAT, as FAT32 is the file system of choice for almost every non-PC device. Formatted it, connected it - still nothing. What the…? I disconnected it again, connected it to the Windows 7 PC I initially formatted it with and took a look at the format tool. For some reason the FAT system I chose wasn't FAT32 but exFAT, a newer version that supports files bigger than 4 GB. Uhm… okay, the Xbox doesn't seem to support this exFAT system, so I tried to find a way to format it as FAT32 but - there wasn't an option for that! I played around with the partition's size and whatever I entered, it didn't offer a FAT32 option. I remembered some size problems around 32 GB or something like that, so I entered 20 GB and still no FAT32. But now the funny thing: when I entered 4 GB, it offered me FAT32!

Now that is so fracking weird, I cannot even remotely think of any reason for this. FAT32 is a file system that supports up to 2 TB per partition, depending on your cluster settings. But 4 GB? For every partition that's larger than 4 GB you don't get the option to format it as FAT32, you then have to format it as exFAT. There are several reasons why this is simply crap:

  1. Microsoft is the main software base for the average consumer, but as their NTFS is closed source and Unix filesystems cannot be formatted by Windows, at least not out of the box, FAT32 is crucial for almost every user that handles media players or similar hardware.
  2. The only reason to disable FAT32 support would be to not confuse customers, what they actually do by disabling it. Not even mentioning the fact that the whole process is far from being consumer friendly.
  3. Their own flagship living room product, the Xbox 360, is openly advertised as supporting external storage for media playback purposes, but doesn't support either exFAT nor NTFS. USB devices have to be formatted as FAT32.

The upshot was that I had to use my Mac to make a simple hard drive compatible to an Xbox 360, as Windows 7 is literally incapable to do it (unless you search for some 3rd party tool, of course). Crazy. And so stupid.

Problem number two: Xbox 360, Kinect, video.

Kinect is the great hype these days. Many people love it, many people hate it, that's just business as usual. I have it and I love it, even if it is not as good as advertised and there are no good games available yet. But I'm addicted to gadgets and it really is a huge step forward in interacting with a video console, it's just not yet utilized as good as it could be.

But not being as good as advertised is something totally different to what they did with the built-in video camera. The device has several cameras and the one I am talking about is just the one for shooting images or taking videos, not the one (or two) that track your body, so don't be afraid of what I'm telling you now.

The built-in camera is advertised as playing crystal clear video at a very good frame rate. In the preview videos they even advertised full screen video, which just isn't there. The application that enables you to do video conferencing is called Kinect-Video and this one doesn't have an option to do full screen conferencing. But well, doesn't matter right now, maybe they'll update this application later on. Really doesn't matter for me.

The bigger problem is that in my case I wasn't able to actually enjoy any second of my video conferencing sessions, as the quality was crappy as hell. The frame rate was stuck at about five to ten frames per second, video is grainy (ingame photos are too) and the audio was producing echoes, squeaking, too silent. The audio actually seems to be using the low quality codec that ingame voice uses on the Xbox 360 and this is just ridiculous for living room video conferencing, especially without using a headset.

But the way bigger fail is one they could have easily fixed before releasing it: slow motion video. I couldn't imagine why video has to be that slow, so I searched the web for it. Microsoft's FAQ told me to check my connection speed, but honestly - 300 mbit/s on WiFi shouldn't be a problem using my 32 mbit/s down /2 mbit/s up ISP connection - yet I connected a cable, just to make sure I'm not the problem here. Still slow motion video. What the… ?

Today I did another search on the web and this time I stumbled across a posting (sorry, don't have the link any more) where someone was suggesting to play around with the living room's lighting, as the camera seems to be compensating low light situations too early, Somehow reminds me of a situation ten years ago, when an old Microsoft webcam produced slow video every time it wasn't full daylight. But hey, these days are over, aren't they? They … are … not!

Earlier this day I tried to troubleshoot it and it's like he said - better lighting and the video plays fluently. But the amount of light that I needed wasn't simply opening the curtains and here you go. I had to put a lamp right beside the camera. When waving my hand right in front of camera and the lamp the video was very good. But that's nothing I can implement for my whole living room. I have a huge window in there that's supposed to let in a reasonable amount of light, but, at least these winter days, that still isn't enough.

So the end of this story is: The camera's video doesn't work fluently for most of the people's living rooms, as you have to have a "daylight bright" situation to make it enjoyable. In my living room I seem to have to pull out those old, bright, energy guzzling lamps I wanted to throw away, hoping that it helps in situations that the sun isn't shining directly into my window.

I love the idea of having Kinect, honestly, but it's also a bit of a pain in the ass. First the room thing (you need 2m of space in front of your TV), now the light thing… feeling like I have to build a new living room to meet all those requirements. Maybe my living room is especially dark and especially small, but I think there are millions of others that have to fight with this situations. Of course you have to meet some requirements, but it just feels like it's not thought out very well. A camera with better low light pictures costs only one buck more in production (if it isn't only a stupid driver problem) and the camera angle could have been better, too. But at this point I just have to say, Microsoft, you failed!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Wed, 28 Jul 2010 05:02:52 -0700 Thoughts about Access Control Lists in Ruby on Rails http://www.arnekolja.de/thoughts-about-access-control-lists-in-ruby-o http://www.arnekolja.de/thoughts-about-access-control-lists-in-ruby-o When you’re implementing a web application that offers some sort of user management, you quickly get into the situation to think about permissions for these users. Usually you want to have groups of users (or „roles“ - I noticed that many in the Ruby on Rails field prefer the term roles here) that share permissions like „may write postings“, „may read profiles“ and these sort of things.

Some time ago I started writing a web application and ran into this exact situation. I asked myself „What’s the best way to set up the most flexible sort of permission system, so anything can be permit or forbidden to anyone?“. My conclusion was that I had to use Access Control Lists (ACLs).

Using ACLs the way I wanted to implement it, each object in my application would have had two additional objects: a requesting object and a requested object. Let’s say you have users and postings. Whenever you create a user you would create a requesting object myUser and a requested object myUser, too. Same with postings. Then I could define a simple 1:1 relationship between each requesting object and each requested object. For example: requesting object myUser shall have permission to read requested object myPosting. Or the other way round: requesting object myPosting shall have permission to read requested object myUser, too. Thinking about all the models you will have in a huge web application, you could easily define permissions for everyone to everything.

But guess what - this system is rather complicated to implement. I am still not finished writing my Rails plugin for this and I don’t think I will be able to finish it within the next few weeks or something.

My idea behind this ACL plugin I was going to write was, that I needed one single plugin that can handle all the needs I will ever have in an web application. If this plugin is finally ready, I can use it for huge and small projects as well. You don’t need its full power? No problem, just use only the parts you need. But I would have this one very solution that helps me all the time, instead of implementing tons of implementations of access control that’s available for Rails. There are so many access control plugins available, I cannot even get an overview about it… but this one variation that I was looking for wasn’t there, so I chose to implement it.

But as I mentioned above, my plugin won’t be available any time soon. I am already thinking about pushing it to Github, so I may get some help and share my work at the same time, but before I do so, I need to clean up and make a real project of it.

Anyway, the situation now is that I do not have my own solution yet, but the projects of course cannot always wait for it. So I thought about it some more and made a decision: there always have to be both a simple and a complex solution. But which solution does my project need? Here’s some thoughts about that.

Access Control Lists are a huge implementation. Using them you gain control over every single object’s permissions. You can inherit from parent objects easily, you can override the permissions for a single user though he’s still in his general user group and so forth. But the big question is here: does my project really need this? Or, which sort of projects really need this? Especially the last question came to my mind today, and it almost blew me away, because I realized that I can skip these ACLs for the more pressuring projects right away.

Short answer: most public projects don’t need this sort of Access Control, but intranet applications do.

Long answer is, the whole power of Access Control is only needed, if you have to be able to override permissions for single users at some point. Normal web applications that are for public use, won’t ever make use of it, because you’ll have so many users that you don’t want to control single users. Users are always grouped into roles that may be called „guest“, „normal user“, „paying user“ or such, but they will not be jailed into areas of your site, just because they belong to a special sub project or something. You will not offer special permissions if someone asks for it and you won’t need to permit use of something that is internal. A web application in your intranet will need this stuff. You will need to give a user more space than the other, or create a special repository for just one department, but this is very fine grained work that will only happen as internal stuff. It won’t happen in the public area. Sure, there will be overlaps, but some parts you will have to add to those general plugins anyway. For example I could permit the use of an object using ACLs, but I would need a additional permission system to set up something like „permit number-of-messages“ and such.

So I decided for myself to not fully stick to the plan. I will look out for a solution that’s role based only for my public projects and continue work on my great ACL solution for the future. For internal/intranet projects.

So if there’s anyone up for some work on a great new solution of ACLs in Rails, be my guest. Rails needs this very plugin. Database based, role independent, anything to anyone. But it’s still a hard bit of work.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Tue, 20 Apr 2010 08:50:30 -0700 shiftit - Project Hosting on Google Code http://www.arnekolja.de/shiftit-project-hosting-on-google-code http://www.arnekolja.de/shiftit-project-hosting-on-google-code

This application will let you resize and move your windows without having to using a mouse. Following are some of things you can do with the Shift It:

  • Shift the focused window to left/right/top/bottom half of the screen.
  • Resize the focused window to fill the whole screen.
  • Move the focused window to the center of the screen.

Shift It is a great tool that lets you organize your windows. Now you can read documents side-by-side without having the pain of manually resizing the windows.

Needs an icon instead of menubar text, but it is a really good Cinch alternative :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Wed, 24 Mar 2010 02:57:57 -0700 Quick Tip: Understanding CSS3 Gradients | Nettuts+ http://www.arnekolja.de/quick-tip-understanding-css3-gradients-nettut http://www.arnekolja.de/quick-tip-understanding-css3-gradients-nettut
Webpages don’t need to look the same in every browser! :)

!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Wed, 24 Feb 2010 07:27:45 -0800 Passing around a NSManagedObjectContext on the iPhone http://www.arnekolja.de/passing-around-a-nsmanagedobjectcontext-on-th http://www.arnekolja.de/passing-around-a-nsmanagedobjectcontext-on-th
Media_httpwwwmacdevel_eqfpu

Very interesting read for those who have to push around Core Data object contexts.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Sun, 21 Feb 2010 12:13:03 -0800 The Real Reasons iPhone/iPad Won’t Ever Support Flash – They Can’t | Cult of Mac http://www.arnekolja.de/the-real-reasons-iphoneipad-wont-ever-support-0 http://www.arnekolja.de/the-real-reasons-iphoneipad-wont-ever-support-0
Don’t just take Steve Jobs’ word for it. Full-time Flash developer Morgan Adams articulates good reasons why Flash should never come to Apple’s iPad and anyone interested in the Apple-Adobe conflict on the matter of Flash would do well to pay attention to his commentary.

Word.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Fri, 19 Feb 2010 11:17:19 -0800 Stargate Studios Virtual Backlot Reel 2009 http://www.arnekolja.de/stargate-studios-virtual-backlot-reel-2009-7 http://www.arnekolja.de/stargate-studios-virtual-backlot-reel-2009-7

Very interesting to see how even simple city scapes and streets are blueboxed.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Thu, 11 Feb 2010 03:09:18 -0800 Mr. Beans :) - Twitterfeeds von Ibo | Home http://www.arnekolja.de/mr-beans-twitterfeeds-von-ibo-home http://www.arnekolja.de/mr-beans-twitterfeeds-von-ibo-home

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Mon, 08 Feb 2010 08:11:00 -0800 Sorry Alexander, CNR http://www.arnekolja.de/sorry-alexander-scnr http://www.arnekolja.de/sorry-alexander-scnr

Virensputzsosopo... yay, I know this tool :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Sun, 07 Feb 2010 10:16:35 -0800 SVG captchas? http://www.arnekolja.de/svg-captchas http://www.arnekolja.de/svg-captchas When I thought about securing forms against spam earlier today it came to my mind, that there's one technique around that's never been used for this purpose as far as I know: SVG (or even canvas). SVG offers so many possibilities to implement a securing method, has there really never been someone to try this? Or does one of my readers know about someone who did?

I mean, it's such a great way to style things of all kind. It could be used to draw simple letters without background patterns like a normal captcha (so it would be way easier to read), one could even draw simple symbols that could be combined with a select box of possible names for that symbol or things like that. Before this method gets broken too, the spammers would have to implement a combination of graphics interpretation software (like they use for captchas right now) and a way to generate a bitmap picture out of SVG first. Sure it wouldn't be so hard to implement the latter, but seriously - it would make us being one step before the spammers again, wouldn't it?

I'm just writing this, because in my opinion we should make interpreting captchas easier for humans again, as the spammers made us go that far, that even humans cannot always read these things.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Wed, 03 Feb 2010 08:58:44 -0800 10 ways to make Internet Explorer act like a modern browser http://www.arnekolja.de/10-ways-to-make-internet-explorer-act-like-a-1 http://www.arnekolja.de/10-ways-to-make-internet-explorer-act-like-a-1
Media_httpwwwcatswhoc_qedgh

Especially the shadows thing is very, very useful. Thanks again!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Wed, 03 Feb 2010 05:13:29 -0800 Saying Goodbye to the overflow: hidden Clearing Hack | Aloe Studios Blog http://www.arnekolja.de/saying-goodbye-to-the-overflow-hidden-clearin http://www.arnekolja.de/saying-goodbye-to-the-overflow-hidden-clearin
Media_httpaloestudios_zgfhm

This one proves so useful, has to be in everyone's snippet collection. Thank you very much!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Fri, 29 Jan 2010 08:29:11 -0800 iPad, eBooks, Germany, Magazines http://www.arnekolja.de/ipad-ebooks-germany-magazines http://www.arnekolja.de/ipad-ebooks-germany-magazines I'm a bit afraid of the German eBook situation when it comes to the Apple iPad. I am totally willing to switch from snail mailed paper magazines to eBook magazines, as long as I got a good reading device to handle them and the iPad seems like just the one thing that makes me do this.

But in Germany, as you may know, it's always a bit different: We are always disadvantaged by our media, because they tend to be late on every single comfort advance. We're paying more for mobile phone calls than anyone else in this world (okay, that's polemic, I don't know if that's true, but you get the clue), we still have a really awkward situation here when it comes to video on demand or high definition tv and for god's sake, we're not even able to watch the shows we'd like to watch, because everything that comes to television is at least half a year behind, almost never available in its original language (for those who like to enjoy it this way, like me) and it gets cancelled and they're mixing up seasons like being on drugs. It's just no fun to not pirate stuff over here, haha.

Anyway, as I mentioned above, I'd like to take advantage of the iBooks store the iPad is offering us. It sounds like heaven to me: Buying your magazines online, not having that paper mountains in your home office any more, without the need to throw them away.

So, Apple told in their press briefing that the iBooks store will be open to US customers at its release date. That's not telling us that international iBooks stores won't be online at that date, but it tells us that Apple's not sure yet, if it gets its contracts signed until that. For me that means that it's safe to say that Germany will once more be behind the states again. It's a bummer, but that's just what we have to live with. As far as I can imagine that's for sure not Apple's fault, it's just the German publishers not getting their ass up to make customer friendly deals again.

Anyhow, that much for spraying out some polemical opinion here again. What's way more interesting: Yesterday I asked myself if the German magazine publishers are even willing to publish their magazines on this platform (or even the Amazon Kindle, for those who prefer that) or if I'll be stuck in that typical German cage at this topic, too. So I emailed the Heise Verlag (just exemplarily, because I like their magazines very much) and asked them if there's any chance to read their mags without having the big old paper problem in the near future. And the answer is not very surprising, but yet very promising - and I totally hope that 2010 is the year to switch from paper subscription to eBooks:

"We're currently not offering an online subscription, but we're actually working on an implementation for this. This includes an implementation for eBooks, too. As soon as we have found a practical and legal solution for this, we will announce it."

Again, that doesn't sound as good as I hoped, but it's at least a step forward and I'm totally positive that it's going to be better with magazines than it is with television. Thank you, Heise Verlag!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Wed, 25 Nov 2009 12:36:41 -0800 Google Wave invites http://www.arnekolja.de/google-wave-invites-30 http://www.arnekolja.de/google-wave-invites-30 Is there still anyone in need for a Google Wave invite? Seems like Google gave me some, so I'd be glad to spend them to anyone. First come, first served.

Somehow the last two weeks it seemed like the hype is already over... haven't noticed any questions for invites on Twitter or something. Anyhow, Wave is quite cool, so if you want to check it out just let me know.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Wed, 25 Nov 2009 08:55:32 -0800 Smoking kills sanity http://www.arnekolja.de/smoking-kills-sanity http://www.arnekolja.de/smoking-kills-sanity I don't want to start a flame war here between smokers and non-smokers, really. Of course I know that I am not allowed to say anything against cigarettes in this world though, right? ;-)

Anyway. You all read some news about Apple not repairing a smoker's Mac, right? I only have one single question about all those news these days: Why the heck is everyone talking about "permission to smoke in front of your Mac", instead of focusing on the damage of the machines the news were about? All magazines and all blog articles mention the damage, but then ask for terms and conditions for smokers which just isn't the point here. The point is that smoking in this cases caused self-imposed damage, not that people aren't allowed to smoke any more.

The problem's the damage. Not the permission to smoke. The damage. Goddammit. Damage! Smoke as much as you want, as long as I don't have to buy your smelly, yellowed Mac afterwards ;-)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Fri, 20 Nov 2009 11:25:47 -0800 In 1995 I bought Wing Commander 3 http://www.arnekolja.de/in-1995-i-bought-wing-commander-3 http://www.arnekolja.de/in-1995-i-bought-wing-commander-3 Now this one is funny. My intention was to show you how much I paid for Wing Commander 3 in 1995 and I almost missed the funny "name" at the bottom.

And yes, it has been very expensive for 1995, too. Don't know why I spent that much money on that game, but when thinking about it - it's been absolutely worth it!

Kaufbeleg_wingcommander3

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Sat, 07 Nov 2009 05:00:44 -0800 Waving to my friends? http://www.arnekolja.de/waving-to-my-friends http://www.arnekolja.de/waving-to-my-friends So thanks to http://dac-xp.com/ I'm activated for Google Wave now. I so much wanted this but... and now? Don't know what to do with it without having any friends activated for it too. Doesn't anyone want to make my buddy Ulf and me a present and send him an invite too, so I can really try it out? I assume there isn't anyone out there able to give another invite, as Google is not giving out any new ones these days, right? A bummer.

Anyhow - anyone having an account too and want to connect? Just let me know!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein
Sat, 17 Oct 2009 16:09:47 -0700 Ruby on Rails: Migrating with default users using restful_authentication http://www.arnekolja.de/ruby-on-rails-migrating-with-default-users-us http://www.arnekolja.de/ruby-on-rails-migrating-with-default-users-us

Whenever your web application is going to offer user management, you might want to install at least a default admin user when creating your database. I searched the web for ideas to implement this and most of them come up with adding fixtures to your migrations. That's a really good one, of course, but I bet there is no way to dynamically hash your password using a fixture. I am using restful_authentication right now and this plugin does not only hash your password using SHA1, but adds a salt too. So a fixture is not what I wanted.

Instead I included the model itself in my migration, so the hashing and validation methods are used automatically. Hope this snippet is going to help others who are seeking for the same stuff. Let me know if it came in handy for you :-)

require 'app/models/user.rb'class LoadDefaultUsers < ActiveRecord::Migration  def self.up    say "Trying to insert default user(s)..."    user = User.create( :login => 'admin', :password => 'password', :password_confirmation => 'password', :email => 'admin@site.com' )    unless user.errors.empty?      say "Could not create admin user, see errors below:"      user.errors.each do |e|        say e      end    else      say "Admin user created"    end  end  def self.down    User.delete_all  endend

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/310929/DSC_0025nb.jpg http://posterous.com/users/k5mHDUosuZ Arne-Kolja Bachstein arnekolja Arne-Kolja Bachstein