#musicbrainz-devel

/

      • kepstin-netbook_ joined the channel
      • 2012-07-21 20345, 2012

      • hawke_ joined the channel
      • 2012-07-21 20336, 2012

      • DWSR joined the channel
      • 2012-07-21 20341, 2012

      • CallerNo6 joined the channel
      • 2012-07-21 20340, 2012

      • ianmcorvidae joined the channel
      • 2012-07-21 20347, 2012

      • plaintext joined the channel
      • 2012-07-21 20312, 2012

      • plaintext
        Hello!
      • 2012-07-21 20344, 2012

      • plaintext
        I have a decoded json variable in perl. The dump is printed here: http://plaintext.mbsandbox.org/logstatistic
      • 2012-07-21 20315, 2012

      • plaintext
        But when I try to get the first element of the list ($var[0]), I get an error while running the server
      • 2012-07-21 20337, 2012

      • plaintext
        "Error while loading app.psgi: Global symbol "@decoded_data" requires explicit package name at lib/MusicBrainz/Server/Data/LogStatistic.pm line 36."
      • 2012-07-21 20347, 2012

      • plaintext
        Could anybody help?
      • 2012-07-21 20330, 2012

      • bitmap
        maybe you're using the wrong sigil on @decoded_data? that usually the problem when I get that error
      • 2012-07-21 20337, 2012

      • bitmap
        *that's
      • 2012-07-21 20316, 2012

      • plaintext
        I tried @var[0] but I got the same error
      • 2012-07-21 20321, 2012

      • bitmap
        what's on line 36? it's complaining about @decoded_data
      • 2012-07-21 20340, 2012

      • plaintext
        this is what I tried:
      • 2012-07-21 20344, 2012

      • plaintext
        $log_stat->data(Dumper($decoded_data[0]));
      • 2012-07-21 20355, 2012

      • plaintext
        I can put the code on gist
      • 2012-07-21 20301, 2012

      • plaintext
        if that helps more
      • 2012-07-21 20325, 2012

      • bitmap
        is decoded_data an array reference? then you need to do $decoded_data->[0]
      • 2012-07-21 20353, 2012

      • plaintext
        oh that might be the case
      • 2012-07-21 20358, 2012

      • plaintext
        thanks bitmap, I'll try
      • 2012-07-21 20356, 2012

      • plaintext
        yay, it works! I really need to learn perl properly :)
      • 2012-07-21 20329, 2012

      • plaintext joined the channel
      • 2012-07-21 20329, 2012

      • ijabz joined the channel
      • 2012-07-21 20331, 2012

      • Mineo joined the channel
      • 2012-07-21 20322, 2012

      • plaintext
        I have one more question if it's ok :)
      • 2012-07-21 20353, 2012

      • plaintext
        $log_stat->data(Dumper($decoded_data->[0])); this produces this hash on the output:
      • 2012-07-21 20355, 2012

      • plaintext
        { 'count' => '9', 'percent' => '0.900000', '_tc' => '1000', 'mbid' => '60f7d020-9580-47c5-8839-a4f25659687d' }
      • 2012-07-21 20327, 2012

      • plaintext
        but this: $log_stat->data(Dumper(keys %{ $decoded_data->[0] } )); produces the single string 'count' for some reason
      • 2012-07-21 20351, 2012

      • plaintext
        however when I try $decoded_data->[0]{'percent'} it works without a problem
      • 2012-07-21 20359, 2012

      • plaintext
        why cant the keys function return all the keys in a list?
      • 2012-07-21 20356, 2012

      • warp
        keys returns an array, not an array ref. is Dumper expecting an array ref perhaps?
      • 2012-07-21 20324, 2012

      • plaintext
        I thought dumper would just output any variable
      • 2012-07-21 20319, 2012

      • bitmap
        it does expect a reference iirc
      • 2012-07-21 20344, 2012

      • warp
        oh, probably Dumper generates an array if given an array, and $log_stat->data() only uses the first argument.
      • 2012-07-21 20302, 2012

      • plaintext
        That may be so
      • 2012-07-21 20356, 2012

      • plaintext
        That's right, thanks warp
      • 2012-07-21 20321, 2012

      • plaintext
        I was expecting Dumper to output the whole array like when it dumped $decoded_data
      • 2012-07-21 20326, 2012

      • plaintext
        which is an array of hashes
      • 2012-07-21 20312, 2012

      • warp
        plaintext: well, it does. it's just that $log_stat->data() isn't expecting that.
      • 2012-07-21 20305, 2012

      • plaintext
        oh I get it
      • 2012-07-21 20315, 2012

      • plaintext
        I think
      • 2012-07-21 20320, 2012

      • warp
        plaintext: install Devel::REPL if you don't have it yet, it makes it easier to try these things.
      • 2012-07-21 20327, 2012

      • warp
      • 2012-07-21 20336, 2012

      • plaintext
        is this sort-of like a shell for perl?
      • 2012-07-21 20349, 2012

      • warp
        yes
      • 2012-07-21 20352, 2012

      • plaintext
        cool, thanks
      • 2012-07-21 20300, 2012

      • warp
        see the screenshot :)
      • 2012-07-21 20304, 2012

      • plaintext
        yeah
      • 2012-07-21 20313, 2012

      • plaintext
        that would be helpful
      • 2012-07-21 20310, 2012

      • djce joined the channel
      • 2012-07-21 20310, 2012

      • the_metalgamer joined the channel
      • 2012-07-21 20343, 2012

      • ocharles
        happy birthday adhawkins-away !
      • 2012-07-21 20316, 2012

      • kepstin joined the channel
      • 2012-07-21 20314, 2012

      • lfranchi joined the channel
      • 2012-07-21 20327, 2012

      • lfranchi joined the channel
      • 2012-07-21 20325, 2012

      • CallerNo6 joined the channel
      • 2012-07-21 20348, 2012

      • dak180 has left the channel
      • 2012-07-21 20327, 2012

      • ijabz joined the channel
      • 2012-07-21 20356, 2012

      • kepstin joined the channel
      • 2012-07-21 20302, 2012

      • ijabz joined the channel
      • 2012-07-21 20317, 2012

      • ruaok joined the channel
      • 2012-07-21 20303, 2012

      • Leftmost joined the channel
      • 2012-07-21 20339, 2012

      • vinay_ joined the channel
      • 2012-07-21 20308, 2012

      • vinay_
        can anyone tell me if we can connect to the local musicbrainz database (which I have downloaded form the website ) using the APIs
      • 2012-07-21 20357, 2012

      • kepstin joined the channel
      • 2012-07-21 20347, 2012

      • navap
        vinay_: If you set up your own musicbrainz-server you'll have local access to the web service
      • 2012-07-21 20312, 2012

      • vinay_
        @navap : Thanks for your reply .. I am using my school network to install it on one of the servers. I read the documentation for setting up the musicbrainz server . Is there any way I can use the existing apache server to host this
      • 2012-07-21 20313, 2012

      • navap
        There probably is, but I've only used the built in catalyst server so I won't be much help in setting up something else
      • 2012-07-21 20323, 2012

      • ianmcorvidae
        you'll need to set up apache as a reverse proxy to running the server with FCGI -- apache will be an extra layer "around" the main server
      • 2012-07-21 20353, 2012

      • ianmcorvidae
        you can't run it with e.g. mod_perl or such, as far as I know, but it's run using Catalyst/PSGI/Plack, so if you want to look at those docs they might inform you
      • 2012-07-21 20316, 2012

      • vinay_
        Thanks Guys. I just found out this. Can I use this instead http://wiki.musicbrainz.org/Development/Search_se…
      • 2012-07-21 20326, 2012

      • ianmcorvidae
        that's a separate component entirely
      • 2012-07-21 20304, 2012

      • ianmcorvidae
        that's used only for search -- the perl server talks to that one (usually just via search.musicbrainz.org, even for external deployments) as a backend for the search functionality
      • 2012-07-21 20317, 2012

      • ianmcorvidae
        if you want the API, you'll need the perl server setup
      • 2012-07-21 20338, 2012

      • vinay_
        Basically I want to use the APIs to extract information , but the APIs need a webservice .
      • 2012-07-21 20310, 2012

      • vinay_
        Ok I will try the perl server setup
      • 2012-07-21 20323, 2012

      • vinay_
        Thank You
      • 2012-07-21 20326, 2012

      • ianmcorvidae
        you could also just set up the database, if you just want any old access to the data
      • 2012-07-21 20357, 2012

      • ianmcorvidae
        but yeah, look into the perl server setup :)
      • 2012-07-21 20338, 2012

      • vinay_
        And when I use the APIs musicbrains blocks us after some requests
      • 2012-07-21 20309, 2012

      • ianmcorvidae
        there's a rate-limit, yes, one per second
      • 2012-07-21 20337, 2012

      • nikkimini
      • 2012-07-21 20302, 2012

      • vinay_
        I wrote programs to extarct data from the database but wanted to see if by using the APIs will it be any faster
      • 2012-07-21 20337, 2012

      • kepstin
        the apis will be slower than directly accessing the data from the database, of course. All they do is add an extra layer between you in the database.
      • 2012-07-21 20337, 2012

      • ianmcorvidae
        kepstin: probably -- the only exceptions might be if he's getting heavy usage of the cache or of the search indexes
      • 2012-07-21 20335, 2012

      • kepstin
        the current etags implementation on the api doesn't actually stop it from doing the db request on 'cached' requests...
      • 2012-07-21 20301, 2012

      • kepstin
        unless there's some other caching in the server itself?
      • 2012-07-21 20325, 2012

      • ianmcorvidae
        yeah, I don't mean etags, I mean object caching
      • 2012-07-21 20330, 2012

      • kepstin
        I didn't think there was on the webservice, since invalidating such a cache on db updates is a problem.
      • 2012-07-21 20307, 2012

      • ianmcorvidae
        I don't know exactly how it plays out or how well it works, but I know that there is some sort of cache
      • 2012-07-21 20318, 2012

      • ianmcorvidae
        it's most effective for things like the list of languages though
      • 2012-07-21 20323, 2012

      • kepstin
        I'm not familiar with that, though - and presumbly an application accessing the db directly could cache relevant stuff internally
      • 2012-07-21 20333, 2012

      • ianmcorvidae
        yeah, it could
      • 2012-07-21 20303, 2012

      • ianmcorvidae
        kepstin: https://github.com/metabrainz/musicbrainz-server/… includes the caching stuff for core entities (CoreEntityCache and EntityCacheBase, which the former inheritS)
      • 2012-07-21 20333, 2012

      • ianmcorvidae
        kepstin: it just does _delete_from_cache after any update, delete, or merge (from perl)
      • 2012-07-21 20301, 2012

      • ianmcorvidae
        but yeah, in general the database should be faster :)
      • 2012-07-21 20341, 2012

      • vinay_
        I was just trying to see the performance but now I dont think its worth it :)
      • 2012-07-21 20354, 2012

      • vinay_
        I will stick to the database then
      • 2012-07-21 20332, 2012

      • vinay_
        Thanks Guys . I really apreciate it .
      • 2012-07-21 20302, 2012

      • ijabz joined the channel
      • 2012-07-21 20332, 2012

      • CallerNo6 joined the channel
      • 2012-07-21 20343, 2012

      • plaintext joined the channel
      • 2012-07-21 20358, 2012

      • plaintext
        Hello
      • 2012-07-21 20337, 2012

      • plaintext
        Is it possible to do something like this in an entity?
      • 2012-07-21 20338, 2012

      • plaintext
        isa => 'ArrayRef[ArrayRef[Str]]',
      • 2012-07-21 20316, 2012

      • plaintext
        Because for some statistics I need to store a whole table of data
      • 2012-07-21 20345, 2012

      • ianmcorvidae
        I think it should be possible, but I guess look at the Moose documentation to be sure
      • 2012-07-21 20314, 2012

      • plaintext
        thanks
      • 2012-07-21 20325, 2012

      • ianmcorvidae
        yeah, looks like you can
      • 2012-07-21 20330, 2012

      • ianmcorvidae
      • 2012-07-21 20334, 2012

      • plaintext
        great! I'll try now
      • 2012-07-21 20353, 2012

      • plaintext
        actually, I think I'll need ArrayRef[Map[...]],
      • 2012-07-21 20359, 2012

      • plaintext
        but if I need a weird structure like this
      • 2012-07-21 20305, 2012

      • plaintext
        there must be a better way to do it
      • 2012-07-21 20312, 2012

      • ianmcorvidae
        hm
      • 2012-07-21 20314, 2012

      • ianmcorvidae
        probably
      • 2012-07-21 20321, 2012

      • ianmcorvidae
        I'm not sure what though
      • 2012-07-21 20328, 2012

      • ianmcorvidae defers to ocharles/warp/moose docs :)
      • 2012-07-21 20332, 2012

      • plaintext
        where can I find ocharles/warp docs? :P
      • 2012-07-21 20356, 2012

      • ianmcorvidae
        haha
      • 2012-07-21 20325, 2012

      • plaintext
        I think I'll ask for some advice on monday
      • 2012-07-21 20340, 2012

      • ianmcorvidae
        yeah, that's likely when they're back
      • 2012-07-21 20345, 2012

      • plaintext
        in the meantime I'll look into moose docs
      • 2012-07-21 20350, 2012

      • plaintext
        but now I'm off to bed
      • 2012-07-21 20357, 2012

      • ianmcorvidae
        cool
      • 2012-07-21 20359, 2012

      • ianmcorvidae
        sleep well :)
      • 2012-07-21 20303, 2012

      • plaintext
        thank you
      • 2012-07-21 20304, 2012

      • plaintext
        bye!