Archive for October, 2011
In Drupal, posts are automatically trimmed to create excerpts, and a “read more” or other like text is inserted in the end of your excerpt to give readers a link to the full page. But what if your entire article is shown in the excerpt and you want to get rid of the “read more” link?
There’s a really easy way to do this.
Drupal has a “break” tag, “
” (without the quotes), that overrides the default excerpt generation, and allows you to specify where the excerpt breaks from the main article. By placing this tag anywhere within an article, you can cause the except to appear shorter or longer, or include the full article without the “read more” link. To do this, simply have this tag at the end of the article, and just make sure there’s no spaces or any other characters after it.
It’s really that easy.
Questions, comments, or feedback? Please do so in the comments section below. Thank you!
If you have a lot of WordPress posts and might want to find all posts containing a certain keyword for any reason, you can start by using the following SQL code, which was taken from this post. I used this in phpMyAdmin for a MySQL database. Make sure you are in the correct database first!
You can substitute any keyword for ‘needle’ below, but you must have the single-quotes and percent signs around it.
SELECT ID FROM wp_posts WHERE post_content LIKE '%needle%';
Example: Let’s say you use the NG Gallery plugin, which has you add a tag to all your posts to include said gallery. Now you find to find all posts which have that NG Gallery tag in them. The following query would work:
SELECT ID FROM wp_posts WHERE post_content LIKE '%nggallery%';
This can also be built upon for find-and-replace operations.
Keep in mind, you can really muck things up using SQL. Make a backup first if you don’t know what you’re doing!
Questions, comments, and feedback are always welcome. Thanks!
In my quest for the perfect “in my dreams” backup solution for my Ubuntu VPS, I created this very simple script which can be run as a cron job and can be easily modified to backup any amount of data to any remote FTP or SFTP server.
You could very easily include a database backup by running mysqldump beforehand, but I’m not including it in this script.
This required yafc to be installed, but Ubuntu installations can easily install it by running
sudo apt-get install yafc
And now, for the script:
#!/bin/bash # format of the open command is proto://username:password@HOSTorIP/ # proto is either ftp or ssh # special characters in the username or password are not well tolerated # anything in the EOF tags are direct commands to yafc. Test if unsure DIR=`date +%F` yafc <<EOF open ftp://username:firstname.lastname@example.org/ cd backup-dir mkdir $DIR cd $DIR put -p -r * close exit EOF
Enjoy! Questions, comments, and feedback are welcome and appreciated. Thank you!
To do this, CTRL-ALT-F1 to an open terminal, log in, and run:
xinit ./program -- :1
where program is the program file you want to start in a new X session. Assuming your normal X session is on
:0 and appears when you CTRL-ALT-F7, your new one will spawn on CTRL-ALT-F8.
Questions, comments? Please feel free to leave them in the comments section below. Thank you.