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:

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:

  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.
info/book/1887/.
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:

http://www.instructables.com/id/Raspberry-Pi-Remote-For-Free/

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

TOOLBOX




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:

Usage:

# compass create yourProjectFolder


Debugging
  • Linux, Windows, Mac - Koala.
COMPASS AND WORDPRESS

# 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

Writer2latex

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)