RSS icon Articles 31 to 40

Parsley.js and Twitter Bootstrap

By Jimmy Bonney | May 9, 2013

Parsley.js is a (quite) new library allowing to perform Javascript form validation – but without writing any Javascript. Validation is performed through instructions embedded in the DOM, in some data attributes to be more precise.

It comes up with a pretty extensive documentation and allows for easy customization. In this article, we’ll highlight how to use it in combination with Twitter Bootstrap - so that we do not need to write any custom CSS (or let’s say a limited amount depending on what you want to achieve).

Read more...


Link Object and Subject with ACL9 without Database View

By Jimmy Bonney | May 5, 2013

Authentication and authorization are two important aspects of any web application. Users should be able to log into the application (this is where the authentication part kicks in) and then view / update / create resources based on their access rights (this is for the authorization).

There are plenty of gems allowing to implement (more or less) quickly those two concepts in a Rails application. A lot of developments have happened in this field in the last few years and to get an overview of the different tools available, the easiest is probably to look at The Ruby Toolbox in the authentication and authorization sections.

Some time ago, most of the authorization gems allowed to define global roles in an application. This means that a user could be assigned an admin role (for instance) that was valid on all components of the application. This type of behavior works well for a forum for instance – where users either have a role to manage the different posts or not – but this isn’t so convenient in an application where more granularity is needed. In a project base application, users could be assigned a manager role on some projects but a viewer role on others and therefore have local roles (or scoped roles). ACL9 was one of the first gem (as far as I know) to offer such behavior and allow to define granular roles on some resources. The remaining of this post focuses on ACL9 and more precisely on how to link / access resources based on the user role.

Read more...


Launch HTTrack manually in Ubuntu 12.04

By Jimmy Bonney | April 6, 2013

I am using HTTrack from time to time in order to fetch some website that I want to be able to browse while being offline. While it was working properly at the beginning, I got some issues recently. Whether I launch the application from the WebHTTrack Website Copier shortcut in the application menu or from the command line with webhttrack, it seems that the server starts but exits right away. Based on a few readings here and there, it seems that I was not alone having this issue. So if launching webhttrack from the command line only gives you the following answer:

1
2
3
4
5
/usr/bin/webhttrack(21010): launching /usr/bin/x-www-browser
/usr/bin/webhttrack(21010): spawning regular browser..
Created new window in existing browser session.
/usr/bin/webhttrack(21010): browser exited
/usr/bin/webhttrack: line 167: 21029 Killed                  ${BINPATH}/htsserver "${DISTPATH}/" path "${HOME}/websites" lang "${LANGN}" $@

keep reading.

Read more...


Configure VirtualBox Shared Folder as Apache Virtual Host

By Jimmy Bonney | February 27, 2013

As mentioned in the previous article, I am using a virtual machine in order to test locally a small website built with nanoc containing a couple of dynamic PHP pages. We left out with a functional VM running a LAMP stack that was setup with a shared folder between the host and the guest containing the website to test.

In this article, we’ll configure Apache on the VM in order to use this shared folder as the source for a website that can be accessed directly from the host.

Read more...


Minimal LAMP Stack for Website Development

By Jimmy Bonney | February 17, 2013

Recently, I needed to have a LAMP (Linux, Apache, MySQL, PHP) environment in order to test out a few things for a website that was developed using nanoc but included a few dynamic PHP pages. While nanoc is mainly for static website, it is however flexible enough to include dynamic pages if one feels like it. The problem in this case relies in testing those dynamic components.

Even though I am using Linux on a daily basis, I didn’t deem appropriate to install a full LAMP stack just for the purpose of testing out a couple of pages. I therefore looked into some solutions providing a virtual LAMP stack that could then run inside a virtual machine - allowing me to do the development on the host system and test it on the guest one.

Read more...


Install SCP on a Synology NAS (DSM 4.1)

By Jimmy Bonney | January 20, 2013

If you tried to copy file securely (i.e. through the scp command) from or to a Synology NAS drive, you might have been welcomed by the following error message:

1
sh: scp: not found

Well, at least, I did. The message didn’t provide me with much indication about where the issue was coming from, but since scp was installed locally on my computer, this meant that it probably came from the remote host, the Synology drive.

By default, SCP is indeed not installed on Synology NAS drives. Fortunately, we can solve this quite rapidly but since there are a few manipulations to do, I’ll sum them up below.

First off, I assume that ipkg is installed (this is the case if you followed the article Install GMVault on a Synology Nas). If this is not the case, you can quickly do it by following the instructions on the Synology forum.

Read more...


Extract Email Addresses from a Mailbox Hosted on CPanel

By Jimmy Bonney | December 28, 2012

If you are using CPanel default mailboxes, you may have noticed that the contacts from whom you receive emails are not added automatically in your address book on CPanel. This is not a big problem but if you are using a mail application such as Outlook / Thunderbird / Mail / … and collect multiple email addresses in this application, then there is no easy way to extract the contacts that belong to only one of your email addresses.

To better illustrate the situation, let’s assume that you are using a mail application on your computer / tablet that collects your professional (@your-domain.com) and your personal email addresses (for instance @gmail.com or @hotmail.com). Usually such applications will create and maintain an address book for you but unfortunately, most of the time this is a common one that will therefore contain both your professional and personal contacts in one place. If you haven’t edited and sorted your contacts on a regular basis, then you most probably won’t be able to differentiate the professional from the personal contacts. In case you wish to send out some information to your professional network only, this might end up being a tedious work.

Everything is however not completely lost if your professional emails are hosted on a server using CPanel. Provided that all your emails are still on the server, it is possible to extract the email addresses of the different people that you have been in contact with. The following paragraphs will illustrate how to do that.

Read more...


8 "Welcome" Tours for Web Applications

By Jimmy Bonney | December 1, 2012

D-Sight Web is evolving quite fast lately and as we are putting new functionalities in place, we estimated that it was time as well to bring some guidance for the users. As a first step, when new users sign up, we redirect them to a brand new home page listing the different projects that they can work on.

While this view is leaner than what we used to offer, we decided to create as well a Welcome Tour in order to introduce users to this new interface. We will re-use this component throughout the application in the future in order to bring some additional help to the different steps of the decision-making process.

In the following sections of this article, we will cover a few jQuery plugins or pure JavaScript implementation allowing to deploy tours to web application in a quick and easy way.

Read more...


Identify Largest Tables in MySQL Databases

By Jimmy Bonney | November 25, 2012

Last week, as we were migrating to production the new version of our corporate web site, we came to realize that the database used on our dev / QA site had grown more than 20 times the size of the production DB.

Identifying the culprit table was however not that complicated. A simple SQL command allows to get the size of all tables in the DB:

1
SELECT s.schema_name,t.table_name, CONCAT(IFNULL(ROUND(SUM(t.data_length)/1024/1024,2),0.00),"Mb") data_size,CONCAT(IFNULL(ROUND(SUM(t.index_length)/1024/1024,2),0.00),"Mb") index_size, t.ENGINE ENGINE, t.table_rows TABLE_ROWS,t.row_format TABLE_ROW_FORMAT,date(t.update_time) FROM INFORMATION_SCHEMA.SCHEMATA s LEFT JOIN INFORMATION_SCHEMA.TABLES t ON s.schema_name = t.table_schema WHERE s.schema_name not in ("mysql","information_schema") GROUP BY s.schema_name,t.table_name,TABLE_ROW_FORMAT,ENGINE ORDER BY TABLE_ROWS DESC,data_size DESC,index_size DESC;

Read more...


Git Configuration Options

By Jimmy Bonney | November 17, 2012

For the same reason that pushed me to publish my configuration of Sublime Text 2, I will introduce my git configuration file in this article. This will allow me to import it more easily on other systems when I need it (and it might inspire someone else to use (some part of) it as well).

The current configuration (it lies in the ~/.gitconfig file in a Linux environment) can be found below and an up-to-date configuration file is available on this gist:

Read more...