<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Lasse Bunk's weblog</title>
	
	<link>http://lassebunk.dk</link>
	<description>(Sorry, I don't have a tagline.)</description>
	<lastBuildDate>Fri, 05 Mar 2010 18:21:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/lassebunkdk" /><feedburner:info uri="lassebunkdk" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Saving multiple models only if all are valid</title>
		<link>http://lassebunk.dk/2010/03/05/saving-multiple-models-only-if-all-are-valid/</link>
		<comments>http://lassebunk.dk/2010/03/05/saving-multiple-models-only-if-all-are-valid/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 16:32:54 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Multiple models]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=1184</guid>
		<description><![CDATA[I&#8217;m doing a website where I have multiple (or, two) models in one form. My goal is to save both of these models at once, but only if they both validate. I want this done easy, idiomatic and terse. This is what I&#8217;ve come up with:

# in the controller
def new
  @account = Account.new
  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m doing a website where I have multiple (or, two) models in one form. My goal is to save both of these models at once, but only if they both validate. I want this done easy, idiomatic and terse. This is what I&#8217;ve come up with:</p>
<pre class="brush: rails;">
# in the controller
def new
  @account = Account.new
  @user = User.new
end
</pre>
<pre class="brush: rails;">
# in the view
&lt;% form_for @account do |f| %&gt;
  &lt;%= f.error_messages %&gt;
  &lt;p&gt;
    &lt;%= f.label :name %&gt;&lt;br /&gt;
    &lt;%= f.text_field :name %&gt;
  &lt;/p&gt;
  &lt;% fields_for @user do |u| %&gt;
    &lt;%= u.error_messages %&gt;
    &lt;p&gt;
      &lt;%= f.label :name %&gt;&lt;br /&gt;
      &lt;%= f.text_field :name %&gt;
    &lt;/p&gt;
  &lt;% end %&gt;
  &lt;p&gt;
    &lt;%= f.submit &quot;Create account&quot; %&gt;
  &lt;/p&gt;
&lt;% end %&gt;
</pre>
<p>And after you press &#8216;Create account&#8217;:</p>
<pre class="brush: rails;">
# in the controller
def create
  @account = Account.new(params[:account])
  @user = User.new(params[:user])

  # this is where the magic starts
  if [@account, @user].map { |rec| rec.valid? }.all?
    [@account, @user].each { |rec| rec.save! }
    redirect_to account_path
  else
    render :new
  end
end
</pre>
<p>This way each model will only be saved if all models validate.</p>
<p><strong>Update:</strong> We could also do this even nicer by writing a method:</p>
<pre class="brush: rails;">
# in your ApplicationController
def save_all(*models)
  if models.map { |rec| rec.valid? }.all?
    models.each { |rec| rec.save! }
    true
  end
end
</pre>
<pre class="brush: rails;">
# in your create method
if save_all(@account, @user)
  redirect_to account_path
else
  render :new
end
</pre>
<p>I&#8217;m not entirely sure this code should go in the <code>ApplicationController</code> but for now, that&#8217;s where it&#8217;ll be.</p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2010/03/05/saving-multiple-models-only-if-all-are-valid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outputting the flash to views and layouts</title>
		<link>http://lassebunk.dk/2010/03/05/outputting-the-flash-to-views-and-layouts/</link>
		<comments>http://lassebunk.dk/2010/03/05/outputting-the-flash-to-views-and-layouts/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 16:13:20 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Views]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=1177</guid>
		<description><![CDATA[Here is a simple way of outputting the first message in the flash (because I didn&#8217;t want it to output both flash[:error] and flash[:notice] at the same time).

# in the controller
flash[:notice] = &#34;Thanks for signing up!&#34;

.. and&#8230;

# in the view
&#60;% flash.detect do &#124;type, text&#124; %&#62;
	&#60;div id=&#34;flash&#34; class=&#34;&#60;%= type.to_s %&#62;&#34;&#62;
		&#60;%= text %&#62;
	&#60;/div&#62;
&#60;% end %&#62;

The detect method [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a simple way of outputting the first message in the <a href="http://api.rubyonrails.org/classes/ActionController/Flash.html">flash</a> (because I didn&#8217;t want it to output both <code>flash[:error]</code> and <code>flash[:notice]</code> at the same time).</p>
<pre class="brush: rails;">
# in the controller
flash[:notice] = &quot;Thanks for signing up!&quot;
</pre>
<p>.. and&#8230;</p>
<pre class="brush: rails;">
# in the view
&lt;% flash.detect do |type, text| %&gt;
	&lt;div id=&quot;flash&quot; class=&quot;&lt;%= type.to_s %&gt;&quot;&gt;
		&lt;%= text %&gt;
	&lt;/div&gt;
&lt;% end %&gt;
</pre>
<p>The <code>detect</code> method will return the first key/value pair of the flash where the block doesn&#8217;t return <code>false</code>. However, that&#8217;s not what we&#8217;re using it for – we&#8217;re using it to make sure we only get the first element.</p>
<p>Hope this is useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2010/03/05/outputting-the-flash-to-views-and-layouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Sinatra to serve smaller (than Rails) applications</title>
		<link>http://lassebunk.dk/2010/02/25/using-sinatra-to-serve-smaller-than-rails-applications/</link>
		<comments>http://lassebunk.dk/2010/02/25/using-sinatra-to-serve-smaller-than-rails-applications/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 14:19:55 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Rack]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Sinatra]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=1147</guid>
		<description><![CDATA[So, maybe you&#8217;ve been coding Rails for a while and wondered &#8211; &#8220;do I really need this full stack framework to serve even small applications?&#8221;. Well, no you don&#8217;t :-)
Check out Norbauer&#8217;s DNS Tools (and on Github). It&#8217;s a small set of easy to use DNS tools. So small it would be overkill to serve [...]]]></description>
			<content:encoded><![CDATA[<p>So, maybe you&#8217;ve been coding <a href="http://rubyonrails.org">Rails</a> for a while and wondered &#8211; &#8220;do I really need this full stack framework to serve even small applications?&#8221;. Well, no you don&#8217;t :-)</p>
<p>Check out <a href="http://dns.norbauer.com">Norbauer&#8217;s DNS Tools</a> (and on <a href="http://github.com/norbauer/dns-tools">Github</a>). It&#8217;s a small set of easy to use DNS tools. So small it would be overkill to serve it using Rails.</p>
<p>Norbauer&#8217;s using <a href="http://www.sinatrarb.com/">Sinatra</a> to serve the app.</p>
<p>Start by installing the gem:</p>
<pre class="brush: bash;">
$ sudo gem install sinatra
</pre>
<p>After that it&#8217;s as simple as this:</p>
<pre class="brush: ruby;">
# myapp.rb
require 'rubygems'
require 'sinatra'

get '/' do
  &quot;Welcome to my homepage!&quot;
end

get '/contact' do
  &quot;My contact info is...&quot;
end
</pre>
<p>At your terminal:</p>
<pre class="brush: bash;">
$ ruby myapp.rb
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from Mongrel
</pre>
<p>Now you can view it in your browser at <a href="http://localhost:4567">http://localhost:4567</a> and <a href="http://localhost:4567/contact">http://localhost:4567/contact</a>. Simple.</p>
<p>This is great for hosting apps from your command line (for example check out <a href="http://adam.blog.heroku.com/past/2009/2/11/taps_for_easy_database_transfers/">Taps</a>) but what if you wanted to serve it like you would a Rails app?</p>
<p>Well, then you&#8217;d be using <a href="http://rack.rubyforge.org/">Rack</a>.</p>
<p>Create a file named <code>config.ru</code> in the same folder as <code>myapp.rb</code>:</p>
<pre class="brush: ruby;">
require 'myapp'
run Sinatra::Application
</pre>
<p>Now you can deploy your application as you would if it was written in Rails (thanks to <code>config.ru</code>).<br />
If you want to check this setup at your localhost, run the following:</p>
<pre class="brush: bash;">
$ sudo gem install rack # make sure you have Rack installed
$ rackup # run the Rack application using config.ru
</pre>
<p>It&#8217;s as easy as that! Great for hosting small applications.</p>
<p>Also see:</p>
<ul>
<li><a href="http://rack.rubyforge.org/doc/">List of Rack compliant web servers</a></li>
<li><a href="http://www.modrails.com/documentation/Users%20guide.html#_deploying_a_rack_based_ruby_application">Deploying a Rack-based Ruby application [with Phusion Passenger]</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2010/02/25/using-sinatra-to-serve-smaller-than-rails-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Paperclip and jpegcam to get pictures from your webcam into Rails</title>
		<link>http://lassebunk.dk/2010/02/18/paperclip-jpegcam-webcam-rails/</link>
		<comments>http://lassebunk.dk/2010/02/18/paperclip-jpegcam-webcam-rails/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 14:45:49 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jpegcam]]></category>
		<category><![CDATA[Paperclip]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Webcam]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=1096</guid>
		<description><![CDATA[Here&#8217;s how to get pictures from your webcam into Rails using the Paperclip plugin and jpegcam.
What we will do is create a Photo model and a Photos controller with actions new, upload and create to take care of the image creation.
Start by creating a new Rails application:

$ rails webcam_app
$ cd webcam_app

Create the Photo model:

$ script/generate [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to get pictures from your webcam into Rails using the <a href="http://github.com/thoughtbot/paperclip">Paperclip plugin</a> and <a href="http://code.google.com/p/jpegcam/">jpegcam</a>.</p>
<p>What we will do is create a <code>Photo</code> model and a <code>Photos</code> controller with actions <code>new</code>, <code>upload</code> and <code>create</code> to take care of the image creation.</p>
<p>Start by creating a new Rails application:</p>
<pre class="brush: bash;">
$ rails webcam_app
$ cd webcam_app
</pre>
<p>Create the <code>Photo</code> model:</p>
<pre class="brush: bash;">
$ script/generate model Photo description:string
$ rake db:migrate
</pre>
<p>Create the <code>Photos</code> controller:</p>
<pre class="brush: bash;">
$ script/generate controller Photos
</pre>
<p>Edit <code>config/routes.rb</code> to contain a photos resource:</p>
<pre class="brush: rails;">
map.resources :photos, :only =&gt; [:index, :show, :new, :create], :new =&gt; { :upload =&gt; :post }
</pre>
<p><a href="http://code.google.com/p/jpegcam/downloads/list">Download jpegcam</a> and put <code>webcam.js</code> in your <code>public/javascripts</code> folder and <code>webcam.swf</code> and <code>shutter.mp3</code> in your <code>public</code> folder.</p>
<p>Create the layout file <code>app/views/layouts/application.html.erb</code> and insert the following HTML:</p>
<pre class="brush: rails;">
&lt;html&gt;
  &lt;head&gt;
    &lt;%= javascript_include_tag :defaults %&gt;
    &lt;%= javascript_include_tag 'webcam' %&gt;
  &lt;/head&gt;
  &lt;body&gt;
	  &lt;%= yield %&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Next, create <code>app/views/photos/new.html.erb</code> and make a div for the webcam contents:</p>
<pre class="brush: html;">
&lt;div id=&quot;webcam&quot;&gt;&lt;/div&gt;
</pre>
<p>And the actual webcam javascript:</p>
<pre class="brush: html;">
&lt;script type=&quot;text/javascript&quot;&gt;
  webcam.set_swf_url('/webcam.swf');
  webcam.set_api_url('&lt;%= upload_new_photo_path %&gt;');
  webcam.set_quality(90);
  webcam.set_shutter_sound(true, '/shutter.mp3');
  $('webcam').innerHTML = webcam.get_html(640, 480);
&lt;/script&gt;
</pre>
<p>That will run the actual webcam so you can see yourself :) But for taking a picture, we&#8217;ll need to add the following button:</p>
<pre class="brush: html;">
&lt;input type=&quot;button&quot; value=&quot;Take picture&quot; onclick=&quot;webcam.snap();&quot; /&gt;
</pre>
<p>Now when you click the button, the webcam image will be posted to <code>/photos/new/upload</code>. Try it out:</p>
<pre class="brush: bash;">
$ script/server
</pre>
<p>and go to <a href="http://localhost:3000/photos/new">http://localhost:3000/photos/new</a>.</p>
<p>Let&#8217;s add some code for handling the upload.</p>
<p>The <code>webcam.swf</code> just uploads a bunch of jpeg data so we&#8217;ll need to get a hold of the raw post data. That&#8217;s done with Rails&#8217; <code>request.raw_post</code>. In your <code>PhotosController</code>:</p>
<pre class="brush: rails;">
def upload
  File.open(upload_path, 'w') do |f|
    f.write request.raw_post
  end
  render :text =&gt; &quot;ok&quot;
end

private

def upload_path # is used in upload and create
  file_name = session[:session_id].to_s + '.jpg'
  File.join(RAILS_ROOT, 'public', 'uploads', file_name)
end
</pre>
<p>Remember to create the <code>public/uploads</code> folder.</p>
<p>Now, back to <code>app/views/photos/new.html.erb</code>. Create the following at the bottom of the view:</p>
<pre class="brush: rails;">
&lt;% form_for Photo.new, :html =&gt; { :style =&gt; &quot;display: none;&quot; } do |f| %&gt;
  &lt;p&gt;
    &lt;%= f.label :description %&gt;&lt;br /&gt;
    &lt;%= f.text_field :description %&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;%= f.submit &quot;Save the photo&quot; %&gt;
    or &lt;%= link_to &quot;Take another&quot;, new_photo_path %&gt;
  &lt;/p&gt;
&lt;% end %&gt;
</pre>
<p>In your javascript just below the webcam div, insert the following function:</p>
<pre class="brush: javascript;">
function upload_complete(msg) {
  if (msg == 'ok') {
    $('new_photo').show();
    $('photo_description').focus();
  } else {
    alert('An error occured');
    webcam.reset();
  }
}
</pre>
<p>And add the following webcam code:</p>
<pre class="brush: javascript;">
webcam.set_hook('onComplete', 'upload_complete');
</pre>
<p>Now when you take a picture you will get a new photo form for entering a description. If something goes wrong, the webcam will be reset so you can try again. This might also be a good time to check your logs.</p>
<p>Now we have the upload (see for yourself in your public/uploads folder) but we still need to add Paperclip to the model.<br />
Start by installing the plugin:</p>
<pre class="brush: bash;">
$ script/plugin install git://github.com/thoughtbot/paperclip.git
</pre>
<p>In the <code>Photo</code> model:</p>
<pre class="brush: rails;">
class Photo &lt; ActiveRecord::Base
  has_attached_file :image, :styles =&gt; { :medium =&gt; &quot;300x300&gt;&quot;, :thumb =&gt; &quot;100x100&gt;&quot; }
end
</pre>
<p>For this to work, we need to add some necessary Paperclip columns to our <code>Photo</code> model:</p>
<pre class="brush: bash;">
$ script/generate paperclip photo image
$ rake db:migrate
</pre>
<p>Now we can show photos like this:</p>
<pre class="brush: rails;">
&lt;%= image_tag photo.image.url(:thumb) %&gt;
</pre>
<p>We just need to save the photos first. Add the following to your <code>PhotosController</code> somewhere above the <code>private</code> keyword:</p>
<pre class="brush: rails;">
def create
  @photo = Photo.new(params[:photo])
  @photo.image = File.new(upload_path)
  @photo.save

  redirect_to @photo
end

def show
  @photo = Photo.find(params[:id])
end

def index
  @photos = Photo.all
end
</pre>
<p>In <code>app/views/photos/show.html.erb</code>:</p>
<pre class="brush: rails;">
&lt;h1&gt;Photo&lt;/h1&gt;
&lt;p&gt;&lt;%= image_tag @photo.image.url(:medium) %&gt;&lt;/p&gt;
&lt;p&gt;
  &lt;strong&gt;Description:&lt;/strong&gt;&lt;br /&gt;
  &lt;%=h @photo.description %&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;%= link_to &quot;Take a new picture&quot;, new_photo_path %&gt;
  | &lt;%= link_to &quot;See all pictures&quot;, photos_path %&gt;
&lt;/p&gt;
</pre>
<p>And last but not least in <code>app/views/photos/index.html.erb</code>:</p>
<pre class="brush: rails;">
&lt;h1&gt;All photos&lt;/h1&gt;
&lt;p&gt;
  &lt;% @photos.each do |photo| %&gt;
    &lt;%= link_to image_tag(photo.image.url(:thumb)), photo %&gt;
  &lt;% end %&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;%= link_to &quot;Take a new picture&quot;, new_photo_path %&gt;
&lt;/p&gt;
</pre>
<p>Now start your <code>script/server</code> if it isn&#8217;t already, go to <a href="http://localhost:3000/photos">http://localhost:3000/photos</a> – aaannnd.. it works!</p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2010/02/18/paperclip-jpegcam-webcam-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Streaming radio on iPhone or iPod Touch</title>
		<link>http://lassebunk.dk/2009/10/10/streaming-radio-on-iphone-or-ipod-touch/</link>
		<comments>http://lassebunk.dk/2009/10/10/streaming-radio-on-iphone-or-ipod-touch/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 10:38:40 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod Touch]]></category>
		<category><![CDATA[M3U]]></category>
		<category><![CDATA[PLS]]></category>
		<category><![CDATA[Streaming]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=252</guid>
		<description><![CDATA[I have found a really great little program called FStream that works for streaming M3U and PLS stations on the iPhone and iPod Touch.

The concept is that you add one or more radio stations. You can do it directly in the app or you can enable a web administration interface that works really great:

I really [...]]]></description>
			<content:encoded><![CDATA[<p>I have found a really great little program called <a title="FStream on iTunes" href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=289892007&amp;mt=8">FStream</a> that works for streaming M3U and PLS stations on the iPhone and iPod Touch.</p>
<p><img class="alignnone size-full wp-image-254" title="FStream playing" src="http://lassebunk.dk/wp-content/uploads/2009/10/fstream.jpg" alt="FStream playing" width="320" height="480" /></p>
<p>The concept is that you add one or more radio stations. You can do it directly in the app or you can enable a web administration interface that works really great:</p>
<p><img class="alignnone size-full wp-image-253" title="FStream web interface" src="http://lassebunk.dk/wp-content/uploads/2009/10/fstream-web.png" alt="FStream web interface" width="397" height="148" /></p>
<p>I really like the application because it&#8217;s stable, and it simply does what it does; plays internet radio. Thanks <a href="http://www.sourcemac.com/">SourceMac</a>.</p>
<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=289892007&amp;mt=8">Check out FStream on iTunes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2009/10/10/streaming-radio-on-iphone-or-ipod-touch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three months on the Mac stack</title>
		<link>http://lassebunk.dk/2009/09/24/three-months-on-the-mac-stack/</link>
		<comments>http://lassebunk.dk/2009/09/24/three-months-on-the-mac-stack/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 13:39:45 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Amiga]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[C64]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[Netbooks]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Slicehost]]></category>
		<category><![CDATA[Slices]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[TextMate]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[VMware Fusion]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=221</guid>
		<description><![CDATA[It’s actually four months now – since May 1st – but I’ve been wanting to write this article for a month. Hence the – somewhat misleading – title.
I bought my MacBook on May 1th after viewing a screencast where a guy sets up a blog in 15 minutes using Ruby on Rails. I immediately said [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">It’s actually four months now – since May 1st – but I’ve been wanting to write this article for a month. Hence the – somewhat misleading – title.</p>
<p>I bought my <a href="http://www.apple.com/macbook/">MacBook</a> on May 1th after viewing a <a href="http://rubyonrails.org/screencasts">screencast where a guy sets up a blog in 15 minutes</a> using <a href="http://rubyonrails.org">Ruby on Rails</a>. I immediately said to my stepdad: “I’m going to buy a Mac and learn Ruby on Rails!”</p>
<p>And so I did &#8211; the day after, I bought a Mac.</p>
<p>I’ve always been a dedicated user of <a href="http://www.microsoft.com">Microsoft</a>&#8217;s products. First <a href="http://en.wikipedia.org/wiki/Commodore_64">C64</a>, then <a href="http://en.wikipedia.org/wiki/Amiga">Amiga</a>, then <a href="http://en.wikipedia.org/wiki/Power_Macintosh_5300">Mac</a>, then PC. I liked the way everything was tested and came from one place, unlike <a href="http://en.wikipedia.org/wiki/Open_source">open source</a>. I’ve always been saying stuff like “I like to pay for my software because then I&#8217;m be sure about the quality.” – but in reality, everyone who uses Windows and other Microsoft products know that this isn’t always the case.</p>
<p>So I bought the Mac, and the first thing that surprised me, was how much of day-to-day work was done in the <a href="http://en.wikipedia.org/wiki/Apple_Terminal">Terminal</a>, or <a href="http://en.wikipedia.org/wiki/Command-line_interface">command line</a>. When I installed Ruby on Rails, it was via command line; when I installed plugins, it was via command line. Evererything command line. :-)</p>
<p>Over the next few days I began to get a hang of it. I bought a couple of <a href="http://en.wikipedia.org/wiki/Domain_name">domain names</a> and signed up for a <a href="http://en.wikipedia.org/wiki/Slice_%28disk%29">slice</a> at <a href="http://www.slicehost.com">Slicehost</a> – because I had read some <a href="http://railswork.com">job description</a> that said that you should&#8217;ve at least tried to use a whole day of setting a slice.</p>
<p>Coming from Windows, Linux is a whole other deal to setup. I used a lot of the <a href="http://articles.slicehost.com/">Slicehost articles</a> that guides you through the whole process from setup and security to getting your slice to run as a <a href="http://www.apache.org">webserver</a>.</p>
<p>In the beginning I was a little nervous about all the command lines, if they would really work and so one. But the more you try it, the more calm you get. It just works! And lucky me there was a lot of helpful articles about Unix and Linux commands out there (just search for the command on <a href="http://www.google.com">Google</a>).</p>
<p>Since starting out on the Mac, I’ve learned a multitude of things:</p>
<ul>
<li> Setting up an <a href="http://www.ubuntu.com/">Ubuntu</a> <a href="http://en.wikipedia.org/wiki/Slice_%28disk%29">slice</a> at <a href="http://www.slicehost.com">Slicehost</a>.</li>
<li>Setting up a <a href="http://www.apache.org">web server</a>.</li>
<li>Setting up <a href="http://www.ubuntu.com/GetUbuntu/download-netbook">Ubuntu Netbook Remix</a> on my <a href="http://eeepc.asus.com/">netbook</a>.</li>
<li>Setting up <a href="http://www.ubuntu.com/getubuntu/download-server">Ubuntu server</a> at home, also on my netbook – which now functions as my testing server.</li>
<li>Programming a little <a href="http://www.php.net">PHP</a> – see Tweet My Cam.</li>
<li>Programming <a href="http://rubyonrails.org">Ruby on Rails</a>.</li>
<li>Tweaking some <a href="http://www.java.com">Java</a> code, <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html">compiling</a> and <a href="http://forums.sun.com/thread.jspa?threadID=174214">signing</a> a <a href="http://en.wikipedia.org/wiki/Java_applet">java applet</a> in one day – see a demo <a href="http://lassebunk.dk/2009/07/19/using-the-clipboard-to-post-images/">here</a>.</li>
<li>Download and compile software (<a href="http://tldp.org/LDP/LG/current/smith.html">configure, make, make install</a>).</li>
<li><a href="http://railsontherun.com/2008/3/3/how-to-use-github-and-submit-a-patch">Submitted a patch</a> to a Ruby on Rails <a href="http://github.com/technoweenie/restful-authentication">plugin</a> on <a href="http://github.com">Github</a>.</li>
<li>Setting up <a href="http://wordpress.org">Wordpress</a> and <a href="http://mu.wordpress.org/">Wordpress Mu</a> blogs and making my own <a href="http://lassebunk.dk">theme</a> – see <a href="http://lassebunk.dk">my private blog</a> and <a href="http://userdriven.dk">private work blog</a>.</li>
<li>Setting up a <a href="http://subversion.tigris.org/">Subversion</a> repository at <a href="http://www.xp-dev.com/">XP-Dev.com</a>.</li>
<li>Using the Subversion repository :-)</li>
<li>Loving <a href="http://macromates.com/">Textmate</a> as my favorite editor – also over <a href="http://www.microsoft.com/visualstudio">Visual Studio</a>.</li>
<li>Plus a bunch of other things.</li>
</ul>
<p>In short I’ve learned so much about the open source world that just wasn’t that easy on the Microsoft platform.</p>
<p>I still use Microsoft Windows and other products, but now it’s through <a href="http://www.vmware.com/products/fusion/">VMware Fusion</a> on the Mac.</p>
<p>I’m happy about the Mac because <a href="http://www.apple.com/macosx/">OS X</a> is very unobtrusive, fast operating system and what it does, it does very good. But at the same time, I also want a netbook that’s easier to carry, so I may end up running both systems for different purposes (unless I&#8217;m just installing Ubuntu on the netbook too ;-)).</p>
<p>Hope you found this post interesting – I wrote it to tell about a beautiful (yak, I know) progress from Windows to Mac and Linux. Thumbs up if this has made you want to try it too. And please tell me in the comments. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2009/09/24/three-months-on-the-mac-stack/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Launched Notesapp</title>
		<link>http://lassebunk.dk/2009/09/22/launched-notesapp/</link>
		<comments>http://lassebunk.dk/2009/09/22/launched-notesapp/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 17:06:35 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=210</guid>
		<description><![CDATA[I have just launched Notesapp which is an application for saving notes online – much like Delicious but with notes instead of links.
Hope you&#8217;ll try it – it&#8217;s at notesapp.net.
PS. I&#8217;ll expand the application to support various text formats and do an open API, but right now I just have other stuff to do. :-)
]]></description>
			<content:encoded><![CDATA[<p>I have just launched <a href="http://notesapp.net">Notesapp</a> which is an application for saving notes online – much like <a href="http://delicious.com">Delicious</a> but with notes instead of links.</p>
<p>Hope you&#8217;ll try it – it&#8217;s at <a href="http://notesapp.net">notesapp.net</a>.</p>
<p>PS. I&#8217;ll expand the application to support various text formats and do an open API, but right now I just have other stuff to do. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2009/09/22/launched-notesapp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just launched Tweet My Cam</title>
		<link>http://lassebunk.dk/2009/09/21/just-launched-tweet-my-cam/</link>
		<comments>http://lassebunk.dk/2009/09/21/just-launched-tweet-my-cam/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 14:19:13 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=206</guid>
		<description><![CDATA[I just launched Tweet My Cam, a simple web service to post pictures from your webcam to Twitter.
Check it out: tweetmycam.com
]]></description>
			<content:encoded><![CDATA[<p>I just launched <a href="http://tweetmycam.com">Tweet My Cam</a>, a simple web service to post pictures from your webcam to <a href="http://twitter.com">Twitter</a>.</p>
<p>Check it out: <a href="http://tweetmycam.com">tweetmycam.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2009/09/21/just-launched-tweet-my-cam/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use U.S. versioned Bing from Europe</title>
		<link>http://lassebunk.dk/2009/09/19/use-us-bing-from-europe/</link>
		<comments>http://lassebunk.dk/2009/09/19/use-us-bing-from-europe/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 19:18:28 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bing]]></category>
		<category><![CDATA[Europe]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[US]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=197</guid>
		<description><![CDATA[So – you read about Bing on Mashable and want to try out the cool new features. But what happens when you go to Bing? You see nothing! That&#8217;s because some of the really cool features are only available from within the U.S.
What I do is that I use a U.S. proxy service so that [...]]]></description>
			<content:encoded><![CDATA[<p>So – you read about <a href="http://mashable.com/2009/09/19/bing-extras/">Bing on Mashable</a> and want to try out the cool new features. But what happens when you go to Bing? You see nothing! That&#8217;s because some of the really cool features are only available from within the U.S.</p>
<p>What I do is that I use a U.S. proxy service so that the IP that Bing sees is in reality the IP of the proxy service – as if I was browsing the site from somewhere in the U.S.</p>
<p>One great proxy service is <a href="http://hidemyass.com">HideMyAss.com</a> which works really well. It has a lot of popup windows but if you can live with that, it really works great.</p>
<p>So: Go to HideMyAss.com and type in www.bing.com – it works!</p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2009/09/19/use-us-bing-from-europe/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clipboard java applet</title>
		<link>http://lassebunk.dk/2009/08/04/clipboard-java-applet/</link>
		<comments>http://lassebunk.dk/2009/08/04/clipboard-java-applet/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 20:49:14 +0000</pubDate>
		<dc:creator>lassebunk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Applet]]></category>
		<category><![CDATA[Clipboard]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://lassebunk.dk/?p=185</guid>
		<description><![CDATA[The source code my previous post about a clipboard image applet is now available here: PasteImageApplet.zip
The code lets you post images from your clipboard directly to the webserver to avoid the need to go through Photoshop or another image application.
When you compile your own applet using javac, you&#8217;ll need to sign it in order to [...]]]></description>
			<content:encoded><![CDATA[<p>The source code my previous <a href="http://lassebunk.dk/2009/07/19/using-the-clipboard-to-post-images/">post</a> about a <a href="http://lassebunk.dk/demos/clipboard-image/clipboard-image.html">clipboard image applet</a> is now available here: <a href="http://lassebunk.dk/downloads/PasteImageApplet.zip">PasteImageApplet.zip</a></p>
<p>The code lets you post images from your clipboard directly to the webserver to avoid the need to go through Photoshop or another image application.</p>
<p>When you compile your own applet using <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html">javac</a>, you&#8217;ll need to <a href="http://forums.sun.com/thread.jspa?threadID=174214">sign it</a> in order to be able to get access to the clipboard. (I have signed the applet contained in the zip and the certificate expires 6 months from July 19th, 2009, around January 19th, 2010).</p>
<p>If you find it useful or somebody else has already done this (and somebody surely has, but I didn&#8217;t have any luck finding it on Google), please write me in the comments.</p>
<p>Thanks.<br />
- Lasse</p>
]]></content:encoded>
			<wfw:commentRss>http://lassebunk.dk/2009/08/04/clipboard-java-applet/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
