While working on a project, somehow the majority of my PHP files acquired Mac style \r newline characters rather than DOS/Windows \r\n or UNIX \n. I don’t know exactly how this happened, but the \r newlines were perpetuated by Notepad++, which identified the files as Macintosh and displayed them transparently. The problem is if I take this code:
<?php echo 'hello'; ?>
and upload it to the Linux project server (on Go Daddy), it becomes:
which of course causes an error. It took a while to trace the problem to its source, mainly because I had no idea such newline characters existed. So now you know, and knowing is half the battle.
Background: I’ve mentioned Ext JS in a previous post and am still using version 3.2.1.
After another fun-filled trip through ext-all-debug.js, I’ve discovered a simple yet hidden way to load an arbitrary page number in a grid that uses a PagingToolbar (Ext.PagingToolbar). Simply call yourGridPanel.getBottomToolbar().doLoad(start), where start is the row index starting from 0. So for example if you set pageSize = 10, then to display the first page call doLoad(0), second page call doLoad(10), etc. Note that when choosing a non-multiple of pageSize, the page number gets rounded up, so for example doLoad(1) would display items 2-11 (if you have 11 or more items) and report the page number as 2.
And of course, as the title of this post implies, this method is absent from the official API documentation (as of the time of this post) despite its being a public and very useful method.