tag:blogger.com,1999:blog-21189659998141032352024-02-20T16:58:56.834+02:00Développer / Develop (fr) Activités reliés au développement d'applications, programmation, plateforme, gestion du code etc.<br>
(en) Activities related to application development, programming, platform, code management etc..<br>
(ar)
جميع الأنشطة المتصلة تطوير التطبيقات والبرمجة ومنصة إدارة رمز، وما إلى ذلك.
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.comBlogger33125tag:blogger.com,1999:blog-2118965999814103235.post-17114873674262300802020-12-13T09:07:00.003+02:002020-12-13T09:09:36.888+02:00New Python Users Group in Lebanon LIPUG<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRvaSPznoRQwFAJD7k-ugUvsPalq393rp9y_yYXUKL3jxgYkf4prWGHR1dDkpJdngLS_dhyphenhyphenWzI-5SqY9sadIvk_2QTqnUGa64dSRCw2BsR1M5EI-Oo517opCf2a3dsteHkfpV8KIoQhXg/s100/python-powered-w-100x40.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="40" data-original-width="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRvaSPznoRQwFAJD7k-ugUvsPalq393rp9y_yYXUKL3jxgYkf4prWGHR1dDkpJdngLS_dhyphenhyphenWzI-5SqY9sadIvk_2QTqnUGa64dSRCw2BsR1M5EI-Oo517opCf2a3dsteHkfpV8KIoQhXg/s0/python-powered-w-100x40.png" /></a></div><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">Users of the Python programming language meet periodically in so-called </span><strong style="background-color: white; font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; font-size: 14.1728px;">Python User Groups</strong><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">. Intermediate and advanced users share how they use the language and learn new tricks; they also welcome </span><strong style="background-color: white; font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; font-size: 14.1728px;">beginners</strong><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;"> and help them step in. It is a great place to ask for help and socialize with other people with a similar interest. Meetings are usually once every month, they are very informal and open to everyone.</span><p></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;"><br /></span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">The <a href="http://lipug.cofares.net">Lebanese Python Users Group </a>is an online group, hosted at github to share, exchange ideas, howtos, snipets, ... in many fields of the Python ecosystem</span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;"><br /></span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">* Functional paradigm</span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">* OOP Object paradigm</span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">* Reactive programming</span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">* Data Science</span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">* Machine learning</span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">All person and all ideas are welcome.</span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;"><br /></span></p><p><span face="Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif" style="background-color: white; font-size: 14.1728px;">This group will start with the students of the <a href="https://www.cnam-liban.fr">ISSAE Cnam Liban</a></span></p>Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com0tag:blogger.com,1999:blog-2118965999814103235.post-79681318507572187172020-04-14T10:53:00.000+03:002020-04-14T10:56:05.437+03:00Configurer l'encodage UTF-8 par défaut dans Apache Netbeans<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<iframe width="560" height="315" src="https://www.youtube.com/embed/lUkfzJmd0Os" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<br /></div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com0tag:blogger.com,1999:blog-2118965999814103235.post-12783567109160586242019-09-25T07:56:00.001+03:002019-09-25T07:56:35.879+03:00Publishing an ASP.NET Core website to a Linux VM host<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="background-color: white; color: #333333; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 1.4; margin-bottom: 1.5em; margin-left: auto; margin-right: auto; text-transform: uppercase; width: 750px;">
STEP 0 - GET A HOST (Google cloud, Azure, <a href="http://eurabiahosting.com/">EurabiaHOSTING</a>, ...)</h3>
<div>
<h3 style="background-color: white; color: #333333; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 1.4; margin-bottom: 1.5em; margin-left: auto; margin-right: auto; text-transform: uppercase; width: 750px;">
STEP 1 - GET .NET CORE ON YOUR LINUX MACHINE</h3>
</div>
<div>
<h3 style="background-color: white; color: #333333; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 1.4; margin-bottom: 1.5em; margin-left: auto; margin-right: auto; text-transform: uppercase; width: 750px;">
STEP 3 - EXPOSE YOUR WEB APP TO THE OUTSIDE.</h3>
</div>
<div>
<h3 style="background-color: white; color: #333333; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 1.4; margin-bottom: 1.5em; margin-left: auto; margin-right: auto; text-transform: uppercase; width: 750px;">
STEP 4 - SETUP A REVERSE PROXY LIKE NGINX OR Apache</h3>
</div>
<div>
Read the full article from <a href="https://www.hanselman.com/" style="color: #e2842c; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; text-decoration-line: none; text-transform: uppercase; transition: all 0.2s ease-in 0s;">SCOTT HANSELMAN</a><span style="color: #575e5b; font-family: "open sans" , "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 16px; text-transform: uppercase;"> blog</span></div>
<div>
<a href="https://www.hanselman.com/blog/PublishingAnASPNETCoreWebsiteToACheapLinuxVMHost.aspx">Publishing an ASP.NET Core website to a cheap Linux VM host</a></div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com1tag:blogger.com,1999:blog-2118965999814103235.post-25999683234330539022017-05-07T08:27:00.001+03:002017-05-07T08:27:19.295+03:00How to create RESTful API usig Node for processing HTTP requests.<div dir="ltr" style="text-align: left;" trbidi="on">
Node.js® is a JavaScript runtime built on <a href="https://developers.google.com/v8/" rel="nofollow">Chrome's V8 JavaScript engine</a>. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, <a href="https://www.npmjs.com/" rel="nofollow">npm</a>, is the largest ecosystem of open source libraries.<br />
Follow : Create <a href="http://www.9lessons.info/2017/02/create-restful-api-nodejs-mysql.html">RestFul API node.js and mysql</a> : <a href="http://www.9lessons.info/2017/02/create-restful-api-nodejs-mysql.html" rel="nofollow">http://www.9lessons.info/2017/02/create-restful-api-nodejs-mysql.html</a></div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com3tag:blogger.com,1999:blog-2118965999814103235.post-73592587829097578862017-05-05T12:04:00.004+03:002017-05-05T12:04:41.609+03:00Manipuler des chaine avec Bash (Linux)<div dir="ltr" style="text-align: left;" trbidi="on">
Voir l'article : <br />
<br /><a href="http://tldp.org/LDP/abs/html/string-manipulation.html">Manipulating Strings</a><br /><a href="http://tldp.org/LDP/abs/html/string-manipulation.html">http://tldp.org/LDP/abs/html/string-manipulation.html </a></div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com1tag:blogger.com,1999:blog-2118965999814103235.post-68252450393288067502017-05-05T12:02:00.001+03:002017-05-05T12:02:52.331+03:00MySQL multiple instances on Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="text-decoration: underline;"><b>Assumptions</b></span><br />
<ol>
<li>OS: <b><span style="color: red;">Ubuntu 16.x edition</span> </b>– up to date</li>
<li>Already has MySQL installed that comes default – you can easily install LAMP <span style="color: #339966;"></span></li>
<li>MySQL Server version: > 5.5</li>
<li>You have OS root privileges</li>
<li>Default MySQL is running on port 3306</li>
</ol>
<span style="text-decoration: underline;"><b>What will we do</b></span><br />
<ol>
<li>Set up 1 more MySQL instances on ports 3407 </li>
<li>Each instance will have their own config files, data directories and log directories</li>
</ol>
<span style="text-decoration: underline;"><b>Stopping default MySQL instance</b></span>
<br />
<pre><span style="line-height: 1.5;">sudo service mysql stop
</span><span style="line-height: 1.5;">sudo ps -A | grep mysql</span></pre>
<span style="text-decoration: underline;"><b>Creating data directories</b></span><br />
<ul>
<li>MySQL cannot share data directories, so we need to set up new ones</li>
<li>default <span style="color: #339966;">basedir = /usr</span>, this can be shared across instances</li>
<li>default instance <span style="color: #339966;">port = 3306</span> and <span style="color: #339966;">data dir = /var/lib/mysql</span></li>
<li><span style="line-height: 1.5;">new instance <span style="color: #339966;">port = 3408</span> and <span style="color: #339966;">data</span> <span style="color: #339966;">dir = /var/lib/mysql3408</span></span></li>
<li>MySQL must own data dirs</li>
<li><span style="line-height: 1.5;">we need to set rules in apparmor to let </span>MySQL<span style="line-height: 1.5;"> access the new dirs</span></li>
</ul>
<pre>sudo mkdir /var/lib/mysql3408
<span style="line-height: 1.5;">sudo chown -R mysql /var/lib/mysql3408
</span></pre>
<span style="text-decoration: underline;"><b>Creating log directories</b></span><br />
<ul>
<li>create separate log dirs for new MySQL instances</li>
<li>default log dir = <span style="color: #339966;">/var/log/mysql</span></li>
<li>new log dir for 3307 = <span style="color: #339966;">/var/log/mysql/mysql3408</span></li>
<li>log dirs must be owned by MySQL</li>
<li>note that /var/log/mysql already has apparmor permissions for MySQL, so any dir under it also has access</li>
</ul>
<pre><span style="line-height: 1.5;">sudo mkdir /var/log/mysql/mysql3408</span>
sudo chown -R mysql /var/log/mysql/mysql3408</pre>
<span style="text-decoration: underline;"><b>Creating config files</b></span><br />
<ul>
<li>create the config files for new instances by copying default file</li>
<li>default config file directory = <span style="color: #339966;">/etc/mysql<span class="skimlinks-unlinked"></span></span></li>
<li>config directory for 3408 = <span style="color: #339966;">/etc/mysql3408</span></li>
<li>copy config files from the default server </li>
<li>cp -r <span style="color: #339966;">/etc/mysql/* /etc/</span><span style="color: #339966;">mysql3408</span></li>
<li>special care has to be taken so that these values are different</li>
<li><span style="color: red;">datadir</span></li>
<li><span style="color: red;">server-id</span></li>
<li><span style="color: red;">all port entries</span></li>
<li><span style="color: red;">all socket entries</span></li>
<li><span style="color: red;">all pid-file entries</span></li>
<li><span style="color: red;">all log file entries, general, error, binary etc</span></li>
</ul>
<pre><span style="color: black;">sudo </span>cp -r <span style="color: #339966;">/etc/mysql/* /etc/</span><span style="color: #339966;">mysql3408</span>
<span style="color: black;"></span></pre>
<span style="text-decoration: underline;"><b><span style="line-height: 1.5;">Apparmor settings ( skip if you dont have this )</span></b></span><br />
<ul>
<li>apparmor is like an application firewall – comes installed default with Ubuntu server</li>
<li>command <span style="color: #339966;">aa-status</span> will show you if it is loaded</li>
<li>default apparmor profile for MySQL = <span style="color: #339966;">/etc/apparmor.d/<span class="skimlinks-unlinked">usr.sbin.mysqld</span></span></li>
<li>put additional rules in <span style="color: red;">/etc/apparmor.d/local/<span class="skimlinks-unlinked">usr.sbin.mysqld</span></span></li>
<li>specify the correct data dirs, pid and socket files for each instance </li>
<li><a href="https://github.com/naveensnayak/mysql-multi/blob/master/usr.sbin.mysqld" target="_blank">/etc/apparmor.d/local/usr.sbin.mysqld</a></li>
<li>after modifying, restart apparmor</li>
</ul>
<pre><span style="line-height: 1.5;">sudo service apparmor reload</span></pre>
<span style="text-decoration: underline;"><b>Installing new MySQL instances</b></span><br />
<ul>
<li>install MySQL files into the new data dirs for port 3307 and port 3308</li>
<li>after this, under each new data dir, you will see the mysql, performance_schema and test dirs</li>
<li>this will install MySQL with default settings, <span style="color: red;">no root password</span></li>
<li>in the below commands, you can use the <span style="color: #339966;">– -verbose</span> flag to see more details</li>
</ul>
<pre>sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql3307 --defaults-file=/etc/mysql/my3307.cnf
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql3308 --defaults-file=/etc/mysql/my3308.cnf</pre>
<span style="text-decoration: underline;"><b>Starting the mysql instances</b></span><br />
<ul>
<li>start the default instance on 3306</li>
<li>start instances on 3307 and 3308 in the background</li>
</ul>
<pre><span style="line-height: 1.5;">sudo service mysql start
</span>sudo -b mysqld_safe --defaults-file=/etc/mysql/my3307.cnf --user=mysql
sudo -b mysqld_safe --defaults-file=/etc/mysql/my3308.cnf --user=mysql</pre>
<span style="text-decoration: underline;"><b>Accessing the new instances</b></span><br />
<ul>
<li>Note that the new instances on 3307 and 3308 will not have a root password</li>
<li><span style="color: red; line-height: 1.5;">it is important to specify host and host=127.0.0.1</span></li>
<li><span style="line-height: 1.5;">if host is omitted, or localhost is given, then default instance is assumed ( on 3306 )</span></li>
<li><span style="color: red; line-height: 1.5;">remember to explicitly specify host and port for all commands</span></li>
</ul>
<pre>mysql -h 127.0.0.1 --port=3307 -u root
mysql -h 127.0.0.1 --port=3308 -u root</pre>
<span style="text-decoration: underline;"><b>Shutting down the MySQL instances</b></span><br />
<ul>
<li>We will use mysqladmin to cleanly shutdown</li>
<li><span style="color: red; line-height: 1.5;">it is important to specify host and and port</span></li>
<li>no password for now</li>
</ul>
<pre><span style="line-height: 1.5;">mysqladmin -h 127.0.0.1 --port=3307 -u root shutdown
mysqladmin -h 127.0.0.1 --port=3308 -u root shutdown
</span></pre>
<span style="text-decoration: underline;"><b>Post installation set up ( for each instance )</b></span><br />
<ul>
<li>update root password</li>
<li><span style="line-height: 1.5;">drop all </span>anonymous<span style="line-height: 1.5;"> users – check for users with empty username</span></li>
<li><span style="line-height: 1.5;">drop database test</span></li>
<li>
<div style="display: inline !important;">
flush privileges</div>
</li>
</ul>
<pre>update <span class="skimlinks-unlinked">mysql.user</span> set password=PASSWORD('myRootPassword') where User='root';
drop database test;
drop user ''@'localhost';
drop user ''@'%';
drop user ''@'ubuntu';
flush privileges;</pre>
<span style="text-decoration: underline;"><b>Starting new instances on boot and reboot</b></span><br />
<ul>
<li>Put commands in the file<span style="color: #339966;"> /etc/<span class="skimlinks-unlinked">rc.local</span></span> to start new instances on boot</li>
<li>the <span class="skimlinks-unlinked">rc.local</span> file will look like this</li>
</ul>
<pre>sudo -b mysqld_safe --defaults-file=/etc/mysql/my3307.cnf --user=mysql
sudo -b mysqld_safe --defaults-file=/etc/mysql/my3308.cnf --user=mysql
exit 0</pre>
<span style="text-decoration: underline;"><b>Troubleshooting</b></span><br />
<ul>
<li>Most of the time, the problem is due to incorrect permissions, or incorrect config files or apparmor</li>
<li>Check error logs in /var/log/mysql for each instance</li>
<li>Make sure that each mysql config has different values for variables</li>
<li>Make sure that directory permissions are correct, mysql must own data and log dirs</li>
<li>remember to specify host and port explicitly when connecting</li>
<li>if connecting from a remote host, check the <span style="color: #339966;">bind-address</span> config variable in the config file for the instance</li>
<li>if connecting from remote host, make sure that ports 3307 and 3308 are open and no other applications are using them</li>
<li><span style="line-height: 1.5;">Make sure that all dirs have the apparmor permissions and you have reloaded apparmor.</span></li>
<li>You can see enties like the below in <span style="color: #339966;">/var/log/syslog</span> if apparmor is blocking mysql</li>
</ul>
<pre>Nov 7 11:51:16 ubuntu kernel: [ 1080.756609] type=1400 audit(1383843076.476:32): apparmor="DENIED" operation="mknod"
parent=2749 profile="/usr/sbin/mysqld" name="/var/lib/mysql1/ibdata1" pid=3559 comm="mysqld" requested_mask="c"
denied_mask="c" fsuid=102 ouid=102</pre>
<span style="text-decoration: underline;"><b>Finally – bash aliases if you need</b></span><br />
<ul>
<li>To make commands simpler to type, you can set up bash aliases</li>
<li>Put the below aliases or whatever you want, in a file called .bash_aliases in your home dir</li>
<li>If the file is not found, create it in <span style="color: #339966;">~/.bash_aliases</span></li>
<li>remember to open a new shell for these commands to take effect</li>
</ul>
<pre>########### mysql @ 3307 ##############################
alias mysql3307-start='sudo -b mysqld_safe --defaults-file=/etc/mysql/my3307.cnf --user=mysql'
alias mysql3307-stop='mysqladmin -h 127.0.0.1 --port=3307 -u root shutdown -p'
alias mysql3307-root='mysql -h 127.0.0.1 --port=3307 -u root -p'
########### mysql @ 3308 ##############################
alias mysql3308-start='sudo -b mysqld_safe --defaults-file=/etc/mysql/my3308.cnf --user=mysql'
alias mysql3308-stop='mysqladmin -h 127.0.0.1 --port=3308 -u root shutdown -p'
alias mysql3308-root='mysql -h 127.0.0.1 --port=3308 -u root -p'</pre>
<span style="text-decoration: underline;"><b>Stopping default MySQL instance</b></span><br />
<pre><span style="line-height: 1.5;">sudo service mysql stop
</span><span style="line-height: 1.5;">sudo ps -A | grep mysql</span></pre>
<span style="text-decoration: underline;"><b>Creating data directories</b></span><br />
<ul>
<li>MySQL cannot share data directories, so we need to set up new ones</li>
<li>default <span style="color: #339966;">basedir = /usr</span>, this can be shared across instances</li>
<li>default instance <span style="color: #339966;">port = 3306</span> and <span style="color: #339966;">data dir = /var/lib/mysql</span></li>
<li><span style="line-height: 1.5;">new instance <span style="color: #339966;">port = 3307</span> and <span style="color: #339966;">data</span> <span style="color: #339966;">dir = /var/lib/mysql3307</span></span></li>
<li><span style="line-height: 1.5;">new instance <span style="color: #339966;">port = 3308</span> and <span style="color: #339966;">data</span> <span style="color: #339966;">dir = /var/lib/mysql3308</span></span></li>
<li>MySQL must own data dirs</li>
<li><span style="line-height: 1.5;">we need to set rules in apparmor to let </span>MySQL<span style="line-height: 1.5;"> access the new dirs</span></li>
</ul>
<pre>sudo mkdir /var/lib/mysql3307
sudo mkdir /var/lib/mysql3308
<span style="line-height: 1.5;">sudo chown -R mysql /var/lib/mysql3307
</span>sudo chown -R mysql /var/lib/mysql3308</pre>
<span style="text-decoration: underline;"><b>Creating log directories</b></span><br />
<ul>
<li>create separate log dirs for new MySQL instances</li>
<li>default log dir = <span style="color: #339966;">/var/log/mysql</span></li>
<li>new log dir for 3307 = <span style="color: #339966;">/var/log/mysql/mysql3307</span></li>
<li>new log dir for 3308 = <span style="color: #339966;">/var/log/mysql/mysql3308</span></li>
<li>log dirs must be owned by MySQL</li>
<li>note that /var/log/mysql already has apparmor permissions for MySQL, so any dir under it also has access</li>
</ul>
<pre><span style="line-height: 1.5;">sudo mkdir /var/log/mysql/mysql3307</span>
sudo mkdir /var/log/mysql/mysql3308
sudo chown -R mysql /var/log/mysql/mysql3307
sudo chown -R mysql /var/log/mysql/mysql3308</pre>
<span style="text-decoration: underline;"><b>Creating config files</b></span><br />
<ul>
<li>create the config files for new instances by copying default file</li>
<li>default config file = <span style="color: #339966;">/etc/mysql/<span class="skimlinks-unlinked">my.cnf</span></span></li>
<li>config file for 3307 = <span style="color: #339966;">/etc/mysql/my3307.cnf</span></li>
<li>config file for 3308 = <span style="color: #339966;">/etc/mysql/my3308.cnf</span></li>
<li>see config files on github</li>
<li><a href="https://github.com/naveensnayak/mysql-multi/blob/master/my3307.cnf" target="_blank">/etc/mysql/my3307.cnf</a></li>
<li><a href="https://github.com/naveensnayak/mysql-multi/blob/master/my3308.cnf" target="_blank">/etc/mysql/my3308.cnf</a></li>
<li>special care has to be taken so that these values are different</li>
<li><span style="color: red;">datadir</span></li>
<li><span style="color: red;">server-id</span></li>
<li><span style="color: red;">all port entries</span></li>
<li><span style="color: red;">all socket entries</span></li>
<li><span style="color: red;">all pid-file entries</span></li>
<li><span style="color: red;">all log file entries, general, error, binary etc</span></li>
</ul>
<pre><span style="color: black;">sudo cp /etc/mysql/<span class="skimlinks-unlinked">my.cnf</span> /etc/mysql/my3307.cnf</span>
<span style="color: black;">sudo cp /etc/mysql/<span class="skimlinks-unlinked">my.cnf</span> /etc/mysql/my3308.cnf</span></pre>
<span style="text-decoration: underline;"><b><span style="line-height: 1.5;">Apparmor settings ( skip if you dont have this )</span></b></span><br />
<ul>
<li>apparmor is like an application firewall – comes installed default with Ubuntu server</li>
<li>command <span style="color: #339966;">aa-status</span> will show you if it is loaded</li>
<li>default apparmor profile for MySQL = <span style="color: #339966;">/etc/apparmor.d/<span class="skimlinks-unlinked">usr.sbin.mysqld</span></span></li>
<li>put additional rules in <span style="color: red;">/etc/apparmor.d/local/<span class="skimlinks-unlinked">usr.sbin.mysqld</span></span></li>
<li>specify the correct data dirs, pid and socket files for each instance – see file on github</li>
<li><a href="https://github.com/naveensnayak/mysql-multi/blob/master/usr.sbin.mysqld" target="_blank">/etc/apparmor.d/local/usr.sbin.mysqld</a></li>
<li>after modifying, restart apparmor</li>
</ul>
<pre><span style="line-height: 1.5;">sudo service apparmor reload</span></pre>
<span style="text-decoration: underline;"><b>Installing new MySQL instances</b></span><br />
<ul>
<li>install MySQL files into the new data dirs for port 3307 and port 3308</li>
<li>after this, under each new data dir, you will see the mysql, performance_schema and test dirs</li>
<li>this will install MySQL with default settings, <span style="color: red;">no root password</span></li>
<li>in the below commands, you can use the <span style="color: #339966;">– -verbose</span> flag to see more details</li>
</ul>
<pre>sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql3307 --defaults-file=/etc/mysql/my3307.cnf
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql3308 --defaults-file=/etc/mysql/my3308.cnf</pre>
<span style="text-decoration: underline;"><b>Starting the mysql instances</b></span><br />
<ul>
<li>start the default instance on 3306</li>
<li>start instances on 3307 and 3308 in the background</li>
</ul>
<pre><span style="line-height: 1.5;">sudo service mysql start
</span>sudo -b mysqld_safe --defaults-file=/etc/mysql/my3307.cnf --user=mysql
sudo -b mysqld_safe --defaults-file=/etc/mysql/my3308.cnf --user=mysql</pre>
<span style="text-decoration: underline;"><b>Accessing the new instances</b></span><br />
<ul>
<li>Note that the new instances on 3307 and 3308 will not have a root password</li>
<li><span style="color: red; line-height: 1.5;">it is important to specify host and host=127.0.0.1</span></li>
<li><span style="line-height: 1.5;">if host is omitted, or localhost is given, then default instance is assumed ( on 3306 )</span></li>
<li><span style="color: red; line-height: 1.5;">remember to explicitly specify host and port for all commands</span></li>
</ul>
<pre>mysql -h 127.0.0.1 --port=3307 -u root
mysql -h 127.0.0.1 --port=3308 -u root</pre>
<span style="text-decoration: underline;"><b>Shutting down the MySQL instances</b></span><br />
<ul>
<li>We will use mysqladmin to cleanly shutdown</li>
<li><span style="color: red; line-height: 1.5;">it is important to specify host and and port</span></li>
<li>no password for now</li>
</ul>
<pre><span style="line-height: 1.5;">mysqladmin -h 127.0.0.1 --port=3307 -u root shutdown
mysqladmin -h 127.0.0.1 --port=3308 -u root shutdown
</span></pre>
<span style="text-decoration: underline;"><b>Post installation set up ( for each instance )</b></span><br />
<ul>
<li>update root password</li>
<li><span style="line-height: 1.5;">drop all </span>anonymous<span style="line-height: 1.5;"> users – check for users with empty username</span></li>
<li><span style="line-height: 1.5;">drop database test</span></li>
<li>
<div style="display: inline !important;">
flush privileges</div>
</li>
</ul>
<pre>update <span class="skimlinks-unlinked">mysql.user</span> set password=PASSWORD('myRootPassword') where User='root';
drop database test;
drop user ''@'localhost';
drop user ''@'%';
drop user ''@'ubuntu';
flush privileges;</pre>
<span style="text-decoration: underline;"><b>Starting new instances on boot and reboot</b></span><br />
<ul>
<li>Put commands in the file<span style="color: #339966;"> /etc/<span class="skimlinks-unlinked">rc.local</span></span> to start new instances on boot</li>
<li>the <span class="skimlinks-unlinked">rc.local</span> file will look like this</li>
</ul>
<pre>sudo -b mysqld_safe --defaults-file=/etc/mysql/my3307.cnf --user=mysql
sudo -b mysqld_safe --defaults-file=/etc/mysql/my3308.cnf --user=mysql
exit 0</pre>
<span style="text-decoration: underline;"><b>Troubleshooting</b></span><br />
<ul>
<li>Most of the time, the problem is due to incorrect permissions, or incorrect config files or apparmor</li>
<li>Check error logs in /var/log/mysql for each instance</li>
<li>Make sure that each mysql config has different values for variables</li>
<li>Make sure that directory permissions are correct, mysql must own data and log dirs</li>
<li>remember to specify host and port explicitly when connecting</li>
<li>if connecting from a remote host, check the <span style="color: #339966;">bind-address</span> config variable in the config file for the instance</li>
<li>if connecting from remote host, make sure that ports 3307 and 3308 are open and no other applications are using them</li>
<li><span style="line-height: 1.5;">Make sure that all dirs have the apparmor permissions and you have reloaded apparmor.</span></li>
<li>You can see enties like the below in <span style="color: #339966;">/var/log/syslog</span> if apparmor is blocking mysql</li>
</ul>
<pre>Nov 7 11:51:16 ubuntu kernel: [ 1080.756609] type=1400 audit(1383843076.476:32): apparmor="DENIED" operation="mknod"
parent=2749 profile="/usr/sbin/mysqld" name="/var/lib/mysql1/ibdata1" pid=3559 comm="mysqld" requested_mask="c"
denied_mask="c" fsuid=102 ouid=102</pre>
<span style="text-decoration: underline;"><b>Finally – bash aliases if you need</b></span><br />
<ul>
<li>To make commands simpler to type, you can set up bash aliases</li>
<li>Put the below aliases or whatever you want, in a file called .bash_aliases in your home dir</li>
<li>If the file is not found, create it in <span style="color: #339966;">~/.bash_aliases</span></li>
<li>remember to open a new shell for these commands to take effect</li>
</ul>
<pre>########### mysql @ 3307 ##############################
alias mysql3307-start='sudo -b mysqld_safe --defaults-file=/etc/mysql/my3307.cnf --user=mysql'
alias mysql3307-stop='mysqladmin -h 127.0.0.1 --port=3307 -u root shutdown -p'
alias mysql3307-root='mysql -h 127.0.0.1 --port=3307 -u root -p'
########### mysql @ 3308 ##############################
alias mysql3308-start='sudo -b mysqld_safe --defaults-file=/etc/mysql/my3308.cnf --user=mysql'
alias mysql3308-stop='mysqladmin -h 127.0.0.1 --port=3308 -u root shutdown -p'
alias mysql3308-root='mysql -h 127.0.0.1 --port=3308 -u root -p'</pre>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com0tag:blogger.com,1999:blog-2118965999814103235.post-20479000184772953352017-03-13T09:34:00.001+02:002017-03-13T09:34:25.058+02:00Lebanese Java User Group: How to Install Oracle Java 8 on Ubuntu 16.10 via P...<a href="http://ljug.cofares.net/2017/03/how-to-install-oracle-java-8-on-ubuntu.html?spref=bl">Lebanese Java User Group: How to Install Oracle Java 8 on Ubuntu 16.10 via P...</a>: If you want to run a program written in Java, then you will need to install JRE (Java Runtime Environment); if you want to begin developin...Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com1tag:blogger.com,1999:blog-2118965999814103235.post-15439040012177771762017-03-12T22:22:00.001+02:002017-03-12T22:24:41.673+02:00Setting up MySQL SSL and secure connections<div dir="ltr" style="text-align: left;" trbidi="on">
There are different articles on how to setup MySQL with SSL but it’s
sometimes difficult to end up with a good simple one. Usually, setting
up MySQL SSL is not really a smooth process due to such factors like
“it’s not your day”, something is broken apparently or the documentation
lies...<br />
<br />
Read this article : <a href="https://www.percona.com/blog/2013/06/22/setting-up-mysql-ssl-and-secure-connections/" rel="nofollow">Setting up MySQL SSL and secure connections</a><br />
<br />
Pre-requisite : <br />
<h3 class="title">
<a href="https://dev.mysql.com/doc/refman/5.5/en/creating-ssl-files-using-openssl.html" rel="nofollow">Creating SSL Certificates and Keys Using openssl</a></h3>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com3tag:blogger.com,1999:blog-2118965999814103235.post-56128760496454443722016-09-28T17:52:00.000+03:002016-09-28T17:52:11.654+03:00New Language Expands on Google's Go<div dir="ltr" style="text-align: left;" trbidi="on">
<i style="-webkit-text-stroke-width: 0px; color: #222222; font-family: arial, sans-serif; font-size: 12.8px; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">InfoWorld (09/23/16) Serdar Yegulalp</i><span style="-webkit-text-stroke-width: 0px; background-color: white; color: #222222; display: inline !important; float: none; font-family: arial, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-converted-space"> </span></span><br style="-webkit-text-stroke-width: 0px; color: #222222; font-family: arial, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; color: #222222; font-family: arial, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" />Polish developer Marcin Wrochniak has introduced Have, a computer language that transpiles to and expands on Google's Go. Wrochniak developed Have as a hobby project, with the goal of the language becoming a "companion" to Go that addresses some of its common "landmines." One of the most obvious differences between Have and Go is the formatting; Go uses curly braces similar to C/C++, while Have uses block indents like Python. Other differences address idiosyncrasies in Go. For example, the way that variable declaration, structs, and interfaces work have all been modified in Have to be more consistent with each other and to avoid internal inconsistencies that are a common source of bugs. The new language also plans to add generics to Go, which will enable programmers to create constructs in the language that use type parameters and make it possible to extend Have in ways not readily possible in Go. Have also features "specializations," which let generics use different code based on the type in question. Although many of the features Wrochniak wants to provide have not been implemented yet, Go's role as a platform for language innovation is notable.<br />
<div style="-webkit-text-stroke-width: 0px; color: #222222; font-family: arial, sans-serif; font-size: 12.8px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; margin-top: 5px; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<a data-saferedirecturl="https://www.google.com/url?hl=fr&q=http://orange.hosting.lsoft.com/trk/click?ref%3Dznwrbbrs9_6-113ffx3fe08x079186%26&source=gmail&ust=1475160204175000&usg=AFQjCNHK6idXABPOeD6T0JV7ibDj9kd5nw" href="http://orange.hosting.lsoft.com/trk/click?ref=znwrbbrs9_6-113ffx3fe08x079186&" style="color: #1155cc;" target="_blank">View Full Article</a></div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com3tag:blogger.com,1999:blog-2118965999814103235.post-89000068005130959622016-04-10T20:01:00.001+03:002016-04-10T20:01:40.665+03:00Lebanese Java User Group: First time git config<a href="http://ljug.cofares.net/2016/03/first-time-git-config.html?spref=bl">Lebanese Java User Group: First time git config</a>: The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit ...Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com2tag:blogger.com,1999:blog-2118965999814103235.post-4277468076500464582014-02-28T00:18:00.001+02:002014-02-28T00:18:13.147+02:00GIT : forking workflow<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="margin: 0px 0px 25px; padding: 0px;">
<a href="https://www.atlassian.com/git/workflows/?utm_source=adroll&utm_medium=retargeting&utm_campaign=git_theme_display&utm_content=gitmicro_en_GitflowFeatureBranchForking_300x250#!workflow-forking" rel="nofollow" style="background-color: white; color: #003366; font-family: kulturista-web, Helvetica, Arial, Verdana, sans-serif; font-size: 26px; font-weight: 400; line-height: 26px;">Forking Workflow</a><span style="color: #003366; font-family: kulturista-web, Helvetica, Arial, Verdana, sans-serif;"><span style="background-color: white; font-size: 26px; font-weight: 400; line-height: 26px;"> :</span></span></h2>
<a href="https://www.atlassian.com/git/workflows/?utm_source=adroll&utm_medium=retargeting&utm_campaign=git_theme_display&utm_content=gitmicro_en_GitflowFeatureBranchForking_300x250#!workflow-forking" rel="nofollow">https://www.atlassian.com/git/workflows</a><div>
<br /><div style="background-color: white; color: #404040; font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 14px; padding: 0px;">
The Forking Workflow is fundamentally different than the other workflows discussed in this tutorial. Instead of using a single server-side repository to act as the “central” codebase, it gives<span style="font-style: inherit; font-weight: inherit;">every</span> developer a server-side repository. This means that each contributor has not one, but two Git repositories: a private local one and a public server-side one.</div>
<div style="background-color: white; color: #404040; font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 14px; padding: 0px;">
<img alt="Git Workflows: Forking" height="344" src="https://www.atlassian.com/git/workflows/pageSections/00/contentFullWidth/0/tabs/03/pageSections/0/contentFullWidth/0/content_files/file/git-workflows-forking.png" style="border: 0px; margin-bottom: 17px;" width="400" /></div>
<div style="background-color: white; color: #404040; font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 14px; padding: 0px;">
<br /></div>
</div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com5tag:blogger.com,1999:blog-2118965999814103235.post-31873309676133897752014-01-06T13:12:00.002+02:002014-01-06T13:13:27.114+02:00clone a single branch from git repo<div dir="ltr" style="text-align: left;" trbidi="on">
<pre style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;">git clone -b <branch> --branch <branch> --single-branch git://github/repository.git</code></pre>
<pre style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;">
<dt class="hdlist1" style="background-color: #fcfcfa; border: 0px; color: #4e443c; font-family: Courier, monospace !important; font-weight: bold; line-height: 21px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: normal;">--[no-]single-branch</dt>
<dd style="background-color: #fcfcfa; border: 0px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 22px; margin: 0px 0px 0px 11px; padding: 0px; vertical-align: baseline; white-space: normal;"><div style="border: 0px; font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; margin-bottom: 11px; padding: 0px; vertical-align: baseline;">
Clone only the history leading to the tip of a single branch, either specified by the <tt style="background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(239, 238, 230); color: #f14e32; display: inline; font-family: Courier, monospace !important; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: 18px; margin: 0px 0px 1em; padding: 1px; vertical-align: baseline;">--branch</tt> option or the primary branch remote's <tt style="background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(239, 238, 230); color: #f14e32; display: inline; font-family: Courier, monospace !important; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: 18px; margin: 0px 0px 1em; padding: 1px; vertical-align: baseline;">HEAD</tt> points at. When creating a shallow clone with the <tt style="background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(239, 238, 230); color: #f14e32; display: inline; font-family: Courier, monospace !important; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: 18px; margin: 0px 0px 1em; padding: 1px; vertical-align: baseline;">--depth</tt>option, this is the default, unless <tt style="background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(239, 238, 230); color: #f14e32; display: inline; font-family: Courier, monospace !important; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: 18px; margin: 0px 0px 1em; padding: 1px; vertical-align: baseline;">--no-single-branch</tt> is given to fetch the histories near the tips of all branches. Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point at any branch when <tt style="background-color: white; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(239, 238, 230); color: #f14e32; display: inline; font-family: Courier, monospace !important; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: 18px; margin: 0px 0px 1em; padding: 1px; vertical-align: baseline;">--single-branch</tt> clone was made, no remote-tracking branch is created.</div>
</dd></code></pre>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com5tag:blogger.com,1999:blog-2118965999814103235.post-77143111288284641392013-12-29T12:50:00.003+02:002013-12-29T12:50:17.992+02:00Go Google Go! A Language on Full Throttle<div dir="ltr" style="text-align: left;" trbidi="on">
<i style="color: #222222; font-family: arial, sans-serif; font-size: 13px;">InfoWorld (12/18/13) Serdar Yegulalp</i><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;"> </span><br /><br />Go, Google's C-like language, recently was ranked at the top of TechEmpower's eighth round of Web framework benchmarks. Go proved to be the strongest in the JSON serialization test, achieving the best peak performance and the lowest latency scores. The high performance with JSON serialization indicates that Go is being performance-tuned for the same set of workloads most directly associated with frameworks such as Node.js. Node.js' lowest performance was at 14.3 percent of Go's speed, while the best was at 69.1 percent. Node.js has the advantage of a broad software development culture--not just through its package repository, but also because there are many more JavaScript programmers than there are Go programmers. Another newcomer in the benchmarks is Facebook's HipHop PHP VM (HHVM), an open source project that compiles PHP into C++ instead of interpreting it. HHVM was designed to replace Facebook's existing PHP-execution framework, and outperformed both Go and Node.js in the multiple-queries and data-updates benchmarks. The major appeal of HHVM is the performance boost the framework can give to legacy PHP code.<br />
<div style="color: #222222; font-family: arial, sans-serif; font-size: 13px; margin-top: 5px;">
<a href="http://www.infoworld.com/t/application-development/go-google-go-language-full-throttle-232829" style="color: #1155cc;" target="_blank">View Full Article</a></div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com10tag:blogger.com,1999:blog-2118965999814103235.post-83274522096114816212013-12-27T18:02:00.002+02:002013-12-27T18:02:49.758+02:00Apache 2.4 new FilterProvider syntax<div dir="ltr" style="text-align: left;" trbidi="on">
This for exemple<br />
<br />
<div style="text-align: center;">
FilterProvider SSI INCLUDES resp=Content-Type $text/html</div>
<br />
will become<br />
<br />
<div style="text-align: center;">
FilterProvider SSI INCLUDES "%{CONTENT_TYPE} = 'text/html'" </div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com2tag:blogger.com,1999:blog-2118965999814103235.post-1764257840820452922013-12-23T18:17:00.002+02:002013-12-23T18:17:36.133+02:00HOWTO remove all dangling commits from your git repository<div dir="ltr" style="text-align: left;" trbidi="on">
<h2>
</h2>
A good explanation of the dangling (<b>fr: </b><span class="short_text" id="result_box" lang="fr"><span class="hps">ballants) </span></span>commits source tells you how they get created.<br />
<br />
<pre>git fsck --full</pre>
<pre> </pre>
<pre>Checking object directories: 100% (300/300), done.
Checking objects: 100% (10658/10658), done.
dangling commit x....
dangling blob y....
dangling commit z....
dangling blob w....
dangling blob a....
dangling commit b....</pre>
<br />
How to quickly remove those?<br />
<pre>git reflog expire --expire=now --all
git gc --prune=now</pre>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com1tag:blogger.com,1999:blog-2118965999814103235.post-5697025366734922332013-12-19T15:28:00.002+02:002013-12-19T15:28:52.600+02:00push and delete remote branches <div dir="ltr" style="text-align: left;" trbidi="on">
This is an action that many Git users need to do frequently, but many
(including the me!!) have forgotten how to do so or simply don’t know
how. Here’s the definitive guide if you’ve forgotten. For this reason I put it on my dev site on cofares the with free articles resources galaxy of sites.<br />
<br />
So you have checked out a new branch,
committed some awesome changes, but now you need to share this branch
though with another developer. You can push the branch up to a remote
very simply:<br />
<br />
<code>git push origin <pascal></code><br />
<br />
Where <code>origin</code> is your remote name and <code><pascal></code>
is the name of the branch you want to push up. <br />
<br />
Deleting is also a pretty simple task:<br />
<br />
<code>git push origin :<pascal></code><br />
<br />
That will delete the <code>newfeature</code> branch on the <code>origin</code> remote, but you’ll still need to delete the branch locally with <code> </code><br />
<br />
<code>git branch -d <pascal></code><br />
<br />
<br /></div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com1tag:blogger.com,1999:blog-2118965999814103235.post-75193012837752218682013-12-17T23:39:00.001+02:002013-12-17T23:39:17.287+02:00Programming Smart Molecules<div dir="ltr" style="text-align: left;" trbidi="on">
<i style="color: #222222; font-family: arial, sans-serif; font-size: 13px;">Harvard University (12/12/13) Caroline Perry</i><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;"> </span><br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /><br style="color: #222222; font-family: arial, sans-serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">Harvard University researchers have shown that an important class of artificial intelligence (AI) algorithms could be implemented using chemical reactions. The researchers note that the machine-learning algorithms, which use a technique called "message passing inference on factor graphs," are a mathematical coupling of ideas from graph theory and probability and already function as critical components of everyday tools. They say that in the long term, these theoretical developments could lead to "smart drugs" that can automatically detect, diagnose, and treat a variety of diseases using a cocktail of chemicals that can perform AI-type reasoning. "This work shows that it is possible to also build intelligent machines at tiny scales, without needing anything that looks like a regular computer," says Harvard professor Ryan P. Adams. The research also could produce methods for analyzing natural biological reaction pathways and regulatory networks as mechanisms that are performing statistical inference. "What makes this project different is that, instead of aiming for general computation, we focused on efficiently translating particular algorithms that have been successful at solving difficult problems in areas like robotics into molecular descriptions," says Harvard professor Nils Napp.</span><br />
<div style="color: #222222; font-family: arial, sans-serif; font-size: 13px; margin-top: 5px;">
<a href="http://www.seas.harvard.edu/news/2013/12/programming-smart-molecules" style="color: #1155cc;" target="_blank">View Full Article</a></div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com2tag:blogger.com,1999:blog-2118965999814103235.post-48133561974802242912013-11-24T18:28:00.004+02:002013-11-24T18:28:44.164+02:00node.js<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="-webkit-text-stroke-width: 0.10000000149011612px; background-color: #46483e; color: #d2d8ba; font-family: Helvetica, Arial, sans-serif; font-size: 12px; font-weight: normal; line-height: 21px; margin: 2em 0px 10px; text-transform: uppercase;">
AN EXAMPLE: WEBSERVER</h2>
<div style="-webkit-text-stroke-width: 0.10000000149011612px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Verdana, Tahoma, sans-serif; font-size: 12px; line-height: 24px;">
<span style="background-color: white;">This simple web server written in Node responds with "Hello World" for every request.</span></div>
<pre class="sh_sourceCode" style="-webkit-text-stroke-width: 0.10000000149011612px; border-left-color: rgb(98, 101, 87); border-left-style: solid; border-left-width: 1px; font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 22px; margin-left: -1em; padding: 0px 0px 0px 1em;"><span style="background-color: white;"><span class="sh_keyword" style="font-style: italic;">var</span> http <span class="sh_symbol">=</span> <span class="sh_function">require</span><span class="sh_symbol">(</span><span class="sh_string">'http'</span><span class="sh_symbol">);</span>
http<span class="sh_symbol">.</span><span class="sh_function">createServer</span><span class="sh_symbol">(</span><span class="sh_keyword" style="font-style: italic;">function</span> <span class="sh_symbol">(</span>req<span class="sh_symbol">,</span> res<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
res<span class="sh_symbol">.</span><span class="sh_function">writeHead</span><span class="sh_symbol">(</span><span class="sh_number">200</span><span class="sh_symbol">,</span> <span class="sh_cbracket">{</span><span class="sh_string">'Content-Type'</span><span class="sh_symbol">:</span> <span class="sh_string">'text/plain'</span><span class="sh_cbracket">}</span><span class="sh_symbol">);</span>
res<span class="sh_symbol">.</span><span class="sh_function">end</span><span class="sh_symbol">(</span><span class="sh_string">'Hello World</span><span class="sh_specialchar">\n</span><span class="sh_string">'</span><span class="sh_symbol">);</span>
<span class="sh_cbracket">}</span><span class="sh_symbol">).</span><span class="sh_function">listen</span><span class="sh_symbol">(</span><span class="sh_number">1337</span><span class="sh_symbol">,</span> <span class="sh_string">'127.0.0.1'</span><span class="sh_symbol">);</span>
console<span class="sh_symbol">.</span><span class="sh_function">log</span><span class="sh_symbol">(</span><span class="sh_string">'Server running at http://127.0.0.1:1337/'</span><span class="sh_symbol">);</span></span></pre>
<div style="-webkit-text-stroke-width: 0.10000000149011612px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Verdana, Tahoma, sans-serif; font-size: 12px; line-height: 24px;">
<span style="background-color: white;">To run the server, put the code into a file <code style="font-family: Monaco, Consolas, 'Lucida Console', monospace; line-height: 22px; margin: 0px; padding: 0px;">example.js</code> and execute it with the <code style="font-family: Monaco, Consolas, 'Lucida Console', monospace; line-height: 22px; margin: 0px; padding: 0px;">node</code> program from the command line:</span></div>
<pre class="sh_none" style="-webkit-text-stroke-width: 0.10000000149011612px; border-left-color: rgb(98, 101, 87); border-left-style: solid; border-left-width: 1px; font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 22px; margin-left: -1em; padding: 0px 0px 0px 1em;"><span style="background-color: white;">% node example.js
Server running at http://127.0.0.1:1337/</span></pre>
<div style="-webkit-text-stroke-width: 0.10000000149011612px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Verdana, Tahoma, sans-serif; font-size: 12px; line-height: 24px;">
<span style="background-color: white;">Here is an example of a simple TCP server which listens on port 1337 and echoes whatever you send it:</span></div>
<pre class="sh_sourceCode" style="-webkit-text-stroke-width: 0.10000000149011612px; border-left-color: rgb(98, 101, 87); border-left-style: solid; border-left-width: 1px; font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 22px; margin-left: -1em; padding: 0px 0px 0px 1em;"><span style="background-color: white;"><span class="sh_keyword" style="font-style: italic;">var</span> net <span class="sh_symbol">=</span> <span class="sh_function">require</span><span class="sh_symbol">(</span><span class="sh_string">'net'</span><span class="sh_symbol">);</span>
<span class="sh_keyword" style="font-style: italic;">var</span> server <span class="sh_symbol">=</span> net<span class="sh_symbol">.</span><span class="sh_function">createServer</span><span class="sh_symbol">(</span><span class="sh_keyword" style="font-style: italic;">function</span> <span class="sh_symbol">(</span>socket<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
socket<span class="sh_symbol">.</span><span class="sh_function">write</span><span class="sh_symbol">(</span><span class="sh_string">'Echo server</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span><span class="sh_symbol">);</span>
socket<span class="sh_symbol">.</span><span class="sh_function">pipe</span><span class="sh_symbol">(</span>socket<span class="sh_symbol">);</span>
<span class="sh_cbracket">}</span><span class="sh_symbol">);</span>
server<span class="sh_symbol">.</span><span class="sh_function">listen</span><span class="sh_symbol">(</span><span class="sh_number">1337</span><span class="sh_symbol">,</span> <span class="sh_string">'127.0.0.1'</span><span class="sh_symbol">);</span></span></pre>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com1tag:blogger.com,1999:blog-2118965999814103235.post-56780312833277519002013-11-06T00:48:00.001+02:002013-11-10T14:04:03.897+02:00Kernel boot parameters<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr">
<a href="http://xmodulo.com/2013/11/add-kernel-boot-parameters-via-grub-linux.html">http://xmodulo.com/2013/11/add-kernel-boot-parameters-via-grub-linux.html</a></div>
<br /></div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com2tag:blogger.com,1999:blog-2118965999814103235.post-44944308597793695742013-09-15T13:20:00.002+03:002013-09-15T13:28:46.787+03:00Introducing OpenPGP keys (launchpad and ubuntu)<div dir="ltr" style="text-align: left;" trbidi="on">
<br /><br />An OpenPGP (also called GnuPrivacyGuard) key allows you to sign documents, such as emails or text files, using a digital key.There are two parts to an OpenPGP key: one public that you share with the world and the other private, which you should guard closely. Both are standard text files that make up a digital signature.<br /><br />In Launchpad, you can use your OpenPGP key to identify yourself when using the bug tracker's email interface, when uploading distribution packages and when signing a code of conduct.<div>
<br /></div>
<div>
<b>Generating your key in Ubuntu (using Seahorse or others)</b><br /><br /><h1 id="Generating_an_OpenPGP_Key" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 28px; font-weight: normal; line-height: 32px; margin: 0em 0px 8px; padding: 0px; vertical-align: baseline;">
Generating an OpenPGP Key</h1>
<div>
<br /></div>
<span class="anchor" id="line-18" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 13px; margin: 0px; padding: 0px; vertical-align: baseline;"></span><div class="line862" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
The core package required to start using OpenPGP, <tt style="border: 0px; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;">gnupg</tt>, is installed by default on Ubuntu systems, as is seahorse, a GNOME application for managing keys. It is called "Passwords and Keys" in Ubuntu.<span class="anchor" id="line-19" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-20" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<div class="line874" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
There are several programs which provide a graphical interface to the GnuPG system.<span class="anchor" id="line-21" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 13px; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;"><div class="line891" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
<a class="https" href="https://www.enigmail.net/home/index.php" style="border: 0px; color: #dd4814; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Enigmail</a>, an OpenPGP plugin for Mozilla Thunderbird.<span class="anchor" id="line-22" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;">Enigmail was available in the "Main" repository through Intrepid, but can be found in the "Universe" repository since Jaunty.<span class="anchor" id="line-23" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-24" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></li>
</ul>
</li>
</ul>
<div class="line874" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
sudo apt-get install enigmail<span class="anchor" id="line-25" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 13px; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;"><div class="line891" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
<a class="http" href="http://www.gnupg.org/gpa.html" style="border: 0px; color: #dd4814; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">GNU Privacy Assistant</a> is a graphical user interface for the GnuPG (GNU Privacy Guard).<span class="anchor" id="line-26" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;"><div class="line862" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
GPA is available in the "Universe" repository. See <a href="https://help.ubuntu.com/community/Repositories" style="border: 0px; color: #dd4814; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Repositories</a> for further information on enabling repositories.<span class="anchor" id="line-27" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-28" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
</li>
</ul>
</li>
</ul>
<div class="line874" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
sudo apt-get install gpa<span class="anchor" id="line-29" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 13px; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;"><div class="line891" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
<a class="http" href="http://seahorse.sourceforge.net/" style="border: 0px; color: #dd4814; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Seahorse</a> is a GNOME application for managing encryption keys. It also integrates with nautilus, gedit, and in other places for encryption operations.<span class="anchor" id="line-30" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;">Seahorse is available in the "Main" repository.<span class="anchor" id="line-31" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-32" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></li>
</ul>
</li>
</ul>
<div class="line874" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
sudo apt-get install seahorse<span class="anchor" id="line-33" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 13px; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;"><div class="line891" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
<a class="http" href="http://utils.kde.org/projects/kgpg/" style="border: 0px; color: #dd4814; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">KGPG</a> is a simple, free, open source KDE frontend for gpg.<span class="anchor" id="line-34" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;">KGPG is available in the "Main" repository since Intrepid, or the "Universe" repository in earlier releases.<span class="anchor" id="line-35" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-36" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></li>
</ul>
</li>
</ul>
<div class="line874" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
sudo apt-get install kgpg<span class="anchor" id="line-37" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 13px; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;"><div class="line891" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
<a class="http" href="http://pim.kde.org/" style="border: 0px; color: #dd4814; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;">Kleopatra</a> is another KDE frontend for gpg that is integrated with the KDE PIM (although you need to install it separately for now).<span class="anchor" id="line-38" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<ul style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; list-style: decimal; margin: 0px 0px 8px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1.5; margin: 0px 0px 0px 2.4em; padding: 0px; text-align: left; vertical-align: baseline;">Kleopatra is available in the "Universe" repository and it includes S/MIME backend:<span class="anchor" id="line-39" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-40" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></li>
</ul>
</li>
</ul>
<div class="line874" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
sudo apt-get install kleopatra<span class="anchor" id="line-41" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-42" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<div class="line874" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
You can also generate keys using these programs. Use the section below for recommendations on settings.<span class="anchor" id="line-43" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span><span class="anchor" id="line-44" style="border: 0px; font-family: inherit; font-style: inherit; line-height: 1; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<div class="line867" style="background-color: white; border: 0px; color: #333333; font-family: Ubuntu, 'Ubuntu Beta', 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.5; margin-bottom: 8px; padding: 0px; vertical-align: baseline;">
</div>
<br />
<b>Publishing your key</b></div>
<div>
<b><br /></b>Your key is useful only if other people can verify items that you sign. By publishing your key to a keyserver, which acts as a directory of people's public keys, you can make your public key available to anyone else.<br />
Before you add your key to Launchpad or elswhere, you need to push it to (for exemple) the Ubuntu keyserver.<br />
<h3>
Using <em>Passwords and Encryption Keys</em></h3>
<strong>Step 1</strong> Open <em>Passwords and Encryption Keys</em>.<br />
<strong>Step 2</strong> Select the <em>My Personal Keys</em> tab, select your key.<br />
<strong>Step 3</strong> Select <em>Remote > Sync and Publish Keys</em> from the menu. Choose the <em>Sync</em>button. (You may need to add hkp://keyserver.ubuntu.com to your key servers if you are not using Ubuntu.)<br />
It can take up to thirty minutes before your key is available to Launchpad. After that time, you're ready to <a href="https://launchpad.net/+help-registry/import-pgp-key.html">import your new key into Launchpad</a>!<br />
<b>Renewing your key</b>You may have set your key to expire. You can update your key and republish it.<br />
<strong>Step 1</strong> Open <em>Passwords and Encryption Keys</em>.<br />
<strong>Step 2</strong> Select the <em>My Personal Keys</em> tab, select your key, and open the property window by pressing Space Bar our double clicking with your pointer.<br />
<strong>Step 3</strong> Set a new expiration date or choose never.<br />
See the <em>Publishing your key</em> section above.<br />
<b>More about GPG</b><a href="http://www.blogger.com/blogger.g?blogID=2118965999814103235" name="publish"></a><br />
<a href="https://help.launchpad.net/YourAccount/ImportingYourPGPKey" target="_blank">Importing Your PGP Key ></a> at Launchpad Help has more information about using OpenPGP with Launchpad and provides examples using the GPG command found on most Linux distributions. Read the <a href="https://help.ubuntu.com/community/GnuPrivacyGuardHowto" target="_blank">Ubuntu community's guide to OpenPGP keys ></a> to learn about how to other uses.</div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com1tag:blogger.com,1999:blog-2118965999814103235.post-89664320201956876492013-09-13T10:38:00.000+03:002013-09-13T10:38:17.758+03:00Virtual user et alis dans postfix<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="margin-bottom: 1.5em; padding: 0px;">
Postfix is a great mailer, but if you're new to administering Postfix, finding your way around can be difficult. For example, just finding information on adding users to a Postfix system can be quite a trial.<br /><br />Postfix is a great mailer, but if you're new to administering it, finding your way around can be difficult. Here's how to get started.<br /><br />In part, this is because Postfix can be set up in a number of ways. Some installations use Postfix alone, others use Postfix in conjunction with other apps and store user information in MySQL. You can have users who have actual accounts on a system, or you can have users on virtual domains that don't have a login but still receive mail. Or you might want aliases that include several users, so everybody on the "marketing" list gets mail or all folks in sales, legal or development can receive messages.<br /><br />For this tip, I'll assume that you've inherited a Postfix domain and want a way to add users or aliases quickly.</div>
<div style="margin-bottom: 1.5em; padding: 0px;">
<span style="background-color: #e2e2e2; color: #3f0007; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.3em;">Adding Users</span></div>
<div style="margin-bottom: 1.5em; padding: 0px;">
<br /><br />The simple way to add a user is to simply add a new account on the system. Postfix will handle the rest. For example, on my server running Ubuntu, I'd just use adduser username, and Postfix would just do the right thing with regard to sending mail to that user, delivered locally.<br /><br />But what if you don't want to create a system account for the user? You should have a virtual domain set up that is not configured as a mydestination domain. For more on this, be sure to read the <a href="http://www.postfix.org/VIRTUAL_README.html" rel="nofollow">Postfix guide</a> on virtual domain hosting.<br /><br />Users are then added in the form user@domain and then either the mailbox on the system or handed off to Courier or another mail delivery program in the /etc/postfix/vmailbox file.<br /><br />However, if you don't have a /etc/postfix/vmailbox file, odds are your system was configured to deliver to local accounts. You should check /etc/postfix/main.cf and look for the linemydestination. If it includes the domain you're adding users for, then they're being added as regular users.<br /><br />Otherwise, in /etc/postfix/vmailbox, add a line like:<br /><br /><br />utisateurV@mondomain.net mondomain.net/utilisateurV<br /><br /><br />You should see some examples already. This will deliver mail to a mailbox called utisateurV in /var/mail/vhosts/mondomain.net -- assuming your system is set up to deliver mail there. Note, you can store mail in an mdir format instead by adding a slash after the username.<br /><br />Next, run postmap against the file (/etc/postfix/vmailbox) and postfix reload.<br /><br />To add an alias, go to /etc/aliases and add the alias like so:<br /><br />alias: localuser # For a local user mapping <br />alias2: user@remote.com # For a remote user mapping</div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com0tag:blogger.com,1999:blog-2118965999814103235.post-70492396896431507332013-08-23T17:47:00.001+03:002013-09-13T10:34:24.280+03:00Mysql realm in glassfish<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr">
JDBC Realm and Form Based Authentication with GlassFish 3.1.2.2 and Primefaces 3.4</div>
<div dir="ltr">
One of the most popular posts on eisele blog is the short tutorial about the JDBC Security Realm and form based Authentication on GlassFish with Primefaces. Here we go:</div>
<div dir="ltr">
<a href="http://blog.eisele.net/2013/01/jdbc-realm-glassfish312-primefaces342.html?m=1">http://blog.eisele.net/2013/01/jdbc-realm-glassfish312-primefaces342.html?m=1</a></div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com0tag:blogger.com,1999:blog-2118965999814103235.post-12023278894400517482013-08-23T14:52:00.000+03:002013-08-23T14:52:59.425+03:00Dépôt et développement social par l'auteur, hithub et java.net<div dir="ltr" style="text-align: left;" trbidi="on">
GitHub : <a href="https://github.com/pascalfares">https://github.com/pascalfares</a><br />
Java.net: <a href="https://java.net/people/39136-Pascal-Fares">https://java.net/people/39136-Pascal-Fares</a><br />
<br /></div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com0tag:blogger.com,1999:blog-2118965999814103235.post-45748415730158326952013-05-21T10:51:00.004+03:002013-05-21T10:51:52.921+03:0010 reasons Windows 8 will be painful for developers<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div id="siu-horizontal" style="background-color: white; border: 0px; color: #37414b; font-family: 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; opacity: 0.5; padding: 0px; vertical-align: baseline; visibility: visible; zoom: 1;">
<div class="siu siu-horizontal clear" style="-webkit-box-shadow: rgb(255, 255, 255) 1px -1px 0px inset, rgba(0, 0, 0, 0.0980392) 0px 2px 2px; background-color: #f0f0f0; background-image: -webkit-linear-gradient(top, rgb(255, 255, 255), rgb(245, 245, 245)); border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-color: rgb(235, 235, 235) rgb(235, 235, 235) rgb(215, 215, 215); border-style: solid; border-top-left-radius: 4px; border-top-right-radius: 4px; border-width: 1px; box-shadow: rgb(255, 255, 255) 1px -1px 0px inset, rgba(0, 0, 0, 0.0980392) 0px 2px 2px; font-family: inherit; font-style: inherit; height: 42px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline;">
<div class="grp siu-cmnt-cont" style="-webkit-box-shadow: none; border: 0px; box-shadow: none; float: left; font-family: inherit; font-style: inherit; height: 30px; margin: 0px; padding: 12px 10px 0px; position: relative; vertical-align: baseline; z-index: 4;">
<a class="siu-cmnt" href="http://www.techrepublic.com/blog/10things/10-reasons-windows-8-will-be-painful-for-developers/2885#talkback" style="background-image: url(http://i1.trstatic.com/images/201202/social-media-sprite.png); background-position: -64px 0px; background-repeat: no-repeat no-repeat; border: 0px; color: white; cursor: pointer; display: block; font-family: inherit; font-style: inherit; height: 24px; margin: 0px; outline: none; overflow: hidden; padding: 0px; position: relative; text-decoration: none; text-shadow: rgba(0, 0, 0, 0.2) 0px -1px 0px; vertical-align: baseline; width: 98px; z-index: 0;"><span class="count" style="border: 0px; color: #585857; display: block; font-family: inherit; font-size: 11px; font-style: inherit; font-weight: bold; line-height: 20px; margin: 0px; padding: 0px; position: absolute; right: 1px; text-align: center; text-shadow: rgb(255, 255, 255) 0px 1px 0px; vertical-align: baseline; width: 25px;"><br />73</span><span class="suffix" style="border: 0px; display: block; font-family: inherit; font-size: 10px; font-style: inherit; font-weight: bold; line-height: 20px; margin: 0px; padding: 0px; text-align: center; vertical-align: baseline; width: 65px;"><span style="background-color: white; color: #778596; font-family: inherit; font-size: 0.93em; font-style: inherit; line-height: 1.43em; text-align: left;">By</span><span style="background-color: white; color: #778596; font-family: inherit; font-size: 0.93em; font-style: inherit; line-height: 1.43em; text-align: left;"> </span></span></a><a href="http://www.techrepublic.com/search?a=justin+james" rel="author" style="background-color: white; border: 0px; color: #003399; cursor: pointer; font-family: inherit; font-size: 0.93em; font-style: inherit; line-height: 1.43em; margin: 0px; outline: none; padding: 0px; text-align: left; text-decoration: none; vertical-align: baseline;">Justin James</a></div>
</div>
</div>
<div class="content-1 entry space-1 clear" style="background-color: white; border: 0px; color: #37414b; font-family: 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 19px; margin-bottom: 10px !important; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow: hidden; padding: 0px; vertical-align: baseline;">
<div class="byline space-1 s-11 c-4" style="border: 0px; color: #778596; font-family: inherit; font-size: 0.93em !important; font-style: inherit; line-height: 1.43em; margin-bottom: 10px !important; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding: 0px; vertical-align: baseline;">
<div class="date" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
October 24, 2012, 12:00 AM PDT</div>
</div>
<div class="c-4 space-1 takeaway" style="border: 0px; color: #778596; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
<span class="c-6 heavy" style="border: 0px; color: #8cbd5b; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; padding: 0px; vertical-align: baseline;">Takeaway: </span>If you plan to develop Windows 8 native apps, be prepared for some hurdles. Justin James looks at some of the biggest problems you’re likely to face.</div>
<article><div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
Ever since the release of the Windows 8 Developer Preview, people have had a lot to say about the experience of playing with the new OS. But few folks are talking about the changes it represents for developers. Windows 8 is the biggest update to the Windows development model since the move from Windows 3.X to Windows 95. While there are lots of good things, there are also a lot of pain points. If you are looking to develop <em style="border: 0px; font-family: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">Windows 8 native applications</em> with the new UI and WinRT API, be careful of these 10 things.</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
<em style="border: 0px; font-family: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">Editor’s note: This is an update of the original post, which published in December.</em></div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
1: Market reboot</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
If you want your applications to be fully compatible with Windows 8 (including running on ARM CPUs), you’ll need to do a full rewrite in Windows 8/WinRT. This may be great for developers looking to break into markets with established players. But if you <em style="border: 0px; font-family: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">are</em> the established player, you are suddenly back at square one.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
2: The asynchronous model</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
Windows 8 development is highly dependent upon asynchronous operations for anything that is long running. While that may be a cute trick in some scenarios, it is downright frustrating in others (like trying to download a file). It isn’t just the work needed to handle the async call; it’s things like error handling and reporting problems back to the user. It requires a whole new approach to the UI from what developers (especially WinForms developers) are used to.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
3: Lack of direct disk access</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
Windows 8 cuts off direct access to the system in quite a few ways, but the one that will hurt typical developers the most is the lack of disk access. Windows 8 follows an extreme isolation model for applications, and if your application <em style="border: 0px; font-family: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">requires</em> access to data outside its own confined little world (including networked services you can access), you can forget about porting it to Windows 8.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
4: Touch UI paradigm</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
Unless you have been writing a lot of mobile apps, shifting to the new UI style, which is designed for touch interaction, is going to pretty tough. It took me a long time to get a feel for what works well and what doesn’t. To make things more difficult, what looks and works well on a screen using a mouse and keyboard can be a poor experience with touch, and things that work well with touch often are a struggle to use on the screen. It’s a tricky balancing act, and as the uproar over the new UI in Windows 8 shows, even Microsoft is struggling to get it right despite having had a few years of experience with it.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
5: Playing by Microsoft’s app store rules</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
If you want to be using the Microsoft app store, you will need to learn to play by its rules. While the rules are fairly reasonable, it will be a jarring experience if it is anything like the WP7 App Hub. For starters, Microsoft rigorously inspects the application and looks for all sorts of things, like unhandled exceptions and circular UI paths. Although this ensures a high quality app, it can be a surprise to developers. In addition, you need to work with an approval process. The details of the Microsoft application store are still under wraps, but recent experience with WP7 suggests that it won’t be fun.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
6: Heavy emphasis on cloud</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
While there is no mandate to use the cloud, Web services, and other off-premise techniques and technologies, it is most definitely encouraged. Things like automatic syncing of settings and data between devices (regardless of how it is done) will become the rule, not the exception, and users will be expecting it. Windows 8 makes this easy (you can have your locally saved information synced automatically with Live), but you will want to be judicious about how you do it for sensitive data. Encryption and other privacy and security techniques will become more important than ever.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
7: Shift to “contracts” and “interfaces” for interop</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
One unique aspect of the Windows 8 paradigm is the idea that applications can provide services to the OS (such as acting as a source of contacts or pictures), as opposed to just dumping the data into a common directory. This allows all sorts of sweet application concepts. But even though this is easy at the technical level, it’s difficult to figure out how to leverage at the conceptual level.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
8: Market uncertainty</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
Now we get into the more high-level pains. Microsoft is clearly pushing Windows 8 for tablets and maybe even phones. Right now, we’re seeing Android struggle in the tablet space, and at the same time, the new Windows 8 UI has been heavily panned by people who have tried the preview versions. Will the market adopt Windows 8 or reject it? Will the tablet market for Windows 8 take off? These are all questions that won’t be answered until it is far too late to be a first mover in the market. If you are going to bet on Windows 8, you simply can’t properly assess the risks right now.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
9: Lack of tablet hardware</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
For developers, not having tablets to try Windows 8 on has been a major problem. Yes, we’ve seen some tablets on Web sites, but not in person. Some (like the Lenovo Twist and some of the Samsung slates) resemble current devices enough that you can use what amounts to their predecessors to test. Others (especially the ARM devices) are just too different from existing products to allow a comparison, so you have to wait until October 26 to get an idea of what they are like on real hardware.</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
There has been no good way to get an idea of what the user experience will be like for your applications on those tablets. Not just in terms of the UI either, but of performance. Can the tablet CPUs run your app well? Is it too “chatty” for a device on a cellular connection? Are you using more storage than makes sense for the typical tablet we’ll see? Without a few tablet models easily available, we don’t know the answers here.</div>
<h2 style="border: 0px; font-family: inherit; font-size: 1.43em; font-style: inherit; line-height: 1.23em; margin: 0px 0px 10px; padding: 0px; vertical-align: baseline;">
10: The trail of dead tech</h2>
<div style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
This is the one that really breaks my heart. Microsoft has a history of pushing a technology as “the next big thing” and then leaving it dying on the vine a few years later. We don’t know if Microsoft will back off its Windows 8 strategy before launch, right after launch (Kin), or a few years down the road (Zune, Silverlight). If the new Windows 8 paradigm is not a success, Microsoft may very well change course in a way that renders all your hard work on Windows 8 native applications a waste of time.</div>
<div align="center" style="border: 0px; font-family: inherit; font-style: inherit; margin-bottom: 15px; padding: 0px; vertical-align: baseline;">
<strong><a href="http://www.techrepublic.com/util/newsletter-signup/e042" style="border: 0px; color: #003399; cursor: pointer; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;">Automatically sign up for TechRepublic's 10 Things newsletter!</a></strong></div>
</article></div>
</div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com0tag:blogger.com,1999:blog-2118965999814103235.post-82999012155932528372013-05-13T10:08:00.001+03:002013-05-13T20:06:45.785+03:00Set Apache Password Protected Directories With .htaccess File<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Q. How do I protecting a directory in Apache on linux?</div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
A. There are many ways you can password protect directories under Apache web server. This is important to keep your file privates from both unauthorized users and search engines (when you do not want to get your data indexed). Here you will see the basics of password protecting a directory on your server. You can use any one of the following method:</div>
<ol style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin: 0px 0px 1.571em 1.571em; padding: 0px;">
<li style="margin: 0px; padding: 0px;">Putting authentication directives in a <Directory> section, in your main server configuration httpd.conf file, is the preferred way to implement this kind of authentication.</li>
<li style="margin: 0px; padding: 0px;">If you do not have access to Apache httpd.conf file (for example shared hosting) then with the help of file called .htaccess you can create password protect directories. .htaccess file provide a way to make configuration changes on a per-directory basis.</li>
</ol>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
In order to create apache password protected directories you need:</div>
<ul style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; list-style: square; margin: 0px 0px 1.571em 1.571em; padding: 0px;">
<li style="margin: 0px; padding: 0px;">Password file</li>
<li style="margin: 0px; padding: 0px;">And Directory name which you would like to password protect (/var/www/docs)</li>
</ul>
<h3 style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;">
Step # 1: Make sure Apache is configured to use .htaccess file</h3>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
You need to have AllowOverride AuthConfig directive in httpd.conf file in order for these directives to have any effect. Look for DocumentRoot Directory entry. In this example, our DocumentRoot directory is set to /var/www. Therefore, my entry in httpd.conf looks like as follows:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;"><Directory /var/www>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory></pre>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Save the file and restart Apache<br />
If you are using Red Hat /Fedora Linux:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;"># service httpd restart</pre>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
If you are using Ubuntu Linux:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;"># /etc/init.d/apache2 restart</pre>
<h3 style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;">
Step # 2: Create a password file with htpasswd</h3>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
htpasswd command is used to create and update the flat-files (text file) used to store usernames and password for basic authentication of Apache users. General syntax:<br />
htpasswd -c password-file username</div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Where,</div>
<ul style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; list-style: square; margin: 0px 0px 1.571em 1.571em; padding: 0px;">
<li style="margin: 0px; padding: 0px;">-c : Create the password-file. If password-file already exists, it is rewritten and truncated.</li>
<li style="margin: 0px; padding: 0px;">username : The username to create or update in password-file. If username does not exist in this file, an entry is added. If it does exist, the password is changed.</li>
</ul>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Create directory outside apache document root, so that only Apache can access password file. The password-file should be placed somewhere not accessible from the web. This is so that people cannot download the password file:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;"># mkdir -p /home/secure/</pre>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Add new user called vivek</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;"># htpasswd -c /home/secure/apasswords vivek</pre>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Make sure /home/secure/apasswords file is readable by Apache web server. If Apache cannot read your password file, it will not authenticate you. You need to setup a correct permission using chown command. Usually apache use www-data user. Use the following command to find out Apache username. If you are using Debian/ubuntu Linux use pache2.conf, type the following command:<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># grep -e '^User' /etc/apache2/apache2.conf</code></div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Output:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;">www-data</pre>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Now allow apache user www-data to read our password file:<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># chown www-data:www-data /home/secure/apasswords<br style="margin: 0px; padding: 0px;" /># chmod 0660 /home/secure/apasswords</code></div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
If you are using RedHat and Fedora core, type the following commands :<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># grep -e '^User' /etc/httpd/conf/httpd.conf</code></div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Output:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;">apache</pre>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Now allow apache user apache to read our password file:<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># chown apache:apache /home/secure/apasswords<br style="margin: 0px; padding: 0px;" /># chmod 0660 /home/secure/apasswords</code></div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Now our user vivek is added but you need to configure the Apache web server to request a password and tell the server which users are allowed access. Let us assume you have directory called /var/www/docs and you would like to protect it with a password.</div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Create a directory /var/www/docs if it does not exist:<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># mkdir -p /var/www/docs</code></div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Create .htaccess file using text editor:<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># cd /var/www/docs<br style="margin: 0px; padding: 0px;" /># vi .htaccess</code></div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Add following text:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; color: #111111; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;">AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/secure/apasswords
Require user vivek</pre>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Save file and exit to shell prompt.<br />
<br />
We could use Require user valid-user<br />
<br />
for any defined user</div>
<h3 style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;">
Step # 3: Test your configuration</h3>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
Fire your browser type url http://yourdomain.com/docs/ or http://localhost/docs/ or http://ip-address/docs</div>
<div style="background-color: white; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; line-height: 21.984375px; margin-bottom: 1.571em; padding: 0px;">
</div>
<div style="margin-bottom: 1.571em; padding: 0px;">
When prompted for username and password please supply username vivek and password. You can add following lines to any file <Diretory> entry in httpd.conf file:</div>
<pre style="background-color: #eeeeee; border: 1px solid rgb(221, 221, 221); clear: both; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin-bottom: 1.833em; overflow: auto; padding: 0.667em 0.917em;">AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/secure/apasswords
Require user vivek</pre>
<div style="margin-bottom: 1.571em; padding: 0px;">
To change or setup new user use htpasswd command again.</div>
<h3 style="font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;">
Troubleshooting</h3>
<div style="margin-bottom: 1.571em; padding: 0px;">
If password is not accepted or if you want to troubleshoot authentication related problems, open and see apache access.log/error.log files:</div>
<div style="margin-bottom: 1.571em; padding: 0px;">
Fedora Core/CentOS/RHEL Linux log file location:<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># tail -f /var/log/httpd/access_log<br style="margin: 0px; padding: 0px;" /># tail -f /var/log/httpd/error_log</code><br />
Debian/Ubuntu Linux Apache 2 log file location:<br />
<code style="background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border: 1px solid rgb(221, 221, 221); display: block; font-family: Consolas, 'Andale Mono', Monaco, Courier, 'Courier New', Verdana, sans-serif; font-size: 0.857em; line-height: 1.5em; margin: 0px 0px 1.833em; overflow: auto; padding: 0.667em 0.917em;"># tailf -f /var/log/apache2/access.log<br style="margin: 0px; padding: 0px;" /># tailf -f /var/log/apache2/error.log</code></div>
<h3 style="font-size: 1.286em; font-weight: normal; line-height: 1.222em; margin: 1.833em 0px 0.611em; padding: 0px;">
See also:</h3>
<ul style="list-style: square; margin: 0px 0px 1.571em 1.571em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><a href="http://httpd.apache.org/docs/2.2/howto/htaccess.html" style="color: #2361a1; margin: 0px; padding: 0px;">Apache Tutorial: .htaccess files</a></li>
</ul>
<br /></div>
Pascal Fareshttp://www.blogger.com/profile/04629761420210109115noreply@blogger.com2