zaterdag 19 maart 2011

[SOLVED] PHP cannot write to file

When trying to execute a PHP script that should write text content to a file, I ran into trouble.
First of all, what did I do?

$myfile = '/var/www/dev/log/mylog.log';
$fh = fopen($myfile, 'w');
fwrite($fh, "add some content\n");
fclose($fh);


Then, when executing and nothing happens: I did the following:

  • set log directory to writable: 777

But again nothing worked...
Finally I found out that I had to set the owner of the directory.

By typing 'ps aux | grep apache' into the terminal I found out that apache is runned with the user www-data.

Now, when the log folder is owned by www-data user, it becomes accessible for apache. To do this, type: chown www-data /var/www/dev/log/ (or any other folder you want to use). Also make sure the folder is 777 and maybe you need to delete previous logfiles in order to let PHP create new ones.

maandag 5 april 2010

Hoe werkt revisie met Word?



In de wetenschap, maar ook in het bedrijfsleven worden veel zaken gedocumenteerd. Bij dit documenteren of rapporteren van teksten zijn vaak meerdere personen (auteurs) betrokken. Om gezamenlijk aan een Word document te werken kan het er praktisch zijn om 'redigeren' te gebruiken. Met redigeren kun je aanpassingen en toevoegingen van elkaar bekijken, goedkeuren of eventueel eenvoudig weer schrappen.
Een paar vragen en antwoorden die ik wil delen:
Hoe zet ik 'revisie' aan?
Hoe kan ik versie verschillen zien?
Hoe kan ik een versie accepteren?


Voor nog betere samenwerking is er een open source word achtige applicatie die live samenwerken mogelijk maakt: je ziet letterlijk elkaars aanpassingen in het scherm verschijnen! Intensief samenwerken heet dat! Check AbiWord eens! Snel begrijpen wat AbiWord doet? check videos!

woensdag 3 juni 2009

My display rotated, how to turn this display back?


Many laptops / notebooks nowadays have the option to rotate the display (not physically!). It allows you to read documents or PDFs very nicely, but often it is very annoying.
If you got this service without asking for it, try the following key combination:
CTRL + ALT + ARROWUP.

You have to press the control key, the alt key and the upper arrow key all at the same time. You can tilt your screen in other directions with another arrow-key! Give it a try, sometime it may become of use.

If it DOES NOT WORK try SHIFT instead of ALT!

See also eHow

zondag 15 maart 2009

Uploading with PHP

The form
1. make sure you have a form with a file field:
<form action="upload.php" enctype="multipart/form-data" method="POST" >
<input type="hidden" value="30000" name="MAX_FILE_SIZE">
<input type="file" name="userfile">
<input type="submit" value="Upload now">
</form>


The script

$target = "uploads/";
$target = $target. filename_safe(basename($_FILES["userfile"]["name"]));

if(move_uploaded_file($_FILES["userfile"]["tmp_name"], $target)) {
// upload succesfull
echo "upload successful";
}
else {
// upload not successfull
echo "upload unsuccesful";
}


Extra information

If things don't work correctly:

* check for the right PHP version: echo phpversion();
From PHP 4.10 you can use $_FILES, otherwise use $HTTP_POST_FILES.

* the actual files you try to upload may be too big, try it with smaller files!

woensdag 25 februari 2009

Getting eGPS (enhanced GPS) to work for Google Maps on you Samsung Omnia I900




In Google Maps you can determine your location with GPS. But on the Samsung Omnia this doesn't work by default. The Omnia has a special version of GPS, called enhanced GPS. This type of positioning is using GSM or GPRS signals to find locations faster.

1. So, first you need to make sure you have an internet connection.

2. Next, you need to set a few settings in Windows Mobile: go to 'settings' / 'control panel', then the tab 'system' and click on 'external GPS'.
In the first tab you need to select COM3
In the second tab (hardware) select COM9 and 4800 as baudrate
In the third tab (access) make sure the box is checked.
Click OK.

3. Then, you select 'Enhanced GPS' in the control panel (settings) and make sure you enable the first option (XTRA), disable the second (Automatic download).
(If things not work at the end you may need to click the button to download XTRA stuff.
Click OK.

4. Start Google Maps (from the programs) and enable the GPS by clicking menu (bottom right) and check the GPS option.
(Under options you may select manual settings for COM port and baudrate, but this is not necessary).

5. It may take a while before your position is determined. But in the end the blue circle should get smaller (meaning that the possible error in location determination becomes lower).
It works best if you take your device outside or close to the window in order to keep visual contact with satellites.

I hope it works!

woensdag 19 november 2008

Beschrijf een Persoon in RDF

(For the english version click here)
Het hele idee achter het Semantische Web is het beschrijven van objecten met een gedeeld vocabulair.
Als we dus bijvoorbeeld een Persoon willen beschrijven, moeten we eerst het juiste vocabulair vinden.

Een erg populair vocabulair is FOAF (Friend of a Friend).

Eerst zullen we een aantal voorbeelden geven. Daarna worden een paar tools gegeven om je eigen Person te maken in RDF.

Voorbeelden
Een paar simpele voorbeelden kun je vinden op:
http://wiki.foaf-project.org/MinimalFoafDocument. (scroll naar beneden)
Meer geavanceerde voorbeelden, op de zelfde website:
http://wiki.foaf-project.org/DescribingAPerson.

Technische details:
De volledige specificatie van wat je allemaal kunt beschrijven met FOAF:
http://xmlns.com/foaf/spec/


Tools:
Een basic multi-language tool voor het online genereren van een FOAF RDF:
http://www.ldodds.com/foaf/foaf-a-matic



Om artikelen leesbaar te houden, kies ik ervoor om een minimale hoeveelheid informatie te geven. Als je van mening bent dat ik iets belangrijks gemist heb, laat het me even weten, zodat ik het artikel kan verbeteren.

Describe a Person in RDF

(Voor de Nederlandse versie klik hier)
The idea of the Semantic Web is to annotate objects with a shared vocabulary.
When we want to annotate a Person object, we should find the right vocabulary.

A very popular vocabulary is called FOAF (Friend of a Friend).

First we will give some examples. Later some tools are shown to make your own Person in RDF.

Examples:
Some simple examples can be found on
http://wiki.foaf-project.org/MinimalFoafDocument. (scroll down)
More advanced examples can be found on the same website:
http://wiki.foaf-project.org/DescribingAPerson.

Technical details:
The full specification of what you can annotate with FOAF:
http://xmlns.com/foaf/spec/


Tools:
A basic multi-language tool for online generating a FOAF RDF:
http://www.ldodds.com/foaf/foaf-a-matic


To keep articles readable I choose to give a minimum amount of information. If you think I missed an important part, please comment and I will improve the article.