27 December, 2015

View a Json Object in the console

At least in Google Chrome this works like a charm:

var xhr = new XMLHttpRequest();
responseObject = JSON.parse(xhr.responseText);
var openFile = "weather.json"; // sample file



The Json Object in a Chrome Console

26 December, 2015

Intrduction to the Philips HUE API

The first impressions using the app from Philips was nice. But even better: there are tons of apps out there. Even better: you can hack your own interface using the fine API from Philips. Here are some starting points:

You can program Philips Hue via the Json based API and methods like GET, POST and PUT. The bridge has a nice API interface on:


Here you'll get a testing GUI to use when experimenting with the API methods.

Experiment with JavaScript and Json

Copypasted a json sample from W3 Schools, and console.logged the result. Surprisingly the console got the json object.

console.log result
From this I should be able to figure out how to write the content to the screen.

Python: Idle session

Python 2.7.9 (default, Apr  2 2015, 15:33:21)
[GCC 4.9.2] on linux2

>>> import requests
>>> import json

>>> taend = json.dumps({"on":False})

>>> r = requests.put("http://192.168.0.xxx/api/your-secret-code/groups/0/action", data=taend)

All lamps went out out, so a success it was.

Bash Experiment

curl -X PUT -d "{\"on\":true}" http://192.168.0.xxx/api/your-secret-code/groups/0/action

Since it's possible to use curl in PHP the same thing must be possible in PHP.

25 December, 2015

Philips HUE

So how do you discover the IP of your device. On linux the answer is arp-scan (if it's not on your system apt-get install it):

Using arp-scan --interface=wlan0 I got:

192.168.*.** *************** (Unknown)
192.168.*.11 00:17:88:20:e8:6e Philips Lighting BV
192.168.*.** *************** (Unknown)

So now I know my IP.

17 December, 2015

The Librarian

Visited the librarian. She recommended these urls:

Lo and Behold! My BibTex compiler works ...

A (oh horror!) .docx file in Libre Office

In order to make a literature review I need to compile a MySQL table in the BibTex format.

Now I've got a file, that looks pretty much like a BibTex formatted file. It's compiled from a MySQL database and the output is formatted by PHP.

In the php code this loop will format the output:

while($row = $result->fetch_assoc()){
    $books[] = "\n@". $row['Type'] 
     ."{" . strtoupper( substr($row['Author'], 0,4)) 
     . "_" . $row['Year']
     . ",\n Author={" . $row['Author'] . "},\n"
     . "Title={" . $row['Title'] . "},\n"
     . "Publisher={" . $row['Where'] . "},\n"
     . "Year=" . $row['Year'] . "}\n";

I made a simple markdown file and compiled it with pandoc. The result was a .docx file.

Here is the output from the database formatted via PHP:

Publisher={Hans Reitzels Forlag},

etc. etc. etc. etc. etc.

The markdown contains a reference to a book in the BibTex file:


Finally the markdown is compiled via pandoc thus:

# pandoc --bibliography=libri.bib test.md -o test.docx

The image above is a screendump from the docx-file in Libre Office. I only refered to Aristoteles, and that's the only work in the list of sources.

Ergo: Q.E.D.

That is: this is just a toolbox. The next step is literature research for the WordPress and Open Source CMS Research Project @ Business Academy Aarhus. And perhaps: come up with title with > x-factor.

16 December, 2015

WordPress and open source CMS research

I have to make a litterature review about open source CMS with focus on WordPress.

Yesterday and today I made a BibTex compiler for WordPress. I have to make a litterature review. By now I'm inspired by Umberto Eco's cardboard file cards. However, nowadays I think that a MySQL database is better suited for the storage.

Here is the system:

  • https://github.com/asathoor/libri
Today the final pieces came together. The database has all entries from my bibtex file. Via PHP I can convert the MySQL data to a bibtex format. Here's the trick:

while($row = $result->fetch_assoc()){     print "\n@Book{" . strtoupper( substr($row['Author'], 0,4)) . "_" . $row['Year']     . ",\n Author={" . $row['Author'] . "},\n"     . "Title={" . $row['Title'] . "},\n"     . "Publisher={" . $row['Where'] . "},\n"     . "Year=" . $row['Year'] . "}\n";   }

Some formatting may be done via SQL, here's a sample from my Github repo:

SELECT '@Book{' as 'Book',

concat(left(`Author`,3),`Year`,',') as 'slug',
concat('Author={{' , `Author`, '}},') as 'Author',
concat('Title={{' ,`Title`, '}},') as 'Title',

FROM `libri`

So the environment for developing the project is almost there. 

06 December, 2015

Brute force attacks on WordPress

It seems that sinister powers are lurking around one of my webpages. There are 501351 attempts to log in - in just one month. I guess the picture is quite normal for attacks on WordPress sites. So don't have a user called Admin - and make sure, that your password is hard to crack.

29 November, 2015

Windows 10 - a bit like Linux Mint Cinnamon

If you're fond of Linux Mint Cinnamon, then Windows 10 is not that bad at all. The start button and menu are very similar indeed.

Perhaps the Redmond designers had a very close look at the open source alternatives here. Windows 10 is very fast indeed when it comes to installing and removing programmes. If you get a version without too much bloat- and nagware it could be usefull.

I've had my reservations towards Microsoft and Windows for years and years. However this version is promising indeed.

Server for RUBY

SASS runs in a Ruby environment. So it'd be nice to be able to run a server in that environment. Many sites recommend Passenger. I think I'll try it out. Sooner or later that is ...

28 November, 2015

Last Chance for Tomtom

Tried to remove an old SD card and format a new one. Now I'm trying to reinstall everything via the new MyDrive Connect. The Windows 10 install was very, very fast. It's been a while since I said: well perhaps this Windows is ok-ish.

After the first install I got an error. No map installed. Then I tried to install a map .. lo and behold:

It actually worked!

Tomtom is up and running again - after at least 15 hours of trial and error that is.

I guess that the problem with Tomtom is totally uncomprehensible error feedback to the user. Figuring what's wrong takes a full blown clairvoyant or a reliable set of Tarot cards. "Install failed" does not say why.

And I still miss a Linux GUI ...

Xampp on Windows 10

Well, installing was easy - but I could not find a solution to programs blocking the ports. Changing the ports is uphill ...

Skype was a running process eventhough the program was not opened. Killed the process in the joblist. Try again ...

Reinstalled Xampp. Killing the Skype process in the joblist did the trick.


26 October, 2015

Notes for an upcoming PHP introduction class

Idea: use bootstrap and develop menus. Include header and footer with scripts etc. Include whatever content needed.

Mobile first and Responsive Web Design concepts.

30 September, 2015

WordPress on the lan - how to use the correct url

Phpmyadmin > wordpress > wp_options

Problem: localhost in stead of ip
In links and stylesheets WordPress used something like:

http://localhost/whatever ...

It should be something like: ...

Open the wp_options table, and rename the http address to the correct ip, e.g.


27 September, 2015

Get read and write permissiongs to shared WordPress (or other) folders

It's so nice to be able to edit your themes in the File Manager

This works like a magick spell:
# sudo groupadd tomandruser

Now that the group exists, add the two users to it:

# sudo usermod -a -G tomandruser tomcat6
# sudo usermod -a -G tomandruser ruser

Now all that's left is to set the permissions on the directory:

# sudo chgrp -R tomandruser /path/to/the/directory
# sudo chmod -R 770 /path/to/the/directory

( See Andrew Lambert's proposal no. 71 in this thread )

On my localhost I decided to share the WordPress themes folder in this way. Here's what I did on my Debian-based system:

  1. Created the goup called webeditor
  2. Added my user to the group.
Added www-data to the same group.
  1. Changed the themes/ folder to the webeditor group.
  2. Changed the permissions of the themes folder to 777.

Now I only need to create a folder and ln -s to the themes folder. Then it's possible to edit themes at log in via the symbolic link:

# ln -s /var/lib/wordpress/wp-content/themes/ ~/wpthemes

But when WordPress or the user create their own stuff, it looks like this:

$ ls -l
totalt 16
drwxr-xr-x 6 www-data www-data  4096 sep 27 09:23 dusk-to-dawn
drwxrws--- 7 www-data webeditor 4096 sep 27 09:33 twentyfifteen
drwxrwx--- 9 www-data webeditor 4096 sep 26 19:30 twentyfourteen
drwxr-xr-x 2 per      per       4096 sep 27 09:52 x

So you can edit the files, but have to change the permissons to folders installed by WordPress.

26 September, 2015

WordPress on Debian - where are the files?

You can install WordPress on a Debian system. Follow the instructions here. This install will make a WordPress site available on your localhost, but the files are not found here.

# var/www/html/

Actually they are saved in a number of different directories. First the virtual host is defined in apache:

# /etc/apache2/sites-available/wp.conf

Alias /wp/wp-content /var/lib/wordpress/wp-content
        Alias /wp /usr/share/wordpress
            Options FollowSymLinks
            AllowOverride Limit Options FileInfo
            DirectoryIndex index.php
            Require all granted
            Options FollowSymLinks
            Require all granted
 These aliases tell Linux where to find the different WordPress files.

Here are the configuration files:

# /etc/wordpress

Here you find the config-localhost.php file. In this file you set up the database connection:

define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', '*******');
define('DB_HOST', 'localhost');
define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');

Here are the actual WordPress files:

# /var/lib/wordpress/

The WordPress themes and plugins etc. are here:

# /usr/share/wordpress/wp-content

WordPress on Debian - enable update

If you get errors when trying to update or installing themes or plugins try to change the owne of the WordPress directory to www-data and change the chmod to 755:

# chown -R www-data:www-data /var/lib/wordpress/
# chmod -R 755 /var/lib/wordpress/

Install Brackets on a Antix Linux OS

Brackets needs libcrypt in order to run. Download libcrypt from this page. Here's what I did:
# wget http://ftp.us.debian.org/debian/pool/main/libg/libgcrypt11/libgcrypt11_1.5.0-5+deb7u3_amd64.deb
# dpkg -i libgcrypt11_1.5.0-5+deb7u3_amd64.deb
#  dpkg -i Brackets.1.4.Extract.64-bit.deb

23 September, 2015

Pandoc - a simple way to compile the semester curriculum

Here's the method:

# pandoc --bibliography=books.bib lectures-day00*.md -o curriculum_course_all_lessons.pdf

This method will compile all relevant *md documents to one, and add the complete list of sources in the end, e.g.:

Brazel, Aron. 2010. The WordPress Bible. Wiley Publishing. http://it-ebooks.
Forta, Ben. 2011. MySQL Crash Course. Sams.
Mcfarland, David Sawyer. 2008. JavaScript - the Missing Manual. O’Reilly.
Wordpress.org. 2015. “Codex.” http://codex.wordpress.org.

14 September, 2015

Raspberry Pi / Sony Bravia

Waiting for the Sugru to dry.
And then ... XBMC
on our Sony TV.

Glue the Pi on your TV!

The first generation of Sony Bravia had web options, but to be honest: the greatest thing here is the HDMI slot. You can connect any PC or DSLR or whatever. Behind the TV a Raspberry Pi is almost invisible. In fact it's more advanced than the intestrians of the Bravia. So why not make the RasPi permanent here? Just glue it on with some Sugru ...

The Pi Configuration

  • An Apache web server.
  • A XBMC media center.
  • X.
  • Noobs.

The remote

This post:


says, that you can connect the Pi to the Sony Bravia. Then press "Sync Menu" on the remote. And then the remote should work ...

Right now I cannot test. I'm waiting for the Sugru to harden, because I mounted the Pi behind the TV with some Sugru ...

Todo - later on

  • DMZ the Pi on the router (using this guide).
  • Figure out a method to allways have the IP address.
  • Set up a firewall with ufw.
  • Try to secure Apache.
  • And security issues in MySQL.

12 September, 2015

Koala - SASS and Compass the easy way

Koala will give you easy access to your Sass / Compass projects. You don't need to use the commandline at all. The error log is a great help for debugging your code.

27 August, 2015

Unity - remove more suggestions

In Unity "more suggestions" are just plain adss. Ubuntu please don't bloat my screen with ads ...

To remove the crap try this:

# gsettings set com.canonical.Unity.Lenses disabled-scopes "['more_suggestions-amazon.scope', 'more_suggestions-u1ms.scope', 'more_suggestions-populartracks.scope', 'music-musicstore.scope', 'more_suggestions-ebay.scope', 'more_suggestions-ubuntushop.scope', 'more_suggestions-skimlinks.scope']"


07 August, 2015

Notes for SASS course


Install SASS

Follow the guide for your operative system.

Install Compass  

# gem update --system
# gem install compass Then initiate a compass project in your theme / webpage:


# compass create yourProjectFolder

  • Linux, Windows, Mac - Koala.

# cd ../wordpress/wp-content/themes
# compass create thematic_child

Now in the folder you'll find these directories and files:

/sass - containing these files: ie.scss print.scss screen.scss
/stylesheets - containing these files: ie.css print.css screen.css

Here is my thematic_child theme.

# compass compile thematic_child/

Will compile relevant .scss to .css

Update your browser to see the result.

Let compass update the .css files automaticly ( see the image above ):

# compass watch thematic_child

29 July, 2015

If you cannot install themes, update WordPress and similar on a Linux / *nix Localhost

WordPress cannot update or install on localhost unless the user rights are correct.

edit the file /etc/apache2/envvars

locate lines:

export APACHE_RUN_USER = www-data
export APACHE_RUN_GROUP= www-data

Change this to:

export APACHE_RUN_USER = YourUserName
export APACHE_RUN_GROUP= YourUserName

Then FTP works.

NB: the user must be one with the right to read, write and execute within the apache folders.

Thanx to this WordPress support page.

25 June, 2015

Ubuntu Mate - Abiword at startup problem

Problem: Abiword starts at every log in to Mate.
Solution (source):


sudo rm -f /usr/share/dbus-1/services/org.freedesktop.Telepathy.Client.AbiCollab.service

Status: we'll see after next log in. Well ... it works all right.

Uname -a: Linux Fenris 3.19.0-21-generic #21-Ubuntu SMP Sun Jun 14 18:31:11 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

08 June, 2015

Burning a Raspian

Burning a rapianpi SD-CARD became quite a challenge. My Laptop with Linux Mint could not do the trick. I tried and tried all afternoon. And a bit of the evening too. Stuff like: gparted, diskwriter etc. etc. etc.

Apache running my style tile.

But what worked. My seven year old server is a Debian KDE. It was just a matter of putting the darn card into the slot. Rightclick. Then format. Finally burn. That's it.

However, Raspian never booted, so I decided to try Noobs. I formatted the SD-card to Fat32 in KDE, noprobleo, copyed the Noobs files to the SD card, noproblemo, booted the Pi noproblemo.

So now the Pi is up and running.

06 June, 2015

Deploying Ruby on Rails

So I succeded in deploying my Ruby on Rails App to Heroku. That part was easy to understand. But what then?

One.com settings

The answer is: DNS administration.

Let a subdomain point to the app URL on Heroku via CNAME.

I guess that's the missing link. BTW any sky solution would work in a similar way.

25 May, 2015

Go not to the Elves for Counsel

/ Go not to the elves for counsel, for \
| they will say both yes and no.       |
|                                      |
\ -- J.R.R. Tolkien                    /
      \                    / \  //\
       \    |\___/|      /   \//  \\
            /0  0  \__  /    //  | \ \    
           /     /  \/_/    //   |  \  \  
           @_^_@'/   \/_   //    |   \   \ 
           //_^_/     \/_ //     |    \    \
        ( //) |        \///      |     \     \
      ( / /) _|_ /   )  //       |      \     _\
    ( // /) '/,_ _ _/  ( ; -.    |    _ _\.-~        .-~~~^-.
  (( / / )) ,-{        _      `-.|.-~-.           .~         `.
 (( // / ))  '/\      /                 ~-. _ .-~      .-~^-.  \
 (( /// ))      `.   {            }                   /      \  \
  (( / ))     .----~-.\        \-'                 .~         \  `. \^-.
             ///.----..>        \             _ -~             `.  ^-`  ^-_
               ///-._ _ _ _ _ _ _}^ - - - - ~                     ~-- ,.-~

21 May, 2015

Pandoc with citations

Compile and add the path to the bibliography file. I keep it in ~/Documents - so on my system the pandoc command looks a bit like this:

# pandoc myText.md --bibliography=/home/per/Dokumenter/bogliste/bogliste.bib -o test.pdf

Markdown with quotations like this:

Bla. bla bla bla [@bruceLee]

17 May, 2015


Install Writer2Latex via apt. Then use the commandline like this:

# w2l -latex -ultraclean input.odt

Footnotes etc. will be saved correctly. See more here.

14 May, 2015

Pandoc convert *html

# find . -name "*.ht*" | while read i; do pandoc +RTS -K64m -RTS -f html -t markdown "$i" -o "${i%.*}.md"; done

Terminal convert files to html loffice

# loffice --headless --convert-to html *odt
# loffice --headless --convert-to html *doc
# loffice --headless --convert-to html *sxw

( ... etc ... )

ODT to Markdown (notes)

  515  loffice --headless --convert-to html test.odt 
  517  pandoc test.html -o markdown.text

(History dump)

LaTeX templates

Covers and much more here. If you want to use one of the covers with Lyx try to add the LaTeX code to the document header.

Try http://www.latextemplates.com/


< mooh >
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Perhaps one of the most usefull bash commands for the Linux terminal.

# cowsay mooh

08 May, 2015

Turn off bluetooth at log in Cinnamon

Turning off the bluetooth will save power. The GUI does not give you the choice, so:

  # sudo nano /etc/rc.local

Add this line before exit 0

  echo disable > /proc/acpi/ibm/bluetooth

Add quotes to markdown in pandoc

The Markdown File

Add a yaml metadata section, that will point to a BibTex (.bib) file. The yaml section can be placed anywhere in the document:

title: "Sample Document"
output: html_document
bibliography: bogliste.bib

Citation in the markdown
Lorem ipsum dolor sit [@PHPWeb]

The citation points to a post in a BibLatex file in this case edited in Pybliographer:

  Author         = {Ullman, Larry},
  Title          = {P{HP} for the {W}eb},
  Publisher      = {Peachpit Press},
  year           = 2011

Compile html from the markdown
In order to create the file pandoc should make a standalone file (-s) and pandoc must know the name of the bibliography file (--bibliography=books.bib)

# pandoc -s --bibliography=books.bib yaml-test.markdown > yaml-test.markdown.html

Missing pandoc-citeproc
Linux Mint gave an error. Pandoc-citeproc was missing. Tried to install the package, and then the problem was solved.

#  sudo apt-get install pandoc-citeproc

Lorem ipsum dolor sit (Ullman 2011)

At the end of the document the reference will appear, so you might add some markdown to state that here comes the list of sources. From the booklist the quoted (and only the quoted!) work will appear:

Ullman, Larry. 2011. PHP for the Web. Peachpit Press.

05 May, 2015

Pybliographer several authors

One line per author in the author field, e.g.:

Andreasen, Frederik
Mosekjær-Madsen, Fred
Jensen, Per Thykjær

25 April, 2015

Install Ruby on Rails on Linux Mint

Reading article i WebDesigner /233:70 on Ruby on Rails. Running RoR on Linux Lime is not that straightforeward. Here's what I did:

Bundle install could not install sqlite3. Solution:

# apt-get install libsqlite3-dev
# bundle install

Tried to start a server. But got an error.

# sudo gem install therubyracer
# sudo apt-get install nodejs

Then the server worked.

22 April, 2015

How to show code in a WordPress post

Simply convert the code to html via Pandoc. Something like this:

# pandoc codefile.foo > html.html

Or simply:

# pandoc codefile.foo

And the rest is copy paste.

21 April, 2015

Pandoc slides

I made a markdown slideshow but got an error message when I wanted to convert the .md to .pdf. Here's a Linux Mint solution.


pandoc: Error producing PDF from TeX source.
! LaTeX Error: File `beamer.cls' not found.

Type X to quit or to proceed,
or enter new name. (Default extension: cls)

Enter file name:
! Emergency stop.

l.2 \usepackage


# sudo apt-get install latex-beamer

Then the code worked like a charm:

# pandoc lastlesson.md -t beamer -o myslides.pdf

19 April, 2015

Lyx to markdown

Export from Lyx to Latex. Then convert the .tex file to markdown via Pandoc:

# pandoc --no-wrap -f latex -t markdown myfile.tex > myfile.md

Pandoc A4

# pandoc index.markdown -o x.pdf -V papersize:"a4paper"

18 April, 2015


I need more and more info about markdown. E.g. how to add pictures and similar

See here!.

BTW this is how to do it in Pandoc / Dexy:

![Screendump](billeder/screendump.png "Screendump")

Full Webpage Capture

Stephen Hay recommends rapid prototyping. In the workflow he'll use full screen webpage captures. As an alternative to the .js capture method you could install a web page capture app on your browser. "ExtensionFull Page Screen Capture" can do this. And here's a shot of a recent style tile:

If you use the Web Developer tools and watch the webpage in some mobile device the "ExtensionFull Page Screen Capture" is able to grab such a page too.

Hay propose to use such images in a pitch at an early stage of the web developent process. Here I have combined the idea with style tiles.

03 April, 2015

A KDE program launcher shortcut

KDE does not ship with a program launcher shortcut. The "windows" or much better meta key is used for combinations. So you have to invent some shortcut. I have chosen meta + space.

Finding the settings was not easy. I gave up following the googled instructions. Many were far out in the green nerdy weeds. But try this:

  1. Right-click on the K icon (bottom left).
  2. Panel settings > panel settings
The window above will open. Click the shortcut symbol - and enter your shortcut.

Flipped Classroom and Linux

For a screencast install gtk-recordmydesktop. On KDE the icon is found in the Video section of the programmes.

# sudo apt-get install gtk-recordmydesktop

For better sound quality use an external microphone.

You'd probably need a video editor. I use OpenShot.

# sudo apt-get install openshot

SSH and One.com

So now you can use SSH for your webhotels at One.com. Very nice - because the terminal is a very powerfull tool. FYI this stuff is available:

  • ssh yoursite.what@yoursite.what
  • mc
  • git
  • Your website is located in /www
  • nano / pico

26 March, 2015

xampp cannot use wordpress theme images

A localhost WordPress could not display images from the themes folder in Xampp on a Linux Mint system.

Solution: all folders must be owned by the Apache user and group (daemon:daemon), or:

# chown -R daemon:daemon [theWordPressThemenameFolder/]
# chmod -R 777 [theWordPressThemenameFolder/]

However this is only for development purposes. On a server work by these guidelines.

23 March, 2015

Install themes on WordPress (Xampp on Linux)

Do this:

# cd /opt/lampp/
# sudo chown -R daemon htdocs
# sudo chmod -R g+w htdocs

On Apache the user is called daemon, therefore chown -R daemon htdocs.

Thanx to this post (my solution is for Linux the former was for Mac).

Now you can install whatever themes on the fly from the WordPress Dashboard.

16 March, 2015

03 March, 2015

Jquery - run it on localhost

Sometimes Jquery needs to run on a server. The accordion plugin is a sample. If you run the code directly from a directory, the darn thing does not work. If you run the same code on your localserver it works fine.

Below: Jquery accordion from a file

Below: Jquery from localhost

Ergo: run Jquery scripts on your localhost or on a server.

11 February, 2015

Drupal Install

In the new version the default settings could not be created. This seems to work:

$ mv default.settings.php settings.php
$ touch default.settings.php

08 February, 2015

Raspberry Pi - thoughts

I love the idea of the Raspberry Pi. But often I tend to just do the exercises on one of my several Linux systems. The creative ideas for projects of the many hands on projects in the community is a source of great inspiration. I have made a smart-TV, and reused an old telle for that purpose. Xbmc runs like a charm on it. Perhaps I'll use the smart-tv in the kitchen for todolists, recipe browsing and similar.

31 January, 2015

Galaxy S3 Cannot Use SD card

For a week or so my Galaxy S3 use, see or format the SD-card. Tried restart, taking SD out etc. but nothing worked. Empty slots for notworking programs are all over the phone. Could not remove the non-existing apps - which is messy and weird.

Log ...
  • Software update - did not help.
  • Reset to factory settings - 
One week later

So far no progress. By now I just use the phone for talk and sms. So not-smartphone. Trying another update.

Found this - it seems that the SanDisk app is the cause of the problem.

27 January, 2015

Comtrol DSLR camera via USB from commandline in Linux

My first gphoto2 image

Install gphoto2

# sudo apt-get install gphoto2
Run gphoto2 from the commandline. Here are some options:

# gphoto2 --capture-image-and-download

The camera will take a picture, and save it to the active folder.

# gphoto2 --list-device

Will tell the name of your camera.

On my SONY A58 the USB-setting in the menu must be "remote PC".

For samples see the man file, or "Using gphoto2".

After installing gphoto2 you can write a bashscript and call it automaticly via anacron or crontab.

In order to see whether your PC is able to connect to the cam, try this:

# gphoto2 --auto-detect

Model                          Port                                           
Sony SLT-A58 (Control)         usb:001,015