Tried to follow this guide. Downloaded the Debian packet and installed it from the download page:
Now pandoc and pandoc-citeproc seems to work.
28 January, 2016
27 January, 2016
Pandoc error
Looking for at solution for this pandoc error message:
pandoc-citeproc:
Error at "source" (line 1, column 94):
unexpected end of input
expecting new-line
http://student.bus.olemiss.edu/files/conlon/others/others/semantic%20web%20papers/roadmap.pdf
Python and MySQL on Linux Mint
Got an error because the MySQLdb package wasn't found. Solution:
# apt-cache search MySQLdb
python-mysqldb - Pythongrænseflade for MySQL
python-mysqldb-dbg - Pythonbrugerflade til MySQL (fejlsøgningsudvidelse)
bibus - Bibliografisk database
mysql-utilities - collection of scripts for managing MySQL servers
petj-HP-EliteBook-850-G1 ~ # apt-get install python-mysqldb
Then
# sudo apt-get install python-mysqldb
Then everything worked like a charm.
# apt-cache search MySQLdb
python-mysqldb - Pythongrænseflade for MySQL
python-mysqldb-dbg - Pythonbrugerflade til MySQL (fejlsøgningsudvidelse)
bibus - Bibliografisk database
mysql-utilities - collection of scripts for managing MySQL servers
petj-HP-EliteBook-850-G1 ~ # apt-get install python-mysqldb
Then
# sudo apt-get install python-mysqldb
Then everything worked like a charm.
24 January, 2016
Tomboy Notes
My old laptop literaly crashed. Litterally. During the reconstruction efforts I found out, that one of my primary concerns was to get the Tomboy Notes.
The files are stored in:
~/.local/share/tomboy
Then:
The files are stored in:
~/.local/share/tomboy
Then:
- #killall tomboy
- copy the files from the backup
- paste the files to ~/.local/share/tomboy
- start tomboy
19 January, 2016
13 January, 2016
How to make an icon for a Python App
![]() |
| The files and the icon. |
So now I have some Python GUIs for my Philips HUE, but I'd like to have a nice Desktop Icon, like any other Linux App. How can I do this?
In Ubuntu - and probably most Linux systems the paths to executable programs are stored in hidden .desktop files.
First create a file and save it as .myApp.desktop
The content of the file could look like this:
[Desktop Entry]
Name=Test
Exec=/home/per/Dokumenter/bin/bin/hue/python/tkinterNoter/tkEntry.py
Icon=/home/per/Dokumenter/bin/bin/hue/python/tkinterNoter/multimusen.png
Terminal=false
Type=Application
GenericName="Python tkEntry Exp"
There are more possible setting, see here.
The next step is to make your file executable, write these commands in the terminal window:
# chmod a+x .myApp.desktop
# chmod a+x tkEntry.py
# cp .*desktop ~/.local/share/applications/
In order to give all system user access to your program, you can:
# cp .*desktop /usr/share/applications
Now you'll see an icon with the chosen picture in the folder. You can drag this icon to e.g. the menu. And now you can run your GUI as you would run any program.
The line Terminal can be true or false. If it's true the program will launch in a terminal window.
11 January, 2016
Json Parsing in Python (Philips Hue Sample)
Import libraries:
import requests
import json
from urllib import urlopen
Here's a class that will print out the names of the scenes:
''' AUTORUN METHOD '''
def __init__(self,master):
self.apiUrl = "http://192.168.0.11/api"
self.user = "xxxxxxxxxxxxxxxxxxxxxxxxx"
self.a = urlopen(self.apiUrl
+ "/"
+ self.user
+ "/"
+ "scenes").read()
self.a = json.loads(self.a)
for thing in self.a:
self.theName = self.a.get( thing ).get('name')
print self.theName
The function will print out a list of scene names.
27 December, 2015
View a Json Object in the 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:
Json
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:
http://192.168.0.xyz/api/YOUR-NUMBER-HERE/lights/1/state
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.
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.
- Philips Hue API (api documentation)
- Hack the Hue (fine intro)
- Json put exaples (google)
Json
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:
http://192.168.0.xyz/api/YOUR-NUMBER-HERE/lights/1/state
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 |
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.
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:
- Videnskabelige artikler
- EAAA Bibliotek
- ACM (link?)
Apart:
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.
- file: byb2.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:
@Book{ARIS_1958,
Author={Aristoteles},
Title={Poetik},
Publisher={Hans Reitzels Forlag},
Year=1958}
etc. etc. etc. etc. etc.
The markdown contains a reference to a book in the BibTex file:
[@ARIS_1958]
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:
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',
concat('Year=',`Year`,'}')
FROM `libri`
So the environment for developing the project is almost there.
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',
concat('Year=',`Year`,'}')
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.
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 ...
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.
Abrahadabra,
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.
Abrahadabra,
20 November, 2015
26 October, 2015
Notes for an upcoming PHP introduction class
- PHP tutorial ( http://php.net/manual/en/tutorial.php )
- Bootstrap ( http://v4-alpha.getbootstrap.com/getting-started/introduction/ )
Mobile first and Responsive Web Design concepts.
06 October, 2015
Where are the media files in WordPress
The files you upload are in this folder:
../wordpress/wp-content/uploads/
../wordpress/wp-content/uploads/
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:
http://192.168.0.22/whatever ...
Solution:
Open the wp_options table, and rename the http address to the correct ip, e.g.
siteurl: http://192.168.0.12/wordpress
home: http://192.168.0.12/wordpress
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:
- Created the goup called webeditor
- Added my user to the group.
- Changed the themes/ folder to the webeditor group.
- 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.
Subscribe to:
Posts (Atom)






