php-general Digest 14 Nov 2011 18:56:23 -0000 Issue 7567

Topics (messages 315671 through 315678):

Re: speeding up heavy web apps with a php-js cache manager
        315671 by: Ashley Sheridan

Re: Novice MySQL problem
        315672 by: David Robley
        315673 by: Jim Giner
        315674 by: David Robley
        315675 by: Stuart Dallas

Re: problem with sending AT command in php
        315676 by: Richard Quadling

Sniping on the List
        315677 by: George Langley
        315678 by: Fredric L. Rice

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Sun, 2011-11-13 at 22:27 -0500, Plamen Ivanov wrote:

> On 11/13/2011 01:39 PM, Ashley Sheridan wrote: 
> 
> > On Sun, 2011-11-13 at 18:39 +0100, rene7705 wrote:
> > 
> >   
> > 
> > > Hi.
> > > 
> > > I'm developing a CMS, with lots of javascript code.
> > > I haven't been satisfied with my page initialization speeds, so I've
> > > started on a caching system.
> > > 
> > > First, i used to call up javascript as needed, and just-in-time. But that,
> > > on a localhost setup, results in a second and a half delay.
> > > So now I include all javascript for the entire CMS as inline js in the
> > > <head> of index.php. Index.php gets gzipped of course.
> > > The difference is really noticeable, without looking at any counters even.
> > > 
> > > So far so good.
> > > 
> > > Now I'd like to implement a caching system for ajax requests.
> > > I was thinking to take URL, GET, and POST send parameters, and compare 
> > > such
> > > a set to items in a local js cache.
> > > 
> > > If the local cache is not available, the ajax request is sent as normal,
> > > and the result is put in the cache.
> > > Javascript implementation could be as easy as changing
> > > jQuery.ajax(ajaxCommand) to cacheManager.ajax(ajaxCommand)
> > > 
> > > If the local cache is available, the onSuccess handler of the ajax request
> > > is called with the cached data.
> > > 
> > > On the server end, the cached items are put in a global JSON "FAT" file,
> > > again with URL, GET and POST as keys to a flat plaintext filename.
> > > 
> > > On the server, any "normal" ajaxable URL will call php code to update the
> > > server end cache.
> > > 
> > > Index.php would query the cache for a "subscription", a list of cache
> > > URL+GET+POST keys, and include these cached items as
> > > <div id="cache_idx" style="display:none"><!-- {"keys" :
> > > {URL+GET+POST+LAST_MODIFIED}, "data" : "cached-data"} --></div>
> > > From where the javascript cache manager would be able to find the data.
> > > 
> > > The javascript cache manager would include some kind of polling system, to
> > > get near realtime updates for it's cached data.
> > > 
> > > I'm convinced caching of ajax results would further increase my page
> > > initialization speeds.
> > > 
> > > I'm interested to learn about potential pitfalls, any opensource libraries
> > > that already do this, or any other tips you can think of.
> > > 
> > > Thanks for your time.
> > >     
> > 
> > 
> > You shouldn't really cache POST requests. GET data is only ever meant to
> > fetch data from a server, which works well with caching, but POST is
> > meant to change the state of something on the server, so it may never
> > make sense to cache that, and could cause problems later on with things
> > being cached even if they appear as if they shouldn't.
> > 
> > If there are certain chunks of the content that will never change then
> > you could cache those I guess, although not sure how you would be able
> > to do that at the server level.
> > 
> > Another way to add some speed is to minify your Javascript, be it inline
> > or in a different file, which results in less bandwidth being used to
> > send the data, and less time to send it as it's smaller. Images can be
> > combined into a sprite map which can reduce the requests in the same way
> > you reduced them by making your Javascript inline.
> > 
> > If you use libraries like JQuery, use a public one such as that found on
> > Google Code. Many sites use it, so it is more likely a user has it
> > cached on their machine already from visiting another site that uses it.
> > 
> > These are all pretty basic techniques, and although they don't answer
> > your question exactly, they may be useful for you to achieve the same
> > goal.
> > 
> >   
> 
> What exactly do you mean by "i used to call up javascript as needed,
> and just-in-time."? If you have a lot of dependencies having lag makes
> sense because of the cascade of calls. Bundle up all your static
> scripts in one JS file and compress. It should get cached most modern
> browsers. Anyhoo, I don't really know how caching works, but this
> might help: HTTP ETag. 
> 
> As a side note: don't do inline -
> http://robertnyman.com/2008/11/20/why-inline-css-and-javascript-code-is-such-a-bad-thing/
> 
> 


Please try to remember to keep the list copied into the replies so that
everyone can benefit.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Jim Giner wrote:

> 
> "drive view" <drivev...@gmail.com> wrote in message
> news:cam4sn2ip7yncw2-2soq-vjk8suer7u5x96fvpeqoitkkcaj...@mail.gmail.com...
>> Hi,
>>
>> I'm a novice to MySQL and am currently facing the following difficulty.
>> I'm trying to update a table with a row of data the primary key of which
>> is
>> an ID which I believe is an auto incrementing serial number.  My first
>> question is how to check if this is the case.
>>
> 
> If you are updating a row, you should already know the id of the record,
> so
> in your update statement you reference it in the where clause.   (ie,
> "where rec_id = $curr_rec_key")
> 
>> Secondly while trying to insert such a row leaving out this column mySql
>> is
>> inserting the row at ID 0 (the previous ID's in the table are from 1 to
>> 9),
>> but then will not take further inserts.
>>
>> Thanks for any help available.
>>
>>
>> Regards
>>
>> Toni
>>
> 
> I don't know what the problem here is.  Personally I never use auto-inc
> fields.

That statement tells us you have a poor understanding of the concept of
relational databases, or you don't use relational tables.


Cheers
-- 
David Robley

Sure, it's clean laundry. The cat's sitting on it, isn't he?
Today is Pungenday, the 26th day of The Aftermath in the YOLD 3177. 


--- End Message ---
--- Begin Message ---
Actually, no it doesn't,  since I have a well-developed sense of all of 
that, but that's not helping to answer the OP's question now, is it?  Stay 
on point. 



--- End Message ---
--- Begin Message ---
Jim Giner wrote:

> Actually, no it doesn't,  since I have a well-developed sense of all of
> that, but that's not helping to answer the OP's question now, is it?  Stay
> on point.

Probably it helps the OP about as much as your statement that 'I don't know
what the problem here is.  Personally I never use auto-inc fields.'



Cheers
-- 
David Robley

Useless Invention: Kickstand for a tank.
Today is Pungenday, the 26th day of The Aftermath in the YOLD 3177. 


--- End Message ---
--- Begin Message ---
On 14 Nov 2011, at 11:47, Jim Giner wrote:

> Actually, no it doesn't,  since I have a well-developed sense of all of 
> that, but that's not helping to answer the OP's question now, is it?  Stay 
> on point. 

The OP's problem is solved, so the point is no longer relevant.

I'm curious to know what your "well-developed sense of all of that" does when 
in lieu of auto-incrementing fields, and why.

The only legitimate reason I've ever come across to avoid them is when you 
expect to need to partition data across multiple master DB servers. Is this why 
you avoid them?

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


--- End Message ---
--- Begin Message ---
On 12 November 2011 20:02, a dehqan <dehqa...@gmail.com> wrote:
> dio_write($handle, 'AT') & dio_write($handle, "AT") make firefox times out
> on Waiting for localhost ... .
> But dio_write($handle, "AT\n") makes it prints AT exactly the same command
> or  Atttt > Atttt , ..
>
> On Sat, Nov 12, 2011 at 10:02 PM, Negin Nickparsa <nickpa...@gmail.com>wrote:
>
>> are you sure about ATD03518726535\n?
>>
>>  can you try if ( dio_write($handle, 'AT') )?
>>
>

Don't use \n, use \r.

http://en.wikipedia.org/wiki/AT_commands#Example_session



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

--- End Message ---
--- Begin Message ---
        Am concerned over the number of posts that appear to be from people 
trying to over-inflate their self-importance.
        If you are the world's best coder, then help those of us who aren't. If 
you happen to know a better way to do something that I'm struggling with, then 
please share it. But if you just want to take pot shots at us, then please keep 
your comments to yourself.

        To that end, I wish to thank Ashley Sheridan, Daniel P. Brown, Tedd 
Sperling and Tommy Pham, to name but just a few of those who have submitted 
incredibly-helpful posts, that I have kept for reference. Your contributions 
are very much appreciated - thanks.


George Langley
Interactive Developer

www.georgelangley.ca

--- End Message ---
--- Begin Message ---
> If you are the world's best coder

That would be me. :)



--- End Message ---

Reply via email to