Power of the feeds module
Today I have given a small talk about the power of the feeds module in Drupal at Madcap. You can find the presentation here. More info about feeds and how to use it is in this article.
Today I have given a small talk about the power of the feeds module in Drupal at Madcap. You can find the presentation here. More info about feeds and how to use it is in this article.
You’d think that cats would be content with having ‘nine lives’ and sleeping for 16 hours a day. But, no. They want more. They want your milk, too.
Drupal 7 uses the DrupalPublicStreamWrapper-class to handle all the files that are upload to a node or served to the audience. When you take a look at the node object you will see that the path where the file is stored is not directly clear. For example:
[0] => Array (
[fid] => 14
[display] => 1
[description] =>
[uid] => 1
[filename] => index.html
[uri] => public://htmlclean/index_3.html
[filemime] => text/html
[filesize] => 38941
[status] => 1
[timestamp] => 1296904269
)
In this example you can see that the file index.html is saved as index_3.html and available at the URI public://htmlclean/index_3.html. For one off my modules I needed the real path. I will explain how I retrieved it. In the example below the $file_array is the array as shown in the example above.
$scheme = file_uri_scheme($file_array['uri']);
$wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);
$path = $wrapper->getDirectoryPath() . '/' . file_uri_target($file_array['uri']);
The result of $path is the following: sites/default/files/htmlclean/index_3.html. If you want a web-accessible URL . Simply use file_create_url($uri).
If there is a faster way to do this let me know! Or else you can use this snippet to retrieve the real path of file in Drupal 7.
You probably know this scenario: You have a laptop and sometimes you would like to have two or more screens but the luxury of just one keyboard and mouse. One screen you would like to use for your browser, one screen for your currently active program and maybe even one to keep an eye on your e-mail program. But you don’t want to buy a second or third screen. This problem is easily solved with with for example two laptops and a small program called QuickSynergy. With this program you can use the keyboard and mouse of one machine to control the others. You can position the client for example left of the server (the machine you want to use the keyboard and mouse on). In my case I created a client on an HP net-book that is on the “left” of my own laptop (“server”). This way when my mouse leaves the screen on the left it will appear in the screen of the net-book. Both machines run in my case on Ubuntu 10.10. Check the tutorial on wiki pages of ubuntu: QuickSynergy
I’m really fond of the XBox Kinect, but I also like our cats. And after watching this movie on Youtube I realized that the Kinect should alter it safety instructions for pet owners. Or simply lock away your pets for a while.