php-general Digest 10 Sep 2013 13:17:10 -0000 Issue 8360
Topics (messages 322061 through 322065):
Re: Which function returns a correct ISO8601 date?
322061 by: Alessandro Pellizzari
322064 by: Simon Schick
char set ?
322062 by: georg chambert
322063 by: Ashley Sheridan
transferring iis7, php5, mysql project to another server
322065 by: Harrison, Roberto
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 Sat, 07 Sep 2013 14:47:00 +0200, Simon Schick wrote:
> The method date("c") actually formats a date, fitting to the format
> defined in the constant DateTime::ATOM.
>
> Are both formats (with and without colon) valid for ISO8601, or is the
> documentation for the method date() wrong?
Yes:
http://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators
Bye.
--- End Message ---
--- Begin Message ---
Hi, Alessandro
Would it be worth noting somewhere, that these two implementations of
ISO8601 differ? Because I needed the DateTime::ATOM way to save the
timezone ... Even so the other one was also about ISO 8601 ...
My system is working towards a search-engine called ElasticSearch.
This one makes use of a Java method to format a date. This one is
defined here:
http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#dateOptionalTimeParser%28%29
The definition for a time-offset is defined like this:
offset = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])
Is there a format, you know of, that makes this difference (colon or
not) bullet-prove?
Bye,
Simon
On Sat, Sep 7, 2013 at 5:29 PM, Alessandro Pellizzari <a...@amiran.it> wrote:
> On Sat, 07 Sep 2013 14:47:00 +0200, Simon Schick wrote:
>
>> The method date("c") actually formats a date, fitting to the format
>> defined in the constant DateTime::ATOM.
>>
>> Are both formats (with and without colon) valid for ISO8601, or is the
>> documentation for the method date() wrong?
>
> Yes:
>
> http://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators
>
> Bye.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
This Q is possibly rather HTML (is there a good list for that...)
anyways;
Im in Sweden, and have done som pages with Swedish text, however our special
(weird) characters åäö
comes out wrong when displayd in browser, would be nice if I could tag the text
and keep the file as is rather
than changing the file format of the text (and encode the characters with some
double/prefix notation,
which I guess would be the main stream
anyone ?
regards
Georg
--- End Message ---
--- Begin Message ---
On Sat, 2013-09-07 at 18:21 +0200, georg chambert wrote:
> This Q is possibly rather HTML (is there a good list for that...)
>
> anyways;
> Im in Sweden, and have done som pages with Swedish text, however our special
> (weird) characters åäö
> comes out wrong when displayd in browser, would be nice if I could tag the
> text and keep the file as is rather
> than changing the file format of the text (and encode the characters with
> some double/prefix notation,
> which I guess would be the main stream
> anyone ?
>
> regards
> Georg
Save PHP script as UTF8, and make sure you output UTF8 headers
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
I have a working project using the above resources, though these are on a
Windows Server 2008 trial installation on a virtual machine in VMWare.
Is there an easy way to transfer the whole project to a legit Windows
Server 2008? So far I have the following backed up:
administration.config
applicationHost.config
redirection.config
Arachnophilia folder
MySQL folder
php folder
phpdebug folder
wwwroot folder
Thanks in advance.
Roberto Harrison, MLIS
Technology Support Librarian
Medical College of Wisconsin Libraries
Link.Learn.Lead
.
On 9/3/13 8:31 AM, "Stuart Dallas" <stu...@3ft9.com> wrote:
>On 3 Sep 2013, at 02:30, Daevid Vincent <dae...@daevid.com> wrote:
>
>> I'm confused on how a reference works I think.
>>
>> I have a DB result set in an array I'm looping over. All I simply want
>>to do
>> is make the array key the "id" of the result set row.
>>
>> This is the basic gist of it:
>>
>> private function _normalize_result_set()
>> {
>> foreach($this->tmp_results as $k => $v)
>> {
>> $id = $v['id'];
>> $new_tmp_results[$id] =& $v; //2013-08-29 [dv]
>>using a
>> reference here cuts the memory usage in half!
>
>You are assigning a reference to $v. In the next iteration of the loop,
>$v will be pointing at the next item in the array, as will the reference
>you're storing here. With this code I'd expect $new_tmp_results to be an
>array where the keys (i.e. the IDs) are correct, but the data in each
>item matches the data in the last item from the original array, which
>appears to be what you describe.
>
>> unset($this->tmp_results[$k]);
>
>Doing this for every loop is likely very inefficient. I don't know how
>the inner workings of PHP process something like this, but I wouldn't be
>surprised if it's allocating a new chunk of memory for a version of the
>array without this element. You may find it better to not unset anything
>until the loop has finished, at which point you can just
>unset($this->tmp_results).
>
>>
>> /*
>> if ($i++ % 1000 == 0)
>> {
>> gc_enable(); // Enable Garbage Collector
>> var_dump(gc_enabled()); // true
>> var_dump(gc_collect_cycles()); // # of
>>elements
>> cleaned up
>> gc_disable(); // Disable Garbage Collector
>> }
>> */
>> }
>> $this->tmp_results = $new_tmp_results;
>> //var_dump($this->tmp_results); exit;
>> unset($new_tmp_results);
>> }
>
>
>Try this:
>
>private function _normalize_result_set()
>{
> // Initialise the temporary variable.
> $new_tmp_results = array();
>
> // Loop around just the keys in the array.
> foreach (array_keys($this->tmp_results) as $k)
> {
> // Store the item in the temporary array with the ID as the key.
> // Note no pointless variable for the ID, and no use of &!
> $new_tmp_results[$this->tmp_results[$k]['id']] =
>$this->tmp_results[$k];
> }
>
> // Assign the temporary variable to the original variable.
> $this->tmp_results = $new_tmp_results;
>}
>
>I'd appreciate it if you could plug this in and see what your memory
>usage reports say. In most cases, trying to control the garbage
>collection through the use of references is the worst way to go about
>optimising your code. In my code above I'm relying on PHPs copy-on-write
>feature where data is only duplicated when assigned if it changes. No
>unsets, just using scope to mark a variable as able to be cleaned up.
>
>Where is this result set coming from? You'd save yourself a lot of
>memory/time by putting the data in to this format when you read it from
>the source. For example, if reading it from MySQL,
>$this->tmp_results[$row['id']] = $row when looping around the result set.
>
>Also, is there any reason why you need to process this full set of data
>in one go? Can you not break it up in to smaller pieces that won't put as
>much strain on resources?
>
>-Stuart
>
>--
>Stuart Dallas
>3ft9 Ltd
>http://3ft9.com/
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---