Re: [Catalyst] utf8 on c-res-write or c-res-print

2014-02-21 Thread Sergey Dmitriev

 Thank you, it works! by using Encode::encode(UTF-8, 'my text' ).


And just for reference, if anyone will use it, HTTP headers should be set
BEFORE calling write_fh.
e.g.
$c-res-header( 'Cache-Control'  = 'public, max-age=600' );
my $fh = $c-res-write_fh; # psgi writer, not filehandle

Otherwise headers will not be set.

HtH, Sergey Dmitriev
*All that is necessary for evil to triumph is for good men to do nothing.
-- Edmund Burke*


2014-02-20 18:53 GMT+04:00 Tomas Doran bobtf...@bobtfish.net:


 On Feb 20, 2014, at 2:19 PM, Dmitry L. dim0...@gmail.com wrote:

 use utf8;

 You shouldn't need this unless you have actual utf8 characters (rather
 than escapes) in your source code.

 my $fh = $c-res-write_fh;
 my $test = \x{41f}\x{440}\x{43e}\x{431}\x{430};
 utf8::encode($test);

 You probably actually want Encode::encode('UTF-8', $test);

 $fh-write($test);
 
  On 20 February 2014 17:45, Sergey Dmitriev sergey.program...@gmail.com
 wrote:
  Hello,
 
  I'm trying to put some utf8 strings as a part of Catalyst response as
  follows:
 

 Right, you can't do that :)

 If you try to use the raw write interfaces you have to send bytes not
 characters (and so need to encode your utf8 character strings).

  $c-res-print ( ... )
  and
  $c-res-write( ... )
 
  line by line.
 
  However it dies with
 
Wide character in syswrite at . IO/Handle.pm line 474
 
  Any ideas how can utf8 be written to response?
 
  E.g. set binmode on output handle. Cannot find how.
  Using Catalyst Runtime 5.90042.
 

 This is not what you want to do.

 The handle is already binary - just you're not writing binary to it,
 you're writing characters (and perl does not know how to translate those
 characters into bytes).

 Cheers
 Tom


 ___
 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/


[Catalyst] utf8 on c-res-write or c-res-print

2014-02-20 Thread Sergey Dmitriev
Hello,

I'm trying to put some utf8 strings as a part of Catalyst response as
follows:

$c-res-print ( ... )
 and
$c-res-write( ... )

line by line.

However it dies with

   Wide character in syswrite at . IO/Handle.pm line 474

Any ideas how can utf8 be written to response?

E.g. set binmode on output handle. Cannot find how.
Using Catalyst Runtime 5.90042.

Thanks.

HtH, Sergey Dmitriev
*All that is necessary for evil to triumph is for good men to do nothing.
-- Edmund Burke*
___
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/


[Catalyst] Re: Out of office 10/4-10/5

2013-08-10 Thread Sergey Dmitriev
Can admin block this email temporarily?
10.08.2013 10:18 пользователь Steve st...@matsch.com написал:

  Thank you for your email.  I will be out of the office Thursday and
 Friday, returning Monday the 8th.  I will respond to your email at that
 time.  Please call our office for any immediate concerns: 616-459-0782.

  --
  Steve Schafer
 Matsch Systems
 Phone: 616-477-9629
 Mobile: 616-304-9440
 Email: st...@matsch.com
 Web: http://www.matsch.com/


 ___
 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] working around request timeouts

2012-08-21 Thread Sergey Dmitriev
Agree. I assumed that client code can be changed to use queue tickets
instead of long-time requests, which isn't good anyway.

2012/8/21 Bill Moseley mose...@hank.org



 On Mon, Aug 20, 2012 at 12:10 PM, Sergey Dmitriev 
 sergey.program...@gmail.com wrote:

 Looks like what you need is the job queue. Take a look at

 Queue::DBI (https://metacpan.org/module/Queue::DBI) - simpler
 TheSchwartz (https://metacpan.org/module/TheSchwartz)


 Yes, and what about long polling?  Would that solve the ajax request
 timing out?  That is, have your client code get sent a message when the
 backend is done instead of waiting.




 Sergey

 2012/8/20 James R. Leu j...@mindspring.com

  Hello all,

 Problem description
 ===
 I have a catalyst application server that responds
 to 'API' requests for web applications via XHTMLRequests.
 Sometimes the requests are timing out due to the backend
 database queries taking too long.  I'm looking for ways to
 work around this and prevent the 'API' requests from
 timing out.

 I know some of the possible resolutions to this are
 - fix the queries
 - fix the database
 - frontend the RDBMS with NoSQL

 I'm working towards those fixes, but they are long
 term projects, I'm looking for an interim solution.
 That would notify the web application that it will
 need to come back later for the response (ie decouple
 request handling from the actual request/response).

 My attempt
 ==
 In my handler I fork a child process.

 In the parent I send a response with a
 'job id' so the web application knows
 to poll the 'API' for completion.

 In the child I close the IO socket so it cannot send
 a response and then let it finish processing the
 request, but it looks like I've lost my database
 connections so the request fails.

 My wish
 ===
 What I would like to do is avoid the fork and instead
 have the handler send an early response to the
 web application and then finish processing the request
 and not try to send a response when done.

 Is there a common term for what I'm trying to do
 like continuation or something like that?
 Has anyone already done this?

 Thank you for your time.
 --
 James R. Leu
 j...@mindspring.com

 ___
 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/




 --
 Bill Moseley
 mose...@hank.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/


___
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] working around request timeouts

2012-08-20 Thread Sergey Dmitriev
Looks like what you need is the job queue. Take a look at

Queue::DBI (https://metacpan.org/module/Queue::DBI) - simpler
TheSchwartz (https://metacpan.org/module/TheSchwartz)

Sergey

2012/8/20 James R. Leu j...@mindspring.com

 Hello all,

 Problem description
 ===
 I have a catalyst application server that responds
 to 'API' requests for web applications via XHTMLRequests.
 Sometimes the requests are timing out due to the backend
 database queries taking too long.  I'm looking for ways to
 work around this and prevent the 'API' requests from
 timing out.

 I know some of the possible resolutions to this are
 - fix the queries
 - fix the database
 - frontend the RDBMS with NoSQL

 I'm working towards those fixes, but they are long
 term projects, I'm looking for an interim solution.
 That would notify the web application that it will
 need to come back later for the response (ie decouple
 request handling from the actual request/response).

 My attempt
 ==
 In my handler I fork a child process.

 In the parent I send a response with a
 'job id' so the web application knows
 to poll the 'API' for completion.

 In the child I close the IO socket so it cannot send
 a response and then let it finish processing the
 request, but it looks like I've lost my database
 connections so the request fails.

 My wish
 ===
 What I would like to do is avoid the fork and instead
 have the handler send an early response to the
 web application and then finish processing the request
 and not try to send a response when done.

 Is there a common term for what I'm trying to do
 like continuation or something like that?
 Has anyone already done this?

 Thank you for your time.
 --
 James R. Leu
 j...@mindspring.com

 ___
 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: Re [Catalyst] How to update data of already logged-in user?

2012-07-13 Thread Sergey Dmitriev
What do you mean? Answers really helped me.

Sergey

2012/7/12 Tomas Doran bobtf...@bobtfish.net


 On 12 Jul 2012, at 07:18, Sergey Dmitriev wrote:

  Thank you Lu. BTW, set_authenticated is marked as internal method in
 documentation, so it could be changed some day.
 

 Well volunteered?

 Cheers
 t0m


 ___
 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: Re [Catalyst] How to update data of already logged-in user?

2012-07-13 Thread Sergey Dmitriev
Ok, if so, no problem, i just need hint like 'how to do it right way'. :)

2012/7/13 Dimitar Petrov mita...@gmail.com

 I think that the method is used by many people and it was discussed that
 the set_authenticated shouldn't be documented as internal... so I guess
 what Tom means is well volunteered for fixing the documentation :)


 On Fri, Jul 13, 2012 at 10:36 AM, Sergey Dmitriev 
 sergey.program...@gmail.com wrote:

 What do you mean? Answers really helped me.

 Sergey


 2012/7/12 Tomas Doran bobtf...@bobtfish.net


 On 12 Jul 2012, at 07:18, Sergey Dmitriev wrote:

  Thank you Lu. BTW, set_authenticated is marked as internal method in
 documentation, so it could be changed some day.
 

 Well volunteered?

 Cheers
 t0m


 ___
 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/



 ___
 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] How to update data of already logged-in user?

2012-07-12 Thread Sergey Dmitriev
Thank you Lu. BTW, set_authenticated is marked as internal method in
documentation, so it could be changed some day.


2012/7/12 鲁国庆(Jack Lu) luguoq...@gmail.com

 my $user = $c-find_user({ user_id = $c-user-user_id });
 $c-set_authenticated($user);

 $user-email will be the new email.


 On Thu, Jul 12, 2012 at 2:28 AM, Sergey Dmitriev 
 sergey.program...@gmail.com wrote:

 Thank you David!

 2012/7/11 David Schmidt davew...@gmx.at

 The object returned by $c-user is not what you are looking for.

 I assume you are using DBIC.

 Get the real user object with $c-user-get_object()


 http://search.cpan.org/~bobtfish/Catalyst-Plugin-Authentication-0.10021/lib/Catalyst/Authentication/User.pm#get_object(_)

 cheers
 david



 On 11 July 2012 17:37, Sergey Dmitriev sergey.program...@gmail.com
 wrote:
  Hello,
 
  My question is simple. I have object of already authenticated user in
 $u by
  using
 
  my $u = $c-user()
 
  So, getter $u-email reflects actual email. How then can I update
 already
  loaded user object? E.g. i need something like:
 
  print $u-email; # old@email
 
  $u-email = 'new@email';
 
  print $u-email; # new@email
 
  How to achieve this simple way? Do I need to update user rec in DB then
  re-load user from DB? Then, which is the simplest way to re-trieve user
  again?
 
  Thank you.
  Sergey
 
 
 
  ___
  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/



 ___
 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/




 --
 Jack

 ___
 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/




-- 
Love never fails.
___
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/


[Catalyst] How to update data of already logged-in user?

2012-07-11 Thread Sergey Dmitriev
Hello,

My question is simple. I have object of already authenticated user in $u by
using

my $u = $c-user()

So, getter $u-email reflects actual email. How then can I update already
loaded user object? E.g. i need something like:

print $u-email; # old@email

$u-email = 'new@email';

print $u-email; # new@email

How to achieve this simple way? Do I need to update user rec in DB then
re-load user from DB? Then, which is the simplest way to re-trieve user
again?

Thank you.
Sergey
___
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] How to update data of already logged-in user?

2012-07-11 Thread Sergey Dmitriev
Thank you David!

2012/7/11 David Schmidt davew...@gmx.at

 The object returned by $c-user is not what you are looking for.

 I assume you are using DBIC.

 Get the real user object with $c-user-get_object()


 http://search.cpan.org/~bobtfish/Catalyst-Plugin-Authentication-0.10021/lib/Catalyst/Authentication/User.pm#get_object(_)

 cheers
 david



 On 11 July 2012 17:37, Sergey Dmitriev sergey.program...@gmail.com
 wrote:
  Hello,
 
  My question is simple. I have object of already authenticated user in $u
 by
  using
 
  my $u = $c-user()
 
  So, getter $u-email reflects actual email. How then can I update already
  loaded user object? E.g. i need something like:
 
  print $u-email; # old@email
 
  $u-email = 'new@email';
 
  print $u-email; # new@email
 
  How to achieve this simple way? Do I need to update user rec in DB then
  re-load user from DB? Then, which is the simplest way to re-trieve user
  again?
 
  Thank you.
  Sergey
 
 
 
  ___
  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/

___
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/