<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
    <title>Proving the Obviously Untrue - php</title>
    <link>http://www.piglets.org/serendipity/</link>
    <description>Maths, Software, Hardware, Martial Arts and more</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1-1 - http://www.s9y.org/</generator>
    
    

<item>
    <title>Garbage collecting sessions in PHP</title>
    <link>http://www.piglets.org/serendipity/archives/81-Garbage-collecting-sessions-in-PHP.html</link>
            <category>php</category>
    
    <comments>http://www.piglets.org/serendipity/archives/81-Garbage-collecting-sessions-in-PHP.html#comments</comments>
    <wfw:comment>http://www.piglets.org/serendipity/wfwcomment.php?cid=81</wfw:comment>

    <wfw:commentRss>http://www.piglets.org/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=81</wfw:commentRss>
    

    <author>nospam@example.com (Colin Turner)</author>
    <content:encoded>
    In PHP, sessions are by default stored in a file in a directory. Sessions can be specifically destroyed from within the code, for example when users logout explicitly, but frequently they do not. As a result session files tend to hang around, and cause the problem of how to clean them up. The standard way is to use PHP&#039;s own garbage collection which is normally enabled out of the box. In this, we define constants that specify the maximum lifetime for the session, and essentially the probability of clean up.&lt;br /&gt;&lt;br /&gt;

To make things more interesting, &lt;a href=&quot;http://www.debian.org&quot;&gt;Debian&lt;/a&gt;, out of the box doesn&#039;t do garbage collection in this way. It has a cron job that regularly erases session files in the defined session directory. But, if like me, and many others, you put your session files in a different directory for each application to avoid clashes on namespaces for two applications running under the same browser from the same server, you have a problem. If you forget Debian&#039;s behaviour the session files will just grow indefinitely. I had forgotten this issue and found over a year&#039;s worth of session files in a directory recently.&lt;br /&gt;&lt;br /&gt;

Solving this problem is actually quite difficult to do optimally. I mean, I could create a cron job to mirror Debian&#039;s own, but then I&#039;d have to put the maximum lifetime in a cron job somewhere, out of the way, and difficult for the average sys admin I&#039;m working with to find and deal with. (That is, away from the main configuration of the project). Or I could parse this value out of the main configuration. But this leads to another problem. For some users, a 30 minute maximum idle time is acceptable (although in my case where actually a suite of applications are being used as a single gestalt entity that can even be a problem), but for many of my administrator users you need huge idle times, since they are used to logging in first thing, and periodically working at the application through the day.&lt;br /&gt;&lt;br /&gt;

In the end I settled on changing our &lt;a href=&quot;http://foss.ulster.ac.uk/projects/uuwaf&quot;&gt;framework&lt;/a&gt; to make it easy to pass through garbage collection values. This makes an interface to the configuration really easy, but it doesn&#039;t solve the problems of long session times that not all users need, and huge delays in garbage collection.&lt;br /&gt;&lt;br /&gt;

In my &lt;a href=&quot;http://www.piglets.org/serendipity/archives/80-My-first-Munin-plugin.html&quot;&gt;last article&lt;/a&gt; I talked about a Munin plugin for OPUS, but when you &lt;a href=&quot;http://fs1.ulster.ac.uk/munin/ulster.ac.uk/fs1.ulster.ac.uk-opus_munin.html&quot;&gt;look at it&lt;/a&gt; you&#039;ll see these kind of cliff fall drops, which are caused by the garbage collection finally kicking in and removing sessions where users have not explicitly logged out. Currently, every ten minutes, OPUS runs through its user database and finds users who are allegedly online but have no active session file and then marks them offline. Then it updates the file with the online user count that Munin reads.&lt;br /&gt;&lt;br /&gt;

I suspect eventually, I will write a more sophisticated script that actually kills sessions depending upon idle time and the user class, which would make for a more accurate picture here. Any brighter ideas gratefully accepted. 
    </content:encoded>

    <pubDate>Sat, 14 Mar 2009 10:44:09 +0000</pubDate>
    <guid isPermaLink="false">http://www.piglets.org/serendipity/archives/81-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license><category>free software</category>
<category>php</category>
<category>programming</category>

</item>
<item>
    <title>Fixing truncated printing with Firefox</title>
    <link>http://www.piglets.org/serendipity/archives/45-Fixing-truncated-printing-with-Firefox.html</link>
            <category>php</category>
    
    <comments>http://www.piglets.org/serendipity/archives/45-Fixing-truncated-printing-with-Firefox.html#comments</comments>
    <wfw:comment>http://www.piglets.org/serendipity/wfwcomment.php?cid=45</wfw:comment>

    <wfw:commentRss>http://www.piglets.org/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=45</wfw:commentRss>
    

    <author>nospam@example.com (Colin Turner)</author>
    <content:encoded>
    A while ago, I discovered that my current main development project &lt;a href=&quot;http://foss.ulster.ac.uk/projects/opus/&quot;&gt;OPUS&lt;/a&gt; had an odd problem when printing out of a &lt;a href=&quot;http://en.wikipedia.org/wiki/Gecko_%28layout_engine%29&quot;&gt;gecko&lt;/a&gt; based browser.&lt;br /&gt;&lt;br /&gt;

It would print the first page, whether in portrait or landscape, and if there was more content, it would be abruptly truncated and the second page would contain merely the footer off the page. I&#039;ve been meaning to try and solve the problem with a print stylesheet for a while and finally did so today. &lt;br /&gt;&lt;a href=&quot;http://www.piglets.org/serendipity/archives/45-Fixing-truncated-printing-with-Firefox.html#extended&quot;&gt;Continue reading &quot;Fixing truncated printing with Firefox&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 16 Apr 2008 23:18:50 +0100</pubDate>
    <guid isPermaLink="false">http://www.piglets.org/serendipity/archives/45-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license><category>php</category>

</item>
<item>
    <title>Drupal Login Problems</title>
    <link>http://www.piglets.org/serendipity/archives/17-Drupal-Login-Problems.html</link>
            <category>Gondolin</category>
            <category>php</category>
            <category>programming</category>
    
    <comments>http://www.piglets.org/serendipity/archives/17-Drupal-Login-Problems.html#comments</comments>
    <wfw:comment>http://www.piglets.org/serendipity/wfwcomment.php?cid=17</wfw:comment>

    <wfw:commentRss>http://www.piglets.org/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=17</wfw:commentRss>
    

    <author>nospam@example.com (ct)</author>
    <content:encoded>
    So, in order to post that rant about PHP and SimpleXML I had to fix a problem that seems to have spontaneously arisen with Drupal (this content management system).

For some reason it wasn&#039;t persisting login information, at least from firefox (sorry - iceweasel here on my Debian system). It&#039;s interesting to note, reading about the bug, that it has been around for literally months and doesn&#039;t seem to have been nailed.

So, anyway, I&#039;ve installed some beta of Drupal, and yes, it now seems to be fixed... If I could only solve the problem that I can&#039;t &quot;uncollapse&quot; parts of the content now. &lt;sigh&gt;

UPDATE: OK, this seems to be a problem with firefox version 2, or probably really the CSS file for it. It works with Galeon, or when I tell firefox to fake being IE &lt;shudder&gt;. 
    </content:encoded>

    <pubDate>Wed, 13 Dec 2006 11:48:37 +0000</pubDate>
    <guid isPermaLink="false">http://www.piglets.org/serendipity/archives/17-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license><category>Gondolin</category>
<category>php</category>
<category>programming</category>

</item>
<item>
    <title>SimpleXML should be called BloodyAckwardXML</title>
    <link>http://www.piglets.org/serendipity/archives/16-SimpleXML-should-be-called-BloodyAckwardXML.html</link>
            <category>php</category>
            <category>programming</category>
    
    <comments>http://www.piglets.org/serendipity/archives/16-SimpleXML-should-be-called-BloodyAckwardXML.html#comments</comments>
    <wfw:comment>http://www.piglets.org/serendipity/wfwcomment.php?cid=16</wfw:comment>

    <wfw:commentRss>http://www.piglets.org/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=16</wfw:commentRss>
    

    <author>nospam@example.com (ct)</author>
    <content:encoded>
    Another night of coding in PHP, and I&#039;ve officially decided that SimpleXML utterly irritates me.

I&#039;d already discovered, much to my irritation, that is virtually impossible to handle SimpleXML objects elegantly with the Smarty template engine - but now I discover I can&#039;t even shove them in a PHP session without trouble - when you next visit the site you get stuff like this:

Warning: session_start() [function.session-start]: Node no longer exists

and then more trouble.

As part of a new Web Application Framework I&#039;m working on I wanted to parse XML configuration files one time only, and then cache the results in the session. It looks like I now have to totally redesign my idea &lt;img src=&quot;http://www.piglets.org/serendipity/templates/default/img/emoticons/sad.png&quot; alt=&quot;:-(&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;. You can see the work in progress at &lt;a href=&quot;http://foss.ulster.ac.uk/projects/uuwaf/&quot;&gt;its home page&lt;/a&gt;.
 
    </content:encoded>

    <pubDate>Wed, 13 Dec 2006 11:39:00 +0000</pubDate>
    <guid isPermaLink="false">http://www.piglets.org/serendipity/archives/16-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license><category>php</category>
<category>programming</category>

</item>

</channel>
</rss>