/** * NF_Persistence * * Agent Smith: “Why, Mr. Anderson, why? Why do you persist?” * Neo: “Because I choose to.” * * PHP Version 5 * * @category NiftyFramework * @package NiftyFramework * @subpackage Database * @author Mats Gefvert * @license http://www.sun.com/cddl/ Common Development and Distribution License */ class NF_PersistenceRelationMap { …. I make [...]
Category Archives: Software Development
11:19
13:00
Microsoft Like Moria, Not Mordor
Contrary to public opinion, Microsoft is not Mordor. Microsoft is like Moria. Being a developer and faced with the task of developing some particularly interesting feature for, say, the Internet Information Server (IIS), is much like Gandalf and the companions looking at crossing the mountains through the treacherous kingdom of Moria. Once a kingdom of [...]
15:33
Speeding Up Delphi’s TStringList.IndexOf
Delphi’s TStringList is one of the objects I love the most. If it’s sorted (StringList.Sorted := true) then you can use it to parse huge chunks of data quickly. For instance, looping through an enormous amount of IP addresses and keeping count of how many times they appeared, is easily done using the following code [...]
10:15
Computer Speed and Memory Access
I’ve found a new great blog, Gustavo Duarte’s blog, where he talks about hardware, operating system kernerls, and other fun items. I liked his comparison of how fast different types of memory is. The first thing that jumps out is how absurdly fast our processors are. Most simple instructions on the Core 2 take one [...]
21:12
Updates
Life goes on. I’ve been working on Nifty this weekend. Seemed like a good idea, because I’m updating a lot of stuff on the intranet at work, building on the 1.2 branch, and I need a couple of new features. So I made a 1.3 branch. Some really nifty features so far: Pages aren’t limited [...]
10:26
Code folding in Netbeans PHP
I recently found out a tip that C#-style #region and #endregion-style declarations work in NetBeans for PHP too, although with a slightly different syntax. The trick was making it work in HTML, since I use it mostly for defining different sections of my .phtml templates, which can get pretty long: <? // <editor-fold defaultstate=”collapsed” desc=”JavaScript [...]
21:25
I’m Publishing My Little Programs Now
I’ve published one or two of my little programs before, but now I’m expanding with a set of new ones. DesktopShooter (shoot up your desktop) Mobile Clock (display a neat clock/countdown on the desktop) Mobile Notepad (the old “notepad” under a new and better name) Mobile Wallpaper (replacement for Webshots) These are all available under [...]
11:17
Nifty Framework 1.2 is Available for Download
At long last, the Nifty Framework 1.2 is available for public download. No guarantees implied. It’s a bleeding edge copy of production code, though. But it’s darn good, if I may say so myself. :)
09:57
All These Mornings
For many years now, while working with computers on a daily basis, I’ve sometimes had these moments when I’m just between sleeping and waking up, and I imagine myself doing ordinary things – you know, like making coffee, taking a shower, stuff like that – and the thing that bothers me in my sleepy state [...]
17:49
Programming with Nifty 1.2
Some features in the upcoming Nifty Framework 1.2 release: <?php class Index extends NF_Page { public function executeView($id) { global $Request, $Persistence, $Response; $form = NF_Component::fromArray(array( ‘component’ => ‘NF_CForm’, ‘name’ => ‘form’, array(‘component’ => ‘NF_CInputHidden’, ‘name’ => ‘id’, ‘dataField’ => ‘id’), array(‘component’ => ‘NF_CInputText’, ‘name’ => ‘name’, ‘dataField’ => ‘name’, ‘label’ => ‘Name: ‘), array(‘component’ [...]
21:59
Getting up to speed on the Nifty Framework
Just finished putting together an introduction to my PHP framework, Nifty. If you’re curious about it, look here for a rather detailed introduction on how it works, the MVC patterns, templating, session, database and persistence layers, etc.
16:37
What an Enormous, Unbelievable Mess
I’ve been trying to config our Apache server today. These are the requirements: We want PHP version 5. All users accounts are separated through virtual hosts. PHP should be run with the same user rights as the user, this means either CGI or FastCGI with suexec; because when frameworks create files in the home directory, [...]
15:47
Publishing My “Nifty” Framework?
I’m sitting here wondering if I should go public with the PHP framework I’ve built over the past couple of years. It’s gone through a couple of iterations and is now something that I’m regularly building internal and external websites on top of. No, it’s not the same thing as my Nifty CMS, but that [...]
13:56
Using XDebug and WinCacheGrind to Optimize PHP Scripts
I noticed earlier that our helpdesk system (written in PHP) became somewhat slower after we upgraded to the new version, 1.1. I always thought I’d look into it but never got that far. Of course, I’m using a self-written framework, and I’ve known that it hasn’t been profiled for speed, so I knew there’d be [...]
14:10
MediaWiki and XSL-FO
At work, we’re using MediaWiki as both an internal and public wiki (we have two different ones, separated, to provide watertight bulkheads between them). Recently, the administrator of the public wiki has been looking for ways to automatically generate PDF files. One extension in particular, Extension:Pdf Export, seemed to be useful; but on closer inspection [...]
21:40
Essential PHP Security
Good book to read for anyone working with PHP. It started off easy enough, you know, don’t trust input, always escape output, stuff like that. “Yeah, yeah”, I thought, “I learned that in kindergarten”. But with each chapter, my attitude kind of changed from a “yada, yada” to “hmmmm” to “oops”. The author doesn’t quite [...]
10:21
Windows Scripting
Over the past few days I’ve been trying to build a number of Windows server administration scripts – you know, for adding users to the Active Directory, creating new IIS websites, doing various stuff – and I get the distinct feeling that this is not something you normally do. Whereas Linux has tools that do [...]
14:26
File Access Rights
This seems to be the state-of-the-art way to change access rights on a file in PowerShell: $colRights = [System.Security.AccessControl.FileSystemRights]“Read” $InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::None $PropagationFlag = [System.Security.AccessControl.PropagationFlags]::None $objType =[System.Security.AccessControl.AccessControlType]::Allow $objUser = New-Object System.Security.Principal.NTAccount(“domain\user”) $objACE = New-Object System.Security.AccessControl.FileSystemAccessRule ` ($objUser, $colRights, $InheritanceFlag, $PropagationFlag, $objType) $objACL = Get-ACL “c:\testfile” $objACL.RemoveAccessRuleAll($objACE) Set-ACL “c:\testfile” $objACL Funny… The unix version would be [...]
21:21
I Wonder If I Actually Do Anything Useful?
I’ve been thinking. That’s never a good sign. :) I build a lot of software systems. If I’m not designing a web platform for support cases, I’m building systems for PowerPoint presentations, or custom PHP frameworks, or… well, you name it. But wherever I look, I’m almost invariably being replaced. The things I implement are [...]
09:25
Cooling Down
We started getting spurious temperature fluctuations in our server room a while ago. Each night, temperature would rise to above 30C for about half an hour, and then go down again. Over the past couple of days, it grew increasingly erratic and threatened the entire server room functionality — outages grew more and more frequent [...]

