[fw-general] issue with keys in Zend_Service_Amazon_Ec2_Instance

2009-10-28 Thread Mark Wright
So here's my code:

Zend_Service_Amazon_Ec2_Ebs::setRegion('us-east-1');
$ec2Instance = new Zend_Service_Amazon_Ec2_Instance('Access Key ID',
'Secret Access Key');
$return =   $ec2Instance-run(
array(
'imageId'   =  'ami',
'keyName'   =  'key name',
'securityGroup' =  'group name',
'userData'  =  
'someData=some value|someOtherData=some other value'
)
);

What I get back is:

Fatal error:  Uncaught exception 'Zend_Service_Amazon_Ec2_Exception'
with message 'The request signature we calculated does not match the
signature you provided. Check your AWS Secret Access Key and signing
method. Consult the service documentation for details.' in
/zend_framework/Zend_1.9.4/Zend/Service/Amazon/Ec2/Abstract.php:196
Stack trace:
#0 /zend_framework/Zend_1.9.4/Zend/Service/Amazon/Ec2/Abstract.php(99):
Zend_Service_Amazon_Ec2_Abstract-gt;checkForErrors(Object(Zend_Service_Amazon_Ec2_Response))
#1 /zend_framework/Zend_1.9.4/Zend/Service/Amazon/Ec2/Instance.php(169):
Zend_Service_Amazon_Ec2_Abstract-gt;sendRequest(Array)
#2 /Users/mark/Zend/workspaces/DefaultWorkspace7/Vagabond/public/aws.php(41):
Zend_Service_Amazon_Ec2_Instance-gt;run(Array)
#3 {main}
  thrown in b/zend_framework/Zend_1.9.4/Zend/Service/Amazon/Ec2/Abstract.php
on line b196


It doesn't make sense. I copied the keys from the Security Credentials
page. I made sure there was no extra white space. I even tried
creating a new access key and got the same thing.

Any ideas?



Mark

-- 
Have fun or die trying - but try not to actually die.


[fw-general] understanding lucene score, kind of weird results, explain class available?

2009-10-28 Thread kampfhering

hallo everyone,

i am having some trouble getting my results in the right order. 

my query is:

( title:WOBENZYM~0.6 OR title:100~0.6 )

and these are my results (score in brackets):

#01  Wobenzym P 100 Stück [1]
#02  WOBENZYM mono Tabletten magensaftresistent [0.875]
#03  WOBENZYM mono Tabletten magensaftresistent [0.875]
#04  WOBENZYM mono Tabletten magensaftresistent [0.875]
#05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
#06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
#07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]

what i don't understand is, why does the #05 has a lower score than #02 -
#04, because #05 has the number 100 in it and #02 - #04 doesn't. i've read
some messages on the nabble java forum, and there seems to be an explain
class which can help determine how the score got calculated. is there an
equivalent for zend_search_lucene? i also tried to change my query a bit,
here are some of my results:

query: ( title:WOBENZYM~0.6 AND title:100~0.6 )

#01  Wobenzym P 100 Stück [1]
#02  WOBENZYM mono Tabletten magensaftresistent [0.875]
#03  WOBENZYM mono Tabletten magensaftresistent [0.875]
#04  WOBENZYM mono Tabletten magensaftresistent [0.875]
#05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
#06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
#07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]

so no matter if its AND or OR, no difference in the score here.

query: ( title:WOBENZYM~0.9 OR title:100~0.9 )

#01  Wobenzym P 100 Stück [1]
#02  WOBENZYM mono Tabletten magensaftresistent [0.875]
#03  WOBENZYM mono Tabletten magensaftresistent [0.875]
#04  WOBENZYM mono Tabletten magensaftresistent [0.875]
#05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
#06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
#07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]

and fuzzy to 0.9 doesn't change anything either.

query: ( title:WOBENZYM OR title:100 )

#01  Wobenzym P 100 Stück [1]
#02  WOBENZYM mono Tabletten magensaftresistent [0.875]
#03  WOBENZYM mono Tabletten magensaftresistent [0.875]
#04  WOBENZYM mono Tabletten magensaftresistent [0.875]
#05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
#06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
#07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]

even completely without fuzzy, i get exactly the same scoring.

i have the feeling the problem could be the slash in the title. maybe it has
a problem with that. i will build a new lucene index with some stripped
titles without special chars, and see what that does get me. i will post the
results later on. if someone has another idea, please let me know.

regards benjamin 
-- 
View this message in context: 
http://www.nabble.com/understanding-lucene-score%2C-kind-of-weird-results%2C-explain-class-available--tp26092008p26092008.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] understanding lucene score, kind of weird results, explain class available?

2009-10-28 Thread kampfhering

so here are my results with my special stripped title without any special
chars:

query: ( stitle:WOBENZYM AND stitle:100 )
#01  Wobenzym P 100 Stück [0.866468607375]
#02  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#03  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#04  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#05  WOBENZYM N Drag magensaftres 200 St [0.649851455532]
#06  WOBENZYM N Drag magensaftres 800 St [0.649851455532]
#07  WOBENZYM N Drag magensaftres 100 St [0.649851455532]

query: ( stitle:WOBENZYM OR stitle:100 )
#01  Wobenzym P 100 Stück [0.866468607375]
#02  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#03  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#04  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#05  WOBENZYM N Drag magensaftres 200 St [0.649851455532]
#06  WOBENZYM N Drag magensaftres 800 St [0.649851455532]
#07  WOBENZYM N Drag magensaftres 100 St [0.649851455532]

query: ( stitle:WOBENZYM~0.6 OR stitle:100~0.6 )
#01  Wobenzym P 100 Stück [0.866468607375]
#02  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#03  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#04  WOBENZYM mono Tabletten magensaftresistent [0.758160031454]
#05  WOBENZYM N Drag magensaftres 200 St [0.649851455532]
#06  WOBENZYM N Drag magensaftres 800 St [0.649851455532]
#07  WOBENZYM N Drag magensaftres 100 St [0.649851455532]

so, unfortunately, different scores, but same order. i am starting to think
it could be 
a problem searching for numbers, because when i use this query:

query: ( stitle:WOBENZYM~0.6 OR stitle:ST~0.6 )
#01  WOBENZYM N Drag magensaftres 200 St [1]
#02  WOBENZYM N Drag magensaftres 800 St [1]
#03  WOBENZYM N Drag magensaftres 100 St [1]
#04  Wobenzym P 100 Stück [0.157236973127]
#05  WOBENZYM mono Tabletten magensaftresistent [0.137582351486]
#06  WOBENZYM mono Tabletten magensaftresistent [0.137582351486]
#07  WOBENZYM mono Tabletten magensaftresistent [0.137582351486]

all seems fine here, but i have to be able to search for numbers, since its
a search for drugs, and the user should be able to enter numbers for
packaging sizes etc. any help greatly appreciated.

regards benjamin



kampfhering wrote:
 
 hallo everyone,
 
 i am having some trouble getting my results in the right order. 
 
 my query is:
 
 ( title:WOBENZYM~0.6 OR title:100~0.6 )
 
 and these are my results (score in brackets):
 
 #01  Wobenzym P 100 Stück [1]
 #02  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #03  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #04  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
 #06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
 #07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]
 
 what i don't understand is, why does the #05 has a lower score than #02 -
 #04, because #05 has the number 100 in it and #02 - #04 doesn't. i've read
 some messages on the nabble java forum, and there seems to be an explain
 class which can help determine how the score got calculated. is there an
 equivalent for zend_search_lucene? i also tried to change my query a bit,
 here are some of my results:
 
 query: ( title:WOBENZYM~0.6 AND title:100~0.6 )
 
 #01  Wobenzym P 100 Stück [1]
 #02  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #03  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #04  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
 #06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
 #07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]
 
 so no matter if its AND or OR, no difference in the score here.
 
 query: ( title:WOBENZYM~0.9 OR title:100~0.9 )
 
 #01  Wobenzym P 100 Stück [1]
 #02  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #03  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #04  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
 #06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
 #07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]
 
 and fuzzy to 0.9 doesn't change anything either.
 
 query: ( title:WOBENZYM OR title:100 )
 
 #01  Wobenzym P 100 Stück [1]
 #02  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #03  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #04  WOBENZYM mono Tabletten magensaftresistent [0.875]
 #05  WOBENZYM N Drag.magensaftres. / 100 St [0.75]
 #06  WOBENZYM N Drag.magensaftres. / 200 St [0.75]
 #07  WOBENZYM N Drag.magensaftres. / 800 St [0.75]
 
 even completely without fuzzy, i get exactly the same scoring.
 
 i have the feeling the problem could be the slash in the title. maybe it
 has a problem with that. i will build a new lucene index with some
 stripped titles without special chars, and see what that does get me. i
 will post the results later on. if someone has another idea, please let me
 know.
 
 regards benjamin 
 

-- 
View this message in context: 

[fw-general] Bug in Zend_Date

2009-10-28 Thread Peter Smit
It seems that Zend_Date does not parse a date well when the year comes after
the timezone.

Example code:
?php
date_default_timezone_set('Europe/Helsinki');
set_include_path('/home/peter/Desktop/ZendFramework-1.9.3PL1/library' .
PATH_SEPARATOR . get_include_path());

require_once('ZendFramework-1.9.3PL1/library/Zend/Date.php');
require_once('ZendFramework-1.9.3PL1/library/Zend/Locale.php');

$informat = EEE MMM d h:mm:ss ZZZ ;
$indate = Fri Oct 23 15:47:42 + 2009;

$outformat =  d MMM ;

$date = new Zend_Date($indate, $informat);
#$date = new Zend_Date();
echo $date-toString($outformat) . \n;
echo $date-toString($informat) . \n;

Gives:
Thursday 23 Oct 
Thu Oct 23 3:47:42 + 

This date format is common for the Twitter API.

Is this a bug?

Regards,

Peter Smit


[fw-general] image upload problem

2009-10-28 Thread attractive eyes

hi all,
I hope u all enjoying happy lives. my problem is that I want to upload
images to a specific folder n for uniqueness of image name i append time()
with image name. and these images are related to different gadgets. when I
want to edit the gadget and change its image then older image for that
gadget will remove and new one will be uploaded. I have achieved all these
on my local server. but when i uploaded n deploy the application. then when
i upload an image. its not uploaded with its unique name rather it uploaded
with its original name and when i edit gadget and change its image then
older one is not deleted. whats the problem. code is given below;
for uploading;
$fname = $form-getValue('pic');
$fnam = time() . $fname;
$ffname = realpath(UPLOAD_PATH).'/'.$fname;


$filename = realpath(UPLOAD_PATH).'/'.$fnam ;


copy($ffname, $filename);
unlink($ffname);
when edit following code works:

$picc = $form-getValue('pic');
if($picc){

$fnam = time() . $picc;
//echo $fnam;exit;
$ffname = realpath(UPLOAD_PATH).'/'.$picc;


$filename = realpath(UPLOAD_PATH).'/' .$fnam ;

copy($ffname, $filename);
unlink($ffname);

$gadget = new Model_DbTable_Gadget();
$gadget = $gadget-editGadget($idd);
$oldpic = $gadget['path'];
$dpath = realpath(UPLOAD_PATH).'/'.$oldpic;
unlink($dpath);

plz help me. 
-- 
View this message in context: 
http://www.nabble.com/image-upload-problem-tp26093110p26093110.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Problems using Zend_Dom

2009-10-28 Thread oportell

Hi,

Is there an easy way for doing a search in an XML file?

I have an TMX file with a language list:

?xml version=1.0 ?
tmx version=1.4
   header creationtool=hand made
  creationtoolversion=1.0.0
  datatype=winres
  segtype=sentence
  adminlang=ca
  srclang=ca
  o-tmf=abc
   /header
   body
  tu tuid=de datatype=plaintext
 tuv xml:lang=casegalemany/seg/tuv
 tuv xml:lang=essegalemán/seg/tuv
 tuv xml:lang=ensegGerman/seg/tuv
  /tu
  tu tuid=en datatype=plaintext
 tuv xml:lang=caseganglès/seg/tuv
 tuv xml:lang=esseginglés/seg/tuv
 tuv xml:lang=ensegEnglish/seg/tuv
  /tu
   /body
/tmx

And I would like to get all languages (for example from tuv nodes which have
xml:lang='en') that match a query text introduced in an AJAX form.

For testing purposes (I never used Zend_Dom before) i have written the
following code in the search action in order to match all tuv nodes with
language en:

$xmlfile = BASE_PATH . '/language/all_languages.tmx';
if (file_exists($xmlfile)) {
   $xml = file_get_contents($xmlfile);
   $dom = new Zend_Dom_Query();
   $dom-setDocumentXml($xml);
   $xpath = //t...@xml:lang='en'];
   $results = $dom-queryXPath($xpath);
   $rows = count($results);
}

But $rows always gets a value of 1. Why is that?
And... what xpath expression should I use to match the query text entered in
the AJAX form?

Thanks in advance,

Oriol  
-- 
View this message in context: 
http://www.nabble.com/Problems-using-Zend_Dom-tp26093704p26093704.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Dojo_Form with required elements cannot be sent when invalid

2009-10-28 Thread Ralf Eggert
Hi,

I noticed a weird problem with Zend_Dojo_Form and would like to know if
others have similar problems.

I have a Zend_Dojo_Form with a couple of elements. Some of them are set
to be required. When I want to send this form it does not work until all
the required fields are filled with data. The submit button just does
not work. I would at least expect that a message is presented to the
user that he needs to fill out the required elements or otherwise the
form cannot be sent.

How can I add this message to the form?

Or is it possible to deactivate the dojo client-side validation for some
of the elements?

Thanks for your kind help.

Best regards,

Ralf Eggert



Re: [fw-general] Bug in Zend_Date

2009-10-28 Thread Shaun Farrell
Peter,

Try this.  It may work

$indate = Fri Oct 23 15:47:42 + 2009;
$outformat =  d MMM ;
$date = new Zend_Date();
$date-setTimezone('Europe/Helsinki');
$datetime = strtotime($indate);
$date-set($datetime);

echo Date:  . $date-toString($outformat);
echo TimeZone:  . $date-getTimezone();


On Wed, Oct 28, 2009 at 6:17 AM, Peter Smit pe...@smitmail.eu wrote:

 It seems that Zend_Date does not parse a date well when the year comes
 after the timezone.

 Example code:
 ?php
 date_default_timezone_set('Europe/Helsinki');
 set_include_path('/home/peter/Desktop/ZendFramework-1.9.3PL1/library' .
 PATH_SEPARATOR . get_include_path());

 require_once('ZendFramework-1.9.3PL1/library/Zend/Date.php');
 require_once('ZendFramework-1.9.3PL1/library/Zend/Locale.php');

 $informat = EEE MMM d h:mm:ss ZZZ ;
 $indate = Fri Oct 23 15:47:42 + 2009;

 $outformat =  d MMM ;

 $date = new Zend_Date($indate, $informat);
 #$date = new Zend_Date();
 echo $date-toString($outformat) . \n;
 echo $date-toString($informat) . \n;

 Gives:
 Thursday 23 Oct 
 Thu Oct 23 3:47:42 + 

 This date format is common for the Twitter API.

 Is this a bug?

 Regards,

 Peter Smit




-- 
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com


Re: [fw-general] Bug in Zend_Date

2009-10-28 Thread Peter Smit
On Wed, Oct 28, 2009 at 2:29 PM, Shaun Farrell farrel...@gmail.com wrote:

 Peter,

 Try this.  It may work

 $indate = Fri Oct 23 15:47:42 + 2009;
 $outformat =  d MMM ;
 $date = new Zend_Date();
 $date-setTimezone('Europe/Helsinki');
 $datetime = strtotime($indate);
 $date-set($datetime);

 echo Date:  . $date-toString($outformat);
 echo TimeZone:  . $date-getTimezone();



It works, it is indeed a workaround to convert the date to a timestamp with
strtotime and construct a date from that. I have only the following 2
concerns
 - I was expecting Zend_Date to do this for me, so is my expectation wrong
than this is a solution, if not it's a workaround
 - This will not work with dates outside the range of the timestamp ( year
2039 according to
http://php.net/manual/en/function.strtotime.php#function.strtotime.notes)


Re: [fw-general] Bug in Zend_Date

2009-10-28 Thread Shaun Farrell
Did you try $date-getTimestamp();  That may work but I'm not sure if it
will read the year correctly.



On Wed, Oct 28, 2009 at 8:37 AM, Peter Smit pe...@smitmail.eu wrote:

 On Wed, Oct 28, 2009 at 2:29 PM, Shaun Farrell farrel...@gmail.comwrote:

 Peter,

 Try this.  It may work

 $indate = Fri Oct 23 15:47:42 + 2009;
 $outformat =  d MMM ;
 $date = new Zend_Date();
 $date-setTimezone('Europe/Helsinki');
 $datetime = strtotime($indate);
 $date-set($datetime);

 echo Date:  . $date-toString($outformat);
 echo TimeZone:  . $date-getTimezone();



 It works, it is indeed a workaround to convert the date to a timestamp with
 strtotime and construct a date from that. I have only the following 2
 concerns
  - I was expecting Zend_Date to do this for me, so is my expectation wrong
 than this is a solution, if not it's a workaround
  - This will not work with dates outside the range of the timestamp ( year
 2039 according to
 http://php.net/manual/en/function.strtotime.php#function.strtotime.notes)





-- 
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com


[fw-general] How to display errors when an ajax request fail?

2009-10-28 Thread Juan Felipe Alvarez Saldarriaga
Hey.

I'm using the default ErrorController from Zend_Tool, so, when an
error is thrown setHttpResponseCode sets an error 500, how can I catch
the exception message on javascript? how can I set the exception
message into the response object? there's not setMessage method in
Zend_Http_Response :| how can I achive this? I'm using jQuery to catch
errors, using $.ajaxSetup( { error: function( XMLHttpRequest,
textStatus, errorThrown ) {} } ); XMLHttpRequest.statusText has the
default error message Internal Server Error from Zend_Http_Response,
there's a way to change this message with the exception message?.

Thanks.


Re: [fw-general] How to display errors when an ajax request fail?

2009-10-28 Thread drm

Juan Felipe Alvarez Saldarriaga wrote:

I'm using the default ErrorController from Zend_Tool, so, when an
error is thrown setHttpResponseCode sets an error 500, how can I catch
the exception message on javascript? how can I set the exception
message into the response object? there's not setMessage method in
Zend_Http_Response :| how can I achive this? I'm using jQuery to catch
errors, using $.ajaxSetup( { error: function( XMLHttpRequest,
textStatus, errorThrown ) {} } ); XMLHttpRequest.statusText has the
default error message Internal Server Error from Zend_Http_Response,
there's a way to change this message with the exception message?.
  
Though strictly not a Zend Framework question but more a jQuery one, you 
can just read out the responseText property of the XMLHttpRequest. Try 
this snippet:


?php

if(count($_GET)) {
   Header(HTTP/1.1 500 Internal server error);
  
   echo Sorry, error!;

   die();
}

?
script type=text/javascript src=javascript/jquery.js/script
script type=text/javascript
   $(function(){
   $.ajaxSetup({
   error: function(req) {
   alert(Error  + req.responseText);
   }  
   });

   $('input').click(function(){
   $.get('?php echo $_SERVER['PHP_SELF']?', {test: 'w00t'}, 
function(data){

   alert(data);
   });
   });
   });
/script

input type=button value=click me


[fw-general] passing values to view from decorators

2009-10-28 Thread Ralikwen

Hi,
I am generating javascript code for form elements in custom decorators.
As opposed to normal decorator functionality the generated code should not
go within the form but to the final view rendered.

This is how I am outputting this in the view script:
? if (!empty($this-ExtOnReady)) {
echo HEREDOC
link href='/scripts/ext-3.0.0/resources/css/ext-all.css' media='screen'
rel='stylesheet' type='text/css' /
script type='text/javascript'
src='/scripts/ext-3.0.0/adapter/ext/ext-base.js'/script
script type='text/javascript' src='/scripts/ext-3.0.0/ext-all.js'/script
script type='text/javascript'
Ext.onReady(function(){
Ext.QuickTips.init();
$this-ExtOnReady   
});
/script
HEREDOC;
}?

This is what I am doing in the decorator:
public function render($content) {
$element = $this-getElement ();
$view = $element-getView ();
...
...
$view-ExtOnReady = $view-ExtOnReady . new Ext.ToolTip({
title: '$label',
target: '$name-ttarget',
anchor: 'left',
trackMouse: true,
html: '$description'
});;
..
..

When I call this from one of my module $view-ExtOnReady has a value after
$form-setConfig ( $config ); 
is executed, when I call this from another it doesn't. 
In both cases if I dump $view-ExtOnReady from within the decorator it does
have value, but in one case somehow it mysteriously disappears. 
I also tried putting the jscript into the registry but even that claims to
be unset.
I don't even know how to debug the code that runs between the decorator
(where I do have the value) and the return of the form object (where I
don't).

Any idea what I might be doing wrong or how to do this correctly/reliably?
Thanks for the help.

SWK


-- 
View this message in context: 
http://www.nabble.com/passing-values-to-view-from-decorators-tp26094673p26094673.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to display errors when an ajax request fail?

2009-10-28 Thread Саша Стаменковић
If you send header HTTP code 500 from your controller

$this-getResponse()-setHttpResponseCode(500);

you can catch it in your javascript with

$.ajax({
type: 'POST',
url: '/c/a',
data: $('#form').serialize(),
dataType: 'html',
success: function(response) {
// success code
},
error: function() {
// error code - show some red div or alert or...
}
});

Regards,
Saša Stamenković


On Wed, Oct 28, 2009 at 2:29 PM, drm d...@melp.nl wrote:

 Juan Felipe Alvarez Saldarriaga wrote:

 I'm using the default ErrorController from Zend_Tool, so, when an
 error is thrown setHttpResponseCode sets an error 500, how can I catch
 the exception message on javascript? how can I set the exception
 message into the response object? there's not setMessage method in
 Zend_Http_Response :| how can I achive this? I'm using jQuery to catch
 errors, using $.ajaxSetup( { error: function( XMLHttpRequest,
 textStatus, errorThrown ) {} } ); XMLHttpRequest.statusText has the
 default error message Internal Server Error from Zend_Http_Response,
 there's a way to change this message with the exception message?.


 Though strictly not a Zend Framework question but more a jQuery one, you
 can just read out the responseText property of the XMLHttpRequest. Try this
 snippet:

 ?php

 if(count($_GET)) {
   Header(HTTP/1.1 500 Internal server error);
 echo Sorry, error!;
   die();
 }

 ?
 script type=text/javascript src=javascript/jquery.js/script
 script type=text/javascript
   $(function(){
   $.ajaxSetup({
   error: function(req) {
   alert(Error  + req.responseText);
   } });
   $('input').click(function(){
   $.get('?php echo $_SERVER['PHP_SELF']?', {test: 'w00t'},
 function(data){
   alert(data);
   });
   });
   });
 /script

 input type=button value=click me



Re: [fw-general] Creating CLI scripts utilizing ZF

2009-10-28 Thread prodigitalson


Tim Fountain wrote:
 
 * I've had to add my application's model/library directories to my local
 PHP
 CLI php.ini include_path, so that ZF can find my provider classes. This is
 not very portable.
 

Is there a reason youre not setting this in the shell profile via
ZEND_TOOL_INCLUDE_PATH or ZEND_TOOL_INCLUDE_PATH_PREPEND of the user running
crontab?


Tim Fountain wrote:
 
 * To give my provider classes access to my application's classes,
 resources
 etc. I've had to add a base provider class which does some bootstrapping
 in
 its constructor. My application provider classes then require this class
 in
 and extend it.
 

I was considering something similar - and i dont think this is necessarily a
bad approach. But id like to not have to.

So i think the crux of this for me is  that Im thinking there has to be a
good way to leverage the functionality of the normal Zend_Application
bootstrapping process just for the CLI environment - im just not sure of
what that *should* look like in general implementation.

-- 
View this message in context: 
http://www.nabble.com/Creating-CLI-scripts-utilizing-ZF-tp26084241p26096261.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] css class to option tags

2009-10-28 Thread Anders Gunnarsson

Hi

I'm creating a select box, and adding the options using addMultiOptions.

How can I set CSS Class to the option-tags?

select
  option class=myClass value=11/option
  option class=myClass value=22/option
  option class=myClass value=33/option
/select

regards
Anders


Re: [fw-general] css class to option tags

2009-10-28 Thread drm

Anders Gunnarsson wrote:
I'm creating a select box, and adding the options using 
addMultiOptions.


How can I set CSS Class to the option-tags?

select
  option class=myClass value=11/option
  option class=myClass value=22/option
  option class=myClass value=33/option
/select
Afaik, you can't, but there is really no need if you're going to give 
all your options the same class, you could simply give your select a 
classname and create a


select.yourclassname option {
   /* ... */
}

css rule


Re: [fw-general] Creating CLI scripts utilizing ZF

2009-10-28 Thread swilhelm

I would also like to see a good example of this. 

Do your CLI scripts require authentication or ACL support? If so, are you
handling that as well?

- Steve W.


 
 So i think the crux of this for me is  that Im thinking there has to be a
 good way to leverage the functionality of the normal Zend_Application
 bootstrapping process just for the CLI environment - im just not sure of
 what that *should* look like in general implementation.
 
 

-- 
View this message in context: 
http://www.nabble.com/Creating-CLI-scripts-utilizing-ZF-tp26084241p26098104.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Creating CLI scripts utilizing ZF

2009-10-28 Thread prodigitalson



Do your CLI scripts require authentication or ACL support? If so, are you
handling that as well?



Mine do not. I ma only using ACL for user based operations through the
webapp. My scripts only server to update certain tables in my DB with the
latest information from the real data source or to send notifications
about/containing data to certain groups of users. I will probably add some
log and cache management tools as well but those shouldnt need to utilize my
ACLs either.
-- 
View this message in context: 
http://www.nabble.com/Creating-CLI-scripts-utilizing-ZF-tp26084241p26098422.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Using Zend Framework with interactive consoles

2009-10-28 Thread Jules Piccotti
Hi, does everyone has any experience on using ZF with any of the  
interactive console?


I tested some of the most populars:
- plain php -a
- phpsh, a Python iplementation open sourced by Facebook: http://www.phpsh.org/
- PHP-Shell, my favourite, which is the only one capable of handling  
fatal errors - indispensable for debugging: http://pear.php.net/package/PHP_Shell/


Unfortunately, they all seems to fail when it comes to autoloading...  
In particolar the standard PHP interactive mode is fully documented as  
not compatible with autoload: http://www.php.net/manual/en/language.oop5.autoload.php


Does anybody knows of a valid alternative, or a workaround to make one  
of these work seamlessy with ZF applications?


Also, if you start testing it, please notice that usage of the  
__FILE__ magic constant will break your application: while in  
interactive console it points to the executable position (probably usr/ 
local/bin or something similar) and not your executed php script.


Jules Piccotti


[fw-general] Router Help?

2009-10-28 Thread Tom Printy
Hello,

I am trying to get some routes to work and having some troubles


I have a couple routes defined like:


$router-addRoute(
'index',
new Zend_Controller_Router_Route(
'/:city/:state/:keyword/', 
array('controller' = 'index', 
  'action' = 'index'
)
)
);

//add the route
$controller = Zend_Controller_Front::getInstance();
$controller-setRouter($router);



However when I try the URL
http://example.com/elgin/il/garage/

I get the following dump
#0 library/Zend/Controller/Front.php(946):
Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
 Object(Zend_Controller_Response_Http))
#1 /library/Zend/Application/Bootstrap/Bootstrap.php(77): 
Zend_Controller_Front-dispatch()
#2 /library/Zend/Application.php(358): 
Zend_Application_Bootstrap_Bootstrap-run()
#3 /public/index.php(26): Zend_Application-run()
#4 {main}  
Request Parameters:
array (
  'controller' = 'elgin',
  'action' = 'il',
  'garage' = 'index',
  'module' = 'default',
)  


Can anyone offer any suggestions?

Thanks
-Tom Printy



Re: [fw-general] Router Help?

2009-10-28 Thread prodigitalson

Try adding the module to your default paramters:

$router-addRoute(
'index',
new Zend_Controller_Router_Route(
'/:city/:state/:keyword/', 
array('controller' = 'index', 
  'action' = 'index',
  'module' = 'default'
)
)
);



tprinty wrote:
 
 Hello,
 
 I am trying to get some routes to work and having some troubles
 
 
 I have a couple routes defined like:
 
 
 $router-addRoute(
   'index',
   new Zend_Controller_Router_Route(
   '/:city/:state/:keyword/', 
   array('controller' = 'index', 
 'action' = 'index'
   )
   )
 );
 
 //add the route
 $controller = Zend_Controller_Front::getInstance();
 $controller-setRouter($router);
 
 
 
 However when I try the URL
 http://example.com/elgin/il/garage/
 
 I get the following dump
 #0 library/Zend/Controller/Front.php(946):
 Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
 Object(Zend_Controller_Response_Http))
 #1 /library/Zend/Application/Bootstrap/Bootstrap.php(77):
 Zend_Controller_Front-dispatch()
 #2 /library/Zend/Application.php(358):
 Zend_Application_Bootstrap_Bootstrap-run()
 #3 /public/index.php(26): Zend_Application-run()
 #4 {main}  
 Request Parameters:
 array (
   'controller' = 'elgin',
   'action' = 'il',
   'garage' = 'index',
   'module' = 'default',
 )  
 
 
 Can anyone offer any suggestions?
 
 Thanks
 -Tom Printy
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Using-Zend-Framework-with-interactive-consoles-tp26100554p26101548.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Router Help?

2009-10-28 Thread Tom Printy
Hi,

Thanks for the reply as you can see in the request params it figures out
the right module. It really goofs up the controller and action though.

Request Parameters:
array (
'controller' = 'elgin',
'action' = 'il',
'garage' = 'index',
'module' = 'default',
) 


On Wed, 2009-10-28 at 13:25 -0700, prodigitalson wrote:
 Try adding the module to your default paramters:
 
 $router-addRoute(
   'index',
   new Zend_Controller_Router_Route(
   '/:city/:state/:keyword/', 
   array('controller' = 'index', 
 'action' = 'index',
   'module' = 'default'
   )
   )
 );
 
 
 
 tprinty wrote:
  
  Hello,
  
  I am trying to get some routes to work and having some troubles
  
  
  I have a couple routes defined like:
  
  
  $router-addRoute(
  'index',
  new Zend_Controller_Router_Route(
  '/:city/:state/:keyword/', 
  array('controller' = 'index', 
'action' = 'index'
  )
  )
  );
  
  //add the route
  $controller = Zend_Controller_Front::getInstance();
  $controller-setRouter($router);
  
  
  
  However when I try the URL
  http://example.com/elgin/il/garage/
  
  I get the following dump
  #0 library/Zend/Controller/Front.php(946):
  Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
  Object(Zend_Controller_Response_Http))
  #1 /library/Zend/Application/Bootstrap/Bootstrap.php(77):
  Zend_Controller_Front-dispatch()
  #2 /library/Zend/Application.php(358):
  Zend_Application_Bootstrap_Bootstrap-run()
  #3 /public/index.php(26): Zend_Application-run()
  #4 {main}  
  Request Parameters:
  array (
'controller' = 'elgin',
'action' = 'il',
'garage' = 'index',
'module' = 'default',
  )  
  
  
  Can anyone offer any suggestions?
  
  Thanks
  -Tom Printy
  
  
  
 



Re: [fw-general] Problems using Zend_Dom

2009-10-28 Thread prodigitalson

Well i havent used Zend_Dom either but i assume its using SimpleXml for its
underlying functionality. If this is indeed the case im thinking that maybe
its the namespace... try removing the xml namespace prefix from your xpath
string. I know simpleXML requires a fully expanded prefix when using an
xpath query. While i would hope this isnt the case with the xml namespace
its worth a shot...



oportell wrote:
 
 Hi,
 
 Is there an easy way for doing a search in an XML file?
 
 I have an TMX file with a language list:
 
 ?xml version=1.0 ?
 tmx version=1.4
header creationtool=hand made
   creationtoolversion=1.0.0
   datatype=winres
   segtype=sentence
   adminlang=ca
   srclang=ca
   o-tmf=abc
/header
body
   tu tuid=de datatype=plaintext
  tuv xml:lang=casegalemany/seg/tuv
  tuv xml:lang=essegalemán/seg/tuv
  tuv xml:lang=ensegGerman/seg/tuv
   /tu
   tu tuid=en datatype=plaintext
  tuv xml:lang=caseganglès/seg/tuv
  tuv xml:lang=esseginglés/seg/tuv
  tuv xml:lang=ensegEnglish/seg/tuv
   /tu
/body
 /tmx
 
 And I would like to get all languages (for example from tuv nodes which
 have xml:lang='en') that match a query text introduced in an AJAX form.
 
 For testing purposes (I never used Zend_Dom before) i have written the
 following code in the search action in order to match all tuv nodes with
 language en:
 
 $xmlfile = BASE_PATH . '/language/all_languages.tmx';
 if (file_exists($xmlfile)) {
$xml = file_get_contents($xmlfile);
$dom = new Zend_Dom_Query();
$dom-setDocumentXml($xml);
$xpath = //t...@xml:lang='en'];
$results = $dom-queryXPath($xpath);
$rows = count($results);
 }
 
 But $rows always gets a value of 1. Why is that?
 And... what xpath expression should I use to match the query text entered
 in the AJAX form?
 
 Thanks in advance,
 
 Oriol  
 

-- 
View this message in context: 
http://www.nabble.com/Problems-using-Zend_Dom-tp26093704p26101728.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Session problem

2009-10-28 Thread Vibhor Singh
Hi folks,

 

I am having  a problem using Zend_Session in my app. Using ZF version 1.9.1

 

I am using  the following code to set a members data in session for a period
of 2 hrs after successful login

 

Zend_Session::rememberMe(60*60*2);

 

However, the session goes out in merely 5 -10 mins. 

I am not able to figure out the problem can someone help me in this.

Thanks in advance

 

Regards,

Vibhor