If you need to ensure that your system or database does not have half complete executions which might have halted due to failures, you have two obvious solutions. One is to try and pre-verify everything before you start your execution but even that is not bulletproof. A more elegant approach is to push each equal and opposite actions to a stack and cause the stack to pop and execute on any failure. Read on to see an implementation.
Read more…
After much research into available backup solutions for windows I could not find one that could do what I wanted (essentially sync files and folders across machines and have changes replicated in all directions so if a change occurred on machine 1 and another on machine 2 both changes would be reflected in both machines instead of one change overwriting the other in a traditional one directional backup solutions). A popular service which serves this purpose is Dropbox but it runs on the cloud and that’s enough for you to look the other way. I’m not a fan of the cloud and neither should you, keep your files safe locally and encrypted.
A linux based command line utility called rsync was the first milestone in finding a solution in terms of efficiency as it is extremely fast in replicating updates across however the problem was this was also one directional.
The final solution came when I discovered a tool called unison which is based on rsync but provides this bidirectional functionality. Unison and rsync are both unix based tool so we will use cygwin on windows to use them.
Read more…
If you upgraded to CodeIgniter 2.0.1 from 1.7.2 you might encounter on some pages the following error:
A PHP Error was encountered
Severity: NoticeMessage: Undefined property: MyStats::$db
Filename: core/Model.php
Line Number: 50
This is easily fixed by editing the Model.php file in the system directory.
Read more…
To keep things clean it’s a great idea to make a common button style that can be reused across your site. But already there is a problem if you try to style an html submit button, that styled button can only be used within an html form which might not fit all your scenarios.
Therefore a common way around that is to instead style an anchor tag which can be used in any context. Although this is great for style reuse it creates problems such as the default html form submit behavior to dissapear and the need of some extra javascript actions to submit the form action. Such behavior as hitting enter from an input box usually submits the form but if no submit button is present in the form it won’t get submitted.

Read more…
When web designing it is quite common to require a picture to seamlessly tile in the x or y direction. The CSS feature repeat-x repeat-y could then be used on such image. This would allow for instance to have a reasonably small background image fill the entire background of the browser region as it repeats with no apparent seam.
to 
This is easily achieved with the Adobe Photoshop Offset Feature.
Read more…