<?xml version="1.0" encoding="iso-8859-2"?>
<!-- name="generator" content="pyblosxom/1.0.0 (May 24, 2004)" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
<channel>
<title>... with flags unfurled...  Mar 2005</title>
<link>http://znouza.meinlschmidt.org/blog/</link>
<description>we reached the dizzy heights...</description>
<language>en</language>
<item>
    <title>Preferences</title>
    <link>http://znouza.meinlschmidt.org/blog/programming/palmbits/050328-2050.html</link>
    <description>&lt;p&gt;Preferences structure definition&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
typedef struct {
	int skeletonData;
} Prefs;

Prefs prefs;
&lt;/pre&gt;
&lt;p&gt;Open preferences&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
void startApp() {
	Int16 prefSize = sizeof(Prefs);
	if ((PrefGetAppPreferences (AppCreator, 
			 		1000, // pref database id
			 		&amp;prefs, 
			 		&amp;prefSize, 
		 	 		true) // saved during Hotsync
		== noPreferenceFound) 
		|| (prefSize != sizeof(Prefs))) {
					// default initialization, since discovered 
					// Prefs was missing or old.
		prefs.skeletonData=1;
	}
}
&lt;/pre&gt;
&lt;p&gt;Write preferences&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
void stopApp() {
	PrefSetAppPreferences (AppCreator, 
				1000,	// pref database id
				1, 	// version of pref database
				&amp;prefs, 
				sizeof(Prefs), 
				true);	// saved during hotsync
}
&lt;/pre&gt;
</description>
  </item>
<item>
    <title>Using libraries</title>
    <link>http://znouza.meinlschmidt.org/blog/programming/palmbits/050328-2040.html</link>
    <description>&lt;p&gt;
Load and initializing the library
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
#include &lt;mathlib.h&gt;
int MathLibRef = -1;
...
// is library already loaded?
err = SysLibFind(&quot;MathLib&quot;, &amp;MathLibRef);
if (err != 0) {
	// negative, load
	err = SysLibLoad(&apos;libr&apos;, &apos;MthL&apos;, &amp;MathLibRef);
	if (err == 0) {
		err = MathLibOpen (MathLibRef, 1);
	}
}
&lt;/pre&gt;
&lt;p&gt;
Closing library
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
if (MathLibRef != -1) {
	Err err;
	UInt16 usecount;
	err = MathLibClose (MathLibRef, &amp;usecount);
	if (usecount == 0) {
		SysLibRemove (MathLibRef);
	}
}
&lt;/pre&gt;
</description>
  </item>
<item>
    <title>Simple PHP security patch</title>
    <link>http://znouza.meinlschmidt.org/blog/programming/phpiing/050307-0941.html</link>
    <description>&lt;p&gt;
I&apos;ve created (after some strange experiences with users in my hosting) small
php patch (for version 4.3.10), which disables remote includes.&lt;strong&gt;This patch doesn&apos;t work with Zend Optimizer enabled unfortunately :(&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
Download the patch &lt;a href=&quot;http://orin.meinlschmidt.org/~znouza/php_patch.txt&quot;&gt;there&lt;/a&gt;. 
After applying, see php.ini-dist and readme.security
&lt;/p&gt;

&lt;p&gt;
example of bad code:
&lt;xmp&gt;
&lt;?php
	$page = $_GET[&apos;page&apos;];
	include ($page);
?&gt;
&lt;/xmp&gt;
&lt;/p&gt;

&lt;p&gt;
example of better code:
&lt;xmp&gt;
&lt;?php
	// filter all unneeded characters
	$page = eregi_replace(&quot;[^a-z0-9_]&quot;,&quot;&quot;, $_GET[&apos;page&apos;]).&quot;.inc.php&quot;;

	// test if $page exists and is file
	if (strlen($page) &amp;&amp; @file_exists($page) &amp;&amp; @is_file($page)) {
		require_once ($page);
	}
?&gt;
&lt;/xmp&gt;
&lt;/p&gt;
&lt;p&gt;
Links:
&lt;div class=&quot;box&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://php.net/include/&quot;&gt;http://php.net/include/&lt;/a&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/p&gt;
</description>
  </item>
<item>
    <title>Got fired for extensive blogging?</title>
    <link>http://znouza.meinlschmidt.org/blog/press/050306-2123.html</link>
    <description>Wanna be fired for your blog entries? Don&apos;t write anything about your employer.
Read &lt;a href=&quot;http://www.cnn.com/2005/TECH/internet/03/06/firedforblogging.ap/index.html&quot;&gt;more&lt;/a&gt;.
</description>
  </item>
<item>
    <title>Steve got new record</title>
    <link>http://znouza.meinlschmidt.org/blog/press/050303-2004.html</link>
    <description>Steve Fossett landed (19:48:56 UTC) at Salina airport after successfull 
flight around the world. See more information at GlobalFlyer &lt;a href=&quot;http://www.virginatlanticglobalflyer.com/&quot;&gt;website&lt;/a&gt;.
</description>
  </item>
   </channel>
</rss>