<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marcus Nyberg &#187; php</title>
	<atom:link href="http://www.marcusnyberg.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcusnyberg.com</link>
	<description>Digital and dangerous</description>
	<lastBuildDate>Fri, 03 Feb 2012 08:41:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Segmentation fault: 11 (core dumped) in php on Freebsd</title>
		<link>http://www.marcusnyberg.com/2011/06/20/segmentation-fault-11-core-dumped-in-php-on-freebsd/</link>
		<comments>http://www.marcusnyberg.com/2011/06/20/segmentation-fault-11-core-dumped-in-php-on-freebsd/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 19:41:11 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=972</guid>
		<description><![CDATA[Oh, I finally got time for some coding and server updates. Sadly but interestering I got this strange error after updating php5 (/usr/ports/lang/php5) to the latest in the Freebsd ports tree. The error: /usr/local> php -v PHP Fatal error: PHP Startup: apc_shm_create: shmget(0, 31457280, 914) failed: Cannot allocate memory. It is possible that the chosen [...]]]></description>
			<content:encoded><![CDATA[<p>Oh, I finally got time for some coding and server updates. Sadly but interestering I got this strange error after updating php5 (/usr/ports/lang/php5) to the latest in the Freebsd ports tree.</p>
<p><strong>The error:</strong><br />
<code>/usr/local> php -v<br />
PHP Fatal error:  PHP Startup: apc_shm_create: shmget(0, 31457280, 914) failed: Cannot allocate memory. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment. in Unknown on line 0<br />
PHP Fatal error:  PHP Startup: apc_shm_attach: shmat failed: in Unknown on line 0<br />
Segmentation fault: 11 (core dumped)</code></p>
<p>The first problem was the &#8221;PHP Fatal error&#8221; lines that has something to do with APC cache. This was solved by:<br />
<code>/usr/ports/www/pecl-APC> make config<br />
<em>Then I unticked the "IPC Enable IPC shm memory support (default: mmap)" line. Don't really know what it does....</em><br />
/usr/ports/www/pecl-APC> make deinstall<br />
/usr/ports/www/pecl-APC> make clean<br />
/usr/ports/www/pecl-APC> make install clean</code></p>
<p>The second problem was the &#8221;Segmentation fault: 11 (core dumped)&#8221; line which caused a core dump each time php ran (a php.core file is produced). This was a bit strange. To investigate why it crashes I used gdb on the core file. A core file contains the in-memory state of the program at the time it crashes.</p>
<p><code>/usr/local/lib/php> gdb /usr/local/bin/php php.core<br />
GNU gdb 6.1.1 [FreeBSD]<br />
Copyright 2004 Free Software Foundation, Inc.<br />
GDB is free software, covered by the GNU General Public License, and you are<br />
welcome to change it and/or distribute copies of it under certain conditions.<br />
Type "show copying" to see the conditions.<br />
There is absolutely no warranty for GDB.  Type "show warranty" for details.<br />
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)...<br />
Core was generated by `php'.<br />
Program terminated with signal 11, Segmentation fault.<br />
Reading symbols from /lib/libcrypt.so.4...(no debugging symbols found)...done.<br />
Loaded symbols for /lib/libcrypt.so.4<br />
Reading symbols from /usr/local/lib/libpcre.so.0...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libpcre.so.0<br />
Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done.<br />
Loaded symbols for /lib/libm.so.5<br />
Reading symbols from /usr/local/lib/libxml2.so.5...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libxml2.so.5<br />
Reading symbols from /lib/libz.so.4...(no debugging symbols found)...done.<br />
Loaded symbols for /lib/libz.so.4<br />
Reading symbols from /usr/local/lib/libiconv.so.3...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libiconv.so.3<br />
Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.<br />
Loaded symbols for /lib/libc.so.7<br />
Reading symbols from /usr/local/lib/php/libs/curl.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/curl.so<br />
Reading symbols from /usr/local/lib/libcurl.so.6...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libcurl.so.6<br />
Reading symbols from /usr/lib/libssl.so.5...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/lib/libssl.so.5<br />
Reading symbols from /lib/libcrypto.so.5...(no debugging symbols found)...done.<br />
Loaded symbols for /lib/libcrypto.so.5<br />
Reading symbols from /usr/local/lib/php/libs/iconv.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/iconv.so<br />
Reading symbols from /usr/local/lib/php/libs/json.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/json.so<br />
Reading symbols from /usr/local/lib/php/libs/exif.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/exif.so<br />
Reading symbols from /usr/local/lib/php/libs/ftp.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/ftp.so<br />
Reading symbols from /usr/local/lib/php/libs/openssl.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/openssl.so<br />
Reading symbols from /usr/local/lib/php/libs/hash.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/hash.so<br />
Reading symbols from /usr/local/lib/php/libs/bz2.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/bz2.so<br />
Reading symbols from /usr/lib/libbz2.so.3...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/lib/libbz2.so.3<br />
Reading symbols from /usr/local/lib/php/libs/mysql.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/mysql.so<br />
Reading symbols from /usr/local/lib/php/libs/tokenizer.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/tokenizer.so<br />
Reading symbols from /usr/local/lib/php/libs/simplexml.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/simplexml.so<br />
Reading symbols from /usr/local/lib/php/libs/xml.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/xml.so<br />
Reading symbols from /usr/local/lib/php/libs/posix.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/posix.so<br />
Reading symbols from /usr/local/lib/php/libs/dom.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/dom.so<br />
Reading symbols from /usr/local/lib/php/libs/gd.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/gd.so<br />
Reading symbols from /usr/local/lib/libt1.so.5...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libt1.so.5<br />
Reading symbols from /usr/local/lib/libfreetype.so.9...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libfreetype.so.9<br />
Reading symbols from /usr/local/lib/libX11.so.6...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libX11.so.6<br />
Reading symbols from /usr/local/lib/libXpm.so.4...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libXpm.so.4<br />
Reading symbols from /usr/local/lib/libpng.so.6...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libpng.so.6<br />
Reading symbols from /usr/local/lib/libjpeg.so.11...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libjpeg.so.11<br />
Reading symbols from /usr/local/lib/libxcb.so.2...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libxcb.so.2<br />
Reading symbols from /usr/lib/librpcsvc.so.4...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/lib/librpcsvc.so.4<br />
Reading symbols from /usr/local/lib/libXau.so.6...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libXau.so.6<br />
Reading symbols from /usr/local/lib/libXdmcp.so.6...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libXdmcp.so.6<br />
Reading symbols from /usr/local/lib/libpthread-stubs.so.0...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libpthread-stubs.so.0<br />
Reading symbols from /usr/local/lib/php/libs/xmlreader.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/xmlreader.so<br />
Reading symbols from /usr/local/lib/php/libs/xmlwriter.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/xmlwriter.so<br />
Reading symbols from /usr/local/lib/php/libs/sockets.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/sockets.so<br />
Reading symbols from /usr/local/lib/php/libs/zlib.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/zlib.so<br />
Reading symbols from /usr/local/lib/php/libs/session.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/session.so<br />
Reading symbols from /usr/local/lib/php/libs/soap.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/soap.so<br />
Reading symbols from /usr/local/lib/php/libs/xsl.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/xsl.so<br />
Reading symbols from /usr/local/lib/libexslt.so.8...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libexslt.so.8<br />
Reading symbols from /usr/local/lib/libxslt.so.2...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libxslt.so.2<br />
Reading symbols from /usr/local/lib/libgcrypt.so.17...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libgcrypt.so.17<br />
Reading symbols from /usr/local/lib/libgpg-error.so.0...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libgpg-error.so.0<br />
Reading symbols from /usr/local/lib/libintl.so.9...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libintl.so.9<br />
Reading symbols from /usr/local/lib/php/libs/sqlite.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/sqlite.so<br />
Reading symbols from /usr/local/lib/php/libs/pdo.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/pdo.so<br />
Reading symbols from /usr/local/lib/php/libs/pdo_sqlite.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/pdo_sqlite.so<br />
Reading symbols from /usr/local/lib/libsqlite3.so.8...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/libsqlite3.so.8<br />
Reading symbols from /lib/libthr.so.3...(no debugging symbols found)...done.<br />
Loaded symbols for /lib/libthr.so.3<br />
Reading symbols from /usr/local/lib/php/libs/xmlrpc.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/xmlrpc.so<br />
Reading symbols from /usr/local/lib/php/libs/ctype.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/ctype.so<br />
Reading symbols from /usr/local/lib/php/libs/fileinfo.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/fileinfo.so<br />
Reading symbols from /usr/local/lib/php/libs/filter.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/filter.so<br />
Reading symbols from /usr/local/lib/php/libs/imap.so...(no debugging symbols found)...done.<br />
Loaded symbols for /usr/local/lib/php/libs/imap.so<br />
Reading symbols from /usr/local/lib/libc-client4.so.9...done.<br />
Loaded symbols for /usr/local/lib/libc-client4.so.9<br />
Reading symbols from /usr/lib/libpam.so.4...done.<br />
Loaded symbols for /usr/lib/libpam.so.4<br />
Reading symbols from /usr/local/lib/php/libs/mbstring.so...done.<br />
Loaded symbols for /usr/local/lib/php/libs/mbstring.so<br />
Reading symbols from /usr/local/lib/libonig.so.1...done.<br />
Loaded symbols for /usr/local/lib/libonig.so.1<br />
Reading symbols from /usr/local/lib/php/libs/sqlite3.so...done.<br />
Loaded symbols for /usr/local/lib/php/libs/sqlite3.so<br />
Reading symbols from /usr/local/lib/php/libs/zip.so...done.<br />
Loaded symbols for /usr/local/lib/php/libs/zip.so<br />
Reading symbols from /usr/local/lib/php/libs/apc.so...done.<br />
Loaded symbols for /usr/local/lib/php/libs/apc.so<br />
Reading symbols from /usr/lib/librt.so.1...done.<br />
Loaded symbols for /usr/lib/librt.so.1<br />
Reading symbols from /libexec/ld-elf.so.1...done.<br />
Loaded symbols for /libexec/ld-elf.so.1<br />
#0  0x0000000805de1f5d in apc_sma_init () from /usr/local/lib/php/libs/apc.so<br />
[New Thread 0x801533120 (LWP 100263)]<br />
</code></p>
<p>Ok, I smell some fish here. Then i checked the &#8221;stack backtrace&#8221; with bt.</p>
<p><code>(gdb) bt<br />
#0  0x0000000804c7c8c0 in ?? ()<br />
#1  0x00000008042e1bc4 in xsltUnregisterExtModuleFunction () from /usr/local/lib/libxslt.so.2<br />
#2  0x00000008040adc97 in zm_shutdown_xsl () from /usr/local/lib/php/libs/xsl.so<br />
#3  0x000000000055e2cf in module_destructor ()<br />
#4  0x000000000056597a in zend_hash_apply_deleter ()<br />
#5  0x0000000000565be8 in zend_hash_graceful_reverse_destroy ()<br />
#6  0x00000000005596f7 in zend_shutdown ()<br />
#7  0x00000000005045f5 in php_module_shutdown ()<br />
#8  0x00000000005e505f in main ()<br />
#9  0x00000000004189e5 in _start ()<br />
#10 0x0000000800786000 in ?? ()<br />
</code></p>
<p>The problem was clearly related to one of my php-extensions /usr/local/lib/php/libs/xsl.so. Then I tried not to use this extension by uncomment it in /usr/local/etc/php/extensions.ini. However I got similiar error in another extension by doing that. There must be some other error that hasn&#8217;t with my extensions to do&#8230;</p>
<p>With some google fu I found <a href="http://groups.google.com/group/mailing.freebsd.ports/browse_thread/thread/8b0c80f86204226a">this post</a> which explains the problem. Some extensions are threaded while php5 isn&#8217;t by default. To make php threaded you have to configure it to be so. That&#8217;s fairly easy in Freebsd.</p>
<p><code>/usr/ports/lang/php5/make config<br />
<em>Tick the  "LINKTHR    Link thread lib (for threaded extensions)" option.</em><br />
/usr/ports/lang/php5/make deinstall<br />
/usr/ports/lang/php5/make clean<br />
/usr/ports/lang/php5/make install clean</code></p>
<p>Then i restarted my apache server, typed &#8221;php -m&#8221; and everything looked fine, not one single strange error message. Yieeehaa!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2011/06/20/segmentation-fault-11-core-dumped-in-php-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Goodbye php eAccelerator and welcome APC</title>
		<link>http://www.marcusnyberg.com/2010/06/01/goodbye-php-eaccelerator/</link>
		<comments>http://www.marcusnyberg.com/2010/06/01/goodbye-php-eaccelerator/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 13:43:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=494</guid>
		<description><![CDATA[Goodbye eaccelerator, your decision to remove the functionality that I use in eAccelerator 0.9.6 is a dead end for me. I am lucky that I wrote my software to check if &#8221;eaccelerator_put&#8221; functions exists on runtime, otherwise my website would have been down by now after updating from 0.9.3. The release info says it all: [...]]]></description>
			<content:encoded><![CDATA[<p>Goodbye eaccelerator, your decision to remove the functionality that I use in <a href="http://www.eaccelerator.net/wiki/Release-0.9.6">eAccelerator 0.9.6</a> is a dead end for me. I am lucky that I wrote my software to check if &#8221;eaccelerator_put&#8221; functions exists on runtime,  otherwise my website would have been down by now after updating from 0.9.3.</p>
<p><strong>The release info says it all:</strong><br />
&#8221;The theme of this release is: back to basics! All non-essential functionality has been removed from eAccelerator. The key and content cache and the session functions have been removed. &#8221;</p>
<p>The theme of this release is a killer for me. I have used eAccelerator for many years with great success but now its time to move on. I am now looking for other php cache systems and I also have to rewrite my code. It is not that much work but it has to be done, sadly. I hope there is something good or better then eAccelerator waiting for me in the FreeBSd ports-tree&#8230;</p>
<p>&#8230; and I found the prefect solution for me in <a href="http://se.php.net/manual/en/book.apc.php">Alternative PHP Cache &#8211; APC</a>. It is going to be included (by default?) in PHP6 so I think it is the best choice for me and others. The most important functionality for me right now is <a href="http://se.php.net/manual/en/function.apc-add.php">apc_add</a> or <a href="http://se.php.net/manual/en/function.apc-store.php">apc_store</a> which should be the equivalent of eaccelerator_put. Great!</p>
<p><strong>How to install APC in FreeBSD</strong><br />
cd /usr/ports/www/pecl-APC<br />
make install clean</p>
<p>And remember to uncomment eaccelerator from php.ini.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2010/06/01/goodbye-php-eaccelerator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sluta använda Internet Explorer 6</title>
		<link>http://www.marcusnyberg.com/2009/11/02/sluta-anvanda-internet-explorer-6/</link>
		<comments>http://www.marcusnyberg.com/2009/11/02/sluta-anvanda-internet-explorer-6/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 16:04:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=305</guid>
		<description><![CDATA[Något som börjar bli uppmärksammat i webbvärlden är kampanjen mot Microsofts webbläsare IE6 (Internet Explorer 6). Läs mer på http://ie6.forteller.net. Denna webbläsare har nu varit med i 8 långsamma år och hållit tillbaka webbens utveckling sedan första dagen. Jag kan bara instämma i detta och kommer att göra allt i min makt för att få [...]]]></description>
			<content:encoded><![CDATA[<p>Något som börjar bli uppmärksammat i webbvärlden är kampanjen mot Microsofts webbläsare IE6 (Internet Explorer 6). Läs mer på <a href="http://ie6.forteller.net">http://ie6.forteller.net</a>. Denna webbläsare har nu varit med i 8 långsamma år och hållit tillbaka webbens utveckling sedan första dagen. Jag kan bara instämma i detta och kommer att göra allt i min makt för att få folk att sluta använda webbläsaren från helvetet.</p>
<p>Jag har gjort en egen lösning för detta i php+css+html som gör att mina sidor ser ut enligt screenshoten nedan. Tanken är att imitera actionbaren som finns i IE6 och be användaren att uppdatera sin webbläsare om denne kör IE6. Lösningen är en blandning av flera andra lösningar.</p>
<p><strong>Screenshot</strong><br />
<a href="http://www.marcusnyberg.com/wp-content/uploads/2009/11/sluta-anvanda-ie6.jpg"><img src="http://www.marcusnyberg.com/wp-content/uploads/2009/11/sluta-anvanda-ie6-300x105.jpg" alt="sluta-anvanda-ie6" title="sluta använda ie6" width="100%" /></a></p>
<p><strong>php</strong><br />
// Vilken webbl&#228;sare k&#246;r anv&#228;ndaren<br />
$browser = substr($_SERVER['HTTP_USER_AGENT'], 25, 8);</p>
<p>// Kolla om IE6<br />
$ie6 = ($browser == &quot;MSIE 6.0&quot;);</p>
<p>// Om IE6, visa actionbar<br />
if(!$ie6) { include &quot;actionbar.html&quot;; }</p>
<p><strong>CSS</strong><br />
div.activebar<br />
{<br />
    position: absolute;<br />
    background-color:   #ffffe1;<br />
    border-bottom: 1px solid #c8c8c8;<br />
    margin:0;<br />
    padding:0;<br />
    width:100%;<br />
}</p>
<p>div.activebarText<br />
{<br />
    font-family: sans-serif;<br />
    font-size: 12px;<br />
    margin-left: 6px;<br />
    margin-top: 4px;<br />
    height: 100%;<br />
}</p>
<p><strong>actionbar.html</strong><br />
&lt;div class=&quot;activebar&quot;&gt;<br />
	&lt;div class=&quot;activebarText&quot; align=&quot;center&quot;&gt;<br />
	Din webbl&#228;sare &#228;r gammal och os&#228;ker! F&#246;r att f&#229; ut det mesta av v&#229;r webbsida s&#229; rekommenderar vi att ni &lt;a href=&quot;http://www.microsoft.com/ie&quot; target=&quot;_blank&quot;&gt;uppgraderar&lt;/a&gt; den.<br />
	Pr&#246;va &#228;ven andra popul&#228;ra webbl&#228;sare som &lt;a href=&quot;http://www.mozilla.com/sv-SE/&quot; target=&quot;_blank&quot;&gt;Firefox&lt;/a&gt;, &lt;a href=&quot;http://www.opera.com/&quot; target=&quot;_blank&quot;&gt;Opera&lt;/a&gt;, &lt;a href=&quot;http://www.google.com/chrome/&quot;  target=&quot;_blank&quot;&gt;Chrome&lt;/a&gt; eller &lt;a href=&quot;http://www.apple.com/se/safari/&quot; target=&quot;_blank&quot;&gt;Safari&lt;/a&gt;.<br />
	&lt;/div&gt;<br />
&lt;/div&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/11/02/sluta-anvanda-internet-explorer-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert youtube-links in text to embedded flash player</title>
		<link>http://www.marcusnyberg.com/2009/10/08/convert-youtube-links-in-text-to-embedded-flash-player/</link>
		<comments>http://www.marcusnyberg.com/2009/10/08/convert-youtube-links-in-text-to-embedded-flash-player/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 08:55:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=282</guid>
		<description><![CDATA[If you have a forum, cms or whatever and the users contribute with youtube-links in their posts. You probably convert the urls to a-href links at display time, like this: If the posted link is a youtube-link, are you converting it the same way? Why should you! A cooler way is to convert the link [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a forum, cms or whatever and the users contribute with youtube-links in their posts. You probably convert the urls to a-href links at display time, like this:</p>
<p><img src="http://www.marcusnyberg.com/wp-content/uploads/2009/10/simple-link.jpg" alt="simple-link" title="simple-link" width="353" height="99"/></p>
<p>If the posted link is a youtube-link, are you converting it the same way? Why should you! A cooler way is to convert the link to a embedded youtube-video, like this:</p>
<p><img src="http://www.marcusnyberg.com/wp-content/uploads/2009/10/parseyoutubeurls.jpg" alt="parseyoutubeurls" title="parseyoutubeurls" width="458" height="445" /></p>
<p>I have written a small php-function that converts youtube-links (like: http://www.youtube.com/watch?v=XELJ9_Fy0ag) in text to embedded videos. Download it, give it a try and feel free to modify it to suit your needs. Feedback is appreciated.</p>
<p><a href='http://www.marcusnyberg.com/wp-content/uploads/2009/10/parseYoutubeUrls.txt'>Download parseYoutubeUrls</a></p>
<p><code>function parseYoutubeUrls($text, $width = -1, $height = -1)<br />
{<br />
// defaults<br />
if($width == -1) { $width = 425; }<br />
if($height == -1) {    $height = round((344/425) * $width); }</p>
<p>// get all urls in text<br />
$regexp = "/&lt;a\s+.*?href=[\"\']?([^\"\' &gt;]*)[\"\']?[^&gt;]*&gt;(.*)&lt;\/a&gt;/i";<br />
if(preg_match_all($regexp, $text, $matches, PREG_SET_ORDER))<br />
{<br />
// check each url<br />
foreach($matches as $match)<br />
{<br />
// replace all youtube urls with embedded flash player<br />
if(preg_match_all("/www.youtube.com/",$match[1],$hit))<br />
{<br />
$parsedUrl = parse_url($match[1]);<br />
parse_str($parsedUrl["query"], $query);<br />
$videoId = ($query['v']);<br />
$replace = '&lt;p&gt;&lt;object width="'.$width.'" height="'.$height.'"&gt;&lt;param name="movie" value="http://www.youtube.com/v/'.$videoId.'&amp;hl=sv&amp;fs=1&amp;rel=0"&gt; &lt;/param&gt; &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/'.$videoId.'&amp;hl=sv&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.$width.'" height="'.$height.'"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;';<br />
$text = str_replace($match[0],$replace, $text);<br />
}<br />
}<br />
}<br />
return $text;<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/10/08/convert-youtube-links-in-text-to-embedded-flash-player/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hemsida till Ludvig Nordström sällskapet</title>
		<link>http://www.marcusnyberg.com/2009/07/27/hemsida-till-ludvig-nordstrom-sallskapet/</link>
		<comments>http://www.marcusnyberg.com/2009/07/27/hemsida-till-ludvig-nordstrom-sallskapet/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 18:13:23 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[qmail]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=232</guid>
		<description><![CDATA[Jag har nyligen hjälp en kompis med att bygga en hemsida åt Ludvig Nordström sällskapet. Så kika på den! Eftersom jag är ett stort fan av att använda WordPress (php) som CMS till enklare webbsidor åt föreningar/mindre företag så blev det givetvis den tekniska lösningen. Som vanligt blev det lite hackande i form av att [...]]]></description>
			<content:encoded><![CDATA[<p>Jag har nyligen hjälp en kompis med att bygga en hemsida åt  <a href="http://ludvignordstromsallskapet.se/" target="_blank">Ludvig Nordström sällskapet</a>. Så kika på den!</p>
<p><a href="http://ludvignordstromsallskapet.se/" target="_blank"><img src="http://www.marcusnyberg.com/wp-content/uploads/2009/07/ludvig1.jpg" alt="ludvig1" title="ludvig1" width="100%"/></A></p>
<p>Eftersom jag är ett stort fan av att använda <a href="http://www.wordpress.org">WordPress</a> (php) som CMS till enklare webbsidor åt föreningar/mindre företag så blev det givetvis den tekniska lösningen. Som vanligt blev det lite hackande i form av att mixtra med teman samt plugins/tillägg men det var ganska enkla fixar som behövde göras. Samtidigt var det kul att se alla bra nyheter i WordPress 2.8. Det är riktigt imponerande att följa WP&#8217;s utveckling.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/07/27/hemsida-till-ludvig-nordstrom-sallskapet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial &#8211; Sending email from WordPress using Google Gmail</title>
		<link>http://www.marcusnyberg.com/2009/01/11/tutorial-sending-email-from-wordpress-using-google-gmail/</link>
		<comments>http://www.marcusnyberg.com/2009/01/11/tutorial-sending-email-from-wordpress-using-google-gmail/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 19:22:07 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=145</guid>
		<description><![CDATA[This tutorial covers how you easily can modify your WordPress installation to send email with a Google Gmail account instead of sending through your webserver. Only ONE file needs to be modified. You also need to have a working WP-installation and a Gmail-account. Step 1 Open the file &#8221;wp-includes/class-phpmailer.php&#8221; (which is the class that sends [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial covers how you easily can modify your WordPress installation to send email with a Google Gmail account instead of sending through your webserver. Only ONE file needs to be modified. You also need to have a working WP-installation and a Gmail-account.</p>
<p><strong>Step 1</strong><br />
Open the file &#8221;wp-includes/class-phpmailer.php&#8221; (which is the class that sends email in WordPress) in your favourite text-editor.</p>
<p><strong>Step 2</strong><br />
Find and modify the following properties.</p>
<p>var $Mailer = &#8216;smtp&#8217;;<br />
var $Host = &#8216;smtp.gmail.com&#8217;;<br />
var $Port = 465;<br />
var $SMTPAuth = true;<br />
var $Username = &#8216;your_username@gmail.com&#8217;;<br />
var $Password  = &#8216;your_gmail_password&#8217;;</p>
<p><strong>Step 3</strong><br />
Find the the method &#8221;IsMail&#8221; (in the same file) and comment out one row of code like this:</p>
<p>function IsMail() {<br />
    //$this->Mailer = &#8216;mail&#8217;;<br />
}</p>
<p><strong>All steps complete!</strong></p>
<p>This should work with all WordPress versions that uses a version of the <a href="http://phpmailer.codeworxtech.com/">phpMailer-class</a> that is Gmail compatible. </p>
<p>Tested in WordPress v 2.7</p>
<p><strong>LOOK HERE</strong><br />
I don&#8217;t use this method any longer because I don&#8217;t want to touch the core-files of wordpress. It is a bad habit to do so, because they get overwritten each time you update wordpress. There is a plugin called <a href="http://www.xpertmailer.com/">XPertMailer </a> that can send email through gmail. Use that one instead!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/01/11/tutorial-sending-email-from-wordpress-using-google-gmail/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Uppgraderar från WordPress 2.3 till 2.7</title>
		<link>http://www.marcusnyberg.com/2009/01/10/uppgraderar-fran-wordpress-23-till-27/</link>
		<comments>http://www.marcusnyberg.com/2009/01/10/uppgraderar-fran-wordpress-23-till-27/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 19:50:02 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/?p=132</guid>
		<description><![CDATA[Då jag skapade bloggen så var det första gången jag testade WordPress och den aktuella versionen var då 2.3. Sedan dess så har det runnit mycket vatten under broarna och WordPress är nu uppe i version 2.7. Det var alltså på tiden att uppdatera den här installationen till &#8221;latest&#8221;. Att uppgradera WordPress visade sig vara [...]]]></description>
			<content:encoded><![CDATA[<p>Då jag skapade bloggen så var det första gången jag testade WordPress och den aktuella versionen var då 2.3. Sedan dess så har det runnit mycket vatten under broarna och WordPress är nu uppe i version 2.7. Det var alltså på tiden att uppdatera den här installationen till &#8221;latest&#8221;. Att uppgradera WordPress visade sig vara väldigt enkelt och förvånansvärt smidigt bara man följer <a href="http://codex.wordpress.org/Upgrading_WordPress">instruktionerna</a>. Efter några minuter var både databas och programfiler uppdaterade. Då jag installerat programvaran och sedan loggar in på administrations-sidorna så möts man av en total remake av gränssnittet. Men som tidigare så är det väldigt enkelt att hitta saker och ting. En rolig detalj var att WP påpekade att det finns en svensk version av WP 2.7 som jag kunde installera. Några knapptryckningar senare så installerades WP  på svenska automatiskt utan att jag behövde lämna webbsidan. Mycket imponerande!</p>
<p>Saker som imponerar på mig:<br />
* Automatisk uppdatering och installation av plugins.<br />
* Automatisk uppdatering av själva WordPress &#8221;core&#8221;<br />
* Det nya GUI:t. Snyggare, enklare och bättre.<br />
* Enkel och smidig uppgradering och installation.<br />
* Widgets för sidopanelen som ändras via wp-admin</p>
<p>Nu tänker jag installera ett nytt tema och anpassa sajten för denna. Så sidan kan se lite tokig ut ett tag och vissa länkar kan vara döda innan jag fått till det.</p>
<p><strong>Summering:</strong><br />
Wordpress 2.7 är en riktigt bra version om man jämför med 2.3 som jag körde tidigare. Man har kommit riktigt långt såväl användarmässigt som systemmässigt. WordPress är riktigt imponerande både som blogg-verktyg och CMS. Det finns ingen tvekan längre, jag kommer nu definitivt att använda WordPress som mitt primära CMS-system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2009/01/10/uppgraderar-fran-wordpress-23-till-27/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elitserien på Facebook</title>
		<link>http://www.marcusnyberg.com/2008/12/10/elitserien-pa-facebook/</link>
		<comments>http://www.marcusnyberg.com/2008/12/10/elitserien-pa-facebook/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 09:24:35 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[facebook]]></category>
		<category><![CDATA[HockeySnack]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/2008/12/10/elitserien-pa-facebook/</guid>
		<description><![CDATA[Igår kväll så roade jag mig med att tillverka min första Facebook-applikation. Efter att ha följt instruktionerna på http://developers.facebook.com/ så tog det inte lång tid innan jag hade en applikation up and running. För att göra något vettigt så gjorde jag en applikation som hämtar upp den senaste elitserietabellen på HockeySnack. Denna kan sedan användarna [...]]]></description>
			<content:encoded><![CDATA[<p>Igår kväll så roade jag mig med att tillverka min första Facebook-applikation. Efter att ha följt instruktionerna på <a href="http://developers.facebook.com/" target="_blank">http://developers.facebook.com/</a> så tog det inte lång tid innan jag hade en applikation up and running. </p>
<p>För att göra något vettigt så gjorde jag en applikation som hämtar upp den <a href="http://www.hockeysnack.com">senaste elitserietabellen på HockeySnack</a>. Denna kan sedan användarna lägga till på sin egen profil.</p>
<p>För att installera Elitserien på din profil så går du till adressen  <a href="http://apps.facebook.com/elitserien/" target="_blank">http://apps.facebook.com/elitserien/</a> och följer instruktionerna. Om du gillar applikationen så får du gärna sprida den till dina hockeypolare.</p>
<p>Exempel på bilden nedan:</p>
<p><a href='http://www.marcusnyberg.com/wp-content/uploads/2008/12/app_3_38430138285_2885.gif' title='Facebook app'><img src='http://www.marcusnyberg.com/wp-content/uploads/2008/12/app_3_38430138285_2885.gif' alt='Facebook app' /></a></p>
<p>Eftersom det inte är särskilt svårt att göra en Facebook applikation så var det här troligen inte den sista som jag tillverkar. Om man lyckas göra en bra svensk applikation så tror jag att man kan få en väldigt stor spridning med tanke på användarantalet på FB.</p>
<p><a href="http://apps.facebook.com/elitserien/" target="_blank">Elitserien på Facebook</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2008/12/10/elitserien-pa-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix timestamp in C#, Java and php</title>
		<link>http://www.marcusnyberg.com/2008/11/20/unix-timestamp-in-c-java-and-php/</link>
		<comments>http://www.marcusnyberg.com/2008/11/20/unix-timestamp-in-c-java-and-php/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 10:30:13 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/2008/11/20/unix-timestamp-in-c-java-and-php/</guid>
		<description><![CDATA[For some strange reason the Dotnet framework has no conversion between a unix timestamp and a DateTime. Or has it? Why is it so when the framework has billions of other stuff that you never use. This functionality is actually something you would normally use in a system that communicates with the outside world. This [...]]]></description>
			<content:encoded><![CDATA[<p>For some strange reason the Dotnet framework has no conversion between a unix timestamp and a DateTime. Or has it? Why is it so when the framework has billions of other stuff that you never use. This functionality is actually something you would normally use in a system that communicates with the outside world.</p>
<p><a href="http://www.codeproject.com/KB/cs/timestamp.aspx">This webpage has a solution</a><br />
<a href="http://codeclimber.net.nz/archive/2007/07/10/Convert-a-Unix-timestamp-to-a-.NET-DateTime.aspx">Another page about the same stuff</a></p>
<p>In my current project I am trying to convert a Java Calendar object to a C# DateTime through JNI (Java Native Interface). I have no perfect solution at this moment but I will try to use a unix timestamp though I am losing some precision.</p>
<p>Java has direct conversion from <a href="http://java.sun.com/javase/6/docs/api/java/util/Calendar.html">Calendar</a> to <a href="http://java.sun.com/javase/6/docs/api/java/util/Date.html">Date</a> (which is a representation of a unix timestamp). Bravo! :-)</p>
<p>php has lots of functions (like <a href="http://se.php.net/strtotime">timetostr</a>, <a href="http://se.php.net/time">time</a>) to create and convert unix timestamps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2008/11/20/unix-timestamp-in-c-java-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strip tags from a string</title>
		<link>http://www.marcusnyberg.com/2008/05/21/strip-tags-from-a-string/</link>
		<comments>http://www.marcusnyberg.com/2008/05/21/strip-tags-from-a-string/#comments</comments>
		<pubDate>Wed, 21 May 2008 12:14:24 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Programmering]]></category>

		<guid isPermaLink="false">http://www.marcusnyberg.com/2008/05/21/strip-tags-from-a-string/</guid>
		<description><![CDATA[It is often useful to have a way to strip html or other tags from a string. Php has the strip_tags function. Stripping tags could be done in .NET with the following code that returns the stripped string: public static string StripTags(string str) { return Regex.Replace(str, @&#8221;&#8221;, string.Empty); }]]></description>
			<content:encoded><![CDATA[<p>It is often useful to have a way to strip html or other tags from a string. Php has the <a href="http://se.php.net/manual/en/function.strip-tags.php">strip_tags</a> function. Stripping tags could be done in .NET with the following code that returns the stripped string:</p>
<p class="kod">
	public static string StripTags(string str)<br />
	{<br />
		return Regex.Replace(str, @&#8221;<(.|\n)*?>&#8221;, string.Empty);<br />
	}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcusnyberg.com/2008/05/21/strip-tags-from-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

