Weblog


Scheduled ftp backup
Sunday, august 22, 2010 | By: Leon van den Beukel | Category: Linux 0 Comment(s) ›› |  Comment ››

Recently I bought a Synology Diskstation. One of the reasons why I bought it was because I want to make a backup of several websites at a daily bases. Unfortunately the build-in scheduled ftp backup feature only allows you to run the scheduled item once. A friend of mine tipped me about writing a simple php script that just uses some built-in ftp functions of php. For example, use the ftp_get function to get your files:

ftp_get($this->conn_id, $this->localpath . $content, $content, FTP_BINARY); 

Add it to your crontab and you're done:

1      1       *       *       *       user    /usr/bin/php /backupwebsite.sh >> /backupwebsite.log

Download the quick and dirty script/class here.


Android console
Wednesday, april 28, 2010 | By: Leon van den Beukel | Category: Android 0 Comment(s) ›› |  Comment ››

When debugging/coding an Android app with the emulator you can 'emulate' a GPS signal by opening a console to your emulator:

telnet localhost portnumber

Then by sending something like this, you emulate a GPS signal:

geo fix -121.45356 46.51119 4392

More info: here and here


IComparer or LINQ?
Tuesday, march 30, 2010 | By: Leon van den Beukel | Category: .Net 0 Comment(s) ›› |  Comment ››

There are at least two ways of sorting an array by a substring. You can use a custom IComparer class (see the code for the class):

string[] namessorted = SortSubArrayList.Sort(names, 1);

Or you can use LINQ to sort: 

IEnumerable namessorted = names
                          .OrderBy(s => s.Substring(1))
                          .Select(s => s);

Which one do you think is better? Download the source here.

RSS
Categories

All

ExtJS(3)
.Net(3)
JavaScript(3)
Linux(2)
Android(1)
Common(1)
GIS(1)