RE: [Catalyst] C::P::Authentication IE Problem - Time Issue

2007-08-27 Thread Peter Edwards

>I was experiencing a weird annoyance with C::P::Authentication today.  I 
>saw reports of similar symptoms in the list, but nobody with my 
>particular solution.  In Firefox everything was working fine, but in all 
>the IE browsers auth cookies weren't being stored.  Eventually I grabbed 
>a HTTP Session inspector to see how the cookies were being set.  The 
>expire time on the cookies was sent as GMT several hours in the past.  

What I've done before is send the server time as part of the login screen
and use some Javascript to warn if the server time is more than a set time
away from the client PC time. Sometimes it's server time drift, sometimes
client PC time drift. It's annoying that IE simply drops a historic cookie
without warning and then you think the user is typing the password wrong.

>As a side note, is there a way to control the session length of the 
>authentication cookie?
In your conf set: cookie_expires 
http://search.cpan.org/author/NUFFIN/Catalyst-Plugin-Session-State-Cookie-0.
07/lib/Catalyst/Plugin/Session/State/Cookie.pm
You can set session expiry with conf: expires
http://search.cpan.org/~nuffin/Catalyst-Plugin-Session-0.18/lib/Catalyst/Plu
gin/Session.pm
You also need to extend an expiring cookie by calling session_expires()
somewhere (e.g. in auto :Private in your main controller) to resend it
otherwise by default it times out after 2 hours.

Regards, Peter




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] CMS

2007-08-27 Thread Peter Edwards
That would be good. I went through this exercise a while ago and ended up
using CMS Made Simple (a PHP app) because it was easy for end users to
understand and there were a lot of plugins you could auto-install. Plus I
only had 2 weeks to develop a system. I found Bricolage too complex and
powerful to use for a simple CMS system.

CMSMS wouldn't be a bad place to start from, doing a straight rewrite. I
think a lot of the difficulty is in the design issues for stylesheets,
templates, cross-browser Javascript and how they fit together with code
plugins.

 

Regards, Peter

Dragonstaff Limited  http://www.dragonstaff.com
   Business IT Consultancy 

  _  

For while I've been thinking it would be nice to have a Cat-based CMS with
multiple features built on top of a platform. The platform can include basic
things like Authn, Authz, Sessions, a basic user schema and pre-built HTML.
The pre-built HTML can include controllers/templates/etc for registration,
login/logout, openid, etc. Then on top of the platform you can have
plug-and-play features like forums, blogs, photo galleries, surveys etc. If
it was built the right way, you could have your choice of forums, etc. You
can also only load the features that you want. I'm not sure how easy this
would be to do but I think it would be neat. 



-- 
John Wang
http://www.dev411.com/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Test server as a child process

2007-07-31 Thread Peter Edwards
Try using IPC::Run. I can see the "You can connect" message when using it to
run scripts/myapp_server.pl (I guess it goes through ptys?)

Regards, Peter

-Original Message-
From: Ivan Fomichev [mailto:[EMAIL PROTECTED] 
Sent: 31 July 2007 09:34
To: catalyst@lists.rawmode.org
Subject: [Catalyst] Test server as a child process

Hello,

I intend to write a script, that would start the test server as a
child process and then run tests. The thing I'm failing to do is to
get output from the test server in order to determine, when the server
has started.

The problem is that test server doesn't print its prompt ("You can
connect to your server at http://localhost:3000";) when run as a child
process :-(

I dug Catalyst's sources, but didn't understood much. I put 'sleep' in
parent process for now, but I don't like it. Could anyone suggest an
adequate work-around? Thank you in advance.



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Catalyst Newbie -> Installation/Quickstart Issues ->Vista

2007-07-26 Thread Peter Edwards
This issue is discussed here
http://www.gossamer-threads.com/lists/catalyst/users/15143?search_string=str
ftime;

and is caused by a bug in ASPerl. Try patching Helper.pm as follows and see
if it works then.

Regards, Peter

 

> For the sake of saving the next soul who wants to use Catalyst under
Win32, 
> which apparently doesn't like %T, suggest changing to: 
> 
> my $time = strftime('%Y-%m-%d %H:%M:%S', localtime time); 
> 
> 
> 
> --- Helper.pm Wed Jul 11 03:24:55 2007 
> +++ Helper.pm.orig Mon Oct 30 18:00:42 2006 
> @@ -387,7 +387,7 @@ 
> sub _mk_changes { 
> my $self = shift; 
> my $dir = $self->{dir}; 
> - my $time = strftime('%Y-%m-%d %H:%M:%S', localtime time); 
> + my $time = strftime('%Y-%m-%d %T', localtime time); 
> $self->render_file( 'changes', "$dir\/Changes", { time => $time } ); 
> } 
> 

  _  

From: Jamie Nicholson [mailto:[EMAIL PROTECTED] 
Sent: 26 July 2007 22:53
To: catalyst@lists.rawmode.org
Subject: [Catalyst] Catalyst Newbie -> Installation/Quickstart Issues
->Vista

 

Hi,

I'm trying to install Catalyst on a new laptop which is running Vista,
Activestate - v5.8.8 - build [820].

After installing the catalyst-devel via ppm I've tried to run the 'perl
catalyst.pl MyApp' command but it just seems to hang, unless that's what
it's meant to do. 

>perl catalyst.pl MyApp

Output

created "MyApp"
created "MyApp\script"
created "MyApp\lib"
created "MyApp\root"
created "MyApp\root\static" 
created "MyApp\root\static\images"
created "MyApp\t"
created "MyApp\lib\MyApp"
created "MyApp\lib\MyApp\Model"
created "MyApp\lib\MyApp\View"
created "MyApp\lib\MyApp\Controller" 
created "MyApp\myapp.yml"
created "MyApp\lib\MyApp.pm"
created "MyApp\lib\MyApp\Controller\Root.pm"
created "MyApp/README"

I figured this must of been the way I installed it so I've tried several
different web links, via ppm everything installs ok, but the example above
just hangs or I can't get to the end of the maze so to speak. 

Links I've tried

http://lists.rawmode.org/pipermail/catalyst/2005-April/000119.html - was
close on this one, using the hops db 
http://catalyst.infogami.com/install/windows - couldn't get the quickstart
going
http://www.shadowcatsystems.co.uk/static/cat-install - balked on the command
line length, so i installed cygwin and it complained as well

Extra PPM Repositories used

trouchelle.com
theoryx5.uwinnipeg.ca

Thats about it, any help, hints or tips would be appreciated.  I'm thinking
a new OS is probably the best place to start :)

Thanks

Jamie

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Re: Announce: Catalyst::Plugin::Authentication 0.10000 Released

2007-07-26 Thread Peter Edwards
>Just an announcement that the new Authentication plugin is finally 
>released! It is available here:
>
>Also - thanks in advance to all the folks who are about to update and 
>will soon send their bug reports and feature requests now that it's 
>out in the wild as a release. 
>
>Cheers! 
>
>JayK

I upgraded an app to use this today, authenticating with crypted Unix type
password and using the new DBIx::Class storage module. It was easy to
understand the documentation and was a smooth change.
I like being able to auth against different realms so I could do some from
Unix /etc/passwd and some from LDAP/Active Directory Server.

Regards, Peter
Dragonstaff Limited  http://www.dragonstaff.com  Business IT Consultancy 



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Catalyst Newbie -> Installation/Quickstart Issues ->Vista

2007-07-26 Thread Peter Edwards
Regards, Peter

Dragonstaff Limited   
http://www.dragonstaff.com  Business IT Consultancy
Technology House, 151 Silbury Boulevard, Central Milton Keynes, Bucks MK9
1LH, UK

Skype:   Peter.Edwards  Tel/Fax: 0845 0537418
Direct: 01908 424400  Mob: 07986 842718

 

  _  

From: Jamie Nicholson [mailto:[EMAIL PROTECTED] 
Sent: 26 July 2007 22:53
To: catalyst@lists.rawmode.org
Subject: [Catalyst] Catalyst Newbie -> Installation/Quickstart Issues
->Vista

 

Hi,

I'm trying to install Catalyst on a new laptop which is running Vista,
Activestate - v5.8.8 - build [820].

After installing the catalyst-devel via ppm I've tried to run the 'perl
catalyst.pl MyApp' command but it just seems to hang, unless that's what
it's meant to do. 

>perl catalyst.pl MyApp

Output

created "MyApp"
created "MyApp\script"
created "MyApp\lib"
created "MyApp\root"
created "MyApp\root\static" 
created "MyApp\root\static\images"
created "MyApp\t"
created "MyApp\lib\MyApp"
created "MyApp\lib\MyApp\Model"
created "MyApp\lib\MyApp\View"
created "MyApp\lib\MyApp\Controller" 
created "MyApp\myapp.yml"
created "MyApp\lib\MyApp.pm"
created "MyApp\lib\MyApp\Controller\Root.pm"
created "MyApp/README"

I figured this must of been the way I installed it so I've tried several
different web links, via ppm everything installs ok, but the example above
just hangs or I can't get to the end of the maze so to speak. 

Links I've tried

http://lists.rawmode.org/pipermail/catalyst/2005-April/000119.html - was
close on this one, using the hops db 
http://catalyst.infogami.com/install/windows - couldn't get the quickstart
going
http://www.shadowcatsystems.co.uk/static/cat-install - balked on the command
line length, so i installed cygwin and it complained as well

Extra PPM Repositories used

trouchelle.com
theoryx5.uwinnipeg.ca

Thats about it, any help, hints or tips would be appreciated.  I'm thinking
a new OS is probably the best place to start :)

Thanks

Jamie

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Catalyst::Helper passes %T to POSIX::strftime - causesinfinite loop under Win32

2007-07-18 Thread Peter Edwards
>> 12:32:48PM -0400, bits wrote:
>> Catalyst::Helper::_mk_changes calls POSIX::strftime on line 390:
>> my $time = strftime('%Y-%m-%d %T', localtime time);
>> 
>> the %T parameter causes my Activestate Perl 5.8.8 820 to infinite loop.  

I'm using AS Perl 5.8.8 817 and POSIX::strftime %T is broken in that.

strftime("%Y-%m-%d %T", localtime time)
gives '2007-07-18 ', empty string in place of %T

strftime("%T", localtime time)
hangs

bits, I suggest you raise a bug with AS.

Regards, Peter
Dragonstaff Limited  http://www.dragonstaff.com  Business IT Consultancy ---




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] [ANNOUNCE] Grokbase - Catalyst-based mailinglistarchive

2007-05-28 Thread Peter Edwards
Hi John, that was using a copy I'd downloaded to browse locally.

I tried again and http://www.dev411.com/slides/webappdesign.xul works fine
off the web.

Regards, Peter

 

  _  

From: John Wang [mailto:[EMAIL PROTECTED] 
Sent: 28 May 2007 18:55
To: The elegant MVC web framework
Subject: Re: [Catalyst] [ANNOUNCE] Grokbase - Catalyst-based
mailinglistarchive

 

On 5/28/07, Peter Edwards <[EMAIL PROTECTED]> wrote:

I tried opening the slides in Firefox and saw nothing?

If you move your cursor to the top of the window does the Firefox slide show
bar appear? Are you able to view other XUL slides? 

Also, what version of Firefox are you using? It works for me on 2.0.0.3 and
1.5x.



-- 
John Wang
http://www.dev411.com/blog/  <http://www.dev411.com/blog/> 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] [ANNOUNCE] Grokbase - Catalyst-based mailing listarchive

2007-05-28 Thread Peter Edwards
I liked the site, cool stuff and love to see the source. I tried opening the
slides in Firefox and saw nothing?

 

 

 

  _  

From: John Wang [mailto:[EMAIL PROTECTED] 
Sent: 28 May 2007 18:00
To: The elegant MVC web framework
Subject: Re: [Catalyst] [ANNOUNCE] Grokbase - Catalyst-based mailing
listarchive

 

On 5/28/07, Gavin Henry <[EMAIL PROTECTED]> wrote:

Very nice, and definitely a Google App feel to it. I can see dojo etc.
there too.

It's fast and I like the red Loading... message, just like google.


Thanks Gavin. I'm glad you like it and that it's snappy for you. Keeping the
performance acceptable was a big design objective. 

 

Is this a closed app?


It is closed for now but that may (or may not) change in the future. There
are a number of reasons why it may be pre-mature to open. I think it would
be more beneficial to start opening some of the underlying libraries and
adding functionality to some existing Perl modules, both of which would be
of more general use. Also, a number of architecture / design departures were
made from standard practices so some discussion and proving is needed. A
while back I put together the following slides about what I learned from
building this project so far. I'd like to see if the ideas in there are
generally useful and if / how they could work with a higher layer of
abstraction, e.g. Reaction, which would also provide more broad ranging
benefits.

http://www.dev411.com/slides/webappdesign.xul 

It would be great to hear what people thought about the slides as well.


-- 
John Wang
http://www.dev411.com/blog/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Encrypt /Decrypt URI

2007-05-19 Thread Peter Edwards
There are several layers of security:

1. Authentication. Login screen and cookie with domain scope gives trusted
user id. Make the login screen SSL even if the rest of the app is plain
HTTP, if you're concerned about protecting user passwords. You could
generate a one time token per transaction if you're really paranoid and have
a single-window application.

2. Application permission. Based on the user id, some concept of which of
the following the user can access
- applications (base controller perm check)
- transactions by application (controller perm check)
- data sets by application (model perm check)
Throw an exception if the user tries to access something they shouldn't. 
Write Test::WWW::Mech / Selenium tests to verify the full range of access
checks, run a smoke test daily and a release test.

3. Exploit attacks. Re-ask for password on critical screens. Be really
careful about escaping form fields and anything that gets passed in as an
SQL argument. Read up on Perl tainting.

The biggest security threat is actually insider fraud, so try and design a
system that you would struggle to break yourself, with checks and balances
including a write-only audit trail. If you are serious about security, pay a
security consultancy to audit your code and site. 
Hashing the URL will make life hard for you as a developer and won't
necessarily stop black hats.

Regards, Peter
Dragonstaff Limited  http://www.dragonstaff.com  Business IT Consultancy


-Original Message-
From: Harshal Shah [mailto:[EMAIL PROTECTED] 
Sent: 19 May 2007 04:39
To: The elegant MVC web framework
Subject: Re: [Catalyst] Encrypt /Decrypt URI

> Ya, exactly.  /item/3 isn't really the request -- it's  guess md5 session> plus /item/3.  Does adding a *second* md5 hash do
> much more good?
>

well ..session id would authorize user to use the application . we
would need additional query to determine if "/item/3/view" is
accessible to user. something like "item.userid = $c->user->userid" in
your query would serve the purpose.

I was trying to avoid the query as far as possible by  obfuscating
URLs ..if user goes through this check ..u need to have a similar
query to do actual authorization.


-- 
Harshal Shah



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] MySQL server has gone away

2007-04-28 Thread Peter Edwards
I've seen this problem under Red Hat Enterprise Linux 4 and Mysql 3.23 and
suspect it was down to incorrect configuration of full/half duplex on the
Network Interface Card against the router, possibly combined with a Linux
Ethernet driver bug. Some useful pointers here
http://dev.mysql.com/doc/refman/5.0/en/communication-errors.html
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

We put in code to wrap the DBI calls, detect the error and re-run the
transactions in that case. You can detect it with $sth->execute() fails and
$sth->errstr() =~ m/gone away/i

For lookups we use tie() through a locking wrapper to DB_File, generating
the DBM databases from master data in the database.

Regards, Peter
Dragonstaff Limited  http://www.dragonstaff.com 

> Oleg Pronin wrote:
> > One can say that it is a very rare situation. I can tell you that in
> > production environment (about 1.000.000 hits per day) it happens
> every
> > day several times. Some users just see an error, some lost their
> data.
> > This is just not always visible to you.
> The OP may find a requirement to incorporate a transaction model
> (explicit start txn/commit/rollback) to solve this problem in MySQL;
> which is what they'd have to do for Oracle or Postgres or Rdb. I'd
> hope
> that MySQL reports a transaction failure when the database connection
> evaporates. This would allow a retry on the failed transaction.
> However,
> it may be that the Catalyst Controller / View design/implementation is
> only what would ordinarily be flat file accesses that use SQL
> instead of
> keyed-access flat files. If that's the case, wrapping a transaction
> around each of these SQL prepare/execute pairs will be a substantial
> performance hit.



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] CC::FormBuilder woes

2007-04-27 Thread Peter Edwards
If fields is a list reference you need something like

[% form.fields.0.label %]

http://www.template-toolkit.org/docs/aqua/Manual/Variables.html#Hash_Array_R
eferences

Regards, Peter
Dragonstaff Limited  http://www.dragonstaff.com

-Original Message-
From: RA Jones [mailto:[EMAIL PROTECTED] 
Sent: 27 April 2007 13:47
To: catalyst@lists.rawmode.org
Subject: [Catalyst] CC::FormBuilder woes

Apologies if this not the right forum for this (but if not, where else 
?). According to the FormBuilder docs, the following code in my template 
should (and does) work:

[% FOREACH field IN form.fields %]
[% field.label %]
[% field.field%]
[% END %]

But so should this (and doesn't):
[% form.field.location.label %]
[% form.field.location.field%]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Re: memory usage of mod_perl process

2007-02-10 Thread Peter Edwards
Jeffrey Ng wrote:
>so are you saying in general catalyst is pretty heavy, and its not for site
with many concurrent users?... 

No, not at all. It all depends on what your application does, how many web
screens, how many peak concurrent users and equivalent requests/second, how
many discrete users, how many data feeds in/out, data volumes, network
transfer volumes.

Your limiting factor might be CPU, database I/O or network bandwidth.

Different architectural models are best for different cases.

 

There is a cost equation between using a powerful framework that increases
robustness, maintainability and speed of development versus how many servers
you need.

Say a server costs you $100 per month to rent and each Catalyst server maxes
at 30 requests per second but you get a peak load of 90 reqs/sec. You would
need to load balance your app across 3 servers. There would be an initial
configuration cost and then you'd be paying $200 p.m. = $2400 p.a. more for
the two extra servers.

Let's say a developer, including overhead, costs you $1000 per day. If you
move away from Catalyst to a lighter framework and it costs you more than
2.5 developer days extra then you're losing money. Catalyst has a lot of
tried and tested pluggable modules and if you end up re-writing any of those
you're almost certainly spending money.

 

>what other light weight approach would you go for?

First thing, set up proper caching (either Squid or a lightweight Apache)
and use a tool like Fiddler to examine the HTTP request Cache headers to
make sure it's working properly. That's a huge saving.

Then do profiling and benchmarking to determine exactly what the bottlenecks
are before making any changes.

If you're doing a lot of dynamic Ajax stuff with complex SQL, there might be
a case for hand-tuning that part of the app. Look at whether you can
pre-calculate and cache expensive queries or change the app design to allow
this. If necessary, you could write a separate lightweight app to serve
those requests.

 

I didn't find a suitable lightweight mod_perl framework so wrote one using
CGI::Session, DBIx::Class, Template toolkit. It's not that difficult.

If you would like some details please feel free to email off-list or call
me. However, that was an atypical case and as soon as you start needing
internationalization, RSS feeds etc. I think you're better off with
Catalyst.

 

You said you need to serve JS from the same server as the heavyweight app.
Assuming the JS pages are static or can be precalculated and stored in a
static dir, and you have the JS below /js and your app below /app in the URI
namespace:

On the same server run two Apaches (or one Apache + one Fastcgi)

1) Lightweight proxy. Build it yourself from source, turn off all
unnecessary options and shared libraries except mod_proxy/mod_rewrite.

Use rewrite rules to proxy /app/. on to heavy server, e.g. based on an
Apache 1 setup I have that's live:

RewriteEngine On

RewriteRule^/app/(.*$)   http://localhost:2000/app/$1  [P]

ProxyPassReverse   /   http://localhost:2000/

RewriteRule^proxy:.*  -  [F]

The /js and /images get served by the proxy server (which has a <1MB memory
footprint per child)

2) Heavy mod_perl server listening at localhost:2000. Maps /app on to your
handler (40-100MB memory per child).

 

Say you had to handle the Ajax part separately. With this model you can add
another proxy entry that routes, say, /ajax/ on to another Apache server on
the same host (e.g. localhost:2001) or on another host altogether (e.g.
http://ajax1.zorpia.com <http://ajax1.zorpia.com/> ). If you need to scale
more, use DNS round robin to a set of front end proxies like this and route
requests to a farm of backend servers using a shared database server.

 

I'd be surprised if you couldn't get decent performance out of a
well-designed Catalyst app. There are businesses listed on the Catalyst
pages that offer consultancy help if you need further pointers. As a
business I used Shadowcat Systems last year and received good technical
design advice.

 

Regards,

Peter Edwards

www.dragonstaff.com <http://www.dragonstaff.com/>  ~ Business IT Consultancy

 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Re: memory usage of mod_perl process

2007-02-09 Thread Peter Edwards
>Are you hitting the database very hard?  Complex joins?  Are your pages
very complex?
No, it's a fairly simple backend processor that mostly handles XML
transactions for a Flash frontend. There are some XHTML admin pages
generated with Template::Toolkit (and so are slower) but they are rarely
hit.

For the database a typical run hits a session table, user table, writes a
log table and reads data from a couple of other tables. No complex joins.
The app handles user registration, some league tables, polls, competition
entries and users submitting images that are approved and shown on the site.

In this case I knew there was the potential for a huge number of users so
went for a lightweight approach that could easily be tuned further. For a
more complex app with fewer peak users I'd have used Catalyst.

Regards, Peter
www.dragonstaff.com 



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Re: memory usage of mod_perl process

2007-02-08 Thread Peter Edwards
There are a lot of good tuning tips in the Apache docs, as Perrin says.

I presume you've tried things like using a lightweight front end proxy (to
serve images/static files) and building a custom backend mod_perl Apache
that includes *only* the modules you need. If you use the stock
Fedora/Redhat Apache that's not optimal.
In your Apache config preload everything pre-fork (if you use that model)
including setting up the DB connection. Write code that caches expensive
calculated values/lookup files/SQL values in memory with a cheap
last-modified check before re-doing work.
Don't set MaxRequestsPerChild too high (I use 100) as the mem usage will
climb as Perl switches some shared memory variables to new memory, as the
Apache mod_perl docs describe.

For comparison, I'm using DBIx::Class across 15 tables and a really simple
hand-rolled MVC (not Cat) for a medium volume site. It gives 'top' lines
like:
  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
21495 apache15   0  203m  43m 6188 S  0.0  4.5   0:01.46 httpd
This can handle over 300 requests/sec with 1GB memory on an x86_64 single
processor.

Regards, Peter
www.dragonstaff.com



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Difference in running application via "perl -d"vscommand line

2007-02-06 Thread Peter Edwards
As I recall there was a posting on the ActiveState support forum but AS
claimed it was a problem in DBI... I think they're wrong as a simple
recompilation fixes it.

Regards, Peter

-Original Message-
From: Lampert, Hugh [mailto:[EMAIL PROTECTED] 
Sent: 06 February 2007 16:41
To: The elegant MVC web framework
Cc: Peter Edwards
Subject: RE: [Catalyst] Difference in running application via "perl
-d"vscommand line

Thanks, I force installed the DBI module from CPAN and that has eliminated
the error.

Is there something easy that I can do (like tell ActiveState something
specific about their version of DBI), that would make their PPM version stop
doing this? 



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


RE: [Catalyst] Difference in running application via "perl -d" vscommand line

2007-02-05 Thread Peter Edwards
I had the same problem.
It is caused by the PPM version of DBI.
Recompile DBI using GCC (from Makefile.PL) and it goes away.
(Thanks to Matt Trout for pointing this out to me)

Regards, Peter
http://www.dragonstaff.com 

>I'm not asking anyone to solve this for me, just point me in the right
>direction as to what I should check.  I'm thinking there's some problem
>with the model mechanics when the app runs from the command line
>(DBD::ADO or the Catalyst DBIC model modules).

U:\LBBWCompliance\LBBWCompliance>script\lbbwcompliance_server.pl
Attempt to free unreferenced scalar: SV 0x9a90e30, Perl interpreter:
0x2245bc at
 C:/Perl/site/lib/DBD/ADO/TypeInfo.pm line 454.



 C:/Perl/site/lib/DBD/ADO.pm line 326.
Attempt to free unreferenced scalar: SV 0x9a8c5d0, Perl interpreter:
0x2245bc at
 C:/Perl/site/lib/DBIx/Class/ResultSource.pm line 194.



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


OT: [Catalyst] creating binaries

2007-01-17 Thread Peter Edwards
>Can you tell me how to find the source code from a perlapp program?
>Everyone says that it is very simple, but nobody was able to do it.

The answer is in the manual
http://perldoc.perl.org/perlfaq3.html#How-can-I-hide-the-source-for-my-Perl-
program%3f

Perlmonks is a better place for these kind of questions
http://www.perlmonks.org/index.pl?node_id=243011

I'm still not really sure what you're trying to achieve as you haven't
really said what your app will do. There are several approaches to consider:

1) Use a remote server to host part of the application and talk to it from a
front end via SOAP and XML-RPC. That's a lot easier than it sounds provided
your users have net access http://search.cpan.org/~rjray/RPC-XML-0.59/.

2) Write part of your app in VB or C# and supply a DLL wrapped in
copy-protection. It will still be possible to crack but a lot more difficult
than trying to hide perl. Bear in mind if your software is popular enough it
only takes one person to crack it and list it on astalavista
http://www.google.co.uk/search?hl=en&q=software+wrapper+copy+protection&btnG
=Google+Search&meta=

3) Go the Open Source route. My customers have started going this way. Why?
A lot cheaper. Cost of developing software is 50% testing and if you use
popular Open Source or sponsor its development you get a lot of free testing
and quicker time to stable software. 

Regards, Peter



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] creating binaries

2007-01-16 Thread Peter Edwards
>If a language is interpreted, this doesn't mean that the programs that were
>made with it cannot be protected in any way.
It will be fairly easy to crack installed Perl software.

>Or, is there another way of protecting the code from a Catalyst app?
Offer an Application Service Provider model. I.e. run a hosted service on a
server you control and provide access to HTTP or SOAP XML-RPC web services.

Regards, Peter



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Catalyst vs Rails vs Django Cook off

2007-01-15 Thread Peter Edwards
For businesses the cost-to-develop and cost-to-maintain are usually more
important than handler performance. 
The reason is that in most medium-large transactional web systems the
bottleneck is the database and not the framework.
A 10-100x slowdown in using an ORM or your framework of choice doesn't make
much difference in terms of end user perceived speed (assuming you serve
static content from a lightweight proxy web server). It does save a lot of
money in cost-to-maintain.

Sure there is a place for optimised libraries and so on, but it's only worth
optimising bottlenecks and the handler usually isn't one.
I recently had to hand-write a TCP/IP server in Perl using POE to handle one
particularly heavy case but most situations are easily dealt with by Apache
mod_perl or FastCGI, in fact running Perl in CGI mode is often adequate.

More important questions to me about frameworks are how:
- easy to learn
- quick to develop
- flexible
- comprehensive in terms of supporting infrastructure (templates,
components)
- easy/expensive to recruit staff
- easy to integrate with other systems

Realistic approaches include
.NET
J2EE
Catalyst, Jifty
RoR

They all have strengths/weaknesses.
For example, you'll get a Jifty or RoR app up quickly if you do it the
standard way. If you want to build a bigger system that doesn't quite fit
their model you're probably better off with Catalyst or another framework.
I did one large system with Catalyst last year and it was great for that.
I did a smaller system just before Christmas and wrote my own simple MVC
framework for convenience.
It's a question of choosing the right tool for the job.

Regards,
Peter Edwards
www.dragonstaff.com  Business IT Consultancy
-Original Message-
From: Hermida, Leandro [mailto:[EMAIL PROTECTED] 
Sent: 15 January 2007 09:30
To: The elegant MVC web framework
Subject: RE: [Catalyst] Catalyst vs Rails vs Django Cook off


> From: Carl Johnstone [mailto:[EMAIL PROTECTED] 
> Sent: Monday, January 15, 2007 10:21
> To: catalyst@lists.rawmode.org
> Subject: Re: [Catalyst] Catalyst vs Rails vs Django Cook off
> 
> 
> > Is it true that Catalyst is so slow comparing with other frameworks?
> 
> Does it matter?
> 
> If speed is so important, you should write your own custom 
> httpd that does exactly what you need in assembly language.
> 
> Carl

Speed does matter and I believe the original thread question is a valid
one.  Not everyone has the time or the know-how to do wheel reinvention
and write custom daemons (I know I don't).  That's why people write
kernels and libraries and abstraction of lower level things so that
others can build things on top.  Otherwise we would never get anything
done.





___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Basic Tutorial & Version Conversion

2006-10-11 Thread Peter Edwards








Looks like you’ve got white space before
the “=head1”.

POD commands like that need to start at
the beginning of a line.

 

Regards, Peter









From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Wong
Sent: 11 October 2006 16:07
To: catalyst@lists.rawmode.org
Subject: [Catalyst] Basic Tutorial
& Version Conversion



 

Hi,

I read through the tutorial and starting to create an test app, following
instructions in the first lesson: Catalyst::Manual::Tutorial::CatalystBasics.
Everything went well untill the last step, launch the app. I got this error,
and don't understand. So I hope someone would teach me on this:

-
Couldn't instantiate component "MyApp::Model::MyAppDB", "Cannot
load schema class 'MyAppDB': syntax error at
/home/kevin/MyApp/script//../lib/MyAppDB.pm line 3, near "="
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.5/Catalyst/Model/DBIC/Schema.pm
line 272.
 at script/myapp_server.pl line 53" at script/myapp_server.pl line 53
Compilation failed in require at script/myapp_server.pl line 53.


and this is my MyAppDB.pm
---
    package MyAppDB;
    
    =head1 NAME 
    
    MyAppDB - DBIC Schema Class
    
    =cut
    
    use base qw/DBIx::Class::Schema/;
.

One more question that I would like to ask is: I have to take over a Catalyst
project developed with Catalyst 5.33  using scaffolding technique. Is
there anyway that I can use the old app on a new server with new version of
Catalyst? Or anyway that I could convert the old app? I've checked the achive
list, there are very helpful hints and guidelines, but could not find a confirmation
and a specific guide on how to. 
Thank you for your help, and sorry if I ask the same old question.

Kevin

  







Stay in the know. Pulse on the new Yahoo.com. Check it
out. 






___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] problem deploying with apache: templates not found

2006-10-11 Thread Peter Edwards

>> Have you tried doing "warn posedb->path_to( 'root' )" ?
>/home/marcl/catalyst/posedb/root

>Still 'Coldn't render template "file error - search.tt2: not found'
>though, while it resides in
>/home/marcl/catalyst/posedb/root/src/search.tt2
 
Shouldn't that be /home/marcl/catalyst/posedb/root/search.tt2

Also the dump before referred to a different path with myapp not posedb
   dirs => ["", "home", "marcl", "catalyst", "myapp", "root"],

Regards, Peter


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] The old double-post issue

2006-09-21 Thread Peter Edwards
I use javascript to 
- disable the form at the start of the page
- enable it at the end of the page as it finishes loading
- disable again after submitting
- re-enable clicks in the error screen if a handler fails
also to check document.readyState == 'complete' in button and link handlers.

That stops a click on a part-loaded page before all the js and form elements
are set up. It also catches a double click on a submit or a click on a
submit followed accidentally by one on another hyperlink nearby. But since
the user is heavily protected that's rare unless the js has bombed, in which
case it's good that they can still get out with an ESC or right click
(assuming they know they can do that or your manual tells them so).
It's quite easy to get multiple submits from js if you're messing around
with form.target, form.action etc. in event handlers.

function clickhandler(e) { return false; }

function disableClick()
  {
  if (isNetscape4plus())
{
top.window.captureEvents(Event.CLICK);
top.window.onclick = clickhandler;
}
  else if (isIE5plus())
{
top.window.document.body.setCapture();
top.window.document.body.style.cursor = "wait";
}
  }

function enableClick()
  {
  if (isNetscape4plus())
{
top.window.onclick = null;
top.window.releaseEvents(Event.CLICK);
}
  else if (isIE5plus())
{
top.window.document.body.releaseCapture();
top.window.document.body.style.cursor = "default";
}
  }

// some obj detection code here to detect browser in isNetscape4plus(),...


Regards, Peter
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bill Moseley
Sent: 21 September 2006 05:34
To: catalyst@lists.rawmode.org
Subject: [Catalyst] The old double-post issue

I had one user complain that when they submitted a form they were
getting a 500 error, yet when reviewing their transaction it was
successfully completed.

But, reviewing the logs I saw an error (a failed transaction) and the
access logs showed two posts at the same time -- the first successful
the second aborted due to the first being already completed.

I'm using C::P::RequestToken to prevent submitting forms twice, but
that still doesn't prevent a second request slipping in before the
token is invalidated.  Perhaps need atomic update for the token stored
in the session.

Even if I trap the exception the user is still going to get a
confusing message if they double post.  Instead of "Transaction
Complete" they will see "Sorry, this transaction is already complete"
kind of thing.

I'm wondering what others are doing to deal with double-posts.  Is
using Javascript to disable the form after posting helpful?  I doubt
it since I would think click submit +  + click submit would still
work.


BTW -- I have not been able to duplicate the double post -- that is,
double clicking on the submit button (or image) won't trigger it in
FF or my version of IE, although in FF I was able to hit 
between clicks and generate the double post.  I suspect it's just
the behavior in some version of IE.



Ah the fun of all those versions of browsers:

I had another IE user where they claimed the form on the "login" page
would just clear the fields when they hit submit, but if they used the
login on the side-navigation it worked fine.  Of course, it's the same
form on both pages -- generated by the same template:

[% PROCESS includes/login_form %]

so it's bit of a mystery why one form would work and not the other.


-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Force server to send data to browser....

2006-08-29 Thread Peter Edwards
> Is there a way to send stuff as
> it's running, like forcing the server to send info every so often?
>   

Good question, not sure how you'd do it with Catalyst.
I've done this before to show output from a lengthy batch program, using
CGI.pm, sending the header then the start of the output followed by a
flushed space char every minute to stop the browser timing out. Like a "tail
-f" on a log file.

Regards, Peter



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] how to get started?

2006-08-21 Thread Peter Edwards

Hi burninbruce, setting up CPAN to follow prequisites and install them
automatically might make it easier.

# perl -MCPAN -e shell

If it's the first time, it will ask a load of setup questions, choose to
follow prerequisites.

Otherwise you can set it on with

cpan> o conf prerequisites_policy follow
cpan> q

Then try reinstalling

Regards, Peter
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 21 August 2006 10:04
To: catalyst@lists.rawmode.org
Subject: [Catalyst] how to get started?

I'm a programmer with many years experience with perl and some
with CGI scripts but little with CPAN and none with web app
frameworks.

I've been trying for days to install Catalyst and haven't gotten
far.  I've tried both "perl -MCPAN 'install Task::Catalyst'" and
cat-install and they both fail with many errors in various
prerequisite modules.  I've tried this on Sun Solaris, NetBSD,
and Cygwin, and they fail in similar ways on all three.



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] pass array to template?

2006-06-28 Thread Peter Edwards
Hi Sarah

>How can I pass an array to Template Toolkit, then loop through it?

You need to pass a pointer to array otherwise you get the scalar (length) of
the array:
 $c->stash->{numarray} = [EMAIL PROTECTED];

Regards, Peter



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] catalyst/perl and resources

2006-06-19 Thread Peter Edwards
Hi D

> If you had a small project that was growing from one or two people
> that needed (say) 5 or 6, what kind of problems does that present?
>
> I'm getting the impression that it isn't too
> easy to recruit perlers.
>
> This is very speculative thinking on my part, just wanted to have a 
> quick "straw poll" as to what is going on out there.

I'm running a project using Catalyst for one part and decided it was going
to come down to a choice between teleworkers or sub-contractors. Catalyst
hasn't been around long enough for there to be many experienced developers
you could recruit. I made a shortlist by looking at who had contributed what
to SVN, the code quality and how well they communicated with others on
list/IRC. It's worth trying http://jobs.perl.org and there's quite a few
perlers on http://www.linkedin.com.
 
For any team, as numbers increase you have to allow more time for
communication between members, including more specs and docs. Also look at
tools, procedures and coding standards. 

Regards, Peter
http://www.dragonstaff.com  Business IT Consultancy




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/