Scala 2.9.1 on Fedora 16

yum install scala on Fedora will grab all the dependencies, including a JVM, but its a pretty old scala.

Luckily it is pretty easy to install scala-2.9.1 by snagging it from rawhide, but just the RPMS only get you so far. Fedora seems to be changing their JAVA_HOME in 17. A little hack, and you are off and running.

  1. sudo yum install scala
  2. sudo curl -O http://mirror.us.leaseweb.net/fedora/linux/development/rawhide/x86_64/os/Packages/j/jline2-2.5-5.fc17.noarch.rpm
  3. sudo curl -O http://mirror.us.leaseweb.net/fedora/linux/development/rawhide/x86_64/os/Packages/s/scala-2.9.1-3.fc17.noarch.rpm
  4. sudo yum install jline2-2.5-5.fc17.noarch.rpm scala-2.9.1-3.fc17.noarch.rpm
  5. rpm -ql scala | grep bin | xargs sudo perl -pi.orig -e ‘s@JAVA_HOME=/usr/lib/jvm/java-1.6.0/@JAVA_HOME=/usr/lib/jvm/jre-1.6.0/@’

 

Ubuntu testdrive networked to your LAN

testdrive uses the -net user feature of kvm by default, which is really cool because it becomes a lan client and magically gets internet via proxy. If you want to test server software, you probably want your testdrive VM directly on the same LAN as your host OS.

In my case I already had a bridge setup so it was as simple as changing the -net option on my kvm command line.

kvm -m 1024 -smp 2 -cdrom /home/jrwren/.cache/testdrive/iso/ubuntu_precise-desktop-amd64.iso -drive file=/home/jrwren/.cache/testdrive/img/testdrive-disk-43F4RO.img,if=virtio,cache=writeback,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio -net tap -soundhw es1370 -vga cirrus -vnc 127.0.0.1:1 -k en-us

 

brctl will now show you the new tap device added to your bridge.

bridge name     bridge id               STP enabled     interfaces
br0             8000.001fd085d98b       no              eth0
eth2
tap0
tap1

The only drawback is that kvm has to be run as root. There is a way around that by specifying a network interface start script which would be suidroot, but for a personal system or testing development system, I find that overkill. I let her run as root.

Ubuntu testdrive as a base for a Fedora test

Ubuntu testdrive is AWESOME. In my words, testdrive lets you test the next version of ubuntu in a VM with a single command.

testdrive ultimately just creates a disk image and runs a virtual machine for you, lets you step through the install from the nightly CD, and then lets you continue to run that VM. I decided to use the exactly same disk image and vm command line to testdrive fedora.

  1. Download fedora cd image :
    curl -O http://download.fedoraproject.org/pub/fedora/linux/releases/16/Live/x86_64/Fedora-16-x86_64-Live-Desktop.iso
  2. copy a disk image : cp .cache/testdrive/img/testdrive-??????.img fedora16.img
  3. start the install : kvm -m 2048 -smp 2 -cdrom Fedora-16-x86_64-Live-Desktop.iso -drive file=fedora.img,if=virtio,cache=writeback,index=0,boot=on -usb -usbdevice tablet -net nic,model=virtio,macaddr=DE:AD:BE:EF:A8:CC -net user -soundhw es1370 -vga std -vnc 127.0.0.1:0 -k en-us

Some details:

  • That copy a disk image step could probably be done much better by creating the qcow2 file yourself, but this worked for my immediate need.
  • The differences in the command line from a testdrive command line, on my system, are memory size (1024/2048) and -vga cirrus v. -vga std.

CodeMash 2012 Changed Me

Every CodeMash has changed me.

This CodeMash was no different.

I’ve attended every codemash. Each is unique and special. I have memories from each that I can point to and say “This is when I realized…” and it is something significant that changed who I am or what I am doing or how I approach code and life.

This year I feel the focus of change was definitely softer. It was not some deep technical conversation that I had at the attendee party with someone able to explain to me something in a way which I can see applicability for myself like it has been in most years past. This year I didn’t focus on the mash part of CodeMash.

CodeMash, to me, has always been about learning from outside your normal circles. If you are a .NET person, go learn something about the ruby world. If you are a Ruby person, go learn something about Java (assuming you’ve never lived in that world). If you are a Java person, find a PHP or Perl session (there weren’t too many this year). ‘Mash not bash’ has always been the underlying philosophy that CodeMash has taught me to adopt.

I’m done mashing for a while. I’ve been doing C# for day work for 7 yrs. Of course, to me, mashing that also meant making sure things would run on Mono. I’ve explored Ruby and Rails for at least 6 years now. I pay attention to the Ruby world. In fact, I have more Ruby podcasts in my subscription than I do .NET (or any other). I watch the Java world (to not do so as a .NET dev is foolish IMO). I long for Akka in .NET (although I think Stact and MassTransit might get me there). I long for… Heroku. I long for.. I mash… I long for… many things.

This year I didn’t mash at CodeMash, and I didn’t miss it. Ok, sure, I did a javascript precompiler where I felt like I finally understand JS as a language. I finally grasp the deceptive simplicity of prototypical inheritance. But beyond that, I went to C# and .NET sessions. I loved seeing Bill Wagner and John Skeet present some deep inside and outside C# async. I loved seeing PhatBoyG present Stact.

During his keynote, I believe I heard Barry Hawkins say “Depth trumps breadth”. Its not that I don’t feel some depth in some areas in which I play, but I want more. I feel like I have enough breadth.

So I leave CodeMash, like I do every year, with new direction and a new sense of purpose which I hope to utilize to become a new person. I want to be a different person than I wanted to be a year ago… again.

I cannot overstate one influencing factor which has had a profound effect on me coming to the above determination. Leon Gersing. I met Leon 4 or so years ago at a Columbus Day of Dot Net event. Of course even then I thought, “What a cool guy.” But if you have known Leon for that long (and I don’t know him very well) you know that Leon too has changed over the years. At the GANG 10 yr anniversary event, I got to listen to Leon give a talk on the topic of “You”. It was similar to the short and less serious topic he gave as Pecha Kucha on “Love”. I think a lot of the underlying message is the same and so I’m walking away with that on my mind.

CodeMash 2012 was huge win. It was also HUGE! I know that there were people there, who I know, who I did not see the whole time! Scott and Gary are a couple guys I didn’t see until the after party! So if I missed you, lets hope we run into each other next year. I’ll be the guy who is a little different than last year.

Thanks for the great conference, CodeMash!

OSX /private/var/vm disk usage

TL;DR see last paragraph.

I googled around for this answer and found nothing, so THEN I read the man page. This felt backward for OSX answers.
My Mac gave me warning that I was almost out of disk space recently. I ran du -kx / | sort -nr | less and noticed the biggest offender with nearly 10% of my disk space was /var/private/vm, so I started digging.
It turns out this is where OSX stores its swap files if it needs them.
OSX dynamically grows its swap files by adding new files, not by resizing an existing file. It starts off with very small files and as it needs a new one it creates a large one until it gets to 1GB file size and then it continues making 1GB swap files. The process dynamic_pager manages this.
In my case the 5GB of swap didn’t seem like that much until you consider that I have a 64GB MacBook Air. That is a large piece of the disk.
I told the dynamic_pager to clean up after itself, if it could, by running this command:

sudo dynamic_pager -L 1073741824

Build MVVM Applications in F#… or C#

Last month Chris Marinos had an article in MSDN Magazine titled “Build MVVM Applications in F#”

I liked it a lot. I jotted down some notes as I read it. My learning processed amused me as I went from WTF… to Hrm… to Oh I see… in a period of about 15 minutes or so.

It went something like this:

> My first thought on skimming the first 3 pages…
>
> Ok, no offense… but… Dude! Really?!?
>
> PM> Install-Package NotifyPropertyWeaver
>
> and my "viewmodel" can be class MovieVieModelCSharp { public string Name
> {get;set;} public string Genre { get;set;} public int Rating {get;set;}
> public MovieVieModelCSharp(Movie movie) { Name=movie.Name;
> Genre=movie.Genre; if(OptionModule.IsSome(movie.Rating)
> Rating=movie.Rating.Value; else Rating=0;} }
>
> But then I realize that isn’t the point of that part of the article.
>
> Everything looks cool. I’m wondering if NotifyPropertyWeaver would work
> with the Dummy F# view model in Figure 7.
>
> Then I see in Figure 9 you use the ViewModelBase. That is cool I guess,
> but I think NPW might allow for writing WAY less code.
>
> …
> OK… i spent some time exploring these idea and realized I’m clueless.
> F# has no concept of autoproperites (WART!) and its A LOT of code to
> write a mutable property (warts!). NPW sure isn’t going to work with
> non-autoproperties (it picks up on C#/VB autoproperty naming convention
> of the compiler IIRC).
>
> So all that said… I think your article is great.
>
> It challenged me to investigate some things. It shows me that F# really
> sucks for WPF. It makes me really appreciate C# autoproperties and NPW.
> Damn that is some ugly ass code in that last "all F#" section.

 

Now some interesting parts to this is that NotifyPropertyWeaver apparently DOES support weaving PropertyChanged into non-autoproperties. That is pretty cool, but even with that, I think that this is a case where C# is actually more appropriate than F#.

Where Windows Is Going

I’ve been stewing for about a day.

I did not go to Build Conference.

Once I figured out that WinRT is for Metro style apps and ONLY Metro style apps, and I tried to make a call from a .NET 4.5 app into a very simple “GetUserInfo” WinRT API and it threw an Access Denied Exception, I was upset.

Then I realized something.

This is not just a new way to program on Windows.

It is also not THE new way to program on Windows.

Microsoft is segregating their application types on purpose. Metro style apps and WinRT is not about “the next windows”. What was shown with the hybrid classic desktop and the new Metro UI is NOT the future vision that MSFT has for Windows. It is a transition.

Microsoft is posing Metro style and ONLY metro style to be the next development platform of a version of Windows that will not have the classic desktop. Some future version of Windows that won’t have Win32 and won’t have .NET. It will be WinRT on top of a Windows kernel and THAT IS ALL.

This is why that line between WinRT and .NET/Win32 has to stay thick and hard. There will be no hybrid apps. That ruins the vision.

win8-platform-and-tools Imagine a thick wall between the light blue and green.

Microsoft knows that it has to participate in a segregated market. They won’t be selling $100 Windows Professional licenses to OEMs of $300 tablet devices. The $10 license of Windows Started Edition is more like it. (I’m guessing at OEM costs.)

The operating system has to run fast on low power hardware. Any applications which run on it have to run on all the better and faster hardware, right on up to $5000 laptops. The Metro style along side classic desktop fits this mold.

I’m a little bit sad that they wouldn’t just come right out and say this. Come right out and say: “Hey! Our phones are going to run Windows 8! There will be 7”, 8”, 9”, 10”, 11”, 12” tablets all running Windows! But its not like any Windows that you’ve ever known!”

samsung-galaxy-tab-10-1-side-2-small-2

Talk about shaking things up! What if that were the first 3 sentences of the Build keynote?

I’m less angry about not being able to call WinRT from my .NET apps. But I’m a .NET developer. I’m not a Windows developer. I’m not a Silverlight developer. I’m not a WinRT developer.

I think in what I’m most disappointed is all that awesome stuff that WinRT makes easy, and out in .NET land, talking to a webcam for photos and video is still painful. Transcoding video is still painful. (Did you see how easy it is to transcode with WinRT? That is SWEET!)

Build Windows Day 2 From Afar: WTF is WinRT

Watching the developer reaction to Metro style and WinRT has been both depressing and comical. I suppose its like watching anyone else learn something from nothing. We can get it very wrong at first. It is part of our learning process.

I know I’ve not figured what the existence of WinRT means for .NET or what I can and cannot do between WinRT and.NET4.5. I’m also not sure what the difference is between Metro style and WinRT. It sure seems like there are some cool non-UI APIs in WinRT that I might want to use from .NET. I sure hope that I can.

At first glance it feels like Metro style apps aren’t .NET. At least not really. It feels like Metro style apps run in a different CLR. They feel like Silverlight on the desktop since they have no direct access to file system and the types available for use are limited.

I’ve read that it is not a different CLR. I’ve read that it is .NET but that the verifier and other tools in the chain of building a Metro style app enforce the restrictions. I’ll have to wait and see how the pieces fit together.

Missing the APIs can be a challenge: http://winmd.tumblr.com/post/10211942442/missing-net-apis

Looks like I can do the above when I say use some WinRT from .NET4.5. Cool, because those file pickers sure are pretty. http://ermau.com/using-winrt-from-net/

Doug Seven has an excellent post detailing what is being released and how it fits: http://dougseven.com/2011/09/14/i-know-what-youre-thinking-and-youre-wrong/

Take a look at this slide from the keynote:

win8-platform-and-tools

I’d like to speculate about a couple things related to this picture.

  1. This is not in the scale of overall importance to all developers. It is in the scale of what is new.
  2. All of the things in blue are still there and still supported.

Consider an alternative pitch for Metro style apps. Metro style apps, like all apps, are all launched from the new “Start Screen”. The start screen replaces the start menu. Metro style apps keep the look and feel of the start screen. It is as if you are never leaving the start screen. Metro style apps are apps that you program into the start screen. Imagine being able to program apps into the start menu. It sounds crazy. Now that your start menu is full screen and interactive, those metro tiles (they have a different name) are programmable by you. I can think of another little square in windows that is programmable: Sidebar Widgets. When was the last time you wrote a sidebar widget? (Mike Ward, you are the only one I know.)

Considered from the point of view, very few of us Line of Business app developers will be writing Metro style apps. They are not meant to replace all desktop apps. You will not see Office apps like Word, Excel or Powerpoint built as Metro style apps. They will likely get some theming that is Metro influenced, but they will still run on the traditional Windows desktop and not in the Start Screen. That said, there might be augmentations in the Metro style apps. After all, Windows on a tablet is far more usable with Office. So I think you will see stripped down, touch optimized, Metro versions of Word, Excel and Powerpoint. The use case for these will be “when you aren’t at your desktop or laptop".

Believe it or not, there was actually announcements around Azure and ASP.NET yesterday. You’d never know it given all the focus on WinRT. I’m super excited about the new async support for controller actions in MVC4. I also think Azure’s replication story around tables and blobs is pretty sweet now.

So much more to come. Its an exciting time be a developer. Just try to remember that ships often look like they are sinking when you see them far off the horizon Smile

Thoughts after the Build Windows keynote: This changes nothing

Nothing has changed, and this is a good thing.

Here is what I took away from yesterdays keynote:

  • Everything I’m doing today with Windows desktop apps will work on Windows 8. No surprise there.
  • If I want to write these new WinRT apps I’ll have to leave Winforms or WPF behind and use what looks like some kind of desktop Silverlight UI control library which has been enhanced with some more controls. (The GridView was shown in the keynote.)
  • There is nothing else to say about the developer story. Everything else shown in the keynote was about consumer experience.

Watching my own twitter feed was rather comical. Everyone seemed to be hearing exactly what they wanted to hear. Sometimes it was the opposite of what I thought I just heard.

There are still lots of unanswered questions, but I’m sure that in the next few days these will all be answered via sessions and blog posts containing the content of the sessions. I’m surprised people aren’t more patient. I’m actually seeing a bit of FUD email and tweets asking questions that should be answered by the end of the week. Be patient.