[Catalyst] Adding Indexes To MySQL Database Tables in DBIC "result source" or "table classes"
I have a MySQL version 5 table named languagelist structured like this: create table languagelist ( lsigntypid varchar(260) NOT NULL, lstage varchar(260) NULL, lopcl varchar(260) NULL, lentdes varchar(260) NULL, lmajcat varchar(260) NULL, lfld varchar(260) NULL, lflsuh varchar(260) NULL, lflv varchar(260) NULL, lflvd varchar(260) NULL, lmemo1 text NULL, lremarks1 varchar(260) NULL, lremarks2 varchar(260) NULL, INDEX (lsigntypid) ) ENGINE = InnoDB; I (just now) created a DBIC "result source" or "table class" file for this, following the tutorial at http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7000/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod#Create_the_DBIC_%22Result_Source%22_Files : (start of table class code)--- package SignTypDB::LanguageList; use base qw/DBIx::Class/; # Load required DBIC stuff __PACKAGE__->load_components(qw/PK::Auto Core/); # Set the table name __PACKAGE__->table('languagelist'); # Set columns in table __PACKAGE__->add_columns(qw/lsigntypid lstage lopcl lentdes lmajcat lfld lflsuh lflv lflvd lmemo1 lremarks1 lremarks2/); --(end of table class code) -- I want to add an index to the table class code above. Following the example given here: --> http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Manual/Cookbook.pod#Adding_Indexes_And_Functions_To_Your_SQL I think I need to append the following code the the table class shown above: -(start of index sub) - sub sqlt_deploy_hook { my ($self, $sqlt_table) = @_; $sqlt_table->add_index(name => 'idx_name', fields => ['lsigntypid']); } -(end of index sub) - Does the above look correct? What does the 'name' above reference in this context? Is it just a name for the index? Should I change it from 'idx_name' to something else? Thanks Bob Cochran Greenbelt, Maryland, USA ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] UTF-16 surrogate message when writing binary data(image)
I've just been looking at this same problem as I see it occasionally in my logs. In my test case the warning occurs when writing plain HTML which I'm certain doesn't contain any UTF-16 surrogates. After some (too much!) poking around, I eventually realised that the reported surrogate is actually the size of the output (so in your example case, I'm guessing your output was DF98 == 57240 bytes). So that suggests to me that it's something to do with the FastCGI protocol header. However a cursory examination of the contents of the buffer passed to syswrite doesn't reveal this header to be present, and a quick look through the calling stack doesn't reveal any routine which might add it. The length of the buffer is, however, always the number which is later reported as a UTF-16 surrogate. So I conclude that the FastCGI protocol header is being put in place on a lower layer, out of my reach. All this neatly explains the previously opaque distribution of the warning in my logs (output size isn't often in the UTF-16 reserved range), and why it was so difficult for me to find a reliable, simple test case (every time I tried to simplify the test case to isolate the cause, the warning went away because the simplified case wasn't in the right size range). Unfortunately, it also tells me that I'm not going to be able to fix it on this particular attack - I've run out of time so I'm going to have to put it aside (again) until I can make another chance to investigate further. Hope all this helps - I look forward to someone else solving it for me ;) Merlyn Kline -Original Message- From: Martin Ellison [mailto:] Sent: 12 May 2008 10:05 To: The elegant MVC web framework Subject: Re: [Catalyst] UTF-16 surrogate message when writing binary data(image) The error is specifically at /usr/lib/perl/5.8/IO/Handle.pm line 199, which is the second syswrite call in sub syswrite { @_ >= 2 && @_ <= 4 or croak 'usage: $io->syswrite(BUF [, LEN [, OFFSET]])'; if (defined($_[2])) { syswrite($_[0], $_[1], $_[2], $_[3] || 0); } else { syswrite($_[0], $_[1]); } } The error is in production, so I am adding some trace code to investigate further, but results will need to wait until I have pushed the code. 2008/5/10 Matt S Trout <[EMAIL PROTECTED]>: On Fri, May 09, 2008 at 02:58:41PM +0800, Martin Ellison wrote: > If I write binary data (a JPEG) using $c->res->body then I get all these > errors > > stderr: UTF-16 surrogate 0xdf98 at /usr/lib/perl/5.8/IO/Handle.pm line 199. > > My code looks like > > $c->res->content_type(q{image/jpeg}); > $c->res->header( 'Content-Disposition', q{inline} ); > $c->res->body($pic_image); > > Presumably, something is assuming that the output is Unicode text and trying > to interpret it accordingly. These error messages are all over the log, > making it difficult to read, besides any impact the situation may be having > on the output. > > Is there any way to fix this issue (eg something like binmode)? My best guess here is that $pic_image is, or looks like, a file handle, and so when Catalyst is sending the response it's doing so by reading from the filehandle and the error's turning up during $fh->read. It'd of course be easier for you to confirm this, since you have the copy of IO/Handle.pm and the line number - maybe you could look? A good way to check would be to loop reading $pic_image yourself and see if you get the same warning ... -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- Regards, Martin ([EMAIL PROTECTED]) IT: http://methodsupport.com Personal: http://thereisnoend.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] Invalid session ids being generated
The problem is I was not able to duplicate this on our development or test servers. Only on production and unfortunately we don't have time right now to set up a duplicate site on production for debugging this issue. The code is the same, the only differences are we use a load balancer with 3 web servers and use mysql replication. If we can get caught up I may spend some more time on it. Ryan Pack Programmer Genares Worldwide Reservations P. 817-722-2834 F. 817-442-0600 -Original Message- From: Jonathan Rockway [mailto:[EMAIL PROTECTED] Sent: Saturday, May 10, 2008 8:39 PM To: The elegant MVC web framework Subject: Re: [Catalyst] Invalid session ids being generated * On Fri, May 09 2008, Hartmaier Alexander wrote: > Delete the session cache file! > I had a similar problem. > > -Alex > > > -Original Message- > From: Ryan Pack [mailto:[EMAIL PROTECTED] > Sent: Friday, May 09, 2008 1:03 AM > To: The elegant MVC web framework > Subject: RE: [Catalyst] Invalid session ids being generated > > I was able to fix it by downgrading Catalyst::Plugin::Session. We were > on 0.13 until I upgraded to .19 (latest) along with a bunch of other > Catalyst modules. Just as a last resort before I downgraded everything > back to the way it was I tried just downgrading > Catalyst::Plugin::Session and it worked! Woohoo! Both of these sound like fragile workarounds. If you guys can do a bit more digging, I would appreciate it. It would be good to actually fix the problems, after all. Regards, Jonathan Rockway -- print just => another => perl => hacker => if $,=$" ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] UTF-16 surrogate message when writing binary data (image)
The error is specifically at /usr/lib/perl/5.8/IO/Handle.pm line 199, which is the second syswrite call in sub syswrite { @_ >= 2 && @_ <= 4 or croak 'usage: $io->syswrite(BUF [, LEN [, OFFSET]])'; if (defined($_[2])) { syswrite($_[0], $_[1], $_[2], $_[3] || 0); } else { syswrite($_[0], $_[1]); } } The error is in production, so I am adding some trace code to investigate further, but results will need to wait until I have pushed the code. 2008/5/10 Matt S Trout <[EMAIL PROTECTED]>: > On Fri, May 09, 2008 at 02:58:41PM +0800, Martin Ellison wrote: > > If I write binary data (a JPEG) using $c->res->body then I get all these > > errors > > > > stderr: UTF-16 surrogate 0xdf98 at /usr/lib/perl/5.8/IO/Handle.pm line > 199. > > > > My code looks like > > > > $c->res->content_type(q{image/jpeg}); > > $c->res->header( 'Content-Disposition', q{inline} ); > > $c->res->body($pic_image); > > > > Presumably, something is assuming that the output is Unicode text and > trying > > to interpret it accordingly. These error messages are all over the log, > > making it difficult to read, besides any impact the situation may be > having > > on the output. > > > > Is there any way to fix this issue (eg something like binmode)? > > My best guess here is that $pic_image is, or looks like, a file handle, > and so when Catalyst is sending the response it's doing so by reading > from the filehandle and the error's turning up during $fh->read. > > It'd of course be easier for you to confirm this, since you have the > copy of IO/Handle.pm and the line number - maybe you could look? > > A good way to check would be to loop reading $pic_image yourself and > see if you get the same warning ... > > -- > Matt S Trout Need help with your Catalyst or DBIx::Class > project? > Technical Director > http://www.shadowcat.co.uk/catalyst/ > Shadowcat Systems Ltd. Want a managed development or deployment > platform? > http://chainsawblues.vox.com/ > http://www.shadowcat.co.uk/servers/ > > ___ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ > -- Regards, Martin ([EMAIL PROTECTED]) IT: http://methodsupport.com Personal: http://thereisnoend.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Suggestions for CatalystX::Installer
All of those modules and the suggestions look like they will be really helpful, thanks for the input Jonathan and Kieren. >I still want support for GetOpt:: modules as well so that we can do all this >from the comand line. Sounds good, the GetOpt:: modules should make command line arguments rather trivial. >The opportunity here is for the whole thing to be done wrong first time round >so we know what to do for the >subsequent iteration. This is a technique that >is proven to work in technology development many times over [2]. I guess I will be back here next year to fix my mistakes then. On Mon, May 12, 2008 at 1:59 AM, Kieren Diment <[EMAIL PROTECTED]> wrote: > > On 12 May 2008, at 13:44, Jonathan Rockway wrote: > >> >> Module::ScanDeps >> > > needs some configuration || filtering to make sense of it, and warn if > Makefile.PL looks wrong > >> "make catalyst_par" > > and improve the documentation here > >> >> "make installdeps" >> >> DBICx::Deploy >> >> "make test" >> > > Provide some standard configuration for DBIx::Class models, and > Catalyst::Model::File models so we get a sense of what's required for > Catalyst::Model::Whatever to support catalystx::installer. I think that > View:: logic is probably ususally hard coded into the app, but i could be > wrong. > > Catalyst::Controller::REST for the CRUD stuff required (maybe) - remember > this originates in a (rejected[1]) google summer of code application, so we > need to provide learning opportunities as well as a final result. > > i still want support for GetOpt:: modules as well so that we can do all this > from the comand line. > > The opportunity here is for the whole thing to be done wrong first time > round so we know what to do for the subsequent iteration. This is a > technique that is proven to work in technology development many times over > [2]. > > [1] Rejected because google is a python shop and so the perl foundation > didn't get enough slots, and the enlightened perl organisation application > was rejected this time round > > [2] Although unix looks like it doesn't conform to this, it was the > licencing that unix got wrong mostly. > > ___ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ > ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Suggestions for CatalystX::Installer
On 12 May 2008, at 13:44, Jonathan Rockway wrote: Module::ScanDeps needs some configuration || filtering to make sense of it, and warn if Makefile.PL looks wrong "make catalyst_par" and improve the documentation here "make installdeps" DBICx::Deploy "make test" Provide some standard configuration for DBIx::Class models, and Catalyst::Model::File models so we get a sense of what's required for Catalyst::Model::Whatever to support catalystx::installer. I think that View:: logic is probably ususally hard coded into the app, but i could be wrong. Catalyst::Controller::REST for the CRUD stuff required (maybe) - remember this originates in a (rejected[1]) google summer of code application, so we need to provide learning opportunities as well as a final result. i still want support for GetOpt:: modules as well so that we can do all this from the comand line. The opportunity here is for the whole thing to be done wrong first time round so we know what to do for the subsequent iteration. This is a technique that is proven to work in technology development many times over [2]. [1] Rejected because google is a python shop and so the perl foundation didn't get enough slots, and the enlightened perl organisation application was rejected this time round [2] Although unix looks like it doesn't conform to this, it was the licencing that unix got wrong mostly. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/