Re: [fw-general] How to: Zend Dojo Form Dependent Selects (e.g. Country/City)

2009-11-11 Thread zig2na

Can I please get what makes up the URL: { url:
"/data/lookup/table/city/filterName/countryId/filterValue/" +
dijit.byId("countryId").value }??

My first table name is 'region' wth the ff fields: id, name and the second
is 'site' with: id, site_name.

I only understand up to the 'lookup' part in the URL which is the controller
action to output JSON. From 'table' to 'filterValue' in the URL is abit
confusing so llitle explaination will help to understand how the URL was
derived and the correct URL to put in.

Counting on your quick response.

Thanks 



denormalized wrote:
> 
> 
> zig2na wrote:
>> 
>> Im using Zend_Dojo_Data and in a controller for my datasource but it
>> still can't filter, Im sure having issues with the onchange
>> 'dojo.data.ItemFileReadStore ' url. Is possible to break the onchange url
>> down me, that only seems to be the problem now. Thanks
>> 
> 
> The onChange url needs to send back a Json-encoded response- basically an
> array of rows containing name-value pairs passed to Zend_Json_Encoder.
> 
> In my "data" controller I have a generic "lookup" action.  All you need is
> a model that can return rows of city names and id's.
> 
>   public function lookupAction()
>   {
>   $tableName = $this->_request->getParam('table');
>   $filterName = $this->_request->getParam('filterName');
>   $filterValue = $this->_request->getParam('filterValue');
>   
>   if (empty($tableName))
>   {
>   return;
>   }
>   
> // TODO:  Should be generic for all lookup tables
>   if ('city' === $tableName) {
>   $_model = new NAME_OF_YOUR_CITY_MODEL();
> // getLookup just returns the rows that match the filter, in this case a
> countryId
>   $data = $_model->getLookup($filterName, $filterValue);  
> 
>   
>   if (null !== $data) {
>   $items = array();
>   foreach ($data as $row) {
>   $items[] = array('label' => $row->name, 'name' 
> => $row->name,
> 'key' => $row->cityId);
>   }
>   $final = array(
>   'identifier' => 'key',
>   'items' => $items,
>   );
>   echo Zend_Json_Encoder::encode($final);
>   }
>   }
>   }
> 

-- 
View this message in context: 
http://old.nabble.com/How-to%3A--Zend-Dojo-Form-Dependent-Selects-%28e.g.-Country-City%29-tp25269984p26309473.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to: Zend Dojo Form Dependent Selects (e.g. Country/City)

2009-11-11 Thread zig2na

Can please get what makes up the URL: { url:
"/data/lookup/table/city/filterName/countryId/filterValue/" +
dijit.byId("countryId").value }??

I only understand up to the 'lookup' in URL which is the controller action.
>From 'table' in the to 'filterValue' in the URL a llitle explaination will
me to understand how that was derived.

Counting on your quick response.

Thanks


zig2na wrote:
> 
> Thanks for your quick responds. I am able to list items using the
> 'Zend_Dojo_Form_Element_FilteringSelect' fields with 'autoCompleteDojo'
> which outputs json in my controller action. What I need now is to
> understand the following line of code so that I can supply the correct URL
> for the filtering to work:
> 
> ->setAttrib('onchange', 'dijit.byId("cityId").store = new
> dojo.data.ItemFileReadStore({ url:
> "/data/lookup/table/city/filterName/countryId/filterValue/" +
> dijit.byId("countryId").value });'); 
> 
> The normal URL I use to output the list is: "index/sites" in the second
> field and "index/region" in the first field.
> 
> Thanks alot  for your help.
> 
> 
> 
> 
> denormalized wrote:
>> 
>> 
>> zig2na wrote:
>>> 
>>> Im using Zend_Dojo_Data and in a controller for my datasource but it
>>> still can't filter, Im sure having issues with the onchange
>>> 'dojo.data.ItemFileReadStore ' url. Is possible to break the onchange
>>> url down me, that only seems to be the problem now. Thanks
>>> 
>> 
>> The onChange url needs to send back a Json-encoded response- basically an
>> array of rows containing name-value pairs passed to Zend_Json_Encoder.
>> 
>> In my "data" controller I have a generic "lookup" action.  All you need
>> is a model that can return rows of city names and id's.
>> 
>>  public function lookupAction()
>>  {
>>  $tableName = $this->_request->getParam('table');
>>  $filterName = $this->_request->getParam('filterName');
>>  $filterValue = $this->_request->getParam('filterValue');
>>  
>>  if (empty($tableName))
>>  {
>>  return;
>>  }
>>  
>> // TODO:  Should be generic for all lookup tables
>>  if ('city' === $tableName) {
>>  $_model = new NAME_OF_YOUR_CITY_MODEL();
>> // getLookup just returns the rows that match the filter, in this case a
>> countryId
>>  $data = $_model->getLookup($filterName, $filterValue);  
>> 
>>  
>>  if (null !== $data) {
>>  $items = array();
>>  foreach ($data as $row) {
>>  $items[] = array('label' => $row->name, 'name' 
>> => $row->name,
>> 'key' => $row->cityId);
>>  }
>>  $final = array(
>>  'identifier' => 'key',
>>  'items' => $items,
>>  );
>>  echo Zend_Json_Encoder::encode($final);
>>  }
>>  }
>>  }
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to%3A--Zend-Dojo-Form-Dependent-Selects-%28e.g.-Country-City%29-tp25269984p26309099.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Incredible memory usage on public server, normal on dev server

2009-11-11 Thread fab2008


fab2008 wrote:
> 
> 
> Luke Richards wrote:
>> 
>> 
>> class Yourlibrary_Mail_Transport_Smtp extends Zend_Mail_Transport_Smtp
>> {
>> /**
>>  * Send a mail using this transport
>>  *
>>  * @param  Zend_Mail $mail
>>  * @access public
>>  * @return void
>>  * @throws Zend_Mail_Transport_Exception if mail is empty
>>  */
>> public function send(Zend_Mail $mail)
>> {
>> $connection = $this->getConnection();
>> if ($connection instanceof Zend_Mail_Protocol_Smtp) {
>> $connection->resetLog();
>> }
>> return parent::send($mail);
>> }
>> }
>> 
>> Hope that helps someone.
>> 
> 
> It has helped me :-) It works...
> 
> When I send a lot of mails the log grows and grows without limit. The big
> memory request was not for the $request var, but for reallocation of $_log
> field.
> 
> Thank you very much for your hint.
> 
> 

It definitely works, here are the results (sending about 1200 mails):

Yesterday: 2009-11-10T15:34:28-05:00 INFO (6): Peak memory usage during
script: 129MB
Today: 2009-11-11T15:13:28-05:00 INFO (6): Peak memory usage during script:
17MB

Thank you again :-)

-- 
View this message in context: 
http://old.nabble.com/Incredible-memory-usage-on-public-server%2C-normal-on-dev-server-tp26215767p26309036.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] zend form addError

2009-11-11 Thread Ralikwen

Hi,
I am trying to add custom error to an element. The error is added fine, but
its format is different from the errors that normally occure in the form.

When an error occurs in the form $form->getMessages () returns an array with
the error codes as the key:

["usr_passwd"] => array(3) {
["regexNotMatch"] => string(86) "message1"
["stringLengthTooShort"] => string(51) "message2"
["isEmpty"] => string(26) "message3"
  }

When I add an error with addError I don't know how to set the key, it seems
that the input is automatically interpreted as a string so I get numerical
keys:

["usr_uname"] => array(2) {
[0] => string(3) "bbb"
[1] => string(3) "ddd"
  }


How can I add an error as an array with a key so that the final error format
in the form would be identical no matter where it comes from?

Thanks for the help.
SWK

-- 
View this message in context: 
http://old.nabble.com/zend-form-addError-tp26304909p26304909.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Chrome always loads default controller and action before actual request

2009-11-11 Thread zpc


Jared Williams-3 wrote:
> 
>  
> Sure it not just requesting http://domain/favicon.ico ?
> 
> Jared 
> 
> 

Thanks.  That's exactly what's happening.  I have no favicon, and my error
controller redirect 404s to '/'.
-- 
View this message in context: 
http://old.nabble.com/Chrome-always-loads-default-controller-and-action-before-actual-request-tp26289065p26302991.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Locale

2009-11-11 Thread asagala


By the way you can set the locale string in the constructor. This works in
the bootstrap file

$locale = new Zend_Locale('en_US');
Zend_Registry::set('Zend_Locale', $locale);

I get the issue when I try to overwrite the value in my controllers


asagala wrote:
> 
> 
> That still doesnt work. 
> 
> 
> thomasW wrote:
>> 
>> According to manual the registry key 'Zend_Locale' has to be an instance
>> of 
>> Zend_Locale.
>> 'fr_CA' may be a locale, but it's not an instance of Zend_Locale.
>> 
>> So when you want to change the application wide locale afterwards you
>> need 
>> to change the instance and not the registry content.
>> 
>> $locale = Zend_Registry::get('Zend_Locale');
>> $locale->setLocale('fr_CA');
>> Zend_Registry::set('Zend_Locale', $locale);
>> 
>> Because giving a string does not overwrite the content of the set
>> instance.
>> 
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>> 
>> 
>> - Original Message - 
>> From: "asagala" 
>> To: 
>> Sent: Friday, November 06, 2009 5:32 PM
>> Subject: Re: [fw-general] Zend_Locale
>> 
>> 
>>>
>>>
>>> Also tried this
>>> $locale = new Zend_Locale('fr_CA');
>>> Zend_Registry::set('Zend_Locale', 'fr_CA');
>>>
>>>
>>> asagala wrote:

 Hi,

 I am currently having an issue with Zend_Locale. I am initializing the
 default in my bootstrap like this

 protected function _initLocale()
 {
 $locale = new Zend_Locale('en_US');
 Zend_Registry::set('Zend_Locale', $locale);

 return $locale;
 }

 and this works fine. However when I try and change the value of the 
 locale
 in my controllers the initial value is not overwritten. Here is how I
 am
 writting the new value to the Zend_Locale key in my controllers

 Zend_Registry::set('Zend_Locale','fr_CA');

 Anyone have a clue?

>>>
>>> -- 
>>> View this message in context: 
>>> http://old.nabble.com/Zend_Locale-tp26230812p26230819.html
>>> Sent from the Zend Framework mailing list archive at Nabble.com. 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Zend_Locale-tp26230812p26302847.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Locale

2009-11-11 Thread asagala


That still doesnt work. 


thomasW wrote:
> 
> According to manual the registry key 'Zend_Locale' has to be an instance
> of 
> Zend_Locale.
> 'fr_CA' may be a locale, but it's not an instance of Zend_Locale.
> 
> So when you want to change the application wide locale afterwards you need 
> to change the instance and not the registry content.
> 
> $locale = Zend_Registry::get('Zend_Locale');
> $locale->setLocale('fr_CA');
> Zend_Registry::set('Zend_Locale', $locale);
> 
> Because giving a string does not overwrite the content of the set
> instance.
> 
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
> 
> 
> - Original Message - 
> From: "asagala" 
> To: 
> Sent: Friday, November 06, 2009 5:32 PM
> Subject: Re: [fw-general] Zend_Locale
> 
> 
>>
>>
>> Also tried this
>> $locale = new Zend_Locale('fr_CA');
>> Zend_Registry::set('Zend_Locale', 'fr_CA');
>>
>>
>> asagala wrote:
>>>
>>> Hi,
>>>
>>> I am currently having an issue with Zend_Locale. I am initializing the
>>> default in my bootstrap like this
>>>
>>> protected function _initLocale()
>>> {
>>> $locale = new Zend_Locale('en_US');
>>> Zend_Registry::set('Zend_Locale', $locale);
>>>
>>> return $locale;
>>> }
>>>
>>> and this works fine. However when I try and change the value of the 
>>> locale
>>> in my controllers the initial value is not overwritten. Here is how I am
>>> writting the new value to the Zend_Locale key in my controllers
>>>
>>> Zend_Registry::set('Zend_Locale','fr_CA');
>>>
>>> Anyone have a clue?
>>>
>>
>> -- 
>> View this message in context: 
>> http://old.nabble.com/Zend_Locale-tp26230812p26230819.html
>> Sent from the Zend Framework mailing list archive at Nabble.com. 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Zend_Locale-tp26230812p26302787.html
Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] zend lucene

2009-11-11 Thread Daniel Latter
Maybe so, but I think the confusion is more likely to come from an
anticipated performance level based (in this case) on previous
experiences with other languages, without really truly understanding
your chosen language in question (in this case PHP)

I would not say you NEED to know all limitations and performance
implications of languages you use, but at least have a base idea. I
think this is taken as red in the manual in some places and therefore
does not need to be stipulated, as the issues in my opinion are at a
lower level than the ZF?

Saying that, the manual does have a section on performance issues, so
maybe there is something in there? I do agree with you though to help
new users it may be worth adding "Limitations" and "Goals" as you
suggest, then people wont be forced to read not very well balanced
articles, but instead hear it straight from the horses mouth so to
speak.

Dan






2009/11/11 Matthew Ratzloff :
> Yes, but there's no "limitations" or "goals" section in the ZSL
> documentation to give people a clear picture of what they can
> reasonably expect or what the use cases are.  I think this causes
> unnecessary confusion.
>
> -Matt
>
> On Wednesday, November 11, 2009, Daniel Latter  wrote:
>>
>> I got the impression that the author used ZL and expected to get the same 
>> performance result akin to using Java. This is where my flawed argument 
>> comes in.  There is no reference to the fundamental difference between the 
>> languages and the performance differences this yields, I am not even talking 
>> about ZL, it's about the fundamental aspects of the two languages.
>> On 10 Nov 2009, at 21:37, Matthew Ratzloff 
>> > 'm...@builtfromsource.com');>> wrote:
>>
>> I guess I don't see how comparing the two is "totally flawed".  You should 
>> compare solutions for the dimensions that matter to your use case--in the 
>> case of large indices, performance will undoubtedly be one of those 
>> dimensions.  I had a similar experience with Zend_Search_Lucene and 
>> concluded that Apache Solr was orders of magnitude more suitable to 
>> enterprise solutions.
>>
>> For a blog or small index, Zend_Search_Lucene is fine, however.  That's not 
>> to disparage it in any way.  PHP is just not well-suited for these kinds of 
>> things.
>>
>> -Matt
>>
>>
>> On Thu, Oct 15, 2009 at 11:40 PM, Daniel Latter 
>> > 
>> wrote:
>>
>> Yeah, it compares PHP to Java which
>> In itself is totally flawed, but I'm sure more smarter people will 
>> articluate this better than me. So hold tight.
>>
>>
>> On 16 Oct 2009, at 05:18, ctx2002 > 'cvml', 'ctx2...@gmail.com');>> wrote:
>>
>>
>>
>> i try use zend lucene as my site search engine, then i have found this
>> article,
>>
>> http://dadabase.de/weblog/archives/2009/07/22/recommendation-dont-use-zend-php-lucene.
>>
>> can any one say something about that article?
>>
>>
>> --
>> View this message in context: 
>> http://www.nabble.com/zend-lucene-tp25919568p25919568.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>>
>>
>>
>


Re: [fw-general] zend lucene

2009-11-11 Thread Matthew Ratzloff
Yes, but there's no "limitations" or "goals" section in the ZSL
documentation to give people a clear picture of what they can
reasonably expect or what the use cases are.  I think this causes
unnecessary confusion.

-Matt

On Wednesday, November 11, 2009, Daniel Latter  wrote:
>
> I got the impression that the author used ZL and expected to get the same 
> performance result akin to using Java. This is where my flawed argument comes 
> in.  There is no reference to the fundamental difference between the 
> languages and the performance differences this yields, I am not even talking 
> about ZL, it's about the fundamental aspects of the two languages.
> On 10 Nov 2009, at 21:37, Matthew Ratzloff 
>  'm...@builtfromsource.com');>> wrote:
>
> I guess I don't see how comparing the two is "totally flawed".  You should 
> compare solutions for the dimensions that matter to your use case--in the 
> case of large indices, performance will undoubtedly be one of those 
> dimensions.  I had a similar experience with Zend_Search_Lucene and concluded 
> that Apache Solr was orders of magnitude more suitable to enterprise 
> solutions.
>
> For a blog or small index, Zend_Search_Lucene is fine, however.  That's not 
> to disparage it in any way.  PHP is just not well-suited for these kinds of 
> things.
>
> -Matt
>
>
> On Thu, Oct 15, 2009 at 11:40 PM, Daniel Latter 
> > 
> wrote:
>
> Yeah, it compares PHP to Java which
> In itself is totally flawed, but I'm sure more smarter people will articluate 
> this better than me. So hold tight.
>
>
> On 16 Oct 2009, at 05:18, ctx2002  'cvml', 'ctx2...@gmail.com');>> wrote:
>
>
>
> i try use zend lucene as my site search engine, then i have found this
> article,
>
> http://dadabase.de/weblog/archives/2009/07/22/recommendation-dont-use-zend-php-lucene.
>
> can any one say something about that article?
>
>
> --
> View this message in context: 
> http://www.nabble.com/zend-lucene-tp25919568p25919568.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>
>
>
>


Re: [fw-general] Zend_Date problem

2009-11-11 Thread Саша Стаменковић
I see, right way would be :

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->toString(Zend_Date::DATES);

Big thanks Thomas!

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 12:06 PM, Thomas Weidner wrote:

> Looks like you didn't use my piece of code to reproduce the problem:
>>
>
> Look like you did not output all date parts.
> Why should I use your code when it's obviously wrong ?
>
> You set the actual date with time, timezone and DST.
> F.e. 2009-11-11 05:00:00+02:00
>
> Then you set a timestamp overwriting the previous date and time but leaving
> timezone and DST.
> This leads to 2009-10-22 10:01:36+02:00.
>
> Then you cut of the time from the instance but still using DST.
>
> Reason:
> You used getDate - this strips the time and returns ONLY date
> 2009-10-22 10:01:36+02:00 -> before
> 2009-10-22 00:00:00 (+02:00->trunking time internally by getDate())
> 2009-10-21 22:00:00 (+00:00-> trunking timezone and DST)
> 2009-10-21 23:00:00 (+01:00 -> trunking DST only by getDate() as a pure
> date without time can not have DST, but adding timezone as it is locale
> dependend, this value is set)
>
> Your problem is that you are mixing date only calculation with date/time
> calculation. By stripping parts in the middle of your calculation you get
> unexpected behaviour.
>
> Why don't you set the time to 0 (setTime() instead of getDate()) or simply
> use the instance as is and output the date only
> (toString(Zend_Date::DATES))?
>
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> - Original Message - From: "Саша Стаменковић" 
> To: "Thomas Weidner" 
> Cc: 
> Sent: Wednesday, November 11, 2009 9:44 AM
>
> Subject: Re: [fw-general] Zend_Date problem
>
>
> Looks like you didn't use my piece of code to reproduce the problem:
>
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString(Zend_Date::DATES);
>
> Using this:
>
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString();
>
> I get
>
> 21 Oct 2009 23:00:00
>
> which is again wrong.
>
> If I understand well, Zend_Date is determining which timezone to use by
> locale passed in constructor. But by looking in constructor docblock I
> figured that it's read from PHP
>
> /**
>* Generates the standard date object, could be a unix timestamp,
> localized date,
>* string, integer, array and so on. Also parts of dates or time are
> supported
>* Always set the default timezone:
> http://php.net/date_default_timezone_set
>* For example, in your bootstrap:
> date_default_timezone_set('America/Los_Angeles');
>* For detailed instructions please look in the docu.
>*
>* @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
> or value of date part to set
>* ,depending on $part.
> If null the actual time is set
>* @param  string  $partOPTIONAL Defines the
> input format of $date
>* @param  string|Zend_Locale  $locale  OPTIONAL Locale for
> parsing input
>* @return Zend_Date
>* @throws Zend_Date_Exception
>*/
>   public function __construct($date = null, $part = null, $locale = null)
>
> and in line #184 it's obvious
>
> // set the timezone and offset for $this
> $zone = @date_default_timezone_get();
> $this->setTimezone($zone);
>
> I use zf 1.9.5.
>
> Regards,
> Saša Stamenković
>
>
> On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner  >wrote:
>
>  Creating the instance affects the timezone.
>> Using set methods affect the timezone.
>> The manual states multiple ways (more than 20?) to affect the timezone.
>>
>> In the code you gave the locale affects the timezone.
>> And we still don't know how your complete date looks like.
>> So all we can do is prediction.
>>
>> And using your code on both locales I get:
>> sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
>> en_GB:string '2009-10-22T10:01:36+02:00' (length=25)
>>
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> - Original Message - From: "Саша Стаменковић" > >
>> To: "Thomas Weidner" 
>>
>> Cc: 
>> Sent: Wednesday, November 11, 2009 8:47 AM
>>
>> Subject: Re: [fw-general] Zend_Date problem
>>
>>
>> How do I set timezone to affect Zend_Date component?
>> I use zend date to create view helper for date formatting.
>>
>> Regards,
>> Saša Stamenković
>>
>>
>> On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner > >wrote:
>>
>>  Sorry, but date_default_timezone_set has no effect on the timezone which
>>
>>> is
>>> actually used by the instance of Zend_Date nor has it effect on DST.
>>> My question was related to the instance not your environment.
>>>
>>> Why don't you output all dateparts from the instance instead of giving
>>> partitial informations ?
>>>
>>> Greetings
>>> Thomas Weidner, I18N Team Le

RE: [fw-general] Chrome always loads default controller and action before actual request

2009-11-11 Thread Jared Williams
 

> -Original Message-
> From: zpc [mailto:zpcha...@gmail.com] 
> Sent: 10 November 2009 19:30
> To: fw-general@lists.zend.com
> Subject: [fw-general] Chrome always loads default controller 
> and action before actual request
> 
> 
> I've found a strange issue with Google Chrome and ZF. Here's 
> the setup:
> 
> Windows XP
> Chrome 3.0.195.32
> Zend Framework 1.9.0
> PHP 5.3.0
> Apache 2.2.11
> 
> In Chrome and only Chrome, if I request http://domain/path, 
> Chrome will invisibly request http://domain/ before it 
> requests the full path.  I thought maybe Chrome always 
> requested the root of the domain before the full path, but 
> I've tested this and it only seems to be happening with my ZF 
> application.  Anyone know what's going on here?
> 
> Perplexedly,
> Zach
> --

Sure it not just requesting http://domain/favicon.ico ?

Jared 



Re: [fw-general] Zend_Date problem

2009-11-11 Thread Thomas Weidner

Looks like you didn't use my piece of code to reproduce the problem:


Look like you did not output all date parts.
Why should I use your code when it's obviously wrong ?

You set the actual date with time, timezone and DST.
F.e. 2009-11-11 05:00:00+02:00

Then you set a timestamp overwriting the previous date and time but leaving 
timezone and DST.

This leads to 2009-10-22 10:01:36+02:00.

Then you cut of the time from the instance but still using DST.

Reason:
You used getDate - this strips the time and returns ONLY date
2009-10-22 10:01:36+02:00 -> before
2009-10-22 00:00:00 (+02:00->trunking time internally by getDate())
2009-10-21 22:00:00 (+00:00-> trunking timezone and DST)
2009-10-21 23:00:00 (+01:00 -> trunking DST only by getDate() as a pure date 
without time can not have DST, but adding timezone as it is locale 
dependend, this value is set)


Your problem is that you are mixing date only calculation with date/time 
calculation. By stripping parts in the middle of your calculation you get 
unexpected behaviour.


Why don't you set the time to 0 (setTime() instead of getDate()) or simply 
use the instance as is and output the date only 
(toString(Zend_Date::DATES))?


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: "Саша Стаменковић" 

To: "Thomas Weidner" 
Cc: 
Sent: Wednesday, November 11, 2009 9:44 AM
Subject: Re: [fw-general] Zend_Date problem


Looks like you didn't use my piece of code to reproduce the problem:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString(Zend_Date::DATES);

Using this:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString();

I get

21 Oct 2009 23:00:00

which is again wrong.

If I understand well, Zend_Date is determining which timezone to use by
locale passed in constructor. But by looking in constructor docblock I
figured that it's read from PHP

/**
* Generates the standard date object, could be a unix timestamp,
localized date,
* string, integer, array and so on. Also parts of dates or time are
supported
* Always set the default timezone:
http://php.net/date_default_timezone_set
* For example, in your bootstrap:
date_default_timezone_set('America/Los_Angeles');
* For detailed instructions please look in the docu.
*
* @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
or value of date part to set
* ,depending on $part.
If null the actual time is set
* @param  string  $partOPTIONAL Defines the
input format of $date
* @param  string|Zend_Locale  $locale  OPTIONAL Locale for
parsing input
* @return Zend_Date
* @throws Zend_Date_Exception
*/
   public function __construct($date = null, $part = null, $locale = null)

and in line #184 it's obvious

// set the timezone and offset for $this
$zone = @date_default_timezone_get();
$this->setTimezone($zone);

I use zf 1.9.5.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner 
wrote:



Creating the instance affects the timezone.
Using set methods affect the timezone.
The manual states multiple ways (more than 20?) to affect the timezone.

In the code you gave the locale affects the timezone.
And we still don't know how your complete date looks like.
So all we can do is prediction.

And using your code on both locales I get:
sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
en_GB:string '2009-10-22T10:01:36+02:00' (length=25)


Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: "Саша Стаменковић" 
To: "Thomas Weidner" 

Cc: 
Sent: Wednesday, November 11, 2009 8:47 AM

Subject: Re: [fw-general] Zend_Date problem


How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner wrote:

 Sorry, but date_default_timezone_set has no effect on the timezone which

is
actually used by the instance of Zend_Date nor has it effect on DST.
My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving
partitial informations ?

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: "Саша Стаменковић" 
To: "kobsu" 
Cc: 
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem



@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:


 Try

Zend_Date::setOptions(array('fix_dst' => true));

before
$date = new Zend_Date();


umpirsky wrote:
>
> Hi zf community.
>
> This cod

[fw-general] ZEND_Search_Lucene Range Query

2009-11-11 Thread tkummer

Hello all,

I have a Lucene Index with a field containing a custom built date format
like
20090105223356 for 2009, May, fist 33:33:56 hour.

my Index contains 25000 documents.
I'm using th ..Common_TextNum_CaseInsensitive Analyzer.
A range query takes minutes (at least forces my soap client to timeout)
example:
releasedate:[2009010100 TO 20090103235959]
to search for data within 3 days.
Every document contains a unique data/time. 

When I search with a java webapp from (Luke from getopt.org)on the same
index I get the result immediately, even If I search for documents from the
years 1955 to 2050, which means all the 25000.
What's wrong here?
Thanks in advance
thorsten
-- 
View this message in context: 
http://old.nabble.com/ZEND_Search_Lucene-Range-Query-tp26299178p26299178.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] zend lucene

2009-11-11 Thread Daniel Latter


I got the impression that the author used ZL and expected to get the  
same performance result akin to using Java. This is where my flawed  
argument comes in.  There is no reference to the fundamental  
difference between the languages and the performance differences this  
yields, I am not even talking about ZL, it's about the fundamental  
aspects of the two languages.


On 10 Nov 2009, at 21:37, Matthew Ratzloff   
wrote:


I guess I don't see how comparing the two is "totally flawed".  You  
should compare solutions for the dimensions that matter to your use  
case--in the case of large indices, performance will undoubtedly be  
one of those dimensions.  I had a similar experience with  
Zend_Search_Lucene and concluded that Apache Solr was orders of  
magnitude more suitable to enterprise solutions.


For a blog or small index, Zend_Search_Lucene is fine, however.   
That's not to disparage it in any way.  PHP is just not well-suited  
for these kinds of things.


-Matt

On Thu, Oct 15, 2009 at 11:40 PM, Daniel Latter  
 wrote:

Yeah, it compares PHP to Java which
In itself is totally flawed, but I'm sure more smarter people will  
articluate this better than me. So hold tight.




On 16 Oct 2009, at 05:18, ctx2002  wrote:


i try use zend lucene as my site search engine, then i have found this
article,

http://dadabase.de/weblog/archives/2009/07/22/recommendation-dont-use-zend-php-lucene 
.


can any one say something about that article?


--
View this message in context: 
http://www.nabble.com/zend-lucene-tp25919568p25919568.html
Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Zend_Date problem

2009-11-11 Thread Саша Стаменковић
Looks like you didn't use my piece of code to reproduce the problem:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString(Zend_Date::DATES);

Using this:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString();

I get

21 Oct 2009 23:00:00

which is again wrong.

If I understand well, Zend_Date is determining which timezone to use by
locale passed in constructor. But by looking in constructor docblock I
figured that it's read from PHP

/**
 * Generates the standard date object, could be a unix timestamp,
localized date,
 * string, integer, array and so on. Also parts of dates or time are
supported
 * Always set the default timezone:
http://php.net/date_default_timezone_set
 * For example, in your bootstrap:
date_default_timezone_set('America/Los_Angeles');
 * For detailed instructions please look in the docu.
 *
 * @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
or value of date part to set
 * ,depending on $part.
If null the actual time is set
 * @param  string  $partOPTIONAL Defines the
input format of $date
 * @param  string|Zend_Locale  $locale  OPTIONAL Locale for
parsing input
 * @return Zend_Date
 * @throws Zend_Date_Exception
 */
public function __construct($date = null, $part = null, $locale = null)

and in line #184 it's obvious

// set the timezone and offset for $this
$zone = @date_default_timezone_get();
$this->setTimezone($zone);

I use zf 1.9.5.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner wrote:

> Creating the instance affects the timezone.
> Using set methods affect the timezone.
> The manual states multiple ways (more than 20?) to affect the timezone.
>
> In the code you gave the locale affects the timezone.
> And we still don't know how your complete date looks like.
> So all we can do is prediction.
>
> And using your code on both locales I get:
> sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
> en_GB:string '2009-10-22T10:01:36+02:00' (length=25)
>
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> - Original Message - From: "Саша Стаменковић" 
> To: "Thomas Weidner" 
>
> Cc: 
> Sent: Wednesday, November 11, 2009 8:47 AM
>
> Subject: Re: [fw-general] Zend_Date problem
>
>
> How do I set timezone to affect Zend_Date component?
> I use zend date to create view helper for date formatting.
>
> Regards,
> Saša Stamenković
>
>
> On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner  >wrote:
>
>  Sorry, but date_default_timezone_set has no effect on the timezone which
>> is
>> actually used by the instance of Zend_Date nor has it effect on DST.
>> My question was related to the instance not your environment.
>>
>> Why don't you output all dateparts from the instance instead of giving
>> partitial informations ?
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> - Original Message - From: "Саша Стаменковић" > >
>> To: "kobsu" 
>> Cc: 
>> Sent: Wednesday, November 11, 2009 7:59 AM
>> Subject: Re: [fw-general] Zend_Date problem
>>
>>
>>
>> @Thomas Weidner
>> *
>> *
>> date_default_timezone_set('Europe/Stockholm'); is in bootstrap.
>>
>> @kobsu
>> *
>> *
>> *Same result :(
>> *
>> Regards,
>> Saša Stamenković
>>
>>
>> On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:
>>
>>
>>  Try
>>> Zend_Date::setOptions(array('fix_dst' => true));
>>>
>>> before
>>> $date = new Zend_Date();
>>>
>>>
>>> umpirsky wrote:
>>> >
>>> > Hi zf community.
>>> >
>>> > This code:
>>> >
>>> > $date = new Zend_Date(null, null, $locale);
>>> > $date->setTimestamp(1256198496);
>>> > echo $date->getDate()->toString(Zend_Date::DATES);
>>> >
>>> > gives date 21.10.2009. for sr_RS locale (similar for other locales), >
>>> for
>>> > en_GB it gives 21 Oct 2009.
>>> > I expect 22 Oct 2009. it's whole day missed?!?!?
>>> >
>>> > Any idea?
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>
>>>
>>>
>>>
>>
>


Re: [fw-general] Zend_Date problem

2009-11-11 Thread Thomas Weidner

Creating the instance affects the timezone.
Using set methods affect the timezone.
The manual states multiple ways (more than 20?) to affect the timezone.

In the code you gave the locale affects the timezone.
And we still don't know how your complete date looks like.
So all we can do is prediction.

And using your code on both locales I get:
sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
en_GB:string '2009-10-22T10:01:36+02:00' (length=25)

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - 
From: "Саша Стаменковић" 

To: "Thomas Weidner" 
Cc: 
Sent: Wednesday, November 11, 2009 8:47 AM
Subject: Re: [fw-general] Zend_Date problem


How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner 
wrote:


Sorry, but date_default_timezone_set has no effect on the timezone which 
is

actually used by the instance of Zend_Date nor has it effect on DST.
My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving
partitial informations ?

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

- Original Message - From: "Саша Стаменковић" 
To: "kobsu" 
Cc: 
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem



@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:



Try
Zend_Date::setOptions(array('fix_dst' => true));

before
$date = new Zend_Date();


umpirsky wrote:
>
> Hi zf community.
>
> This code:
>
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString(Zend_Date::DATES);
>
> gives date 21.10.2009. for sr_RS locale (similar for other locales), 
> for

> en_GB it gives 21 Oct 2009.
> I expect 22 Oct 2009. it's whole day missed?!?!?
>
> Any idea?
>

--
View this message in context:
http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
Sent from the Zend Framework mailing list archive at Nabble.com.