#musicbrainz-devel

/

      • kepstin-netbook_ joined the channel
      • hawke_ joined the channel
      • DWSR joined the channel
      • CallerNo6 joined the channel
      • ianmcorvidae joined the channel
      • plaintext joined the channel
      • plaintext
        Hello!
      • I have a decoded json variable in perl. The dump is printed here: http://plaintext.mbsandbox.org/logstatistic
      • But when I try to get the first element of the list ($var[0]), I get an error while running the server
      • "Error while loading app.psgi: Global symbol "@decoded_data" requires explicit package name at lib/MusicBrainz/Server/Data/LogStatistic.pm line 36."
      • Could anybody help?
      • bitmap
        maybe you're using the wrong sigil on @decoded_data? that usually the problem when I get that error
      • *that's
      • plaintext
        I tried @var[0] but I got the same error
      • bitmap
        what's on line 36? it's complaining about @decoded_data
      • plaintext
        this is what I tried:
      • $log_stat->data(Dumper($decoded_data[0]));
      • I can put the code on gist
      • if that helps more
      • bitmap
        is decoded_data an array reference? then you need to do $decoded_data->[0]
      • plaintext
        oh that might be the case
      • thanks bitmap, I'll try
      • yay, it works! I really need to learn perl properly :)
      • plaintext joined the channel
      • ijabz joined the channel
      • Mineo joined the channel
      • I have one more question if it's ok :)
      • $log_stat->data(Dumper($decoded_data->[0])); this produces this hash on the output:
      • { 'count' => '9', 'percent' => '0.900000', '_tc' => '1000', 'mbid' => '60f7d020-9580-47c5-8839-a4f25659687d' }
      • but this: $log_stat->data(Dumper(keys %{ $decoded_data->[0] } )); produces the single string 'count' for some reason
      • however when I try $decoded_data->[0]{'percent'} it works without a problem
      • why cant the keys function return all the keys in a list?
      • warp
        keys returns an array, not an array ref. is Dumper expecting an array ref perhaps?
      • plaintext
        I thought dumper would just output any variable
      • bitmap
        it does expect a reference iirc
      • warp
        oh, probably Dumper generates an array if given an array, and $log_stat->data() only uses the first argument.
      • plaintext
        That may be so
      • That's right, thanks warp
      • I was expecting Dumper to output the whole array like when it dumped $decoded_data
      • which is an array of hashes
      • warp
        plaintext: well, it does. it's just that $log_stat->data() isn't expecting that.
      • plaintext
        oh I get it
      • I think
      • warp
        plaintext: install Devel::REPL if you don't have it yet, it makes it easier to try these things.
      • plaintext
        is this sort-of like a shell for perl?
      • warp
        yes
      • plaintext
        cool, thanks
      • warp
        see the screenshot :)
      • plaintext
        yeah
      • that would be helpful
      • djce joined the channel
      • the_metalgamer joined the channel
      • ocharles
        happy birthday adhawkins-away !
      • kepstin joined the channel
      • lfranchi joined the channel
      • lfranchi joined the channel
      • CallerNo6 joined the channel
      • dak180 has left the channel
      • ijabz joined the channel
      • kepstin joined the channel
      • ijabz joined the channel
      • ruaok joined the channel
      • Leftmost joined the channel
      • vinay_ joined the channel
      • vinay_
        can anyone tell me if we can connect to the local musicbrainz database (which I have downloaded form the website ) using the APIs
      • kepstin joined the channel
      • navap
        vinay_: If you set up your own musicbrainz-server you'll have local access to the web service
      • 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
      • 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
      • 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
      • 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
      • vinay_
        Thanks Guys. I just found out this. Can I use this instead http://wiki.musicbrainz.org/Development/Search_...
      • ianmcorvidae
        that's a separate component entirely
      • 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
      • if you want the API, you'll need the perl server setup
      • vinay_
        Basically I want to use the APIs to extract information , but the APIs need a webservice .
      • Ok I will try the perl server setup
      • Thank You
      • ianmcorvidae
        you could also just set up the database, if you just want any old access to the data
      • but yeah, look into the perl server setup :)
      • vinay_
        And when I use the APIs musicbrains blocks us after some requests
      • ianmcorvidae
        there's a rate-limit, yes, one per second
      • nikkimini
      • vinay_
        I wrote programs to extarct data from the database but wanted to see if by using the APIs will it be any faster
      • 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.
      • ianmcorvidae
        kepstin: probably -- the only exceptions might be if he's getting heavy usage of the cache or of the search indexes
      • kepstin
        the current etags implementation on the api doesn't actually stop it from doing the db request on 'cached' requests...
      • unless there's some other caching in the server itself?
      • ianmcorvidae
        yeah, I don't mean etags, I mean object caching
      • kepstin
        I didn't think there was on the webservice, since invalidating such a cache on db updates is a problem.
      • 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
      • it's most effective for things like the list of languages though
      • kepstin
        I'm not familiar with that, though - and presumbly an application accessing the db directly could cache relevant stuff internally
      • ianmcorvidae
        yeah, it could
      • kepstin: https://github.com/metabrainz/musicbrainz-serve... includes the caching stuff for core entities (CoreEntityCache and EntityCacheBase, which the former inheritS)
      • kepstin: it just does _delete_from_cache after any update, delete, or merge (from perl)
      • but yeah, in general the database should be faster :)
      • vinay_
        I was just trying to see the performance but now I dont think its worth it :)
      • I will stick to the database then
      • Thanks Guys . I really apreciate it .
      • ijabz joined the channel
      • CallerNo6 joined the channel
      • plaintext joined the channel
      • plaintext
        Hello
      • Is it possible to do something like this in an entity?
      • isa => 'ArrayRef[ArrayRef[Str]]',
      • Because for some statistics I need to store a whole table of data
      • ianmcorvidae
        I think it should be possible, but I guess look at the Moose documentation to be sure
      • plaintext
        thanks
      • ianmcorvidae
        yeah, looks like you can
      • plaintext
        great! I'll try now
      • actually, I think I'll need ArrayRef[Map[...]],
      • but if I need a weird structure like this
      • there must be a better way to do it
      • ianmcorvidae
        hm
      • probably
      • I'm not sure what though
      • ianmcorvidae defers to ocharles/warp/moose docs :)
      • plaintext
        where can I find ocharles/warp docs? :P
      • ianmcorvidae
        haha
      • plaintext
        I think I'll ask for some advice on monday
      • ianmcorvidae
        yeah, that's likely when they're back
      • plaintext
        in the meantime I'll look into moose docs
      • but now I'm off to bed
      • ianmcorvidae
        cool
      • sleep well :)
      • plaintext
        thank you
      • bye!