.

C82 · art, the web, and everything in between

C82 · art, the web, and everything in between

This is pretty interesting idea. It came up at just the right time too – I ended up needing a widget that worked just like this.

Some Examples


5 Mintues Into Edgy

Ok I decided to start the process of moving over to Edgy.

For a change instead of doing it the Debian command line way I used the Ubuntu upgrade manager

gksudo "update-manager -c -d"

That triggered the update manager with the option to upgrade to the new release.

It took a while to download the 1200 packages that had been updated since Dapper. The process was pretty straight forward. At the end, it handled prompting me about config files that I had changed. This would probably confuse normal users but then I don’t they end up editing the config files as much as I did.

The only real problem I ran into was with my processor. Part of it was Ubuntu and the other part was my own fault. Edgy ships with linux-image-386. That kernerl doesn’t recognize multi core processors. Since I didn’t spend the money on dual core, to run single core in Linux I had to fix it. It turns out the solution is pretty simple – you must run linux-image-generic. My mistake was taking this opportunity to remove a bunch of old kernel images I had laying around. In the process I manged to mess up grub and my Nvidia drivers. After a little bit of dinking about, I manage to get everything up and running – and I’m now posting this from Firefox 2.0 (I thought it would be IceWeasel).

They have made some changes to the system. I haven’t really explored the new start up mechanism, but I already went through the fstab and noticed that everything now references UUIDs instead of the standard /dev/hd(a-z) labeling. This makes things a little more confusing to read, but apparently it makes the system handle boot order of drives a lot better.

As I spend more time with it, I’ll report more about my experiences – but so far so good!


Guess I Know What I’m Doing This Weekend

Edgy Eft is out – and available for download.


50 States

50 States – Presented by Addicting Games

Here is your chance to prove you know where all 50 states go – there are no borders – though it does get easier as you place states – the score to beat?

90% avg err 21 miles – 470 secs


Philosophical Health Check

Philosophical Health Check

This shows how many view points you have that are contradictory. It seems to fit into a larger discussion I’ve been having about Athieism and a person’s moral compass or lack there of.

Take a moment and see how much tension you have -(for reference – I’m at 7% – avg is 28%)

I won’t tell you which ones :)


Shuttleworth Announces Name For Edgy +1

Planning for Ubuntu 7.04

Salve, Ubuntero’s

With the final release of Ubuntu 6.10 approaching, and apparently set
to be spot on schedule October 26th, we’re starting to look beyond
it to Ubuntu 7.04, scheduled for release on 19 April 2007.

In the next cycle we’ll expand on the brand new infrastructure that has
landed in Edgy as well as branching out in some exciting new directions.
This combination of courage and restlessness is also found in a young deer
that sets out to explore a world that is new and exciting – seeing the
world through eyes unprejudiced by what has gone before.

In that spirit, the release will be be code named “The Feisty Fawn”.

The main themes for feature development in this release will be
improvements to hardware support in the laptop, desktop and high-end
server market, and aggressive adoption of emerging desktop technologies.
Ubuntu’s Feisty release will put the spotlight on multimedia enablement
and desktop effects. We expect this to be a very gratifying release for
both users and developers. Detailed planning will take place at the
developer summit next month in Mountain View, California. Please join
us there to help shape the Feisty Fawn!

https://wiki.ubuntu.com/UbuntuDeveloperSummitMountainView

This will be our sixth release, marking the third anniversary of the
project’s inception, and will be a return to our standard six-month release
schedule following the shortened catch-up cycle used for 6.10.

Edgy has been a wild ride, with some remarkable achievements (nothing
like re-inventing and substantially improving on init!). Feisty will
be a little more focused on features that are very visible to end-users.

We welcome new participants in our community – whatever your talent we
look forward to working with you! Jono Bacon, our new community lead,
will find a way to make sure your contribution is well received.

Mark

Now I just need to get through updating to Edgy.


Magic Migration….To Hell

I got hit by this today and it was so confusing that it took me a long time to sort out. That makes it a prime canidate to post here to make sure it doesn’t get me or you ever again.

I’m a huge fan of the migration system in Rails. It makes it very easy to track changes to you database schema. That’s a good thing!

The issue I ran into today was this – I have been working on my workstation at home for several days. It meant I generated both a lot of code and a lot of tests.

Today I showed up at the office -

svn update
rake setup_test_db (It's a custom task that has actually been superceded by a series of commands in standard rails)
rake

This should bring my laptop up to date, reload the test db, and run all tests. This helps me make sure everything is still on track. Immediately, a huge batch of tests failed – because they couldn’t find the tables I had recently created. After a heck of a lot of head banging – I found the solution.

I was hit by a bit of the old Rails magic. As far as I can tell, the version your test system is going to fixate on is set by your development db.

Small disclaimer – this happened on Rails Edge it may or may not hold true for the current offical release

So in my case, I started running the tests before I touched the development db. That meant that the test db migrated back to the version that was stored in my development db – which was three versions lower than the current one.

The solution was to

rake db:migrate

That brought the development system up to spead and then the tests ran flawlessly.

So if you do revert your development system to a previous version be prepared for the tests to work on that version as well.


Adobe Acquires Video Software Maker Serious Magic – News, Guides and Tips – Consumer Camcorders – Camcorderinfo.com

Adobe Acquires Video Software Maker Serious Magic – News, Guides and Tips – Consumer Camcorders – Camcorderinfo.com

I’m a big fan of Serious Magic. I got their Visual Communicator software package a couple of years ago and use it every month to make a news report for an internal website where I work.

My hope is that this means their technology (which is really good) while reach a much greater audience.


Soap (Rails) + Soap (Python) == Dirty Water

For a project I’m working on I have to provide web services via Soap in Rails. The consuming client is SOAPpy (Python).

I hit two different problems and a solution that I wouldn’t mind feedback on.

The first one is that when you post via SOAPpy you get this header


Content-type: text/xml; charset="utf-8"

That generates an error along the lines of

XSD::Charset::CharsetConversionError (Converter not found: X_UNKNOWN -> UTF8):
/usr/lib/ruby/1.8/xsd/charset.rb:112:in `encoding_conv'
/usr/lib/ruby/1.8/xsd/charset.rb:102:in `encoding_from_xml'

The source of the problem is that SOAPpy is putting quotes around the charset. I won’t tell you how long it took me to figure that out. I don’t know if this is a bug in SOAPpy or in Rails because I don’t know if it violates the standard to put it in quotes. (If you know let me know – it will help me figure out who to submit the bug to) In the interim I figured I’d need to fix this.

The other issue is related to Mongrel. For whatever reason when Mongrel talks to SOAPpy it ends up putting the Content-Length header twice. SOAPpy stores it as a list – which then causes it to blow up. I don’t know if that is really a bug on Mongrel’s part because again I don’t know the standard. I submitted a bug anyway.

AS you can see these are problems specifically in interacting with SOAPpy. I don’t have control of the other side so I needed to fix it on the Rails side. So if you have feedback – please keep in mind that I CANNOT modify the Python side unless the SOAPpy project itself releases the update – which since the current version is from 2005 – seems unlikely.

So my solution involved Opening A Class(aka Monkey Patching)

Before we go further let me just say that this strategy is very powerful. Like all powerful things it can be very dangerous. First you are modifing the behvior of something standard to do something different. That means that when someone else tries to use your code – or when updates come out – if you are not careful you may earn your self a lot of time in the penalty box when you can’t figure out why something doesn’t work for you. The goal of the process as described here is to make it at least possible to figure out where to look.

First of all, most of the structure is actually from another developer I’m working with (Thanks Ryan!) – but I figured I’d spend some time documenting it with my solution to the Soap problem.

In the rails project we now have a directory /add/core_ext

This is where all modifications go.

At the very bottome of config/enviroment.rb the following line is added

Dir["#{File.expand_path(RAILS_ROOT)}/app/core_ext/*.rb"].each { |file| load file }

If an object acts weird you get to look here first.

Second – the modifications are added in a module named in a way that shows that modifications are being made.

This allows me to issue a command like this to console

ActionWebService::Protocol::Soap::SoapProtocol.ancestors

Which returns

[ActionWebService::Protocol::Soap::SoapProtocol, SoapProtocolExtension, ActionWebService::Protocol::AbstractProtocol, Object, ObjectExtension, Base64::Deprecated, Base64, Kernel]

You can see the SoapExtension in the list. I’m sure as we deal with this more we will standardize more to make it easier to figure out if something has been opened by something else.

Now on to the code.

I create a file in core_ext called soap_protocol.rb

module SoapProtocolExtension
    #Required to handle CONTENT-TYPE that wraps the char set in quotes
    def custom_decode_action_pack_request(action_pack_request)
        return nil unless soap_action = has_valid_soap_action?(action_pack_request)
        service_name = action_pack_request.parameters['action']
        input_encoding = parse_charset(action_pack_request.env['HTTP_CONTENT_TYPE']).gsub(/["']/,"")
        protocol_options = {
            :soap_action => soap_action,
            :charset  => input_encoding
        }
        decode_request(action_pack_request.raw_post, service_name, protocol_options)
    end
end

ActionWebService::Protocol::Soap::SoapProtocol.class_eval {
    include SoapProtocolExtension
    alias old_decode_action_pack_request decode_action_pack_request
    alias decode_action_pack_request custom_decode_action_pack_request

}

The top part defines the function that actually handles the quoting.

The bottom part opens the class and includes the new method. Then it uses the alias method to move the old method out of the way. Then it moves the custom method into place. I could have probably reduced code by just modifing the HTTP_CONTENT_TYPE and passing it on to the old method. (Assuming I stick to this path that’s probably what will happen).

The second patch is in a file called mongrel.rb. I had to add a little bit more logic because Mongrel isn’t always present at startup (Hello webbrick). I also ended up putting it inside the Mongrel module to give it access to constants and other info related to Mongrel

if Module.constants.include?(“Mongrel”)

module Mongrel
        module Mongrel::HttpResponseContentLengthBug
            def custom_send_status(content_length=@body.length)
                if not @status_sent
                    #@header['Content-Length'] = content_length unless @status == 304
                    write(Const::STATUS_FORMAT % [@status, HTTP_STATUS_CODES[@status]])
                    @status_sent = true
                end
            end
        end
    end
    Mongrel::HttpResponse.class_eval {
        include Mongrel::HttpResponseContentLengthBug
        alias old_send_status send_status
        alias send_status custom_send_status
    }
end

Once the bug in Mongrel gets fixed I’ll remove this modification. But until then I can continue working on the system. Anybody else done anything like this? Am I going down a dark path?


Fun with TimeStamps

I can’t tell yet if this is an issue I just never ran into or if it has something to do with running Edge Rails (more testing and I’ll know)

Anyway I ran into a problem today working on some code were I actually need to set the created_at/updated_at fields for a given object. This made it easier to make sure that the search returned the right objects.

I kept doing

my_obj = MyClass.new(:name => "hello", :created_at => Time.gm(2006,1,1,10,12,13),
:updated_at => Time.gm(2006,1,1,10,12,13))

The updated_at always got set to now(). Which defeats the purpose. Turns out there is a simple way to turn off the Rails magic

MyClass.record_timestamps = false

That line of code turns off auto settting the magic fields. This let me set the stamps to what I wanted – and then I just turned it back on after the creation was done. (if you don’t it will be turned off for all tests which is probably not what you want.)

You can also add this if you have one class you never want to use auto timestamping

class MyClass < ActiveRecord::Base
self.record_timestamps = false
end

The above is from active_record/timestamp.rb

Just one of many nooks and cranies I've fallen into this week. If I can I'll put up my notes on the joys of Monkey Patching with web services.


    Stuff I want to read

    Shelfari: Book reviews on your book blog

    Stuff I've Read

    Shelfari: Book reviews on your book blog
    You are currently browsing the Economy Size Geek weblog archives for October, 2006.
    Categories
    Archives

    .