RSS icon Articles 61 to 70

Revert a Single Commit in Subversion

By Jimmy Bonney | June 10, 2012

There are quite a few SVN commands that I do not use so often but that I need every once in a while. One of them is related to reverting a single commit.

If some code has been committed to the repository but you then realize later that those changes should not have been commited for some reason (code breaks some functionalities, tests not running, …), it is possible to execute a reverse merge.

In order to revert a single commit in the working copy, one can simply use the following syntax:

1
svn merge -c -N .

where N is the revision number that needs to be reverted.


Connect to Zoho CRM with Ruby

By Jimmy Bonney | June 3, 2012

At D-Sight, we use Zoho CRM to follow-up on our leads (people who try out D-Sight or D-Sight Web). Being able to integrate Zoho solutions with our products makes it easier for us to focus on important activities, rather than spending time importing contacts manually from our applications.

The problem is that Zoho documentation is rather sparse on technical details about Ruby integration. Quite a lot of things are available for PHP and Java users but for the moment it seems that Ruby is not a top priority. However, Zoho offers a great API and therefore integration with Ruby is not that complicated.

We have therefore created a script that reads in a MySQL database, extracts the latest entries and sends them to Zoho. In case any error occur while sending the data to Zoho, an email containing the entries that could not be added is sent out to the administrator.

Read more...


PHPList Export Unconfirmed Users and Blacklist them

By Jimmy Bonney | November 27, 2011

Before making a new bulk import in PHPList it is important to ensure that the imported users will not override the “unconfirmed” status of existing users. Since PHPList does not offer options to blacklist existing unconfirmed users we will proceed in two steps:

  1. Export unconfirmed users
  2. Blaklist unconfirmed users

Read more...


SVN Commit Working Copy to New Branch

By Jimmy Bonney | October 10, 2011

If you have ever been working on code to realize that you cannot commit the changes that you have made to the original branch you were working in, it might get a bit annoying. Fortunaltely, there is an easy way to commit your code in a new branch (without you losing any data).

In order to do that, you only need to follow three steps:

  1. Create a new branch in which you will commit your changes
  2. Switch your current working copy to this new branch
  3. Commit your changes to the new branch

Read more...


Javascript Autofocus in Form

By Jimmy Bonney | October 3, 2011

When using javascript in Rails in order to fill in forms and remain on the same page, it is nice if after submitting and resetting the form, the focus is set back on the first element of the form. In order to do this, you can simply use the following piece of JS in your file.js.erb:

1
$("input:text:visible:first").focus();

Embed view in Ubercart catalog

By Jimmy Bonney | August 22, 2011

Ubercart comes with a catalog that allows to display the different products in categories. This is a pretty nice and convenient way to browse through the different product families but for the product browsing itself, a list is much more easy to go through. The problem with the catalog list / table default display, is that it doesn’t use Views but rather a default call to the ubercart table display.

Fortunately, Ubercart makes it easy to override this default call. For this, one just needs to define a themable function (theme_uc_catalog_products($products)) in template.php in order to make a call to a predefined view with the function views_embed_view.

Read more...


Add Content to Ubercart Checkout Panes

By Jimmy Bonney | August 16, 2011

While working on the online store of D-Sight, it was necessary to include a link back to the cart when a user is on the checkout page. It is possible to click on the Cancel button but this is a bit counter-intuitive and one might not know whether the cart will remain or whether it will be emptied. Therefore, two options have been considered:

  1. Change the Cancel button label to rename it “Back to cart” for instance
  2. Modify the cart pane in the checkout view to include additional information (such as a “Back to cart” link)

Read more...


Add Metadata to a Drupal Node

By Jimmy Bonney | August 12, 2011

While trying to ensure that a website created in Drupal was correctly verified with Google webmasters tools, I needed to add some metadata to the homepage of the website. Since this was a one shot only operation, it was not necessary to modify the full website template. Instead, in such cases, it can be done quite easily by adding the following bit of PHP code to the body of the home page and to ensure that the input format is set to PHP code.

1
2
3
4
<?php
    $meta = '<meta name="google-site-verification" content="ABCDEFGHWy6OxJzyJkzWGq4Um7FXYZTUVW" />';
    drupal_set_html_head($meta);
?>

The function drupal_set_html_head is fully documented in Drupal API. Put simply, it allows to add code in the head tag of the HTML output.


Getting Code to Display Properly With nanoc and HAML

By Jimmy Bonney | August 12, 2011

When I wrote the article about drupal and metadata, I needed to include some code snippets in order to illustrate what needed to be done. At the time, only nanoc, haml and sass were installed in my environment to generate this website. While I thought that it would be trivial to display code between pre tags, it turned out that I coudn’t get haml to display anything properly - even though I tried pretty much every combination (:preserve, whitespace preservation ~, …) in the haml-lang website.

Read more...


Encrypt Email Address

By Jimmy Bonney | July 9, 2011

An easy way to limit (or fully avoid) spamming is to encrypt the email addresses that appear on your website. In order to do that, services exist and help you convert your email address (or even the complete mailto: link) into hexadecimal entities.

The following two services can be used for such a purpose:

A lot of others services are obviously available and a simple search on Google for “encrypt email” will provide you a lot of results but I have been very happy with those two so far and they have been used with success on D-Sight website as well as on this website.