mediatribe.net -- Drupal et développement web

Using limit and stop sell orders for stocks

by root Il y a 1 year 16 weeks

If it is May 1st and I have $1000 to invest, and after due diligence, I like a stock which sells for $99, I might buy 10 of them at the market price and pay $10 for the commission. Assuming the stock has good volume and I end up getting it for $99, I will end up with stock worth a total of $990. (This technique will not work for stocks which do not have good volume because the actual sale price will be very different from the market price. I am not a sophisticated investor so I stick with stocks with large volume.)

Because of human psychology, I now face two risks:

  • Greed: if my stock rises to, say, $110, I might convince myself to wait just a little longer to make as much money as possible.
  • The sunk cost fallacy: if my stock falls to, say, $90, I might convince myself to hold on because I'd lose too much if I sell.

In both cases, I'd be wrong and that's that's why most investors lose money.

To reduce these risks, once I own the stock, I will immediately decide my target price and tolerance for potential loss; and I would like to place the following orders which are good for 30 days:

  • A sell order of type stop at $90. This will guarantee that I cut my losses and the stock will be sold if it falls below $90.
  • A sell order of type limit at $110. This will insure me against greed and guarantee that the stock will be sold if rises above $110.

Certain brokerages do not allow these so-called "one-cancels-the-other" or "bracket" orders. Scotia iTrade does not allow them, but Questrade seems to. See also this StackExchange thread.

If I check my portfolio every month, then on June 1st one of these scenarios will have played out:

  • The stock has lost value and triggered the sell order of type stop, in which case I'll wind up with $890 after my sell commission.
  • The stock has gained value and triggered the sell order of type limit, in which case I'll wind up with $1090 after my sell commission.
  • The stock hasn't moved too much, in which case I can decide whether to get rid fo the stock in favor of another one, or to keep it. If I keep it, I'll then place two more stop and limit sell orders good for another month.

More about order types can be found on the YouTube video "FRM: Order Types (market, limit, stop, stop-limit)".

( comments, last Il y a 1 year 16 weeks)

Using limit and stop sell orders for stocks

by root Il y a 1 year 16 weeks
If it is May 1st and I have $1000 to invest, and after due diligence, I like a stock which sells for $99, I might buy 10 of them at the market price and pay $10 for the commission. Assuming the stock has good volume and I end up getting it for $99, I will end up with stock worth a total of $990. (This technique will not work for stocks which do not have good volume because the actual sale price... » read more
( comments, last Il y a 1 year 16 weeks)

Échec d'un guichet Desjardins...

by root Il y a 2 years 12 weeks
Ce matin (27 avril 2015 à 8h15) j'ai effectué un retrait de 500$ au Guichet 3024028, le guichet de gauche de la succursale Galt/Wellington à Verdun. Une erreur s'est produite dans le montant, et par hasard c'était à la faveur de le caisse: j'ai l'habitude de compter les pulsations internes du guichet pour m'assurer que le compte est bon. Il l'était, mais en sortant, l'argent est sorti croche, et... » read more
( comments, last Il y a 2 years 12 weeks)

Restoring Mozy backups has been very arduous

by root Il y a 2 years 38 weeks
A computer I am managing was recently stolen. I logged into my Mozy account and tried these restore methods, all of which are an exercise in frustration. I have a very speedy internet connection and have downloaded several HD movies on iTunes and Mac OS Yosemite (a 5Gb download) in a hour or two with no problem. First: Mozy Download Manager Mozy Download Manager (I tried it both on Mac OS... » read more
( comments, last Il y a 2 years 38 weeks)

See my watched issues in Jira

by Albert Il y a 3 years 11 weeks
It took me a while to figure this out. I'm following (watching) issues in Jira and need to see them. If my Jira URL is myjira.example.com, here is the list of watched issues. https://myjira.example.com/issues/?jql=watcher%20%3D%20currentUser() » read more
(16 comments, last Il y a 3 weeks 6 days)

Installed drush with PEAR, where is it?

by Albert Il y a 3 years 13 weeks
If you are on CentOS, look here: cd /usr/share/pear/drush » read more
( comments, last Il y a 3 years 13 weeks)

Restarting MAMP's Apache from the command line

by Albert Il y a 3 years 14 weeks
First thing, you need to have the correct executable in your $PATH: sudo mv /usr/sbin/apachectl /usr/sbin/apachectl-mac sudo ln -s /Applications/MAMP/Library/bin/apachectl /usr/sbin/apachectl Next you need to give yourself access to call `sudo apachectl restart` without having to enter a password: sudo visudo Learn how [vi text editor](http://www.howtogeek.com/102468/a-beginners-guide... » read more
( comments, last Il y a 3 years 14 weeks)

Calculating elapsed time on the command line

by Albert Il y a 3 years 15 weeks
If you want to calculate how much time something takes on the command line: START=$(date +%s) # do your thing echo "$(echo "$(date +%s) - $START"|bc) seconds since start" » read more
( comments, last Il y a 3 years 15 weeks)

Testing Moneris with a sandbox

by Albert Il y a 3 years 17 weeks
I had a hard time finding sandbox APIs for Drupal commerce and moneris, here they are: http://www.corecommerce.com/kb/25211/moneris_canada_e-select_plus_paymen... » read more
( comments, last Il y a 3 years 17 weeks)

MAMP, drush and the command line

by Albert Il y a 3 years 18 weeks
This often happens when you restore from a time machine backup or change computers: your command line utilities are not restored properly. You need access from the command line to mysql to be able to call drush mysqlc, drush updb, for example. First, figure out where your mysql utility is: on my machine it is at /Applications/MAMP/bin/apache2/bin/mysql. There are also many other useful utilities... » read more
( comments, last Il y a 3 years 18 weeks)

Drupal 7: Se connecter avec Facebook et Twitter

by Albert Il y a 3 years 19 weeks
Voici ma technique pour permettre la connection au site via Facebook ou Twitter. Avant de commencer Faites-vous des clé d'application (API) pour Twitter et Facebook, tel que décrit ici. Télécharger les modules Twitter et Facebook Oauth pour Drupal. Activer twitter_signin et fboauth. Twitter Sur admin/reports/status, vous verrez qu'il manque les clés de l'application Twitter. Pour les... » read more
(1 comments, last Il y a 2 years 45 weeks)

Comment se faire des clés API Facebook et Twitter

by Albert Il y a 3 years 19 weeks
Voici comment se faire des clés API Facebook et Twitter. Vous en aurez besoin pour utiliser les services de connexion à votre site via ces comptes. Pour cet exemple, disons que vous développez un site "Outils AAA" et que votre environnement de développement est http://outils.local/ Connectez-vous sur votre compte Twitter Aller au https://apps.twitter.com/app/new Name: mettez un nom unique, par... » read more
(1 comments, last Il y a 1 year 50 weeks)

Easily find backlinks to your website

by Albert Il y a 3 years 30 weeks
You can use the the search at http://www.opensiteexplorer.org to find out who is talking about your website » read more
( comments, last Il y a 3 years 30 weeks)

Disabling a module directly in the Drupal database

by Albert Il y a 3 years 30 weeks
Here is how to disable a module directly in the Drupal database echo "UPDATE system SET status = 0 WHERE name = 'MODULENAME';" | drush sqlc » read more
( comments, last Il y a 3 years 30 weeks)

MAMP, drush and the command line: beware upgrades

by Albert Il y a 3 years 31 weeks
If you are using MAMP, you will need to create a symlink for /usr/bin/php and /usr/bin/mysql to MAMP's executable, something like this: ls -lah /usr/bin | grep sql lrwxr-xr-x 1 root wheel 26B 26 Mar 2012 mysql -> /usr/local/mysql/bin/mysql ... sudo mv /usr/bin/mysql mysql-mac sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/bin/mysql sudo mv /usr/bin/php php-mac sudo ln -s /... » read more
( comments, last Il y a 3 years 31 weeks)

Git: Moving a to new branch, tracking a remote branch

by Albert Il y a 3 years 32 weeks
Let's say you only have one local branch, master, which, and you want to create a new local branch, stage, to track the stage branch which exists remotely on the origin, you'll want to be careful how to create your new branch. This way is correct: git checkout -b stage origin/stage Whereas the following is incorrect, because you will wind up a stage branch integrating with whatever changes you... » read more
( comments, last Il y a 3 years 32 weeks)

Jenkins: Could not checkout null with start point

by Albert Il y a 3 years 32 weeks
I got this problem all of a sudden with three projects: I push commit 123456 to master Jenkins gives me this error: Checking out Revision 123456 (origin/master) FATAL: Could not checkout null with start point 123456 For each project I logged into the jenkins server sudo su jenkins cd /var/lib/jenkins/workspace/myproject git status # Not currently on any branch. nothing to commit (working... » read more
(1 comments, last Il y a 2 years 10 weeks)

Écrire des tests automatisés pour Wordpress

by Albert Il y a 3 years 32 weeks
Nous tentons dans mon agence d'implémenter des tests automatisés pour plusieurs technologies avec lesquelles nous travaillons. Pour Drupal, la méthode que nous avons mise en place est documentée sur le site Dcycle. Pour Wordpress, je me suis basé sur cette méthode pour donner la procédure suivante. Étant un développeur Drupal, le monde du Wordpress m'est à peu près inconnu, alors si quelque... » read more
( comments, last Il y a 3 years 32 weeks)

Adding postal codes for Canada to Drupal location module

by Albert Il y a 3 years 33 weeks
The Drupal location module does not ship with Canadian postal codes. I've recently had to fix this on two Drupal 6 sites, here is how: wget http://www.freeformsolutions.ca/en/sites/mediatribe.net/files/downloads/zipcodes.ca.mysql.zip unzip zipcodes.ca.mysql.zip drush sqlc < zipcodes.ca.mysql #### takes 10 minutes!!! rm zipcodes.ca.* » read more
( comments, last Il y a 3 years 33 weeks)

Procédure pour ajouter un site Drupal à Jenkins

by Albert Il y a 3 years 33 weeks
Voici ma procédure pour ajouter un projet Drupal à Jenkins (1) Assurez-vous d'avoir une version locale du site sur Git. (2) Allez sur votre instance de Jenkins et ajouter un projet de type "free-style software project" pour ce site. (3) Dans description mettre "Teste la branche master et la met sur URL", où "URL" est un URL propre à Jenkins, selon votre nomenclature, par exemple monsite.... » read more
( comments, last Il y a 3 years 33 weeks)

DocumentRoot does not exist when it does?

by Albert Il y a 3 years 33 weeks
When restarting Apache, if you get "DocumentRoot does not exist", but your document root does exist, and you have read access to it, try this: setenforce 0sudo apachectl restart I have no idea what this is, but it worked for me! » read more
( comments, last Il y a 3 years 33 weeks)

Simpletest hanging? Try the error log

by Albert Il y a 3 years 35 weeks
Once in a while you'll get a simpletest just hang when you run it in the GUI. Here is one thing which may help you: Go to sites/mediatribe.net/files/files/simpletest/[test run number]/error.log In there you might find some indication about what the problem, for example a PHP error in the test itself. » read more
( comments, last Il y a 3 years 35 weeks)

Drupal: Cloner une BD externe sur votre ordi

by Albert Il y a 3 years 36 weeks
Si vous voulez travailler sur une version locale d'un site web, faites ce qui suit: git clone [chemin-git]cd [répertoire]echo 'create database [dbname]' | mysql -u[user] -p[pass]drush si --db-url=mysql://[user]:[pass]@localhost/[dbname] --account-name=root --account-pass=rootssh moi@example.com "drush -r /chemin/vers/drupal sql-dump" > db.sqldrush sqlc < db.sql » read more
(3 comments, last Il y a 3 years 36 weeks)

scp and rsync: command not found with remote Centos 6

by Albert Il y a 3 years 36 weeks
I was trying to scp and rsync from a Mac into a brand-new CentOS VM, and was getting this error, even after installing rsync and scp on my remote machine with yum install openssh-clients and yum install rsync: scp root@example.com:~/whatever.txt ~/scp: command not found Same problem with rsync. It turns out scp and rsync are expected to be on the remote machine at /usr/sbin but are at /usr/bin by... » read more
(1 comments, last Il y a 15 weeks 21 hours)

htaccess: redirecting one path to another

by Albert Il y a 3 years 37 weeks
I want to type example.com/source and be redirected to example.com/destination. This can be achieved by adding the following rewrite rule to .htaccess, provided rewrite engine is available and activated: RewriteRule ^source$ /destination [L,R=301] » read more
( comments, last Il y a 3 years 37 weeks)

Where is ImageMagick on Mac OS X

by Albert Il y a 3 years 37 weeks
The standard installer of ImageMagick did not add the binaries to my $PATH. For exapmle, I was looking for the compare utility. Here it is: /opt/ImageMagick/bin/compare » read more
( comments, last Il y a 3 years 37 weeks)

Drupal site hanging due to semaphore table

by Albert Il y a 3 years 37 weeks
I recently had to debug a problem on a production site, so I cloned it to my local computer. Now, the site was just hanging (loading forever). Here's how I fixed the problem: - I first eabled xdebug on my local site. - Next I installed Webgrind. - Now I visited the hanging page and add ?XDEBUG_PROFILE=1 to the end of the URL - Webgrind informed me that lock_wait() was being called repeatedly.... » read more
(4 comments, last Il y a 44 weeks 5 days)

Enabling xdebug on MAMP

by Albert Il y a 3 years 38 weeks
Add the following to the end of you php.ini file in MAMP [xdebug] zend_extension="/Applications/MAMP/bin/php/php5.3.14/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so" xdebug.remote_enable=1 xdebug.profiler_enable_trigger=1 xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.remote_handler=dbgp » read more
( comments, last Il y a 3 years 38 weeks)

Views development: add your handlers to the .info file to avoid missing/broken handler

by Albert Il y a 3 years 38 weeks
I just lost 30 minutes on this one: for all you novice views developers (like me): creating a new handler requires you to add its file to your module's .info file, or else you'll get a missing/broken handler problem. » read more
( comments, last Il y a 3 years 38 weeks)

Skitch annoying you with Evernote password, sharing? Revert to an older version

by Albert Il y a 3 years 39 weeks
Skitch is a great screen-capture tool for mac, which allows you to annotate your captures. The newer version of Skitch (> 2) seems to require an Evernote account. I don't know what Evernote is, I don't want an account, and I don't want to be reminded that my "password expired". My solution has been to download the latest 1.x version of Skitch from http://www.oldapps.com/mac/skitch_for_mac.php?... » read more
( comments, last Il y a 3 years 39 weeks)

Git: specifying a directory without being in it

by Albert Il y a 3 years 40 weeks
In case you don't want to cd into a directory, you can still target it with git. See also http://stackoverflow.com/questions/1386291. Here is an example: mkdir testcd testgit initInitialized empty Git repository in /path/to/test/.git/touch test.txtgit add .git commit -am 'initial'[master (root-commit) d0505e5] initial 0 files changed create mode 100644 test.txtcd ..pwd/path/togit --git-... » read more
(1 comments, last Il y a 3 years 40 weeks)

SSH key authentication permission scheme

by Albert Il y a 3 years 40 weeks
SSH key authentication will not work unless your files, on your server, have the following permission scheme: ls -lah ~/.sshdrwx------  2 root root 4.0K Oct  2 11:39 .-rw-r-----  1 root root  17K Oct  2 11:39 authorized_keys... » read more
( comments, last Il y a 3 years 40 weeks)

Find out where the site is on the server

by Albert Il y a 3 years 40 weeks
So you have a site example.com, you know is hosted on the server somewhere, but your server structure is a mess. In some cases you can find your filepath by typing: grep -r 'example' /etc/httpd/conf.d/ » read more
( comments, last Il y a 3 years 40 weeks)

Exit parent process with the code of the child process on Mac OS X

by Albert Il y a 3 years 43 weeks
Sometimes you want the parent process to exit with the child process's code. In the example below, whatever is in parentheses is child code. For example, calling exit 1 directly exists the process, but calling (exit 1) does not exit the process. (exit 1)#parent still running(exit 0)#parent still running(exit 1)#parent still running[ $? = 0 ] || exit $?# exit parent with exit code of child process... » read more
( comments, last Il y a 3 years 43 weeks)

Drupal: Use module_load_include(), not require_once. Here is why

by Albert Il y a 3 years 43 weeks
In Drupal 7, say you are in the module xyz and you want to include xyz.admin.inc., you should always use <?phpmodule_load_include('inc', 'xyz', 'xyz.admin');?> and not: <?phprequire_once dirname(__FILE__) . '/xyz.admin.inc';?> Here is a typical scenario where this breaks your site completely: Say you start a project by downloading a bunch of modules to sites/all/modules. Eventually,... » read more
(2 comments, last Il y a 3 years 9 weeks)

How to grab a local copy of a remote Wordpress database

by Albert Il y a 3 years 44 weeks
(1) Log on to the remote server and visit wp-config.php, take note of the database, username and password. (2) Make sure you have the same code locally (except wp-config.php, which is probably excluded from your version control repo), and run the following: ssh me@example.com "mysqldump -uuser -ppassword databasename --default-character-set=utf8" > database.sqlecho 'create... » read more
(1 comments, last Il y a 1 year 10 weeks)

Snippet of code to test image uploading in simpletests

by Albert Il y a 3 years 45 weeks
I can't get this in my head, so here it is: how to test that a module can upload images. Add this in your Drupal Simpletest: <?php$image = current($this->drupalGetTestFiles('image'));return drupal_realpath($image->uri);?> » read more
( comments, last Il y a 3 years 45 weeks)

J'aimerais changer mot mot de passe Drupal, comment faire

by Albert Il y a 3 years 46 weeks
L'exemple suivant utilise example.com comme domaine. 1. assurez-vous de ne pas être connectés au site (aller sur http://example.com/user/logout, en vous assurant de mettre votre domaine à la place de example.com) 2. aller sur http://example.com/user/password, en vous assurant de mettre votre domaine à la place de example.com 3. mettre votre nom d'utilisateur ou votre adresse courriel 4. attendre... » read more
( comments, last Il y a 3 years 46 weeks)

nicely formatted multilingual dates

by Albert Il y a 3 years 51 weeks
Here is a code snippet which allows nicely formatted multilingual dates <?php/** * Generate some nicely formatted dates depending on the current lang */function MYMODULE_format_date($timestamp, $lang = NULL) {  if (!$lang) {    global $language;    $lang = $language->language;  }  $extra = '';  switch ($lang) {    case 'fr':... » read more
( comments, last Il y a 3 years 51 weeks)

Running Drupal simpletests from the command line and the "Could not upload file" problem

by Albert Il y a 4 years 2 weeks
I am using Simpletests for my site which check for file upload functionality. The problem is that uploading files requires sites/*/files to be owned by the web user (www in my case). When running simpletests, files are uploaded to a temporary directory sites/*/files/simpletest/*, which also needs to be owned by the web user (www). When running your tests via the command line (in my case with the... » read more
( comments, last Il y a 4 years 2 weeks)

Limiting the execution time of a command line on Mac OS X

by Albert Il y a 4 years 5 weeks
Unfortunately the "timeout" command does not exist on mac OS X. (sleep 2;echo 'done')  & sleep 1; kill $! 2> /dev/null || : will not display "done" because the first command executed in more than 1 second. (sleep 2;echo 'done')  & sleep 3; kill $! 2> /dev/null || : will not display "done" because the first command executed in less than 3 second. Walking... » read more
(1 comments, last Il y a 4 years 3 weeks)

Linux: moving to the parent of a command file

by Albert Il y a 4 years 7 weeks
Say you want to cd into the parent directory of the command file xyz, you can type: cd $(which xyz | xargs dirname) » read more
( comments, last Il y a 4 years 7 weeks)

Mozy credit card change annoyance

by Albert Il y a 4 years 21 weeks
My credit card having been changed, Mozy contacted me to change the card on file, which I did. A few days later I get an "account suspended" message, so I changed it again. Now the home screen is giving me two contradictory messages, as you can see in the enclosed screenshot. Contacting customer support yields yet more annoyances: opening a support ticket, it is impossible to add file attachments... » read more
(2 comments, last Il y a 3 years 16 weeks)

Drupal 7: Absolute path to file URI or file object

by Albert Il y a 4 years 21 weeks
Say you have a file in one of your modules for which you need a file object, the trick is to _copy_ it to the public filesystem, and then use it. For example, say we need to import the french translation of MYMODULE during an update, we can use the following code: <?php$file = file_save_data(file_get_contents(realpath(drupal_get_path('module', 'MYMODULE') . '/translations/fr.po')), 'public://... » read more
( comments, last Il y a 4 years 21 weeks)

In PHP, getting the calling function

by Albert Il y a 4 years 24 weeks
In PHP, if you want to know the function that called whatever function you are currently in, you can define something like: <?php/** * Returns the calling function through a backtrace */function get_calling_function() {  // a funciton x has called a function y which called this  // see stackoverflow.com/questions/190421  $caller = debug_backtrace();  $caller = $caller[2];... » read more
(1 comments, last Il y a 3 years 9 weeks)

Where is the JDK directory on Mac OS X

by Albert Il y a 4 years 25 weeks
If you are installing Jenkins on Mac OS X, JDK is already installing (trying to install it automatically won't work). Its home directory is "/Library/Java/Home". » read more
( comments, last Il y a 4 years 25 weeks)

Comment gérer vos chemins sur un site Drupal

by Albert Il y a 4 years 36 weeks
À penser: - Quels chemins on veut pour différents contenus - Que se passe-t-il si un visiteur retire une partie d'un chemin (par exemple, il tombe sur k.o/nouvelles/2010/08/02/x-y-z, et il efface tout après 08, y a-t-il une vue ou page à prévoir ou le visiteur tombe-t-il sur une "page non trouvée") - Liens permanents (genre k.o/nouvelles/2010/08/02/x-y-z) vs. temporaires (k.o/yxz) -- dans ce cas... » read more
( comments, last Il y a 4 years 36 weeks)

Finding a script on Mac OS X

by Albert Il y a 4 years 47 weeks
To find a script on Mac OS X - which xyz will find the actual location of the script which would run. - whereis xyz will find the standard location See also this post. » read more
( comments, last Il y a 4 years 47 weeks)

Automatic testing for your Drupal update and upgrade paths

by Albert Il y a 4 years 51 weeks
Introduction Simpletest is great for unit and functional tests for your Drupal modules; you can also use Simpletest to automatically test your module updates and upgrade path. The process is similar in Drupal 7 and Drupal 8, and this article will show you how to do it, and include some simple example modules. Terminology First, some terminology: updates of your module remains within the same... » read more
( comments, last Il y a 4 years 51 weeks)

Creating and applying a Drupal patch with binary files

by Albert Il y a 4 years 51 weeks
I am normally in the habit of creating my patches with the commands "git diff 123456 abcdef > patch.patch" (where 123456 and abcdef are commits); and applying the patch with "patch -p1 < patch.patch". This works fine unless you have binary files. For example, for this issue I needed to include a new .gz file in my patch, and the above technique was causing a fail. To create and apply... » read more
(2 comments, last Il y a 2 years 24 weeks)

Using conditional stylesheets (IE) with Omega

by Albert Il y a 5 years 4 weeks
As described here, conditional_styles does not work with Omega for Drupal. Here's what to add in your template.php file for this to work: <?phpfunction YOUR_THEME_NAME_preprocess_html(&$variables) {    // Add conditional stylesheets for IE  drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' =... » read more
( comments, last Il y a 5 years 4 weeks)

Drush, Drupal 8, MAMP, and the magic_quotes_gpc problems

by Albert Il y a 5 years 6 weeks
The latest version of Drush gives me this error, but only with Drupal 8 sites: PHP's 'magic_quotes_gpc' and 'magic_quotes_runtime' settings are not supported and must be disabled.Drush command terminated abnormally due to an unrecoverable error.          I'm using MAMP, so I turned all magic quote related stuff off in /... » read more
(3 comments, last Il y a 4 years 46 weeks)

Créer un newsletter HTML avec le feature dCycle Generate HTML Newsletter et simplenews

by Albert Il y a 5 years 7 weeks
Les liens suivants utilisent le domaine example.com. Il faut installer le module https://github.com/alberto56/generatecivihtml sur votre site et changer les liens example.com par votre propre nom de domaine. Pour créer un newsletter avec dCycle Generate HTML Newsletter: aller créer un nouveau newsletter issue. Choisir le gabarit qui vous convient. (vous pouvez créer de nouveaux gabarits ici)... » read more
( comments, last Il y a 5 years 7 weeks)

Sending HTML emails using simplenews on Drupal 6

by Albert Il y a 5 years 7 weeks
- download and enable simplenews and mimemail - admin/settings/simplenews/newsletter: set format to HTML and save - go to node/add/simplenews, and make sure Wysiwyg is disabled (click on Deactivate rich text, for example) - paste full HTML in the body section, and send your email. (Actually creating good HTML is outside the scope of this tutorial!) - you might have to run cron on your site for... » read more
(2 comments, last Il y a 3 years 24 weeks)

Setting up per-forum search on Drupal 6

by Albert Il y a 5 years 7 weeks
Install advanced_forum 6.x-2.x and nodecomment 6.x-2.x. Enable advanced_comment, nodecomment and core search module. (nodecomment might take a few minutes to be enabled, depending on the number of nodes on your site. You might also have an out of memory error while enabling the module, just ignore it). Run cron on your site If you have a non-English site, go to admin/build/translate/search, and... » read more
( comments, last Il y a 5 years 7 weeks)

Using more than one SSH private key

by Albert Il y a 5 years 8 weeks
Say you have your regular SSH public-private key pair for most of what you do, and you need to have another SSH public-private key pair for specific servers (this doesn't happen often, but there are some edge cases where there is no easy alternative). start by creating a new directory in your home folder, called .ssh-whatever, and put your public private key pair (or just your private key, that... » read more
( comments, last Il y a 5 years 8 weeks)

Selenium: testing Javascript with Simpletest on Drupal 7

by Albert Il y a 5 years 11 weeks
Prerequisites To get the best of this tutorial, it is best to know a bit about Simpletest, Drupal 7, the command line, and applying patches. Chrome and Firefox should be installed on your computer. I tested this on Mac OS but it should work on Linux. Going through it all might take you about an hour. You should do all of it on your laptop (using MAMP or Quickstart, rather than a remote server --... » read more
(3 comments, last Il y a 3 years 23 weeks)

Enabling a theme in D7 and setting it to default

by Albert Il y a 5 years 11 weeks
I normally will do this in the install hook of my site's main feature when using dCycle <?php  theme_enable(array('mytheme'));  variable_set('theme_default', 'mytheme');?> » read more
( comments, last Il y a 5 years 11 weeks)

Using prepopulate on Drupal 7's contact form

by Albert Il y a 5 years 11 weeks
Say I have several categories in my Drupal contact form, and I'd like to create a link to the contact form, but with one of those categories preselected, and, while I'm at, prepopulate the subject and message fields, here's how I go about it. (1) install and enable the prepopulate module. (2) Figure out which category (recipient) you want to preselect by finding its ID on the page example.com/... » read more
( comments, last Il y a 5 years 11 weeks)

Installing / debugging MAMP on Mac OS X

by Albert Il y a 5 years 16 weeks
MAMP is a local server with MySql and PHP on your Mac. It is great to run local copies of Drupal, Wordpress, etc. on your computer. Here's how to install it. I reinstall MAMP every time I update Mac OS X (say, from 10.6.6 to 10.6.7). The reason is that updating Mac OS X results in MySQL Server refusing to start (i.e. I get the red light next the Mamp Server), and after hours of searching, I can'... » read more
( comments, last Il y a 5 years 16 weeks)

Using Mac OS to make an iPhone 3G work like an iPod Touch

by Albert Il y a 5 years 19 weeks
Here's how I got an iPhone 3G I inherited from my sister to work like an iPod Touch. (So much for Apple's legendary ease of use -- this took me an hour to set up.) Note that I don't care about the phone, speed, features, lost data, or having the latest version. I just want to access the internet with wifi. 1. Put any SIM card in your iPhone and connect the iPhone to your Mac. 2. Download... » read more
( comments, last Il y a 5 years 19 weeks)

mysql server gone away, Drupal 6 and MAMP

by Albert Il y a 5 years 21 weeks
In my experience, the problem is always too many cck fields. Here's how to fix this: (1) open /Applications/MAMP/bin/startMysql.sh with your favorite text editor (2) put "--max_allowed_packet=16M " before the trailing & (3) restart MAMP Troubleshooting. If your mysql server won't start try this: - make sure there are no newlines in your startMysql.sh file - sudo chgrp admin /Applications/MAMP... » read more
(1 comments, last Il y a 5 years 4 weeks)

For Drupal/dcycle theme developers: pulling new changes to a site

by Albert Il y a 5 years 41 weeks
If you are theming a Drupal 7 site using the dCycle workflow, and a colleague has updated features (for example, added a new view, content type, etc.), here's how to theme it: In terminal, navigate to your sites/*/modules folder for your site: for example cd /path/to/your/drupal/site/sites/mediatribe.net/modules Check git status. If your directory is not clean, commit your latest changes, for... » read more
( comments, last Il y a 5 years 41 weeks)

Drupal 7 Simpletest: in your tests, creating users with specifc roles

by Albert Il y a 5 years 41 weeks
When creating automated tests in Drupal 7, you can use $this->drupalCreateUser() to create a user with specific permissions, but what if you want to create a user with a specific role? Here's how to set up a user with the role "administrator", for example within your setUp() method: <?php    // create a new user with some permissions you need; then log in.    $... » read more
(6 comments, last Il y a 36 weeks 23 hours)

Dev-stage-prod in Drupal: a formalized workflow

by Albert Il y a 5 years 44 weeks
Tired of dealing with many disparate dev-stage-prod workflows, I have gathered all my best practices into dCycle. » read more
( comments, last Il y a 5 years 44 weeks)

Drupal 6: Two menu items pointing to the same page with features

by Albert Il y a 5 years 48 weeks
The Drupal features module does not, for the moment, allow you to export two menu items with the same path. This is a problem if you have a menu structure like this, which is quite common: Resources: path "resources/one" One: path "resources/one" Two: path "resources/two" Now, we don't want to have a Resources page. Rather, we would like the top "resources" menu item to lead to "reasources/... » read more
( comments, last Il y a 5 years 48 weeks)

Definitive Guide to Drupal 7 Launched!

by Albert Il y a 5 years 49 weeks
The Definitive Guide to Drupal 7 has finally been launched. At over 1100 pages, this book contains all necessary information to use Drupal 7 to its full potential. Thirty authors contributed included Koumbit's own Albert Albala with a chapter on automated testing. » read more
(7 comments, last Il y a 1 year 27 weeks)

Lancement du Definitive Guide to Drupal 7 !

by root Il y a 5 years 49 weeks
Le Definitive Guide to Drupal 7, a finalement été lancé. Avec plus de 1100, ce livre contient toute l'information nécessaire pour bien utiliser Drupal 7. Trente auteurs ont collaboré à ce livre, dont le koumbitien Albert Albala avec un chapitre sur les tests automatisés. » read more
(2 comments, last Il y a 5 years 49 weeks)

Installing a wyiswyg editor on Drupal 6 and 7

by Albert Il y a 5 years 49 weeks
Installing a wysiwyg editor is a convoluted process with numerous obstacles. Here is my step-by-step procedure for Drupal 6 and for Drupal 7. » read more
(2 comments, last Il y a 5 years 48 weeks)

Drupal on a virtual host in MAMP on Mac OS X

by Albert Il y a 5 years 50 weeks
When you install MAMP, localhost points to your htdocs folder. I install multiple sites in there, so that localhost/example, for example, is a Drupal site. The thing is, certain irritating things happen when Drupal is running in a subdirectory, so I would rather have my Drupal sites run on, for example, example.local. Here's how that's done: == Before you start == Make a backup of your /etc/... » read more
(2 comments, last Il y a 4 years 12 weeks)

Adding a user to a group in Mac OS X

by root Il y a 5 years 50 weeks
Here is how to add your user, say, albert, to the group wheel in Mac OS X Snow Leopard: sudo dscl . append /Groups/admin GroupMembership albert » read more
( comments, last Il y a 5 years 50 weeks)

Using hook_update_n() for to update your Drupal website database

by Albert Il y a 6 years 7 weeks
Note that this article applies primarily to Drupal 6. When developing features or other modules, I often find myself making changes to the module dependencies or other aspects after my module has first been moved to the staging site. I use hook_update_N() for that. Here's how. Initial install hook Features normally don't do anything to the database, so typically we won't have an implementation of... » read more
(3 comments, last Il y a 4 years 27 weeks)

Call to undefined function image_gd_check_settings()

by root Il y a 6 years 10 weeks
Getting Fatal error: Call to undefined function image_gd_check_settings() in ... This was after I migrated a Drupal site to Aegir. The solution is to visit this page: admin/settings/image-toolkit and click save. See also http://drupal.org/node/295854 » read more
(2 comments, last Il y a 3 years 42 weeks)

Theme-specific image styles (equivelent of imagecache) in Drupal 7

by Albert Il y a 6 years 14 weeks
(EDIT: 28 oct. 2011, changed the Drupal 7 version to reflect changes in the 7.9 implementation -- updated solution should work for all versions of D7, see also this issue) Image styles in Drupal 7 are the equivalent of Imagecache presets in Drupal 6: definitions of a namespace with one or more effects for images. For example, a "thumbnail" image might be 150 pixel-wide version of your image.... » read more
(6 comments, last Il y a 4 years 30 weeks)

Styles d'images (equivalent de imagecache) spécifiques au thème dans Drupal 7

by Albert Il y a 6 years 14 weeks
Les styles d'image (image styles) sont à Drupal 7 ce que les préréglages imagecache sont à Drupal 6: une définition de comment une image doit apparaître. Par exemple, une "vignette" (thumbnail) pourrait être une image de 150 pixels de large. Ces préréglages peuvent ensuite être utilisés par les vues, les nodes, etc. Cepedant, différents thèmes peuvent avoir différentes conceptions de ce qu'est... » read more
( comments, last Il y a 6 years 14 weeks)

Building a javascript-based browser map with views for Drupal 6

by Albert Il y a 6 years 24 weeks
Recently for a projet I needed to build a javascript-based browsing mechanism for alternatives.ca. You can see the result at http://alternatives.ca/projets. I'll try to describe how this was done. It takes about two hours to set this up properly. Compatibility: IE7 and above. The basic idea I categorized my content with taxonomy, then created a view with exposed filters, enabled ajax in the view... » read more
(4 comments, last Il y a 5 years 27 weeks)

Finding files by name in Linux

by Albert Il y a 6 years 27 weeks
One way of searching for a file containing "abc" through a file system without annoying "Permission denied" messages: find . -name '*abc*' 2>/dev/null » read more
( comments, last Il y a 6 years 27 weeks)

Using aliases to navigate the command line

by Albert Il y a 6 years 27 weeks
I need to have access to several ssh servers, and several paths throughout my working day. I'm a very unsophisticated command line user, so for others out there who would like to tame the command line, here's a trick: vi ~/.bash_profile Add, at the very end alias go-whatever='cd /path/to/whatever'alias go-client='ssh me@client.com'#etc. Then, to make aliases permanent source... » read more
( comments, last Il y a 6 years 27 weeks)

Moving WMVs from Vista to a mac for video editing.

by Albert Il y a 6 years 36 weeks
I have a FireWire camcorder, a Vista machine with FireWire; and Mac OS X 10.6 machine sans FireWire with Final Cut Express video editing software. This technique takes about 10 hours of processing and transfer time for each hour of footage Here's how I go about transferring my movies for editing: (1) Download wmv2avi.exe http://www.freewarezoom.com/archives/free-wmv-to-avi-mpeg-converter to... » read more
(1 comments, last Il y a 6 years 25 weeks)

Sharing between Mac OS X Snow Loepard and Windows Vista

by Albert Il y a 6 years 36 weeks
Found a great resource which will have this set up in a few minutes. Just deactivate your Vista firewall before sharing and reactivate it after. http://www.youtube.com/v/w4chH8hrs6A?fs=1&hl=en_US » read more
( comments, last Il y a 6 years 36 weeks)

Installing Gobby 0.5 on Mac OS (via Ubuntu on VirtualBox)

by Albert Il y a 6 years 39 weeks
Gobby is a tool which allows teams to edit the same document simultaneously in real time. We use it at Koumbit during some meetings; and when we quickly need to produce a document without going through the normal revision procedures. As of this writing Gobby 0.5 is not available directly on mac OS X (The MacPorts installation guide here gives me Gobby 0.4, which is incompatible with Gobby 0.5).... » read more
( comments, last Il y a 6 years 39 weeks)

How to scan with the lexmark X5495 on Mac OS X 10.6.8

by Albert Il y a 6 years 41 weeks
Update: 9 Oct 2011. Made some slight changes, still works though. I've just spent an hour on the phone with Lexmark because my mom wanted me to scan something on my Lexmark X5495 scanner. This is the second time in two month that I have to call Lexmark in order to get my scanner to work. I'm documenting the solution here -- it worked for me. These steps assume you have already set up your printer... » read more
(2 comments, last Il y a 4 years 21 weeks)

A hosting platform -- the end of an experiment

by Albert Il y a 6 years 42 weeks
Aegir, Drupal—Last year we launched a beta version of Qumbia, a platform for creating Drupal sites easily. Today we are definitely shutting it down. I'll attempt to explain how it worked, why we're shutting it down, and what will replace it. Here's how it worked: one "master" site, with all the basic functionalities you'd want in a basic website (wysiwyg editing, captcha, blog, events, store etc.) was kept up... » read more
( comments, last Il y a 6 years 42 weeks)

Converting a word doc to pdf

by Albert Il y a 6 years 44 weeks
I recently got a 2Mb word document I had to convert to PDF to put online. For some reason, on Mac OS X: OpenOffice (through the print... dialog) generated a 64Mb document Acrobat (through extreme space saving meaures) generated a 24Mb document OpenOffice (through export... > Adobe PDF > smallest file size) generated a whopping 160Mb document Google Docs couldn't read by word doc at all (it... » read more
(2 comments, last Il y a 6 years 27 weeks)

Displaying the total number of rows in a view

by Albert Il y a 7 years 3 weeks
Drupal—Put a pager, make sure your items to display is not set to unlimited, and put this in your header or footer: <?php $view = views_get_current_view();print $view->total_rows . ' ' . t('items in this category'); ?> » read more
( comments, last Il y a 7 years 3 weeks)

how to upgrade a module to drupal 7

by Albert Il y a 7 years 3 weeks
drupal development—Here are some step-by-step instructions on how I upgrade modules from d6 to d7: drush dl coder drush dl grammar_parser drush en coder_upgrade put the latest 6.x version of the module into sites/mediatribe.net/files/coder_upgrade/old go to admin/config/development/coder/upgrade click the checkbox next to the name of the module you are upgrading to d7 click convert files make sure there are no... » read more
(1 comments, last Il y a 3 years 11 weeks)

Adding content (text and images) to a Drupal site via email

by Albert Il y a 7 years 5 weeks
Drupal—In my experience, there are several users who don't feel comfortable using the standard Drupal interface to create content on their website. I've noticed that this is the case with reforestation.net, I site I manage: even though I provide users with accounts and training, almost all users end up sending me their content (including images and text) via email, and I have to upload it myself to the... » read more
(4 comments, last Il y a 4 years 6 days)

Creating actions for use with views bulk operations

by Albert Il y a 7 years 10 weeks
Drupal—You can combine Views bulk operations with your own code to make powerful actions which can be applied to several nodes at the time. Here is some sample code to create an action:   /* describe your action(s) */function mymodule_action_info() {  return array(    'mymodule_action_callback' => array(       'type' =>... » read more
(1 comments, last Il y a 4 years 46 weeks)

Great site for checking nameservers

by Albert Il y a 7 years 17 weeks
Jus enter any domain here: http://intodns.com/example.com And it will give you info about your nameservers. Here are some practical commands for use with mac os x: dscacheutil -flushcachetraceroutenslookup » read more
( comments, last Il y a 7 years 17 weeks)

Displaying a block with a field from the current node using Views 2 and Drupal 6

by Albert Il y a 7 years 19 weeks
Drupal, Views—I have a CCK field with an image on my page nodes. I want to display a block with the CCK field value on its related node, but nothing on non-pages. This often works in the views preview, but not on the actual page. This was driving me nuts and I spent a few hours finding this solution: Create view with Filter: node nid > 0 Argument: node nid, Action to take if argument is not present:... » read more
(6 comments, last Il y a 2 years 46 weeks)

Counting inodes (files, folders, symlinks)

by Albert Il y a 7 years 19 weeks
Many hosts restrict the number of inodes you can use on a VPS or shared account. If you have shell access, the following commands are useful to determine how many inodes you are using: ls -R /path/to/directory | /usr/bin/wc cd /path/to/directoryfor i in $(ls);do echo -n "`pwd`/$i: ";find $i -print|wc -l 2>/dev/null;done » read more
( comments, last Il y a 7 years 19 weeks)

Setting up wysiwyg with image upload on Drupal

by Albert Il y a 7 years 19 weeks
Drupal—Update May 3, 2010 -- Please see the first comment, below. Some of the hacks in this article are outdated. Please proceed carefully and report your results here! Warning: this will take you at least an hour and if you make even the slightest mistake, it won't work! Please try this on a test site to make sure it suits your needs! Related issues: Doesn't work with themes with dark backgrounds:... » read more
(3 comments, last Il y a 6 years 3 weeks)

Un YouTube pour les mp3

by Albert Il y a 7 years 36 weeks
Pour ceux qui cherchent un service de type YouTube pour les fichiers sonores (mp3, etc.), j'ai trouvé HoundBite qui fonctionne très bien... si le logo de la société sur votre site ne vous gêne pas! Seul hic: en téléversant un mp3, mon fureteur m'a averti qu'un script sur le site demandait l'accès sans restriction à mon ordinateur... ce que j'ai refusé, bien sûr, mais tout a fonctionné quand même. » read more
(2 comments, last Il y a 6 years 4 weeks)

Bloc de sélecteur de langue dans Drupal: Ne pas afficher la langue active

by Albert Il y a 7 years 37 weeks
Drupal, multilingue—La plupart de nos clients ont un site bilingue (français et anglais). Le bloc "sélecteur de langue" (Language Switcher) est une bonne façon de passer d'une langue à l'autre, mais souvent nous ne voulons pas afficher la langue courante. Par exemple, sur une page en français, nous voulons un lien vers le contenu en anglais, mais pas de lien "français". Notre solution est d'ajouter le css suivant à... » read more
( comments, last Il y a 7 years 37 weeks)

Using diff and patch for directories, and managing patches during Drupal upgrades.

by Albert Il y a 7 years 37 weeks
Drupal—Background: I was recently making a Drupal site where I needed (as is often the case) a visual text editor along with image- and file-upload capabilities. I tried using the wysiwyg module in conjunction FCKEditor 2.6.x, which is a good combination for that purpose. Since this does not work out of the box, I followed the instructions here. This procedure requires modifying files in the Wysiwyg... » read more
( comments, last Il y a 7 years 37 weeks)

Setting up Cron with Drupal 6 and cPanel

by Albert Il y a 7 years 38 weeks
cPanel, Drupal, procedures—If you have a drupal site on a cPanel account, you can set up cron in cPanel. Here is how: (1) Your site is, say, example.com (2) Log into cPanel (example.com/cpanel) (3) Go to cron jobs > standard (4) Enter the following code in your cron: /usr/bin/lynx -source http://example.com/cron.php (replace example.com with your actual website) I normally choose every hour, every day, every weekday,... » read more
(2 comments, last Il y a 6 years 23 weeks)

Language Switcher Block: Not displaying the active language in Drupal 6

by Albert Il y a 7 years 39 weeks
Drupal, Multilingual—Most of our clients have bilingual (French and English) websites. The Language Switcher Block is a great way to switch between languages, but we often don't want to display the active language. For example, on a French-language page, we want to have a link to English (not French and English). Our solution is to add the following css either to your theme, or, if you are using a contrib or core... » read more
( comments, last Il y a 7 years 39 weeks)