#musicbrainz

/

      • aCiD2
        the latter being the most common approach, and the one used by cpan modules etc
      • luks
        I'd like to keep the types in MusicBrainz::Entity::Types, since they won't cover other classes
      • aCiD2
        MusicBrainz::Entity::Types then, heh
      • czaanja has quit
      • N[]vA joined the channel
      • luks
        hmm, what do I need to do to be able to use 'subtype'
      • just 'use Moose' doesn't seem enough
      • aCiD2
        have you used Moose::Util::TypeConstraints?
      • that's where subtype and class_type are
      • luks
        thanks
      • heh, now the types are short, I'm tempted to put the has commands back to a single line
      • aCiD2
        Heh, did you know you can have multiple attributes to one has?
      • has [qw/foo bar/] => ( ... )
      • if we're sure we won't need to put extra constraints on attributes like traits, metaclasses, whatever - then just stick them on one line
      • luks
        I've seen it in your example from the mail first time
      • aCiD2
        I just expand them from personal prepreference
      • prepreference? preference*
      • luks
        the only reason I like them on one line is because I can see more of them
      • aCiD2 nodes
      • aCiD2
        I'm spoilt by a huge screen and good eye sight :)
      • luks
        heh
      • aCiD2
        that and I use folding
      • luks
        hmm
      • would be nice if the Collection::Array metaclass, when using provides => { push => 'add_stuff' }, automatically called the item class constructor if I pass it just a plain hash
      • aCiD2
        What do you mean, pass it a hash?
      • luks
        $artist_credit->add_name(MusicBrainz::Server::Entity::ArtistCreditName->new(name => 'Artist 1', join_phrase => ', '));
      • vs
      • $artist_credit->add_name(name => 'Artist 1', join_phrase => ', ');
      • aCiD2
        Ah
      • luks
        it knows the item has to be MusicBrainz::Server::Entity::ArtistCreditName
      • aCiD2
        You could use coercion to get that
      • corce 'Whatever' => from 'HashRef' => via { Foo->new{$_) }
      • luks
        yeah, but the metaclass could handle that automatically
      • aCiD2
        yea
      • i agree
      • but I think add can take a list, so it wouldn't know whether you give it a hash or a list of items
      • luks
        oh, right
      • aCiD2: do you know where is Catalyst::Plugin::Cache used?
      • aCiD2
        No, ruaok added that
      • I'd guess somewhere in the web service
      • but I'm not sure where
      • luks
        ok, time to read diffs then
      • aCiD2
        :)
      • luks
        from what I can see, it isn't used anywhere
      • aCiD2
        Nope, I can't find any references to $c->cache either
      • do you want to remove it?
      • luks
        I don't know yet, I'd like to not make cache dependant on catalyst
      • aCiD2
        yea, i agree with that
      • luks
        but if the plugin does somethign useful, we might want to keep it
      • Kr1stjan joined the channel
      • what I wanted was to make some kind of Context object, with access to the database and cache, which can by used by tests and console scripts
      • aCiD2
        something that maintains handles?
      • luks
        and MusicBrainz::Server would inherit this, to make it available to the catalyst context too
      • yes
      • aCiD2
        mmm, I can't see any other way to do, and to get testing working easily too
      • N|afk joined the channel
      • gouchi has quit
      • N[]vA has quit
      • luks: for completion (and mainly as an exercise for myself :)) I tried writing what I meant by using roles and traits for caching: http://gist.github.com/98016
      • like I said, just there for completeness sake, was fun to write :)
      • damnit, why is emacs using tabs >.>
      • chefkoch has quit
      • Kr1stjan has quit
      • N|afk has quit
      • luks
        aCiD2: one problem with the code is that it's not easily testable
      • aCiD2: unit testing should test the simplest possible units
      • aCiD2: so you should have tests for loading from the database, loading from the cache, serialization/deserialization
      • and all these should be independant
      • Munger
      • luks
        I'd say Jive
      • Munger
        That's what I thought, but I saw the existing RE on http://musicbrainz.org/release/bf594062-27f5-45... and suspect that should be changed as well. Barcode seems to concur
      • aCiD2
        luks: hrm, actually i'd argue it is *more* testable. If you want to make sure the right cache keys are set, make a mock using 'with CacheAccessor' and a mock cache implementation (provide from/to_cache)
      • but I haven't tried, so I'm most likely talking nonsense :)
      • luks
        aCiD2: how are you going to test the path of Artist::load which is loading directly from the database?
      • symphonick has quit
      • aCiD2
        Give a mock cache implementation that returns undef, so it won't use the cache?
      • luks
        how do you give it a mock cache implementation?
      • aCiD2
        oh right, heh
      • how do you do it in yours?
      • luks
        it's easier to have Artist class which only works with the database
      • no cache involved
      • aCiD2
        Oh, well I wasn't sure where you added the caching layer
      • luks
        then you have a subclass, which caches te requests
      • *the
      • aCiD2
        So we have 2 storage classes and an entity class for every entity?
      • luks
        no, not every entity is cacheable
      • aCiD2
        ah, right
      • luks
        and the second caching wrappers will look like: package CachedEntity; extends 'Entity'; with 'CacheMixing';
      • -g
      • aCiD2
        Well it would be pretty easy to take the caching out of artist, seeing as it is all in a role anyway. but I need to do revision instead, bah
      • Alan_New has quit
      • ps3 joined the channel
      • aCiD2 has quit
      • Munger has quit
      • bfirsh joined the channel
      • bfirsh has quit
      • chefkoch joined the channel
      • chefkoch
        chefkoch is now known as chefkoch_AW
      • bfirsh joined the channel
      • Sargun has quit
      • cooperaa joined the channel
      • cooperaa
        good morning MB :)
      • everyone sleeping?
      • nikki
        no
      • cooperaa
        hi nikki!
      • nikki
        hey
      • cooperaa
        I'm doing a cool project on cd sales projections
      • and was hoping to get some suggestions from the MB folks :)
      • nikki
        what sort of suggestions?
      • cooperaa
        I'm looking for interesting factors which we think do or don't affect CD sales
      • nikki
        the exchange rate
      • for me at least :P
      • cooperaa
        :)
      • well I'm comparing things to Canadian CD sales... so I could do the US exchange rate
      • So far, I've got per capita income, iTunes sales, Mininova downloads
      • will be adding in Other Format sales (substitutes)
      • nikki
        I wonder how places like amazon deal with the exchange rates for usa/canada... I mean, for british people they're not going to go look at .fr or .de for something cheaper 'cause they're not in english, and .com would involve quite slow/expensive shipping in comparison to .uk
      • fuppp
        How do I get a list of albums? I tried using this query, but then I got a list that includes singles
      • SELECT DISTINCT name FROM album WHERE artist IN(SELECT id FROM artist WHERE name='Britney Spears');
      • FauxFaux
        There's a table which stores whether it's an album or a single.
      • cooperaa
        fuppp: you'll probably want to add a condition for what type of album you want (I assume the ALBUM table is actually the table for all "releases
      • luks
        WHERE 1 = ANY(attributes[2:4]) AND artist IN (...)
      • nikki
        hey luks!
      • luks
        hi
      • nikki
        I was wondering about my question yesterday (selecting just one release event per album)... you mentioned doing subquery in the select or something... do you have any examples of those?
      • fuppp
        ah thanks, seems like that works :)
      • FauxFaux
        select (select date from release_events where album_id = album.album_id limit 1) as pony, album_id from album?
      • FauxFaux goes to install the postgres connectivity tools so he can actually test stuff. ¬_¬
      • nikki
        hmm
      • Muz
        FauxFaux: what, PHPpgadmin?
      • luks
        + ORDER BY releasedate
      • but yes, that's the one
      • FauxFaux
        Muz: s/php// yes. :p
      • Muz
        Haha
      • luks
        I've written some kind of aggregate function, where you can do SELECT id, min_2(releasedate, barcode), min_2(releasedate, label) FROM album, release GROUP BY album.id
      • but I couldn't make it work with any data type
      • nikki
        :o
      • it works :D
      • thanks luks and FauxFaux :D
      • Munger joined the channel
      • Munger
        join #macosx
      • Ooops
      • cooperaa has quit
      • czaanja joined the channel
      • ps3 has quit
      • bfirsh_ joined the channel
      • bfirsh_ has quit
      • bfirsh has quit
      • czaanja has quit
      • daq4th
        hm, what are the guidelines to add a compiltioan track with "artist1 presents artist2"? It is not like feature and it is not a collaboration ...