[fw-general] xml to json--- how to get rid of unnecessary fields in a created json
hi all, I have a xml file: shahrzad shahab Now I want to use context switch to return json >> ( ->addActionContext('index', 'json')) ->> json go to extjs to show in a grid... ok. in index action, I get xml file.. convert it to json by contextSwitch, but json file have some fields that I don't need them and must delete to show correctly... for example here how to get rid of items, item,.. in json file, I just want to return {[{firstname:'shahrzad'},{firstname:'shahab'}]} in json???!! Thanks, Shahrzad
Re: [fw-general] Zend_Paginator and normalization of pageNumber
Yep, this was intentional behavior. Luckily, it's easy enough to provide your own functionality by extending the class. The method is quite short: /** * Brings the page number in range of the paginator. * * @param integer $pageNumber * @return integer */ public function normalizePageNumber($pageNumber) { if ($pageNumber < 1) { $pageNumber = 1; } $pageCount = $this->count(); if ($pageCount > 0 and $pageNumber > $pageCount) { $pageNumber = $pageCount; } return $pageNumber; } -Matt On Mon, May 17, 2010 at 11:41 AM, Aleksey Zapparov wrote: > Hello, > > Returning last page if requested page number is higher than total pages > amount is some kind of time-defined standard. More than that, normally > user should not enter page number manually. > > > 2010/5/17 Bartosz Maciaszek : > > Hi all, > > > > I just had a bit of work to do with Zend_Paginator (nb. with > > Zend_Db_Table_Select) and I noticed some weird behaviour. Let's take > > this simple code as an example: > > > > $paginator = Zend_Paginator::factory($table->select()->where('foo is > null')); > > $paginator->setCurrentPageNumber(1); > > > > If the query returns more than default number of rows in Paginator > > (10) then I get Iterator with 10 first elements and that's quite all > > right. > > > > Now, imagine that query returns 100 rows (which makes 10 pages in > > default configuration). User requests page number 20: > > > > $paginator->setCurrentPageNumber(20); > > > > As a result I get 10 *last* rows (exactly the same when requesting > > 10th page). My expectation is to get empty Iterator, because page > > number 20 does not exists. > > > > I dig into the code and I found, that's because of > > normalizePageNumber() method which changes my requested 20 into 10. > > > > Is that behaviour really helpful? I think it should be parametrized > > because sometimes (i.e. in my case - fetching next pages while > > scrolling the page down) it completely distorts the effect - at the > > end I get last page every time I request the next one. > > > > What do you think? > > > > Regards, > > Bartosz > > > > -- > > Never regret. If it's good - it's wonderful. If it's bad - it's > experience. > > > > > > -- > Sincerely yours, > Aleksey V. Zapparov A.K.A. ixti > FSF Member #7118 > Mobile Phone: +34 617 179 344 > Homepage: http://www.ixti.ru > JID: zappa...@jabber.ru > > *Origin: Happy Hacking! >
[fw-general] ZendCon CFP Ends Today!
Just a reminder, everyone: The ZendCon 2010 Call for Papers ends today! http://dz.zend.com/a/12105 Get your abstracts in -- and hopefully I'll get a chance to meet you in November! -ralph
[fw-general] Saving many Zend_Db_Table_Rows in for loop
I have this: $row = $table->find($id); // Zend_Db_Table $row->setReadOnly(false); $row->status = 'ACTIVE'; $row->save(); In for loop. When having for instance 20 iterations, it happends to get 2010-05-17T08:49:07+02:00 ERR (3): exception 'Zend_Db_Adapter_Mysqli_Exception' with message 'User *** already has more than 'max_user_connections' active connections' in Zend/Db/Adapter/Mysqli.php:333 Stack trace: #0 Zend/Db/Adapter/Abstract.php(832): Zend_Db_Adapter_Mysqli->_connect() #1 Zend/Db/Adapter/Abstract.php(902): Zend_Db_Adapter_Abstract->quote('376', NULL) #2 Zend/Db/Select.php(1000): Zend_Db_Adapter_Abstract->quoteInto('table...', '376', NULL) #3 Zend/Db/Select.php(475): Zend_Db_Select->_where('table...', '376', NULL, true) ... I am on shared FreeBSD hosting. Is it possible that there is some connection overhead that code like this can generate? Regards, Saša Stamenković
Re: [fw-general] Serving XHTML with the correct mime-type
On Fri, May 14, 2010 at 5:23 PM, Aleksey Zapparov wrote: > Hello, > > As far as I can see it's valid, but not very recommended. Or my english is > not good enogh :)) XHTML 1.0 states: > > If it encounters an entity reference (other than one of the entities defined > in > this recommendation or in the XML recommendation) for which the user agent > has processed no declaration (which could happen if the declaration is in the > external subset which the user agent hasn't read), the entity reference should > be processed as the characters (starting with the ampersand and ending with > the semi-colon) that make up the entity reference. > > And XHTML DTD has nbsp entity reference as: > > > > Correct me if I'm wrong or misunderstanding something... > > Your e-mail prompted me to dig a little deeper. I had missed the fact that the XHTML DTD imports an external entity reference that includes nbsp. (I had initially just scanned the DTD itself for the entity.) This was compounded by the fact that the declaration I had at the top of the layout inadvertently included standalone="yes" which was causing Firefox not to resolve those external entity references. I changed to and now the site appears to be working in Firefox (3.6.3), Google Chrome (4.1), Opera (10.53), Safari (4.0.5) and even Internet Explorer 7, all using the application/xhtml+xml mime-type. I guess support is getting better than I thought it was at this point. Andrew
Re: [fw-general] Zend_Paginator and normalization of pageNumber
Hello, Returning last page if requested page number is higher than total pages amount is some kind of time-defined standard. More than that, normally user should not enter page number manually. 2010/5/17 Bartosz Maciaszek : > Hi all, > > I just had a bit of work to do with Zend_Paginator (nb. with > Zend_Db_Table_Select) and I noticed some weird behaviour. Let's take > this simple code as an example: > > $paginator = Zend_Paginator::factory($table->select()->where('foo is null')); > $paginator->setCurrentPageNumber(1); > > If the query returns more than default number of rows in Paginator > (10) then I get Iterator with 10 first elements and that's quite all > right. > > Now, imagine that query returns 100 rows (which makes 10 pages in > default configuration). User requests page number 20: > > $paginator->setCurrentPageNumber(20); > > As a result I get 10 *last* rows (exactly the same when requesting > 10th page). My expectation is to get empty Iterator, because page > number 20 does not exists. > > I dig into the code and I found, that's because of > normalizePageNumber() method which changes my requested 20 into 10. > > Is that behaviour really helpful? I think it should be parametrized > because sometimes (i.e. in my case - fetching next pages while > scrolling the page down) it completely distorts the effect - at the > end I get last page every time I request the next one. > > What do you think? > > Regards, > Bartosz > > -- > Never regret. If it's good - it's wonderful. If it's bad - it's experience. > -- Sincerely yours, Aleksey V. Zapparov A.K.A. ixti FSF Member #7118 Mobile Phone: +34 617 179 344 Homepage: http://www.ixti.ru JID: zappa...@jabber.ru *Origin: Happy Hacking!
Re: [fw-general] Zend_Paginator and normalization of pageNumber
I'm not sure if it's useful, but you can get around it by doing a quick test: if ($page > $paginator->count()) return null; -- Hector On Mon, May 17, 2010 at 10:54 AM, Bartosz Maciaszek < bartosz.macias...@gmail.com> wrote: > Hi all, > > I just had a bit of work to do with Zend_Paginator (nb. with > Zend_Db_Table_Select) and I noticed some weird behaviour. Let's take > this simple code as an example: > > $paginator = Zend_Paginator::factory($table->select()->where('foo is > null')); > $paginator->setCurrentPageNumber(1); > > If the query returns more than default number of rows in Paginator > (10) then I get Iterator with 10 first elements and that's quite all > right. > > Now, imagine that query returns 100 rows (which makes 10 pages in > default configuration). User requests page number 20: > > $paginator->setCurrentPageNumber(20); > > As a result I get 10 *last* rows (exactly the same when requesting > 10th page). My expectation is to get empty Iterator, because page > number 20 does not exists. > > I dig into the code and I found, that's because of > normalizePageNumber() method which changes my requested 20 into 10. > > Is that behaviour really helpful? I think it should be parametrized > because sometimes (i.e. in my case - fetching next pages while > scrolling the page down) it completely distorts the effect - at the > end I get last page every time I request the next one. > > What do you think? > > Regards, > Bartosz > > -- > Never regret. If it's good - it's wonderful. If it's bad - it's experience. >
[fw-general] Zend_Paginator and normalization of pageNumber
Hi all, I just had a bit of work to do with Zend_Paginator (nb. with Zend_Db_Table_Select) and I noticed some weird behaviour. Let's take this simple code as an example: $paginator = Zend_Paginator::factory($table->select()->where('foo is null')); $paginator->setCurrentPageNumber(1); If the query returns more than default number of rows in Paginator (10) then I get Iterator with 10 first elements and that's quite all right. Now, imagine that query returns 100 rows (which makes 10 pages in default configuration). User requests page number 20: $paginator->setCurrentPageNumber(20); As a result I get 10 *last* rows (exactly the same when requesting 10th page). My expectation is to get empty Iterator, because page number 20 does not exists. I dig into the code and I found, that's because of normalizePageNumber() method which changes my requested 20 into 10. Is that behaviour really helpful? I think it should be parametrized because sometimes (i.e. in my case - fetching next pages while scrolling the page down) it completely distorts the effect - at the end I get last page every time I request the next one. What do you think? Regards, Bartosz -- Never regret. If it's good - it's wonderful. If it's bad - it's experience.
[fw-general] Re: Scrum app (using ZF)?
Any update on this Matthew? I'm looking forward to digging through the code. See you tomorrow, JK - Jeremy Kendall Web Developer & Entrepreneur http://jeremykendall.net http://jeremykendall.net -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Scrum-app-using-ZF-tp1477318p2220052.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Apache Cassandra and ZF
Either way, however you want to do it. I switched jobs recently so don't have as much time to work on it as I'd like, but I can find time. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Apache-Cassandra-and-ZF-tp1015266p2219733.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Use Zend_Queue for sending mails
On 05/14/2010 11:36 AM, Ralf Eggert wrote: Hi, I want to use Zend_Queue to send bulk mails (newsletters). These newsletters are individualized. I think I have two general options how to handle this: a) Create all Zend_Mail objects and send them serialized to the Zend_Queue. When the queue is processed, I only need to send these mails out. b) Just send the parameters in the Zend_Queue (user id, newsletter id). When the queue is processed I create the Zend_Mail objects from these parameters and send them out. If I were to use Zend_Queue, I'd recommend option b. If you want to take a look at how we do it, visit http://projects.binaryvibes.co.in/repositories/entry/bizsense/trunk/application/modules/default/models/Newsletter/Message/Queue.php We don't use Zend_Queue though. We store all the required information in message_queue table and process the queue via cron. -- With warm regards, Sudheer. S Tech stuff: http://techchorus.net Business: http://binaryvibes.co.in
Re: [fw-general] Re: Apache Cassandra and ZF
I'd have a lot of feedback, if you want. :) I could open issues on github or fork and send you a pull request. On Wed, Feb 24, 2010 at 11:20 PM, James Bathgate wrote: > > I'm more than willing to keep working on this library, but I need direction > to know what everyone would be looking for. It's intended just to be a thin > wrapper to the Cassandra Thrift library right now. > -- > View this message in context: > http://n4.nabble.com/Apache-Cassandra-and-ZF-tp1015266p1568059.html > Sent from the Zend Framework mailing list archive at Nabble.com. >
[fw-general] Logging in unit test with route Hostname
Im working on a login with user accounts as a subdomain, a la basecamp account-name.domain.com - Shows the account login screen for that account A route is setup to detect the subdomain and creates the account parameter as such; and redirects to the session controller $hostnameRoute = new Zend_Controller_Router_Route_Hostname( ':account.domain.local', array( 'controller' => 'session', 'action' => 'index' ) ); Problem is my testing, at the moment if the user logs in successfully they are redirected to the account controller. Here is how my test case is set public function testUserCanLogin() { $this->request->setParam('account', 'algiz'); $this->request->setPost(array( 'username' => 'username', 'password' => 'changeme' )); $this->dispatch("/session"); $this->assertRedirectTo("/account"); } Thing is via the browser this works, however the test case always fails. Any help is much appreciated -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Logging-in-unit-test-with-route-Hostname-tp2219474p2219474.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Re: Apache Cassandra and ZF
Hi Hector, Any news regarding this? I've seen no other post in this list about it. Matthew, With this nosql frenzy (couch, mongo and cassandra) are there any plans or proposals for ZF 1.x in place? On Wed, Feb 24, 2010 at 12:32 PM, Hector Virgen wrote: > Here's the link, hosted on github: > > http://github.com/julesbravo/Zend_Cassandra > > If you have any questions feel free to ask James (julesbravo, the author). > > -- > Hector > > > > On Wed, Feb 24, 2010 at 2:13 AM, till wrote: > >> +1 here. Cassandra, yes please. :) >> >> Till >> >> On Wed, Feb 24, 2010 at 6:20 AM, Weagle >> wrote: >> > >> > Hey Matthew and Hector, >> > >> > Keep me posted on when you begin. Our team is highly interested in >> helping >> > with the development. >> > >> > Cheers, >> > Will >> > >> > >> > Hector Virgen wrote: >> >> >> >> Thanks, Matthew! We'll be submitting our proposal to the wiki next week >> >> after the holiday break. I hope you all have a good weekend :) >> >> >> >> -- >> >> Hector >> >> >> >> >> >> On Fri, Jan 15, 2010 at 1:40 PM, Matthew Weier O'Phinney >> >> wrote: >> >> >> >>> -- Hector Virgen wrote >> >>> (on Friday, 15 January 2010, 12:48 PM -0800): >> >>> > A team member and I are starting development for an adapter to >> connect >> >>> to >> >>> > Apache Cassandra[1] databases from within the Zend Framework. We >> would >> >>> like to >> >>> > share our work by contributing it to ZF when it's complete. We are >> also >> >>> > interested in getting community feedback to aid us in its >> development. >> >>> Some of >> >>> > the questions we have before we write up the proposal are: >> >>> > >> >>> > • Do we need to be concerned with licensing issues? Cassandra uses >> >>> the >> >>> Apache >> >>> > 2.0 license[2] while ZF uses the new BSD license[3]. >> >>> >> >>> Since they're two different languages, likely not. From what I >> >>> understand, anyways, the Apache and BSD licenses are pretty similar >> and >> >>> usually compatible. >> >>> >> >>> > • Cassandra has not been formally released (it's still >> incubating). >> >>> Will this >> >>> > be an issue? >> >>> >> >>> No -- we have a number of components targeting services that are still >> >>> pre-release, and have even more planned. >> >>> >> >>> > If you are interested in helping or already have a solution in place >> >>> > please let us know. Thanks! >> >>> >> >>> I'm assuming you already are familiar with our proposal process; if >> >>> not, email me and I'll point you in the right direction. >> >>> >> >>> Looking forward to seeing more on this front! >> >>> >> >>> -- >> >>> Matthew Weier O'Phinney >> >>> Project Lead| matt...@zend.com >> >>> Zend Framework | http://framework.zend.com/ >> >>> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc >> >>> >> >> >> >> >> > >> > -- >> > View this message in context: >> http://n4.nabble.com/Apache-Cassandra-and-ZF-tp1015266p1566972.html >> > Sent from the Zend Framework mailing list archive at Nabble.com. >> > >> > >
Re: [fw-general] Use Zend_Queue for sending mails
On Mon, May 17, 2010 at 6:41 AM, Ralf Eggert wrote: > Hi Jurian, > >> I'd store only the data. The instance of Zend_Mail can be reused with new >> data >> to send the next mail, so you don't need to instantiate Zend_Mail for each >> new >> email. > > That is the solution I am implementing now. Its also a matter of > performance since I need to create almost 50.000 mails. Creating these > mails and saving them in a Zend_Queue will take much more time than just > saving some primary keys. > > Thanks and best regards, > > Ralf > Maybe you want to look at Mail_Queue: http://pear.php.net/Mail_Queue Till