Ressources documentaires pour Mandriva Linux et les Logiciels Libres

Using Parse-Dia-SQL to generate SQL from UML Dia diagram and how to install it under Mageia

dia2sql_1It can be tedious when designing an application ( and not using frameworks like Symfony ) to design your database and then create corresponding SQL scripts. Thanks to Parse-Dia-SQL you can design your database using Dia and then generate corresponding SQL script for your database.

Ubuntu users just need to install libparse-dia-sql-perl package.

Windows may download Parse-Dia-SQL installer directly from Dia homepage : http://dia-installer.de/parse-dia-sql/index.html

Now let’s see how to install Parse-Dia-SQL under Mageia :

  • Install minimal set of dependencies. To found corresponding Mageia packages, use urpmf –provides –literal. For example to found Html::Lint, just do : urpmf --provides --literal 'perl(Html::Lint)'
  • Install corresponding minimal set of dependencies for http://search.cpan.org/dist/Parse-Dia-SQL/ : urpmi perl-base perl-Log-Log4perl perl-XML-DOM perl-HTML-Lint perl-Text-Table perl-Text-Aligner perl-Test-Exception
  • Install CPAN : urpmi perl-devel make
  • Now install Parse-Dia-SQL from CPAN : cpan /Parse-Dia-SQL/
  • parsediasql should be installed now in /usr/local/bin/
  • Now to create a SQL file from your Dia diagram, just do : parsediasql --file db_model_file.dia --db dbtype
    • Supported values for dbtype are : mysql-innodb, mysql-myisam, postgres ( for PostgreSQL ), db2, oracle, sqlite3, sqlite3fk, mssql and html

Now to create your UML model with Dia, use Dia’s UML shapes :

  • SQL table are UML Class
  • To mark an attribute as being a primary key, set Visibility = protected
  • To add NOT NULL and DEFAULT xxx to your attributes, first add the default value and then the NULL or NOT NULL  in Value field. For example to have DEFAULT CURRENT_TIMESTAMP NOT NULL on your SQL file, just add CURRENT_TIMESTAMP NOT NULL in Value field
  • Additional indexes can be create in [Operations] tab where :
    • Operation Name = Index name ( e.g table_col_idx )
    • Operation Type = Index type ( INDEX or UNIQUE INDEX )
    • Parameters =  Index columns ( one parameter name for each column name in the index )
    • Stereotype: Index type — For PostgreSQL, you can choose other than btree ( hash, gist, gin ). Please note that GIN indexes may be useful for JSON datatype
  • Foreign-keys constraint are done with UML aggregation tool ( line with a diamond at one end ) in which in its properties you are going to specify foreign-key direction and columns

Please note that for PostgreSQL no need to use typemaps for autoincrement columns, just put SERIAL as attribute type :)

Links:

Automatic SQL generation using Dia

Database design with Dia

Utilisation de Dia2SQL ( Fr )

Using Dia to Interact With tedia2sql ( Parse-Dia-SQL is a fork of tedia2sql to support latest Dia version, documentation for tedia2sql is relevant for Parse-Dia-SQL too )

Parse-Dia-SQL homepage

 

Select best Ubuntu mirror from CLI

Sometimes your Ubuntu mirrors may not be up-to-date or may be down. To check Ubuntu mirrors status, don’t hesitate to consult : https://launchpad.net/ubuntu/+archivemirrors.

Now here is a handy little script that allow to select a mirror with the lowest latency available : apt-select.

To install it :

  • If you are using Python 2 ( if not use python3-bs4 instead ) : sudo apt-get install python-bs4
  • Download code from github : wget --no-check-certificate https://github.com/jblakeman/apt-select/archive/master.tar.gz -O - | tar -zx
  • cd apt-select-master
  • Start script and select best mirror ( sources.list will be save in script dir ) : ./apt-select.py
  • Don’t hesitate to check sources.list content : view sources.list
  • Update system sources.list : ./update.sh
  • Update APT database : apt-get update

Enjoy !!! :)

Seen at Orange Portails, Mougins #car #lotus #forsale

Seen at Orange Portails, Mougins #car #lotus #forsale

PostgreSQL tips : quickly add a surrogate key column

Suppose that you want to add a surrogate key to a table in PostgreSQL to help you quickly identify each rows in a unique way. You can do this easily and quickly by just adding a SERIAL type column. When adding a SERIAL type column to an already filled table, PostgreSQL will automatically fill the column with some values.
To ensure your surrogate key uniqueness, don’t forget to add the UNIQUE constraint : on top of that this will create an index, thus speeding up your join queries on this column.

[sql light="true"]ALTER TABLE mytable ADD COLUMN id SERIAL UNIQUE;[/sql]

PLUS »

Sightseeing in Nice

Sightseeing in Nice

votez pour Babason !!! :)

votez pour Babason !!! :)

Quel est votre groupe préféré ?

so true :)

so true :)

Les chats – Partagez échangez et retrouvez chaques jours les meilleures images, images droles sur demotivateur.fr.

Et si on harmonisait calendrier politique européen ?

Attention, cet article ne concerne en rien Linux ou les Logiciels Libres !!!

Il est assez intéressant d’observer le ballet politique en cette période électorale en France, notamment concernant la politique européenne. Le nouveau traité de stabilité étant relativement contesté, les candidats de l’opposition redoublent de propositions et se proposent d’amender voire d’annuler ce que le gouvernement actuel va valider avec ses partenaires européens.
Bien sûr cette attitude est « logique » de la part de candidats à la recherche de voix, mais est elle réaliste ? Là est toute la question … Les candidats de gauche proposent de réformer l’Europe, mais le peuvent-ils si la majorité des gouvernements européens sont conservateurs ? J’en doute.

On parle beaucoup d’harmonisation des politiques fiscale, budgétaires, des politiques économiques voire même au niveau social. Mais qu’en est il de l’harmonisation des calendriers politiques ? En effet, bien que les élections européennes qui permettent l’élection des députés se déroule au même moment dans l’union européenne; le Parlement européen ne détient pas tous les pouvoirs : celui ci est partagé avec la Commission Européenne, mais aussi le Conseil Européen  qui réunit les chefs d’État et de gouvernement. On a vu notamment tout le poids et l’influence de ce dernier dans les différentes mesures prises durant la crise de la dette.
Or, l’attitude et les exigences d’un chef d’État ne sont pas les mêmes selon qu’il soit en période électorale ou pas. Les candidats feront des promesses concernant l’Europe chacun de leurs côtés dans leur pays sans forcément se concerter avec les candidats du même bord politique dans les autres pays car notamment leurs calendriers et donc leurs priorités ne seront pas les mêmes.

Et si on faisait se dérouler les élections des gouvernements ( ou des chefs d’État selon le type de régime ) en même temps partout en Europe ? Cela pourrait permettre aux candidats de faire de vrais propositions qui seraient concertées concernant l’Europe : tant qu’à harmoniser, autant aller jusqu’au bout !
Malheureusement ce sera très compliqué voire impossible à mettre en place car il y aura des changements de Constitution à faire de dans nombreux pays notamment pour avoir les mêmes durées de législature et de mandat, des chefs d’états devront accepter d’écourter leur mandat, et bien sûr cela renforce le côté fédéraliste … Un rêve pieu en somme. Que les candidats continuent à brasser du vent alors …

Using Dokan under Windows to mount your $HOME with SSH

Linux Windows cooperationAt work we are using Windows workstations, but we are working most of the time in our Virtual Machine, hosted in a Cloud, running under Linux. We have access to our Linux VM with NXClient or by using Putty. If you want to transfer some files from your Windows workstations to your Linux VM, several solutions exists. Most solutions are using the built-in SFTP server of OpenSSH : Filezilla, WinSCP. Their drawbacks ? They are just some FTP-like clients, and so you lack integration with Windows, notably the Windows Explorer.

Under Linux we can use SSHFS to mount your SSH server as a filesystem. Nautilus and Dolphin, at least, allow also to mount your remote SSH server in your local filesystem. Under Windows there are 2 solutions : ExpanDrive which a proprietary solution, and Dokan which is an OpenSource and Free implementation of a FUSE-like filesystem.

 

Installing Dokan

In fact Dokan is not really a program but a library implementing a FUSE-like filesystem. So for SSHFS support, you need to install the Dokan library, and then after, you will install the module allowing to use SSHFS protocol.

  1. Download the latest version of the Dokan library : http://dokan-dev.net/en/download/#dokan
  2. Install the Dokan library by running the installer
  3. Download and install the Microsoft Visual C++ 2005 SP1 Redistributable Package.
  4. Download the latest and matching version of the Dokan SSHFS support : http://dokan-dev.net/en/download/#sshfs
  5. Extract the content of the archive ( if you are using the zip version ) in C:\Program Files\Dokan
  6. To start Dokan, just run the binary DokanSSHFS.exe which is located normally in C:\Program Files\Dokan\dokan-sshfs-0.6.0.
  7. You may want to create a shortcut on your Desktop ( right click on DokanSSHFS.exe -> Send To -> Desktop ( create a shortcut )

 

Using Dokan

To use Dokan you just need to run DokanSSHFS.exe, then a window will allow to enter the different settings.

  1. Enter you connection settings ( SSH server Host, username, password or identity file ).
  2. If you want to map directly your $HOME, put the full Linux path to your home directory in Server Root.
  3. Select the Windows letter drive which will map your SSHFS drive.
  4. You can save theses settings by giving a name to the profile and then clicking on [Save] at the top of the window.
  5. Press [Connect] and if everything is fine, you should have a new  drive letter in your Windows Explorer.

 

Links :

 

Dokan SSHFS Configuration windows

Dokan SSHFS Configuration windows

First days at Orange

French ISP Orange group logo

French ISP Orange group logo

Since Monday July 4th, I’m working as a Linux sysadmin at Orange Hebex. I moved from Rouen to Sophia-Antipolis which is located in the south-west of France in the famous French Riviera. My job as a Linux sysadmin will be to ensure that the Linux servers at Orange are working fine ;-) Orange is the largest ISP in France, and have worldwide coverage. At Orange Hebex ( Hosting & Exploitations ) we are dealing with all the Orange websites and portals. I will be working more specifically on a very specific piece of this infrastructure which allow to aggregate data from different sources/data warehouses. Most servers are running Ubuntu ( some older servers running Debian are being migrated to Ubuntu LTS ) and the specific platform on which I will be working will be running PostgreSQL as database. Deployments are handled by Debian FAI , and the configuration is handled by CFengine as we have more than 3000 servers spread across 3 sites.

Even so in my daily usage at work I will be using Ubuntu ( running in a VM to which I’m connected using NX Client under Windows), I’m still planning to use Mandriva as my only desktop platform for daily use notably on my laptop. I do hope that I will still be able to contribute to the Mandriva community. I guess this will be a good opportunity for me to see why some people do prefer to use Debian/Ubuntu as servers and thus bring the best from them to Mandriva Linux distribution.

Long live to Mandriva, and long live to my former colleagues at Fiventis which are still running Mandriva Linux on all the servers, but also on the workstations ! I do still plan to keep an eye on them :-)

Catégories

My Tweets

Instagram feed