I am currently using rsync as a backup solution between two computers and an external backup drive, all operating across my wireless LAN. However, every so often - and always when syncing a lot of files - rsync has knocked out my wireless internet. Today, I decided to find out what was going on, and found the solution:
rsync --bwlimit=500 ...
It turns out that rsync was overloading my router with data, causing it to reset the connection. Setting a bandwidth limit (in kBPS) to one nearer that of the router prevents overloading, and allows the scripts to complete.
If storing a date/timestamp in a varchar or text field in postgres, the to_timestamp() function will let you access the value as a ‘real’ date. The second parameter tells the function the format of your string:
SELECT to_timestamp('2008-08-01', 'YYYY-MM-DD') AS date;
A frustrating problem I came across today when I tried binding an NSPopUpButton’s selection key to an NSArrayController’s selection was that the NSPopUpButton would always display a ‘ghost’ object -one of the opaque classes internal to Cocoa/Core-Data Bindings(<_NSControllerObjectProxy… or similar).
It turns out that NSPopUpButton does not record the user’s selection, so even if I had been able to get rid of the ghost object, I wouldn’t have been able to access the selected object.
The solution is to manually maintain a currently selected object in the window controller - File’s Owner in Interface Builder; in this case, selectedPackage:
I’ve not had any time to try out Jaxer yet, but the idea of a single platform for both client and server-side processing sounds good.
On trying to get started, though, one problem I encountered was that the installation instructions on Aptana’s site didn’t quite get Jaxer running on my default Ubuntu 8.04 install. The reason seems to be the built-in Apache trying to load an external library from
/usr/lib
which doesn’t exist.
The library in question is libexpat.so.0; however, there is a libexpat.so.1.5.2 installed! You can check this by running:
$ ls -l /usr/bin | grep libexpat
Creating a link to this file in /usr/lib with:
$ ln -s libexpat.so.1.5.2 /usr/bin/libexpat.so.0
seems to have got Jaxer running and the server status looks good. If you’re having trouble getting a Jaxer server running on the latest Ubuntu, this might be worth giving a go.
At work, I have been developing a custom framework loosely based on my experience with the symfony and Propel. One of the requirements for the application under development is to store the application’s state both on the server and the client, so that information can be passed by means of AJAX requests.
To aid this process, each page controller PHP class has a corresponding Javascript class. In order to maintain state through the application, each class as a Singleton. With the help of Prototype, singleton classes are quick and easy to implement in Javascript:
First, declare the class itself using Prototype’s Class.create() method:
PageController =Class.create({/**
* @type {integer}
*/
userId:null,// ... more properties .../**
* Constructor
*/
initialize:function(){// ...},/**
* A method to do something...
*/
doSomething:function(){
console.log('doSomething()');},// ... more methods ...});
Once the class is created, we can declare a static instance of the class and a static method, getInstance(), that will be used to return the single instance of the class:
/**
* @type {PageController} Static instance of the page controller
*/
PageController.instance=null;/**
* Return the static (singleton) instance of
* the page controller object
*/
PageController.getInstance=function(){if(!PageController.instance)
PageController.instance=new PageController()return PageController.instance;}
With the class now declared, the singleton instance can be accessed in your application using the static getInstance() method: