MV

Thursday, April 28, 2016

From reStructuredText to DITA... and back?

My life as technical writer started around 2003. Since then I've been using mainly a CMS, wiki, a very short period DocBook and the last couple of years reStructuredText (reST). Recently I've started working with DITA (Darwin Information Typing Architecture) to replace reST. At the company where I'm employed the main tool to edit DITA is oXygen, which is a nifty well-equipped editor, not to say the reference tool for DITA editing. Having used Vim for quite some years as editing tool for reST, oXygen is quite overwhelming when you start it for the first time. Of course I could reconfigure my Vim for DITA editing but that would take quite a lot of time, which I don't have. Still looking for a decent Vim setup though...

Anyway, while switching regularly between DITA and reST, and thus between oXygen and Vim, the DITA markup couldn't convince me as format. Was it due to oXygen as tool or was it really the markup, don't know, probably a mix. When I recently travelled to the US, I had a huge jetlag, so I got awake every day in the middle of the night. As my documentation in reST had to be transformed to DITA format, these nights provided me some extra hours to get the job done. During these nightly hours I got to know DITA and oXygen a lot better and I have to admit, I started to appreciate the markup and the tool. 

At first there seemed to be too many restrictions in DITA but after taking the first hurdle of getting a bit more familiar with the editing tool, it all became more clear. Especially when you switch from an unstructured language, the DITA markup seems so restrictive, but in fact it isn't. On the contrary, it even helps me in writing documentation. While using the DITA markup more and more I get to appreciate some of the features like reusing content, the easy way of adding indexes and metadata, and so on. And after my 2-day training with Yves Barbion at Flow, formerly known as Teka Infopilots and Scripto, I even have some more sympathy for DITA.

So don't I have cons to DITA? Of course there are. The major con is the way of branding your documentation; this is cumbersome, especially if I compare it with reST. 

Suppose you have an identical manual for company A and company B but both companies have their own product names and product versions. Since we don't want to copy the content from one company to another and then apply a find/replace, we'll use variables.

In reST, define I just have to store my variables in a Python dict in my project's configuration file, where the key of the dict is the company name and the value is the a list of values. In this example I would have a dict like this:

my_variables = {
    company_A : ('company_A', 'A_product_name', 'A_product_version'),
    company_B : ('company_B', 'B_product_name', 'B_product_version'),
}

In the same configuration file I have to define which variable name I have to use in my sources and then of course use the variable names in my sources. When building the output, I just have to select which company I want and build. In DITA this is far more complex as far as I know. Because the only way I found now is that you need a ditamap, a key definition file and a variables file per company, which means six files to maintain only for two companies. Still looking for a way to this in a conditional way, which would make it a lot easier.

Besides this major disadvantage, there's some other minor disadvantages, but if one would ask me now what I'd choose between the two of them? 

Well, it all depends on the project. Even Word could do the trick...

Saturday, October 11, 2014

Local Instance of READTHEDOCS


I've been struggling in setting up a local instance of readthedocs (rtd) with Solr for searching.
After lots of testing I've come up with the following procedure to have a local instance of Read The Docs and a working Solr. 

Bare in mind that this procedure is not for production instances!

I did this procedure on a clean Ubuntu 14.04 desktop installation.

Prerequisites

Make sure that you install the following packages:
  • python-virtualenv
  • git
  • curl
  • libxml2-dev
  • libxslt1-dev
  • zlib1g-dev
  • openjdk-7-dev
Most of the steps can be found in the documentation of readthedocs.org. Here I will show you the steps I followed.

Steps

Use three terminals to get this thing working, one for running readthedocs, one for Solr and one for building the files and saving them into Solr.
  1. Create a virtualenv and activate it:
    virtualenv venv
    source venv/bin/activate
  2. Create a folder in venv and clone the readthedocs repository:
    cd venv
    mkdir sources
    git clone https://github.com/rtfd/readthedocs.org.git
  3. Install rtd:
    cd readthedocs.org
    pip install -r pip_requirements.txt
  4. Build the rtd database:
    cd readthedocs
    ./manage.py syncdb
    Create a superuser when requested.
  5. Migrate:
    ./manage.py migrate
  6. Set Solr as local backend in the rtd settings:
    1. Go into the settings directory and update the files __init__.py, base.py, and sqlite.py.
    2. Update the parameter HAYSTACK_CONNECTIONS with:
      HAYSTACK_CONNECTIONS = {
          'default': {
              'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
              'URL': 'http://127.0.0.1:8983/solr',
          }
      }
  7. Open your second terminal and create and activate virtualenv, identical as in step 1. 
  8. Download and extract Solr 3.5.0:
    cd venv/sources/
    curl -O http://archive.apache.org/dist/lucene/solr/3.5.0/apache-solr-3.5.0.tgz
    tar xvzf apache-solr-3.5.0.tgz && SOLR_PATH=`pwd`/apache-solr-3.5.0/example
  9. Install pysolr and pyquery: pip install pysolr && pip install pyquery.
  10. Go to the directory venv/sources/readthedocs.org/readthedocs.
  11. Build a Solr-schema: ./manage.py build_solr_schema > $SOLR_PATH/solr/conf/schema.xml.
  12. Go back to the directory venv/sources/apache-solr-3.5.0/example and start solr:
    java -jar start.jar
  13. In your first terminal, go to the directory venv/sources/readthedocs.org/readthedocs and start the rtd instance:
    ./manage runserver
You are now able to log in to RTD with the created superuser. Go to 127.0.0.1:8000 for the RTD instance or to 127.0.0.1:8000/admin for the Django settings.

The created setup needs to be filled with data, you can do this via a third terminal and add some projects.
In this third terminal, create a virtualenv as described above and then add projects as follows:
  1. Go to venv/sources/readthedocs.org/readthedocs.
  2. Add a project with the following command: ./manage.py update_repos
    • pip
    • haystack
    • tastypie
    • kong
    • read-the-docs
    • ...
  3. Add the content to Solr, to be able to search in the documentation:
    ./manage.py build_files.
When you add other projects, either via the above command, or by importing them via the rtd web interface, run this last command to make them available through Solr.

You have now a local instance of RTD with Solr as search engine.

A lot more needs to be done in order to make it ready for production environments. Solr should be working in a container, a webserver is required, automation needs to be set up for new projects to become automatically available, and so on. Hope to get this done in the near future.

Until then, have fun with your local ReadTheDocs!

Friday, July 4, 2014

Sphinx, ReadTheDocs and Dashes

For my documentation, I often have to document *nix command-line stuff. No problem until you have to document options that come along with commands.

In Sphinx you have the ":command:" directive to show commands in a uniform way. However, if the command has options that are indicated with a double-dash, the double-dash is by default converted to a single dash.

For example: ":command:`./mycommand.py --myoptions options.ini`" would render as "./mycommand.py -myoptions option.ini". Very annoying indeed, since people tend to copy/paste commands and then they are surprised that "it doesn't work".

Weird thing is that in my local Sphinx setup, using 1.3a0, the rendering is correct, but in the default Sphinx version 1.2.x (if I'm not mistaken, also used by ReadTheDocs), I have the single dash. After looking around on the web, found that the parameter "html_use_smartypants" in the Sphinx conf.py file is the culprit. This parameter is by default disabled, but the smartypants is not disabled by Sphinx and ReadTheDocs itself. This smartypants converts the double dash to a single dash or sometimes en-dash (or em-dash). Since the parameter was commented I didn't take notice of it, but I didn't come to the proper rendering.

To actually disable the smartypants, you have to literally set it to False and then I finally have the correct rendering of my double dash.

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.

html_use_smartypants = False

/me happy to start the last day of the week.

Wednesday, September 18, 2013

Dear Atlassian


To whom it may concern...

I have been using your Confluence since 2007 and the ease of it was just a joy. Ok, it had its shortcomings, but I could live with them, they didn't annoy me. Confluence, you were easy to learn, you were just a plain text editor, you had enough room for easy customizations. All this made that I could focus on my job, which happens to be technical writing in software companies. My last version I worked with was 3.5, but then came August 2013.
In that month I started at a new company where they use a 5.x version. Now one (yes only ONE) month later and you make me already sick.

I suppose that the function of the new interface is to be more user-friendly than a plain text editor. I have to admit, inserting macros is a step forward, same for inserting warnings, tips, notes,...  BUT, what the hell have you been doing with lists? To insert or add a numbered item to an existing numbered list, you have to be a magician. Luckily CTRL-Z does work in your editor.
And why can't I use a bulleted list in for example a warning block, when this block is in a numbered list? Can you give me an explanation for that?

Table of contents macro, maybe it's not your fault, but why do you use different styles? A table of contents is supposed to have a consistent layout, but why some items are in bold, others in a large font-size and some others in smaller font-size, I really don't see the benefit of it.

Apart from my aforementioned vexations, I have a last one to mention. When you create a PDF of a space, the links in the PDF document refer to the online documentation, whereas in 3.5 and earlier versions, they referred to the page inside the PDF. Did this function moved to more comfy places, is it playing trollface, ... You were in there and now you're gone, how hard can it be to get it back?
This bug is reported 721 days ago (27 September 2011, yes that's almost TWO years). It surprises me that you do go to the selected section when you click an item in the table of contents. So where's the difference? I don't see any so just FIX IT, and if you can't fix it, FIX HARDER!

I can't get the idea out of my head that you, Atlassian, are becoming like that other well-known tech giant, founded by Bill Gates. That company too is very good at ditching good parts of software, creating new versions that annoys people, and not listening to their customers.

Perhaps our annual fee is just 0,00000005% of your annual turnover, which makes us just a 'no-influence-at-all' company for you, but I just don't care. Perhaps that some day I will embrace you again with love and care, but right now, I'm ditching you.

Sincerely

Friday, August 16, 2013

Good to know

I recently started working on MacBook Pro, you have to try it all. In the past I had Windows and Ubuntu, so now the time has come to try OS X. Just like every other OS, OS X also has annoyances, of which iTunes is one of my biggest annoyance. Did they replace that team already? Unfortunately you sometimes need it, so I can't get rid of it.

As default music player I now try Songbird and added the keyboard shortcut add-on, which works perfectly. But the downside is that every time you hit a music key (next, previous, play/pause), it also launches iTunes.

The easiest way to get rid of this behavior was nicely noted in the following post:

http://gavinroy.com/posts/disabling-default-itunes-launch-behavior-with.html

Basically, you just need to execute:

launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist

No more, no less.

Friday, June 21, 2013

Thunderbird configureren voor verzenden mails via Telenet account

Toen ik mijn gsm wou instellen om e-mails te ontvangen en versturen via mijn telenet account, kon ik de mails wel ontvangen, maar niet versturen. Ik kon enkel mails versturen als ik op het telenet netwerk zat (wifi of via telenet gsm-abonnement).
Na enig zoekwerk, bleek dat ik dus TLS moest gebruiken en authenticated SMTP om mails te kunnen versturen. Dit direct ook eens gecontroleerd op mijn computer, want ook daar kon ik geen mails versturen via mijn telenet account.

In Thunderbird (getest met versie 17.0.6):

  1. Via Edit > Account Settings, selecteer Outgoing Server (SMTP) in de linker kolom.
    Dit is afhankelijk van operating systeem en taalinstellingen!
  2. Klik op Add en vul in/selecteer de opties zoals aangegeven in de afbeelding onderaan.
  3. Bij gebruikersnaam, geef je je Telenet gebruikers-ID in, meestal bestaande uit 1 letter gevolgd door 6 cijfers zoals in de afbeelding.
Je zou nu zonder problemen mails moeten kunnen versturen, zelfs als je geen gebruik maakt van een Telenet netwerk.

Tuesday, May 21, 2013

How to close xml tags easily in VIM

From ViM 7.3 onwards, most of the common programming languages are supported (/usr/share/vim/vim73/autoload/...). To make them work automatically, update your vimrc with:


autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete





Use CTRL+ X O to close tags after typing the start of the closing tags.


For example:

This is a sample paragraph </ CTRL +X O will automatically complete the closing tag.

Simple as that

More information on configuring ViM: http://newbiedoc.sourceforge.net/text_editing/vim.html

Thursday, February 21, 2013

USB connection on Galaxy S3 Mini

Lately my galaxy s3 mini phone was not detected through USB. This is quite annoying... to say the least.

I thought a reboot of my phone would solve the problem, but guess what, it didn't.
I checked the cable, used different ports on my pc and other computers, used different cables, nothing worked, it only started to charge the battery.

I own this phone for only a couple of weeks, so perhaps this thing needed a repair under guarantee. But of course this would take weeks before having it back, so I called my best friend as help.

Google offered me this link http://android.stackexchange.com/questions/35313/unable-to-connect-galaxy-s3-to-pc-via-usb

Most of the links referred to Windows drivers but I'm not a Windows user. However, scrolling down led me to a very simple solution:

*#7284# to access PhoneUtil 

 and select PDA in both sections. Reset phone and that's it.

Credits to the user "eidolon" from Australia.

The only thing is that I don't know how I got in this situation... but at least now I know how to solve it.

Thursday, June 7, 2012

Windows 7 and the Search Function

I'm not a Windows lover to say the least, but lately I'm working on Windows for professional reasons, hopefully not for too long.
Being upgraded to Win 7, I must admit that I was surprised in the positive way, but not that I'll replace my Ubuntu. For the simple reason that Windows just annoys me too often (http://bit.ly/LD5WpP).

One of the negative surprises was the search function in Explorer. They made it a real piece of crap of it. I must admit that I'm spoiled with the built-in grep function in my Ubuntu and I also admit that my last search operations date from the Windows XP times. The only thing that I wanted to do is search for a word in a specific file-type. So in XP you could easily perform a search on a file type and then look in this result in the content. You even had a search shortcut in the context-menu of a directory.  Assumed that this function didn't change that much, oh boy, was I completely wrong about that. I know I know, many would say now, why don't you just install a grep-program? Well I guess I'm just too stubborn... Why install a program to perform an action that I could do in Windows XP and if I'm not mistaken in all XP's predecessors?

First of all, Search in context-menu: GONE.
Ok, looking for a search box... found it in the top right corner rather fast, since this is similar to the search in some of the popular web browsers.
Next look for files, that went pretty smooth, start to search the moment I start entering characters.
But this was not what I wanted, I wanted to look for content inside a file, and furthermore content in specific file types. For example I want to look for a word 'parrot', but only in files with file name 'animals.cfg'.
Since I didn't find this immediately, I used my best friend Google. Unfortunately even this friend let me down a bit. No satisfying result on the first results page... how is that possible.
Ok, let's look a bit further then. Finally found how to make the search function also look inside files, the easy but slow way, slow as in takes ages to find a result, even if directory is indexed:

  1. Open Windows Explorer
  2. In the blue bar under the address and search boxes, click Organize and select Folder and search options.
  3. Go to the Search tab. In the What to search box, select "Always search file names and contents..."
  4. That's it, happy looking for content
But of course not the result that I wanted, even when it has to look for content, it only looks for content in the file name. It's getting more and more fun. Now it doesn't even do what they promise.

So looking some more on the web I found that you can use a keyword to look in the content. See the Microsoft answers page. But guess what... And then people keep asking me why I don't like to work with Windows...

I give up, back to my Ubuntu to quickly find my files of a specific file type, containing a specific word. Wow, that took me 1s to type my command and about 0.16s (ZERO POINT SIXTEEN seconds) to give me the list of files. So dear Microsoft, fix your Search function, document it better, or fix your Search function harder.

Friday, May 25, 2012

Switch IP addresses for WordPress

As technical writer, I should be playing with all kinds of tools, so since WordPress is becoming more and more popular, I'd give it a try.

So I installed WordPress on a LAMP stack (as a virtual machine), by following their Famous 5-Minute Install instructions. So all went fine. I used the IP address of my VM to configure my WP database since I don't have a domain name. No problem, I played a bit around with WordPress, tested some configurations, and so on. It really works fine.

Unfortunately after restarting my VM, I got another IP address and I was no longer able to connect to my installation. Not in FireFox, not in Chrome. In FF I got to an login window, but in plain text, so no CSS at all. But the most surprising was that both browsers always tried to reach WordPress via my previous IP address.

After clearing the cache and cookies of my browsers and restarting Apache on my WordPress server I thought my issue would be solved... wishful thinking that was.

Luckily I can trust my dear friend Google. One search query and following the first result got me back in the driving seat.

http://stackoverflow.com/questions/535534/wordpress-host-ip-changed

I only need to change the wp-config.php file and add these two lines:


define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

where I change `example.com` by my IP address.

Monday, May 7, 2012

Den Barkentijn


Om ons verlengd weekend van 1 mei af te sluiten besloten we (ondertekende met wederhelft en onze twee dochters)  om nog eens een hapje te gaan eten op den dijk van Oostduinkerke. Eentje die in ons geheugen zal blijven hangen, helaas in de negatieve zin.

Na eerst wat kuieren op de dijk, besloten we uiteindelijk om ons de installeren op het halfopen terras van De Barkentijn. Niet te veel volk op hun terras op het strand, geen volk binnen, enkel nog een ander gezin op het terras aansluitend aan het etablissement. Niet echt druk dus voor een feestdag.

Om met de deur in huis te vallen: het is een serieuze tegenvaller geworden. Niet zozeer door het eten. Hiervoor moeten ze niet veel onderdoen voor de andere etablissementen op de dijk. Het eten was okee, niet meer niet minder; de gewone kwaliteit zoals je die op de dijk kan verwachten. Niet echt iets wat we zullen onthouden dus.

De service daarentegen zullen we wel nog lang onthouden. Ik denk dat we 3 of 4 mensen van het personeel hebben gezien en allemaal gaven ze ons de indruk dat ze ons liever kwijt dan rijk waren. Het opnemen van het eten en drinken duurde al lang, veel te lang, zeker als je weet dat we minstens 5x gepasseerd zijn geweest door de obers.

De wachttijd voor het leveren van eten en drinken was dan weer wel in orde. Helaas was de bediening dat iets minder. Weerom een gezicht dat op onweer stond, een glimlach kon er echt niet af blijkbaar.

Toen we uiteindelijk wilden betalen, hebben we 3x teken moeten doen naar de ober, toen die dit de 3de keer zag, konden we duidelijk zien dat het hem niet aanstond dat we de rekening vroegen. Hebben de rekening dan maar aan een andere ober gevraagd. Dit was dan ook niet met de meest hartelijke persoon, maar we waren al tevreden dat hij er snel was met de rekening zodat we snel konden afrekenen om daar zo snel mogelijk buiten te zijn. Mochten we punten mogen geven zoals in 'Komen Eten', zou het voor sfeer en service een dikke nul geweest zijn.

Opgelucht om een brasserie/taverne te verlaten, het was een nieuwe ervaring...

Friday, March 30, 2012

Tab usage in Skype on Linux... at last

Skype on my Ubuntu works fine, despite some configuration issues at installation time, but I was tired of all those windows for each and every chat session and even the list of contacts.
Now this is finally over, I have finally a skype version that produces only one window, except when making a call, but I can live with that though.

Add the ppa from this site: https://launchpad.net/~keks9n/+archive/skypetab/
apt-get update and install the package skypetab-ng.

Then instead of launching skype, launch /usr/bin/skypetab-ng!

Not sure if it uses the original Skype, but I think so.


Wednesday, March 28, 2012

Rooting my Acer Liquid MT (S120)

In case I want to root my android again, follow these links instead of always losing too much time in finding the information:

* http://168.site90.net/doku.php?id=mobile:acer-liquid-metal-s120
* http://android.modaco.com/topic/348167-236-acer-official-release-400013emeagen1/

Now I hope to not forget that I wrote down this information in my blog :P

Monday, October 24, 2011

another note to self (get sound through headphones)

sound is not coming through headphone jack, only via built-in speakers on Dell Studio XPS.

After clean install of my laptop with Ubuntu 11.10 64-bit (Oneiric Ocelot), I no longer had sound through my headphones, only via the built-in speakers.

This resolved my issue:

open /etc/modprobe.d/alsa-base.conf
Add this line at the end of the file: options snd-hda-intel model=dell-m6
Logout/login and problem is solved.

Experienced this issue already in 10.10 (if my memory doesn´t let me down)

Monday, July 25, 2011

Ejabberd cluster on Ubuntu Server

Two years ago, I created a blog about the clustering of ejabberd nodes, running on OpenSolaris.

This message here has the same purpose but now running on Ubuntu Servers and linked to an openldap server. I used 9.04 (Jaunty Jackalope), but I think there shouldn't be too much changes in earlier or later versions.

I used the following setup:
3 ejabberd nodes (ejabberd1, ejabberd2, and ejabberd3)
1 OpenLDAP Server

Installation and Configuration First ejabberd



Make sure that your are logged in as root user.

1. Install ejabberd:
$ apt-get install ejabberd
2. Configure ejabberd to get users from the openldap server
* adapt /etc/ejabberd/ejabberd.cfg:

** %% Admin user: in this example the user must be listed in the LDAP
** %% Hostname
** %% List of LDAP servers: {ldap_servers, [""]}.
--> make sure that ejabberd node can reach ldap server using its
hostname (possibly adapt /etc/hosts)
** %% Encryption .. LDAP Servers (LDAPS): {ldap_encrypt, }.
--> tls, ssl, none, ...
** %% Port connect to LDAP server: {ldap_port, }.
** %% LDAP Manager: {ldap_rootdn, ""}.
--> e.g. {ldap_rootdn, "cn=admin,dc=example,dc=com"}.
** %% Password of LDAP manager: {ldap_password, ""}.
** %% LDAP attribute that holds user ID: {ldap_uids, [{"uid", "%u"}]}.

3. Modify /usr/sbin/ejabberdctl: ERLANG_NODE=ejabberd@`hostname`
--> not single quotes but back single quotes around hostname
4. Start ejabberd: /etc/init.d/ejabberd start

Check if ejabberd is running:

$ ejabberdctl status
Node ejabberd@ejabberd1 is started. Status: started
ejabberd is running


Installation and Configuration Other ejabberd Nodes



1. Install ejabberd:
$ apt-get install ejabberd
2. Copy ejabberd.cfg from first node
3. Copy ejabberdctl from first node
4. Copy /var/lib/ejabberd/.erlang.cookie from node 1 to new node.
5. Start ejabberd: /etc/init.d/ejabberd start

Check if ejabberd is running:

$ ejabberdctl status
Node ejabberd@ejabberd2 is started. Status: started
ejabberd is running


Now synchronize the databases is the tricky part. Thanks to this blog it is a piece of cake.
Just perform the steps below to synchronize the database of node 2 with the first node:

1. Start ejabberd in debug mode:
$ ejabberdctl debug
You arrive in an Erlang shell.
2. Enter the following commands:

* FirstNode = 'ejabberd@first', %%where first is the hostname of the first node (!) Make sure that the line ends with a comma, indicating that there are other commands to follow
* mnesia:stop(),
* mnesia:delete_schema([node()]),
* mnesia:start(),
* mnesia:change_config(extra_db_nodes, [FirstNode]),
* mnesia:change_table_copy_type(schema, node(), disc_copies).

3. End the debug session by pressing Ctrl-c, Ctrl-c

Your second node now runs ejabberd with the same database as on the first node.
Repeat this procedure for other ejabberd nodes which must serve the same database.

Web Interface ejabberd
----------------------
By default there is a webinterface available for ejabberd on http://:5280/admin

Log on with an LDAP user who has been added to the list of Admin users in ejabberd.cfg, login name is in the format user@domain, e.g. admin@example.com

Configuring OpenLDAP on Ubuntu Server

This message shows you how an easy setup of OpenLDAP. I configured this to test a new ejabberd clustering setup using Ubuntu Servers. So I decided why not to integrate OpenLDAP with the ejabberd cluster, which is likely a more useful setup.

Most of the documentation is taken from https://help.ubuntu.com/community/OpenLDAPServer.

Setup:
Simple Dual-core server 1024 MB RAM, running Ubuntu Server 9.04.
Make sure that you are connected to the Internet and that you are logged on as
root.

Installing the necessary packages:
* Install the following packages:
** slapd: ldap server daemon
** ldap-utils: ldap utilities
** db4.2-util: ?, not sure if this one is necessary

When installing these packages you will be asked for a password for the LDAP
directory administrator, which is not the root password of the server on which
you're installing OpenLDAP.

Reconfigure the LDAP tree:

$ dpkg-reconfigure slapd
Omit OpenLDAP server configuration? ... No
DNS domain name: ... example.com
Name of your organization: ... Whatever & Co
Admin Password: ******
Confirm Password: ******
OK
BDB
Do you want your database to be removed when slapd is purged? ... No
Move old database? ... Yes
Allow LDAPv2 Protocol? ... No


Check if ldap works:

$ ldapsearch -x -b dc=example,dc=com


Generate an encrypted password with slappasswd:

$ slappasswd
New password:
Re-enter password:
{SSHA}d2BamRTgBuhC6SxC0vFGWol31ki8iq5m


This example shows what happens when using "secret" for the password, but your
result may vary!

Create the file /etc/ldap/slapd.conf and add the following content:


suffix "dc=example,dc=com"
directory "/var/lib/ldap"
rootdn "cn=admin,dc=example,dc=com"
rootpw {SSHA}d2BamRTgBuhC6SxC0vFGWol31ki8iq5m


As root password use the generated password with the slappasswd tool.

Edit the file /etc/ldap/ldap.conf and uncomment the following line:


BASE dc=example,dc=com


Restart the LDAP service:

/etc/init.d/slapd restart


Populating the LDAP Tree
------------------------
Now that your LDAP directory is ready, you can start populating it. This will
be a 'classical' entry intended to be very compatible with Unix accounts
(posix), directories (like addressbooks), and classical accounts (for web
applications). But really it's just a starting point.

An LDAP directory can be fed with a ldif file ("ldap directory interchange
format" file). Create this file init.ldif somewhere on your system:


dn: dc=example,dc=com
objectClass: dcObject
objectClass: organizationalUnit
dc: example
ou: Example Dot Com

dn: cn=admin,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword:

dn: ou=people,dc=example,dc=com
objectClass: organizationalUnit
ou: people

dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups

dn: uid=loboloco,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: loboloco
sn: Loco
givenName: Lobo
cn: Lobo Loco
displayName: Lobo Loco
uidNumber: 1000
gidNumber: 10000
userPassword:
gecos: Lobo Loco
loginShell: /bin/bash
homeDirectory: /home/lobo
shadowExpire: -1
shadowFlag: 0
shadowWarning: 7
shadowMin: 8
shadowMax: 999999
shadowLastChange: 10877
mail: lobo.loco@example.com
postalCode: 31000
l: Brussels
o: Example
mobile: +32 (0)3 xxx xx xx
homePhone: +32 (0)475 xxx xxx
title: System Administrator
postalAddress:
initials: LL

dn: cn=example,ou=groups,dc=example,dc=com
objectClass: posixGroup
cn: example
memberUid: loboloco
gidNumber: 10000

dn: cn=example2,ou=groups,dc=example,dc=com
objectClass: posixGroup
cn: example2
gidNumber: 10001


In the example above, the directory structure, a user and group have been
defined. In other examples you might see the objectClass: top added in every
entry, but that is default behavior so you don't have to add it explicitly.

As with the LDAP root password, these passwords can be generated with
slappasswd using the MD5 or CRYPT hashing scheme. See man slappasswd).


Examples slappasswd:
(http://www.zytrax.com/books/ldap/ch14/)
Generate an SSHA password suitable for use as rootpw (in slapd.conf) or for use in a LDIF file for userPassword or authPassword attributes.


# no options required
slappasswd

# prompts twice for password string and then outputs
{SSHA}kjhfhfehflejhfvlldkl

# save to a file using normal re-direction
slapppasswd > /tmp/slappassword

# generate {SSHA} encoding of password secret
slappasswd -s secret

# generate {MD5) encoding of password secret
slappasswd -s secret -h {MD5}


To place the output in LDIF or slapd.conf, save to a file and copy, paste to
relevant file if GUI editing tools are being used. If vi is being used,
navigate to location in file where password is to be inserted then use :r
!slappasswd [opts] - this runs the command and inserts stdout into editing file at last cursor position. Alternatively save the output of slappasswd to a file, navigate to insert location in vi and execute :r /path/to/file - inserts file
contents into last cursor location.

When you're done, write and close the file.

Now, add your entries to the LDAP:

stop LDAP daemon: /etc/init.d/slapd stop

delete the content that was automatically added at installation:
rm -rf /var/lib/ldap/*

add the new content: slapadd -l init.ldif

correct permissions on the database:
chown -R openldap:openldap /var/lib/ldap

start LDAP daemon: /etc/init.d/slapd start

Your LDAP Server is up and running.

Wednesday, June 22, 2011

startup script ubuntu

When creating a new script to be executed at the startup of Ubuntu, create a script in /etc/init.d

For example 'foo', google for examples of startup scripts, can be anything...

Make the script executable: sudo chmod +x foo

And finally update the list of startup scripts: sudo update-rc.d foo defaults

Simple as that.

Tuesday, May 17, 2011

Increase duration of ringtones

When you get a call on your mobile, the duration of the dialing tone is 15s for most of the Belgian mobile providers before forwarding to voice mail. For some people this is too short, so here's a list how you can increase the dialing tone for the various Belgian mobile providers. Just enter the code and press the dial button to activate the new duration. In the examples I set the duration to 30s.

Proximus: **61*+32475151516*11*30# or **61*+32475151516**30#
Base: **61*+32486191933**30# or *61*+32486191933**30#
Mobistar: **61*5555**30#
Telenet: **61*5555**30#

Apparently for Proximus you can only use this code if you have post-paid formula, with Pay-And-Go (pre-paid) numbers the codes don't work.

Thursday, February 3, 2011

ssh with passphrase authentication

i need to ssh quite a lot and i'm getting tired of always entering my password, so I finally decided to make use of the passphrase authentication.

By far this is the easiest way:
ssh-copy-id -i path/to/id_rsa.pub user@ipaddress

You can do this also manually, which is does the same as the ssh-copy-id command:

1. Check if you have already an rsa key-pair in ~/.ssh directory. You should have the files id_rsa and id_rsa.pub (or another name-combo, f.e. loboloco and loboloco.pub)
If there isn't such a file combo, proceed with the next step, otherwise skip to step 3.
2. first generate an rsa key-pair on your local machine in ~/.ssh:

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/dewolfth/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/loboloco/.ssh/id_rsa.
Your public key has been saved in /home/loboloco/.ssh/id_rsa.pub.
The key fingerprint is:
d9:c5:65:7d:6b:38:fe:a2:d5:d4:d9:fc:c9:88:a9:01 loboloco@blackfrancis
The key's randomart image is:
+--[ RSA 2048]----+
| o. |
| . o o|
| o . o|
| o . o ++|
| ES . . oo+|
| . o.= o|
| . o o.+.|
| o .. . |
| . .. . |
+-----------------+
loboloco@blackfrancis:~$

3. Copy the .pub file to the destination server (scp, rsync)
4. Connect to the server via ssh
5. Copy the .pub file to the file ~/.ssh/authorized_keys: cat id_rsa.pub >> .ssh/authorized_keys

That should be it, when you connect again you won't have to enter your password anymore. Very handy if you have to commit code via ssh.

Wednesday, January 19, 2011

EID card reader on Ubuntu... what a mess

Installing a card reader on ubuntu isn't that hard, there exists even good documentation... but Ubuntu seems to mess up the middleware with some updates, kernel updates seem to be most likely.

So each time I need my card reader (let's say 1 time every three months), it has become out of order when trying to connect to a site with my EID, giving either error:

"ssl_error_handshake_failure_alert" or "ssl_error_bad_cert_alert"

This is what helps for me:

A. Reinstall middleware:
1. Download the middleware: here
If the link doesn't work, try this page (in Dutch) which contains a link to the binary.
2. Unpack the .tgz file: tar xvf beid-middlew...tgz
3. cd install
4. Execute "sudo ./install.sh" and follow the instructions. The execution can end with the following lines:

libqtgui4 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
./install.sh: 390: [[: not found
checking pcscd running...
./install.sh: 390: [[: not found
./install.sh: 390: [[: not found
Follow the instructions in the documentation to:
- register the software in Firefox.
- set the environment variable MOZILLA_CERTIFICATE_FOLDER

Please read the README file and licensing information for more information about
libraries this software and the software it is depending on


Try again in Firefox to connect to site with EID.

B. Certificate issues
1. uninstall the beid add-on in firefox, if already installed.
2. Open Firefox
3. Go to this page.
4. Click "Add to firefox".
5. Click "Install Now"
6. Restart firefox.
7. Go to Edit > Preferences > Advanced > Encryption and click View Certificates
8. On Authorities tab, select Belgium CA Root certificate and click Edit.
9. Select the 3 available options and click OK until you return to firefox.
10. Restart firefox to complete the update.

Hooray for ubuntu updates... next time take care of the middleware