Posts

Showing posts from June, 2015

How to remove search conduit

This search conduit browser hijack software was installed automatically during a uTorrent update. I don't recall having an option, but usual next/next/next install box, I guess it could have been there, I must admit I wasn't looking for it due to it being an update to installed software. Running this command seems to remove the search conduit browser hijack without removing uTorrent. Checking the box saying, "restore original settings", did as advertised. "C:\PROGRA~2\SearchProtect\Main\bin\uninstall.exe" /S BTW: Found this by searching windows registry: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\SearchProtect Notes: http://forum.utorrent.com/viewtopic.php?id=90100

Why is CPU load high?

Show processes $ ps aux MySQL high? Log into mysql $ mysql -uUSERNAME -pPASSWORD Show running queries > SHOW PROCESSLIST; Apache2 high? Check Mod Status. Note, if your default page is a CMS, e.g. wordpress/drupal/etc you may need to move .htaccess temporarily, or else that directive will just redirect this page as not found. $ lynx http://localhost/server-status References: http://articles.slicehost.com/2010/3/26/enabling-and-using-apache-s-mod_status-on-ubuntu

Using Meld to compare code changes with Git

Install Meld $ sudo apt-get install meld Create a script in your home directory. $ nano ~/diff.py Paste this in #!/usr/bin/python import sys import os os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5])) Set script to be executable $ sudo chmod ug+x ~/diff.py Run this: git config --global diff.external ~/diff.py Now you should be able to run git diff and it should load meld. $ git diff git_filename_to_diff References: http://nathanhoad.net/how-to-meld-for-git-diffs-in-ubuntu-hardy/

SQL Server 2008 - Saving changes is not permitted

Want to design a table using SQL Server 2008? Well get ready to reach for Google to find out where the hidden setting is. The SQL team wouldn't want to tell you where the setting is in their large dialog box that basically says "computer says no", that would be far to easy. Tools -> Options -> Designers -> Tables and designers -> Uncheck the option: "Prevent saving changes that require table re-creation". References: http://www.henrycordes.nl/post/2008/11/Saving-changes-is-not-permitted-(SQL-Server-2008).aspx

Run DocXViewer in Ubuntu via Wine

I got sick of loading a VMWare to view docx (and doc) in the original format, found a little app called DocXViewer. Requires "Wine" to run in Ubuntu. (Install Wine from Ubuntu Software Center, right click on .exe file and click "Open With..." -> Wine) References: http://epingsoft.com/docx/docxv.asp

Why is hard drive is full?

Just a few notes I needed recently to clean up a full Ubuntu hard drive. Find out how much space left on all drives. df -h -T Find recently modified files, this will often point you to the cause of a recently full drive. In this example find files modified in the past 24 hours. By default recursive from current directory. find -mtime -1 Find files of size find / -size +10M -ls I got into a bad habit of used sudo when deleting multiple files. I think because it asked me to confirm, and I didn't look up the man page to see it was as simple as adding either -I or -f (force). So just as a reminder not to use sudo. Delete all files ending in .foo in the current directory. rm -I ./*.foo References: https://help.ubuntu.com/community/find https://www.linux.com/news/hardware/peripherals/8247-disk-usage-analysis-and-cleanup-tools

My Adventures with MythTV, MythWeb, MyMote and MythMote

Edit 25-June I gave up on the iPhone remote app and instead luckily had an Android device so I downloaded the Android equivalent, MythMote, which worked perfectly. Got everything going on an Asus N10J netbook, and all seems to be working great. I've set up a bunch of recordings, and watched a few shows. I still have to configure an external HDD as the built in one is only 160GB, but it doesn't look too hard. ----------------- Wanted to get some notes down about this because I am struggling to get this set up. It seems like it should be easy, but I'm stuffed if I know what I'm doing wrong. So I downloaded the 0.25 32 bit Mythbuntu ISO image and restored it onto a netbook (ASUS N10J - with NVidia card and HDMI connection.) All smooth so far. Then configured my system and got through the basic setup wizards, backend and frontend and did the sound and video tests, great! Then I wanted to get MyMote going, and this is where I've struck trouble. I'm not new to L...

Using Git to develop Drupal

This is by far and away the best article I've come across that describes how to develop with Git and Drupal. http://drupal.org/node/803746

How to Reset Drupal 7 password using Drush

drush user-password admin --password="admin123" If you have the message: "Sorry, there have been more than 5 failed login attempts for this account. It is temporarily blocked." drush php-eval 'db_query("DELETE FROM `flood`");' References: http://drupal.org/node/1023440 http://drupal.org/node/1023428

Twitter

It's been a busy few months, hence no blog entries for a while. I've started using twitter a lot more, it's quite incredible that you can basically have your own feed of information and you can comment, retweet (promote) and interact with a huge community, this seems to be the best example of democracy since the blogging revolution! Follow @hutch120

Using Drupal 6 to collect history on nodes

This is pretty simple, but maybe not completely obvious as the default settings in Drupal 6 are turned off. So basically you just turn on create revision on save (check the box on the content type you want to collect history for) Administer > Content management > Workflow settings > Create new revision Now if you save a change to an existing node look at the database table you will notice that a new record is created with a VID (Version ID) reference in the content type table. So that was pretty easy, now maybe you normally have an SQL query that does a join using nid, a bit like the following to get the data in a node: SELECT n.nid as nid, n.title as title, field_my_nodedata as nodedata FROM node n INNER JOIN content_type_myct myct ON n.nid = myct.nid But now that will return all the history values! Maybe you just wanted the last saved node so the query changes slightly to use VID to do the join this: SELECT n.nid as nid, n.title as title, field_my_nodedata as node...

Zipping files in Ubuntu is easy just use tar

To create a tar with Gzip compression (recursive by default): tar czf zip_of_relative_path_recursive.tar.gz relative/path To extract files from tar using Gzip to the current directory: tar xzf relative/path/to/zip_of_relative_path_recursive.tar.gz References: http://ubuntuforums.org/showpost.php?p=5798678&postcount=7

Drupal Drush

Sounds like a bad disease, but it's the best thing about Drupal. It's the main reason I'm still persisting with this unwieldy product. With features like command line backup and restore of all files and database, automatic update of modules, password reset and other user management functions, sql database functions, content type manipulation, and lots more, it is the only thing that keeps me sane dealing with the enormous code base.

Dell XPS L702x Ubuntu 11.04

Update 15-March-2012 Very happy with this laptop on the whole. My only disappointment is that I'm unable to make the best use of the graphics card. Hopefully as more people get into Ubuntu/Linux as a personal desktop the graphics card companies will provide faster driver support and we will get the most out of these kick arse laptops. ----------------- [Solved!] Ok, I think I've got it! I'd never used the Ubuntu Display Settings tool before, but it seems to work pretty well, and it even supports multi-monitor! Load it at System->Preferences->Monitors. If you have your display port cable plugged in then it should just detect all your monitors and you can set them up with individual resolutions, etc. Oh man, the number of hours I've spent on this and of course it is actually so easy. Note that when you set your monitor input source to Display Port it seems to take about 10 seconds to actually switch, so be patient at that step. [UPDATE 18-Oct-2011] There was a q...

Drupal 7 entities

I've just spent the good part of the day trying to get my head around how the database in Drupal 7 works, I think I'm close, and here are some notes from my travels. This is a good starting point to jump right into an example: http://www.commerceguys.com/resources/articles/183 http://drupal.org/node/916776#comment-4344024 I'd recommend this high level article as worth a read for those trying to get a grasp on the new Drupal 7 way of doing things at a DB level. http://www.istos.it/blog/drupal/drupal-entities-part-1-moving-beyond-nodes My two cents is that many of the examples in the main doco seem to be aimed at core developers, but this is not clear because in D6 we used to have to write SQL queries that pretty much did stuff like this: http://drupal.org/node/310075#joins Topics like the following show joins with entity_id, ok to do this if you are writing a views type module, but imagine writing that join for your own code! Crazy! http://drupal.org/node/992704 By now I...

Upgrading firmware in Polycom Soundpoint IP 320

Update 15-March-2012 Get another phone, don't even bother wasting time upgrading this piece of crap. It broke again recently and I couldn't get it going again after a number of hours. The support VoIP company even admitted they no longer support it because of all the hassles. ----------------- The phone came with 3.0.1.0032 firmware and I remember having a tough time setting up the phone when I first got it, I think it was something to do with only being able to change one setting at a time, but then today (2 years later) it stopped working and all the settings disappeared and I could not get it going again. Basically the settings would not save in on the phone web server, even one at a time. I used a program called pumpkin (2) rather than the one that is listed (1) below because it is really easy to install and configure. Basically just download and unzip the files from (6) and (7) below to the same directory, and point pumpkin to allow all to that directory. 1. Plug in y...

Dropbox Command Line Ubuntu Install

So there is a little bit to this, here are some notes that should be pretty easy to follow. Get the platform type $ uname -a Install Dropbox Log in to your Linux server so you obtain a shell prompt, and change to your home directory. $ cd Install EITHER the 32 OR 64 bit version. Stable 32-bit: $ wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86" Stable 64-bit: $ wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86_64" Extract the zip file. $ tar -xvzf dropbox.tar.gz Make sure the LANG environment variable is set to something other than NULL, e.g. en_US.iso88591. If it is NULL, you'll get a cryptic error. $ echo $LANG Run dropboxd: $ ~/.dropbox-dist/dropboxd You should see output like this: This client is not linked to any account... Please visit https://www.dropbox.... to link this machine. dropboxd will create a ~/Dropbox folder and start synchronizing it after this step! Go to the URL given; you sh...

Querying a ODBC Linked Server from MSSQL

When trying to browse a linked server in MSSQL through Microsoft SQL Server Management Studio I got an error from the GUI "[LinkedServerName]...[TableName] contains no columns that can be selected or the current user does not have permissions on that object." What tha? I confirmed that the user had access through checking the properties on the connection. So what else? I tried querying it from the Query Editor directly... select * from [LinkedServerName]...[TableName] This gave another error "OLE DB Provider "MSDASQL" for linked Server "[LinkedServerName]" returned an invalid definition for table "[TableName]". WHAT THA? Ok, so did some more digging on this error and found that the error was being caused because the underlying Linked Server did not support TSQL statements. I think the linked server doesn't like the ...[TableName] portion of the query. Hmmm, so how do you get around this? Turns out there is syntax to wrap the query!...

Drupal print module footer for TCPDF

Well I spent way too long on this, but I couldn't for the life of me figure out how to add page numbers to the pdf! Something that would seem so simple. Anyway, in the end this is how I achieved it, I'm sure this is not the preferred way but after hours of searching google, trawling though the issues queue for the print module at Drupal.org and not finding an answer I did this. Commented out the overloaded function Footer() in /sites/all/modules/print/print_pdf/print_pdf.class.inc. So then it uses the default function in /sites/all/libraries/tcpdf/tcpdf.php So just in case anyone thinks, oh, but you just have to copy the theme_... functions, well I tried, and it wasn't working. I'm sure I missed something simple. And I saw a note about uncommenting some code in print_pdf.class.inc. I tried that and it didn't seem to help. $pdf = theme('print_pdf_tcpdf_footer', $pdf, $html, $font); References: http://drupal.org/node/306892 http://php.net/manual/en/funct...

Duplicate entry INSERT INTO og_access_post

The reason for this is explained in detail here: http://drupal.org/node/309974#comment-2594564 user warning: Duplicate entry ... for key 'PRIMARY' query: INSERT INTO og_access_post (nid, og_public) VALUES (..., 0) in ... common.inc on line 3528. Here's the short version: This happened to me because og_access has a weight of 1, and workflow has a weight of 0. Workflow's save post action triggers a node_save() inside a node_save() which confuses the hell out of OG Access and causes it to insert the record twice. Increasing workflow's weight to 1 in the system table solves the issue. I had a similar problem, but I couldn't find the module causing the problem so in the end the fix I used was to reduce the weight of the OG modules. UPDATE system SET weight = weight - 10 WHERE name = 'og_access'; UPDATE system SET weight = weight - 10 WHERE name = 'og_actions'; UPDATE system SET weight = weight - 10 WHERE name = 'og_notifications'; UPDATE ...

PHP Beautifier Notes

I've just spent quite a few hours looking into the PHP Beautifier. From the blogs out there it seems most people think it doesn't really do the job out of the box. But it is fairly simple to modify it once you understand the basics of how it works. Hopefully this blog will help get over that initial learning hump. Normal installation Try this: pear install PHP_Beautifier Will probably fail with a warning to use the 0.1.15 version) so run this instead: pear install PHP_Beautifier-0.1.15 Fix a bug if running PHP First, installation files have a bug in them if you are running PHP 5.2 or less, this is what stopped me last time, but it is easy to patch, so once you have installed it you need to patch it, do that as follows. The install of 0.1.15 has a bug for PHP versions under 5.3 and I had to apply a patch manually to stop it from throwing a notice warning, the correct code is here: https://github.com/clbustos/PHP_Beautifier/blob/master/Beautifier.php Basically PHP ver...

Drupal 6 Node Import reports success but fails when submit button has spaces in text.

Drupal 6 Node Import reports success but fails when submit button has spaces in text. Short version If you change the text of the form submit button to something with spaces such as "Save Form" you break Node Import. The following code is similar to what is in my module. Now the long version This took me hours to figure out, some of my guesses were that I'd created an invalid bit of CCK, or my data was invalid and I trawlled though my 1000s of rows of CSV to try and find something wrong, I stripped back the content type to simple text fields, I was running a slightly old version of node import so I tried to update that, I started to look at the PHP version, and I could go on. I took a break and when I came back it dawned on me that perhaps the cause was another module in the system that was conflicting with node import, ah, very quickly after having that thought, lets say about 5 seconds, I though, oh man only my module is changing form elements for these conten...

Drupal 6 MimeDetect module - Fileinfo could not load the magic file

Drupal 6 MimeDetect module - Fileinfo could not load the magic file. It could be corrupted. Try reinstalling the magic file distributed with the MimeDetect module. What a horrible error message. Firstly it is not corrupted, so don't worry about that. It is one of two things. 1) Most likely is that the magic file that comes with the drupal module is not supported by your apache2 server. So just point it to the one that is installed by your server. The Readme.txt file in the MimeDetect module has details. Basically just add this line to sites/default/settings.php $conf['mimedetect_magic'] = '/usr/share/file/magic'; 2) Very slim chance that not having the fileinfo apache2 module enabled is causing you problems, easy fix. sudo a2enmod mime_magic

Dropbox You don't have permission to access / on this server.

Update 24-July-2012 To avoid missing hidden files (e.g. .htaccess) use rsync rather than cp to copy files. E.g. rsync -ravz /src/folder/ /dest/folder/ --------------- Original Notes --------------- We added a new Ubuntu 10.04 server to our Dropbox account and I'm not sure of the exact sequence, but some time soon after that every server, including linked development server all reported "You don't have permission to access / on this server.". Obviously a permissions issue, and obviously due to Dropbox as it happened on all linked servers. Checking permissions all seemed ok, but it wasn't immediately obvious that we had at some stage during setup months ago modified the group of all the files to www-data to allow apache to read-all and write-some files/directories. In the end this was a fairly easy fix, made a bit more tricky given we had stuffed around with all permissions to try and get a quick fix and were running Drupal which requires certain directories to...

Drupal 6 multiple submit buttons

There is a bit more to adding multiple submit buttons in Drupal 6 than at first glance. I didn't find an article that covered all the elements I needed, so here is a condensed version. So this is how I ended up achieving multiple buttons that reference the node ID. 1) You need to add the buttons first, this is fairly easy and there are a number of tutorials about this online. Basically this is how you do that. In the form_alter function of your Drupal module you can add lines like this to add new buttons. You can alter the text on the default button using the #value attribute. // This is a the default save button $form['buttons']['submit']['#value'] = 'Default Save'; // Change text on the button // This is a new custom save button $form['buttons']['button2']['#type'] = 'submit'; // Type of the button, Drupal will do its magic $form['buttons']['button2']['#value'] = 'Save Only'; // ...

Repost of some paypal horror stories

Repost of some paypal horror stories. From: http://reviews.ebay.com.au/Paypal-serious-problems_W0QQugidZ10000000006178850 ======================================= Never use Paypal!!!!! Here's my shortened story. Sold a scooter on Ebay for $7500. Buyer is happy, I'm happy. Money went through paypal to my paypal account. I tried to withdraw it and paypal stopped the account and reversed the payment. They said "unusual activity". They have $7500 of mine and have limited my account so I cant get it. They did that for no reason. I've faxed them information they requested twice and they still havent done anything. Now they want more info. There are many many people with the same problem - I'll never use paypal again. I'm sending my story to as many people as possible and that includes A Current Affair - already done about 1 hour ago. Check out (3w's) paypalwarning.com for real horror stories from people all over the world using paypal. I will NEVER use the...

Paypal is a joke

Adding to the staggering weight of disgust about the paypal service (see references below) here is my recent experience. We run a small SMS service and thought paypal would be a good way to make transactions safe and simple. We implemented their automatic payment gateway API and all went well for many months. Then we got a scammer sign up, buy the most expensive pack and use all the credit by sending SMS messages. Well, we thought, no worries, paypal will sort this out, LOL! Anyway, needless to say, but I'll say it anyway, paypal did not want to discuss this at all, even after a number of telephone calls and emails they simply refused to acknowledge that it was in any way their fault. Their response was and still is, hey just don't send them the goods, make sure you get paid first. Well paypal, you told us (via the API) that we did get paid, so we credited the account! So basically we thought, ok, maybe this is unusual, and put in a few more measures to sign up and payment, s...

Energy independence

Clearly Secure is involved in development of remote wireless technology and one issue holding back deployment of some of these systems is power requirements. Energy independence can be political, but also can just mean no wires! :) SMRs: http://en.wikipedia.org/wiki/Small_Modular_Reactors An interesting summary of a range of SMRs. How small can they get? http://aygn.org/__data/assets/pdf_file/0005/49685/Lecture_Event_20101021.pdf Is Australia funding development of this technology? Probably not. http://www.ansto.gov.au/ An argument saying large reactors will be cheaper. I think they missed the point that SMRs can be used in remote locations. Also I wonder if they considered the saving in infrastructure costs such as reduced need for construction and maintenance of transmission lines? http://www.ieer.org/fctsheet/small-modular-reactors2010.pdf Other links: http://www.world-nuclear.org/info/inf33.html http://www.nytimes.com/2011/02/13/science/earth/13nuke.html?_r=1 http://the...

Scammers targeting Gumtree users

I have bought and sold a bunch of stuff though gumtree and have always had a good experience, but today got a strange text/sms message within a few hours of posting an advert. The exact punctuation of the message was this: "hello is your car still for sale?please get back to me through my private email deanmills2007@ymail.com.thanks" Seemed a bit strange, so thought I would google deanmills2007@ymail.com which turned out to be the correct response as I found someone else who got this strange message. Needless to say, I won't be replying to that and I hope this helps someone else who gets this message. Update: Got another message today which went: "Anything else to add to the ad you posted on gumtree or the ad says it all?, get back to me at 123438jhy4@gmail.com,I only have access to email for now , Robert" References: http://www.perth-wrx.com/vb/showthread.php?t=39863 http://whocallsme.com/Phone-Number.aspx/61427042684#p188846000049626632

gEdit is a great PHP editor

Update: 21 May 2011 PHP Beautifier 19 January 2011 I liked phpEclipse, but it was slow (probably mainly due to the JRE), and some things could be frustrating, also it really doesn't offer that much that a fully featured PHP editor should offer such as code completion and inline function help. So anyway, it died without warning today, and after spending about an hour trying to resurrect it I thought I'd investigate some other options. Turns out if you add a bunch of plugins to gedit it is a very good PHP editor! Check out this link: https://github.com/gmate/gmate Unfortunately I couldn't get PHP Beautifier working right away, might revisit that. References: The code: http://pear.php.net/package/PHP_Beautifier/ Guy having similar problems: http://old.nabble.com/PHP_Beautifier%3A--strange-behaviour-with-newlines-and-comments-td27811969.html Comment from the Author: http://stackoverflow.com/questions/1265564/fixing-php-beautifiers-empty-lines-problem PHP Tokens: ht...

Creating a Drupal Patch

Update 2011-04-25: Creating patches has changed as Drupal has moved to GIT source control. See: http://drupal.org/node/707484 This was the old way to create a patch: ===================== OLD OLD OLD ===================== Here is a very cut down version of how to create a patch. See references below for more details. Checkout the code. cd sites/example.com/modules cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d modulenamehere contributions/modules/modulenamehere OR cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r -d moduleName contributions/modules/moduleName To get the correct version tag, visit the CVS contrib modules repo, choose your module, and pick one of the available NON-BRANCH tags from the dropdown list at the top of the page (such as DRUPAL-6--1-0). Example: cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-6--1 -d datatables contributions/modules...

How to redirect a save form in Drupal to a custom path

There are two ways to do this. $form_state['redirect'] on the node specific your-content-type_form_alter hook or $form['destination'] on the generic form_alter hook. Each can be useful in different situations. 'hidden', '#value' => 'suppliers'); } ?> So first alter the edit form to call your custom submission handler: Then override the redirect variable to suit: References: http://www.brianvuyk.com/story-type/changing-redirect-value-drupal-node-form-d6

Drupal DataTable Module: How to fix squashed table

http://drupal.org/node/979182

Drupal module development: How to update a node

http://drupal.org/node/439090#comment-2282264

Drupal datatables module: How to implement multi_filter

http://drupal.org/node/980424

Drupal Printing module: How to remove the back horizontal line on the top of the pdf

http://drupal.org/node/796912

Getting heading numbers in Google Docs word processor

Google Docs word processor is great but lacks a few essential features. Heading numbering is one of them... however this is an easy way to overcome it that seems to work GREAT. This Javascript code numbers the headings in the same format of a formal document. Just add it as a shortcut on the bookmark taskbar and job done: javascript:(function(){var doc=window.frames['wys_frame'].document;var elements=doc.getElementsByTagName('*');var numbers=[0,0,0,0,0,0,0];for(var i in elements){var e=elements[i];if(!e||!e.tagName||!e.tagName.match(/^H([1-6])$/)){continue}var eLevel=RegExp.$1;var txt='';numbers[eLevel]++;for(var l=1;l Each time the numbering needs updating just hit the bookmark. Brilliant.

Remove the grid lines from spreadsheets created in Google Docs using a greasemonkey script

Update 7-Dec-2010: You don't have to do this anymore! Hallelujah!! =========== If first time then: 1) Publish Quote. Click share, publish. 2) Open Firefox. 3) Install greasemonkey add-on 4) Open the spreadsheet URL in firefox and add "&range=A1:P50" to the end. 5) Right click on the greasemonkey icon (bottom right), click the top link, "1xx scripts", filter for the word "docs", install the script "GridEraser for Google Docs". 6) Refresh the page. 7) There should be no gridlines anymore, or any other random lines. 8) Setup page settings to A4 size, there is some bug in firefox that it will only save settings if you print to the default printer, so set options->Print background images and then print to default printer once. If not first time pretty easy: 1) Publish Quote. Click share, publish. 2) Copy the URL to the clipboard. 3) Open Firefox. 4) Open the spreadsheet URL in firefox and add "&range=A1:P50" to t...

How to start common Ubuntu GUI programs from the terminal

To find the command line of something in the menus go to: System -> Preferences -> Main Menu Select the application and click preferences. It can be handy to launch a bunch of programs that are linked, like your browser, debugger and terminal without starting each one individually. Write a bash script, like this: #!/bin/bash nohup /opt/google/chrome/google-chrome %U & nohup gnome-terminal & Mark it as executable and put it in a path that is searched by Ubuntu like /usr/local/bin. Here are some program launch examples: Create a USB start disk usb-creator A terminal session gnome-terminal Driver management jockey-gtk Graphics card config nvidia-settings The software update manager update-manager Startup programs gnome-session-properties References: http://ubuntu-ky.ubuntuforums.org/showthread.php?t=1047494

Renew SSL certificate on Ubuntu and Apache2

I just had to renew my SSL certificate and wanted to make a couple of notes that someone might find handy. (Probably me next year) * Find the CSR file. (Or you can/should generate a new one) Open /etc/apache2/sites-available/www.yoursite.com and search for '.key' which gives you the directory where the CSR file should be. Or run something like the following command: find / -name '*.csr' * Open the CSR file in nano and copy the text into the renew certificate field from your hosting provider. * Check email for SSL certificate from SSL provider. Remember they will only send to certain email addresses like admin@yoursite.com, so set that up first. * BACKUP THE CURRENT CRT FILE! Then paste text into the file www.yoursite.com.crt * Restart apache2 * Test your web site. If the new pubic key doesn't match the private key apache will not start and your site(s) will all be down. You can fix the problem by restoring the crt file you backed up, or disabling SSL by editin...

Output dynamic user specific XML content via Drupal node

My set up is Drupal 6 on LAMP (Linux/Apache/MySQL/PHP) and I needed to dynamically generate XML on a per user basis as a data transfer mechanism between MySQL and the web browser via PHP and Java (I.e. AJAX) for a mapping application. The actual code is pretty simple really, but finding the right place to put all the bits was very frustrating. I couldn't find an article that really nailed it, so here is what I did. There are a number of elements needed to achieve this. * Linking to drupal user managment (getting access to global $user). * Creating a theme that doesn't mess with the XML. * Writing PHP code to dynamically generate the XML. * Writing JavaScript code to get and parse the XML (AJAX) So here are some more details. To serve that XML in a dynamic, user specific and secure way I needed to get access to the drupal userid requesting the data, this is why it had to be served in the form of a drupal node. So I found a basic theme Zen and sub themed it with Zenophile a...

Comparing files in Nautilus with diff-ext

Install: $ sudo apt-get install diff-ext Restart Nautilus (Log out) Usage: Pick two files and right click -> compare. References: http://morgancollett.wordpress.com/2008/11/19/comparing-files-in-nautilus-with-diff-ext/

How to disable amavis and clamav

Edit: /etc/postfix/main.cf #content_filter = amavis:[127.0.0.1]:10024 #receive_override_options = no_address_mappings Edit: /etc/postfix/master.cf #amavis unix - - - - 2 smtp # -o smtp_data_done_timeout=1200 # -o smtp_send_xforward_command=yes #127.0.0.1:10025 inet n - - - - smtpd # -o content_filter= # -o local_recipient_maps= # -o relay_recipient_maps= # -o smtpd_restriction_classes= # -o smtpd_client_restrictions= # -o smtpd_helo_restrictions= # -o smtpd_sender_restrictions= # -o smtpd_recipient_restrictions=permit_mynetworks,rej ect # -o mynetworks=127.0.0.0/8 # -o strict_rfc821_envelopes=yes # -o receive_override_options=no_unknown_recipient_chec ks,no_header_body_checks # -o smtpd_bind_address=127.0.0.1 Now stop amavis-new and clamd: $ sudo /etc/init.d/amavis stop $ sudo /etc/init.d/clamav-daemon stop $ sudo /etc/init.d/clamav-freshclam stop Now disable amavis and clamd form starting on system boot: chkconfig doesn't work for Ubuntu so use this boot process editor: $ ...

How to setup Eclipse with PHP plugin on Ubuntu 9.10

Install Eclipse from the package manager. Then: sudo add-apt-repository ppa:yogarine/eclipse/ubuntu && sudo apt-get update sudo apt-get install eclipse-pdt Sooooo much easier than I remember on 8.04 and 8.10. Similarly to install RabbitVCS sudo add-apt-repository ppa:rabbitvcs && sudo apt-get update Search package manager for rabbitvcs, there are about 6 plugins. References: https://help.ubuntu.com/community/EclipsePDT http://blog.yogarine.com/2009/10/eclipse-plugin-packages-for-ubuntu.html http://wiki.rabbitvcs.org/wiki/download

Setup SNMPTT in Ubuntu 8.10 for traps to go to MySQL

Download from here: http://sourceforge.net/projects/snmptt/files/ Basic installing from here (with exceptions below): http://snmptt.sourceforge.net/docs/snmptt.shtml#Installation-Unix Found some of the paths not right for Ubuntu such as: cp snmptt.init.d to /etc/rc.d/init.d/snmptt should be cp snmptt.init.d to /etc/init.d/snmptt 9.4. I see following error: Can't locate Config/IniFiles.pm in @INC ...What should I do? It's likely that you don't have required Perl modules installed. In this case it's Config::IniFiles that is missing. The easiest way to install Perl modules is to use CPAN extension, eg. perl -MCPAN -e 'install Config::IniFiles'. From here: http://www.secit.at/doc/snmptt-1.0/html/faqs.html Q: Why doesn't the snmptt-init.d script work with Debian? The snmptt-init.d script provided with SNMPTT was written for Mandrake and RedHat. To make the script work with Debian without requiring any re-writing of the script, copy /etc/init.d/skeleton ...

LAMP Memory Tuning

Running a VPS? Going over your oomguarpages limit? Well this should help http://onlamp.com/pub/a/onlamp/2004/02/05/lamp_tuning.html In particular check out the section about MaxRequestsPerChild and you can use this command ps axu --sort:rss to see how much RAM you are using.

Where is PHP.ini installed in Ubuntu 8.10?

1) PHP Web server To find this one create a file with and run it on your web server. /etc/php5/apache2/php.ini 2) PHP Client To find this run this command. $ php -r "phpinfo();" grep php.ini /etc/php5/cli/php.ini

How to get fopen to work with crontab

Basically you need to understand three things to understand how this works: 1) Which user is the php file running as? - When you run "crontab -e" the user you are running it as will be the user the php file runs as. 2) What are the permissions on the log file? - Check the permissions, owner and group using "ls -al" 3) What are the permissions on the php file? If you run the php file with a directive #!/bin/php at the top of the file then you need to set executable permissions on the file. If you specify php /path/to/phpfile.php then you don't need to do this. If you still can't get it going then here are some troubleshooting tips. In the crontab file you have: * * * * * /var/www/foo/bar/test.php as the command to execute . Set yourself to root: $ sudo /bin/bash Then when running this from the command line you'll see: root@vps:~# /var/www/foo/bar/cron/test.php bash: /var/www/foo/bar/cron/test.php: Permission denied This is because the file doesn...

How to set up Internet Tethering with the BlueMan Applet

I found there was a bit of stuffing around to get this Internet tethering going, so here is my quick guide to how it worked for me. So my setup is I'm running Ubuntu 8.10, have BlueMan installed and have an iPhone 3GS 32GB. So here are the steps. 1) Open Bluetooth BlueMan applet on laptop (enable bluetooth if not enabled) 2) Open Bluetooth settings in iPhone (enable bluetooth if not enabled) 3) The device name (your-laptop-name) should be showing on the iPhone. Press the name with your finger to connect (!! not the arrow as I kept doing !!) 4) It should ask for a PIN, type in an easy PIN into the iPhone for the connection authentication, you'll see why in the next step. 5) On the laptop a popup will show for about 4 seconds (you have to be very quick), in that time type in the PIN you typed into the iPhone. The first time I did it the window popped up under another window, and it took me ages to figure out why the devices wouldn't connect! If you are too slow minim...

iPhone Internet Tethering settings

iPhone Internet Tethering settings. For newer iPhones it should there already under: Settings->General->Network->Internet Tethering. If it's not there then go to this link: http://help.benm.at/help.php (on your iphone). Select on mobileconfigs which goes to here: http://help.benm.at/tethering.php Select Australia (or whatever country you are in) which goes here: http://help.benm.at/au.php Pick your provider.

Installing SSL on a VPN

These links may be useful (haven't tried them yet) https://knowledge.rapidssl.com/support/ssl-certificate-support/index?page=content&id=SO6506 https://knowledge.rapidssl.com/support/ssl-certificate-support/index?page=content&id=SO16226 This link might be handy (posters seem to think so). I'll expand on this blog entry once I've tried it. Extracted from link below: ++++++++++++++++++++++++++++++ A Mini-Howto for apache2: :) apt-get install apache2 apache2-ssl-certificate (and answer the questions) Now, enable ssl: a2enmod ssl configure ssl: cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl "/etc/apache2/sites-enabled/ssl" should look like this: NameVirtualHost *:443 (... configure the directories too...) and "/etc/apache2/sites-enabled/default" should look like this: NameVirtualHost *:80 (... configure the directories too...) In /etc/apache2/po...

Creating Virtual Hosts on your VPS

The article (link below re: debian-administration) was pretty good, except the bit that said to create a file called virtual.conf. This pretty much didn't seem to work (maybe I did it wrong), but it just caused apache2 to throw the following error on restart: [warn] NameVirtualHost *:80 has no VirtualHosts By removing this file and specifying *:80 in each of the VirtualHosts sections instead of just using * fixed this problem. I also found the official documentation about virtual hosts enlightening. References: http://www.debian-administration.org/articles/412 http://httpd.apache.org/docs/2.2/vhosts/examples.html

Configure web site access on VPS

So I spent some time trying to figure out why drupal wouldn't allow clean URLs and why I couldn't lock down directory listings on my shiny new VPS. I knew from plenty of experience on shared servers that if you use .htaccess you can set Options -Indexes and this will stop prying eyes from getting a directory listing of your site. But this wasn't working. I finally found this article http://httpd.apache.org/docs/2.0/howto/htaccess.html which states: "There is, for example, a prevailing misconception that user authentication should always be done in .htaccess files. This is simply not the case. You can put user authentication configurations in the main server configuration, and this is, in fact, the preferred way to do things." I was surprised to find that you should not use .htaccess files if you have root access! Many blog entries I read said that .htaccess should be used even when the person asking the question obviously had root access. When you have root a...

How to lock down a node to a role using drupal content access module

Took me a while to figure out how to use the drupal content access module correctly, maybe because the readme.txt file was pretty basic. Anyway, basically locking down a node to a role is a two step process. The first is done just once (well actually once for each new role added). 1) Define the default permissions you want on the content type. So for my case I wanted all roles to be locked down to only edit own content (content created by the currently logged in user.) Go to: Administer->Content Management->Content Types->Edit->Access Control Tick: View/Edit/Delete own content. Tick: Per content node access control settings. 2) When the user creates new content (a new node) they need to define which roles (other than themself) they want to give access. That's it. Not sure why it was so hard to figure this out, but there you go. If you want a page that displays nodes for a specific content type that are assigned a role that the logged in user is allowed to see then ...

Clear IE7 Cache from Command Line

* RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255 (Deletes ALL History) * RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1 (Deletes History Only) * RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2 (Deletes Cookies Only) * RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 (Deletes Temporary Internet Files Only) * RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16 (Deletes Form Data Only) * RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32 (Deletes Password History Only) http://blogs.techrepublic.com.com/window-on-windows/?p=574

Enable cut and paste from VMWare 6.5 with Ubuntu installed

Enable VMWare 6.5 cut and paste in Ubuntu 8.10 or Ubuntu 9.04 Ubuntu 8.10 1) Inside VMWare Image - Add "vmware-user" to startup System->Preferences->Sessions 2) Restart X (alt+ctrl+back_space) More Info for Ubuntu 8.10: http://communities.vmware.com/message/1129103#1129103 http://communities.vmware.com/thread/177129;jsessionid=9D39949A232111D0543A2DD68F104664?start=15&tstart=0 Update for 9.04 1) Inside VMWare Image - Add "vmware-user" to startup System->Preferences->Startup Applications 2) Restart X Notes for 9.04 - Failed to compile VMWare tools correctly. - Mouse integration with didn't exit VMware automatically - ctrl+alt+back_space (to reset X) not enabled by default?

Style sheets, IFrames and Tables - Part 2 - Resolution

Originally this code had hardcoded style tags and it was impossible to override the layout. Now using style sheets you can override invalid settings. This will look OK in Internet Explorer. (I'm not recommending a solution for any job in general, these are just some notes from a job I'm working on. In fact I would definitely NOT recommend using table tags to do any sort of layout. They are shown here due to their use in the job in question. Tables are for displaying data not defining layout.) iframe.myIFrameStyleSheet { position: absolute; width: 100%; height: 100%; border-style: none; overflow: hidden; frameborder: 0; scrolling: no; allowtransparency: true; } iframe.myIFrameStyleSheet { position: relative; } Take a look at the source code and see that the CSS override section is uncommented. This is how the page looks now. First Row ...

Style sheets, IFrames and Tables - Part 1 - Problem

What I'm trying to show here is that by using style sheets you can easily override layout in client code for different purposes. This code has hardcoded table and style tags and is virtually impossible to override the layout client side. This will look CRAP in Internet Explorer and the layout is virtually impossible to override. Resolution Here

Every developer needs a find string script

Well here is my find string for php files. Create a new file (bash script) $ sudo gedit /usr/bin/fsp Add these lines #!/bin/bash clear echo "fsp - Find string recursivly from current directory in PHP files. -i = case insensitive"; echo ""; echo "find ./ -name '*.php' xargs grep -i \"$1\""; echo ""; find ./ -name '*.php' xargs grep -i "$1"; echo ""; And don't forget to set file to be executable! sudo chmod +x /usr/bin/fsp Now try it out, cd ~/development/project fsp "search for something in your php files!"

Install flash on Firefox 3.0.6 running on Ubuntu 8.10 64bit

Ran just a few lines of the script posted in the link below to get flash going. Ubuntu 8.10 64 bit Firefox 3.0.6 Code below is an extract from the shell script posted here: http://www.cyberciti.biz/tips/install-flash-10-ubuntu-linux-64bit.html echo "Closing Firefox" sudo killall -9 firefox echo "Removing previous installs of flash:" sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper sudo rm -f /usr/lib/mozilla/plugins/*flash* sudo rm -f ~/.mozilla/plugins/*flash* sudo rm -f /usr/lib/firefox/plugins/*flash* sudo rm -f /usr/lib/firefox-addons/plugins/*flash* sudo rm -rfd /usr/lib/nspluginwrapper echo "Installing ia32-libs and nspluginwrapper" sudo apt-get install ia32-libs nspluginwrapper echo "Installing Flash Player 10" cd ~ wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.tar.gz tar zxvf install_flash_player_10_li...

Moving Drupal

[UPDATE 11-Nov-2011] If you are doing this fairly often then rather than do this manually I highly recommend using the command line backup and restore functions that come with Drupal Drush. ================================ The official notes: http://drupal.org/node/135206 My Notes: Adding to the plethora of articles about moving a drupal site are my tips: To move a site do this on the site you are going to move: 1) Turn off clean urls Note: I moved a Drupal 6.14 site recently and skipped this step and it worked, not sure what's changed, I'm sure you used to have to do this to avoid problems. Maybe I have improved step 2 to clear the potential problems. 2) Clean up the database When exporting/backing up tick the box in the export that says drop tables. Also before you backup up clear the caches using the truncate commands below, check you might have more cache_* tables, clear them all. You can do this after restore if it is a running site, but doing it before the export ...

Building a development environment

Well I thought it was smooth sailing with my shiny new Ubuntu LAMP environment with Eclipse, PDT and SVN. But you know there is always something that keeps you guessing!! Below are some tips and experiences that had me tearing my hair out at times. *** Apache2 PHP Save As dialog issue *** Having got all the software setup and running, including phpmyadmin working and restoring databases (albeit needed to increase the PHP file upload limit in php.ini) I thought it was smooth sailing. But then I downloaded our source code and started getting Save As dialog boxes, for a long time I thought it was a configuration issue with Apache or PHP and spent about 6 hours stuffing around with that, but as it turned out it was a permissions issue to our log directory. PHP being unable to write to the folder for some reason decided to bomb out horribly and the only indication I could see of something going wrong was a save as dialog box and an error "exit signal Segmentation fault (11)" in t...

Installing Eclipse and PDT

I don't know why, but when I tried to install eclipse and PDT last time I had so much trouble. But this time it has gone reasonably smoothly. I attribute the issues I had to being lead to believe I needed to download a package from the PDT web site which is not the case as these links show. Anyway, here are the basic steps. I followed the instructions in these links: Install Eclipse: https://help.ubuntu.com/community/EclipseIDE Install PDT: https://help.ubuntu.com/community/EclipsePDT Install SVN: http://ubuntuforums.org/showthread.php?t=187739 The above instructions made for a smooth installation. The only thing I did wrong was not run eclipse with sudo when installing PDT. After the install returned a bunch of errors I just closed eclipse and re-ran as sudo, and followed the instructions to install again and it all seems fine. Also note that when you select PDT as it says it will say packages required, you need to expand the tree of second two packages before it will actuall...

Installing Dell M1530 XPS

Just documenting a few tips from my move from an old Dell Inspiron to a shiny new Dell M1530 XPS with 6GB ram. Add repository: https://help.ubuntu.com/community/Medibuntu Ubuntu 8.10 "Intrepid Ibex": sudo wget http://www.medibuntu.org/sources.list.d/intrepid.list --output-document=/etc/apt/sources.list.d/medibuntu.list Then, add the GPG Key: sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update Installed Filezilla Transfering my Evolution mail files was soooo easy. 1) Export from old machine 2) Copy file to new machine 3) Import into Evolution 4) Send/Receive!! VMWare setup was a breeze with the .bundle package. 1) Download Ubuntu 64 bit bundle package (Approx. 350MB) 2) cd /home/username/Desktop 3) sudo sh VMware-Workstation-xxxxxxxx.bundle 4) Creating Ubuntu 8.10 64-bit virtual machine? Check this key mapping issue: http://communities.vmware.com/thread/177321 Installed Google Gadgets. The facebook slideshow is pretty coo...

Equivalent for windows key + D in Ubuntu

http://ubuntuforums.org/showthread.php?t=87345 If you just want to know the show desktop short cut keys in Ubuntu is is: CTRL + ALT + D If you want to map the "windows" key to the equivalent functions see this link: https://help.ubuntu.com/community/MappingWindowsKey Basically: Create a file here /home/user/.xstartup Paste the following in the file: # Make the Windows key a useable mod key: #xmodmap -e "remove mod4 = F13" # should not need this line xmodmap -e "keycode 115 = Super_L" xmodmap -e "add mod4 = Super_L" Go to System -> Preferences -> Keyboard Shortcuts Map keys (these are the ones I use fairly often) Win+R Show the panel run application dialog Win+E Home Folder Win+D Hide all windows and focus desktop

How to fix Check Junk Failed error message in Evolution

Evolution Mail - Check Junk Failed - error message. Fix by marking an email as junk, then go to the junk folder and mark as not junk. Also posted here: http://hutch120.blogspot.com/2008/12/how-to-fix-check-junk-failed-error.html ############################################################################################################################################################################## PHP imap_open can fail if you specify a mailbox in connection string. Recently our email parsing code written in PHP started to fail and the only indication of the problem was a PHP notice in the web server error_log that we hadn't encountered before. "PHP Notice: Unknown: SECURITY PROBLEM: insecure server advertised AUTH=PLAIN" A quick support call to our web host we found they had made a change to dovecot email system http://www.dovecot.org/ A bit of to and fro of them trying various settings in dovecot got us nowhere and eventually it was escalated to cPanel suppor...

How to copy filename with spaces using rsync

Putting rsync script with spaces in filename in bash. Finally found answer here: http://lists.samba.org/archive/rsync/2002-January/001217.html http://lists.samba.org/archive/rsync/2002-January/001219.html On the command line, or explicitly in a script, it works fine, however when I invoke it from a script it throws errors. Key is to use the "eval" keyword, see example below. #!/bin/bash # -------------------------------- # Edit the three settings below. # -------------------------------- # # Define home location # home="/home/hutcho" # # Backup directories # backupDirs=("Projects" "Directory With Spaces" "Desktop" "Other" "Personal" "Utils") # Define backup location # Note that you also need to define the path to the backup location in /etc/fstab. More info at: http://en.wikipedia.org/wiki/Fstab # fstab (file system table) entry is as follows: # //IPADDRESS/d$/hutcho_backup /home/hutcho_backup ...

How to clear watchdog and sessions tables in drupal

Recently my development watchdog table reached almost 2GB. A quick fix is to run the SQL command: "truncate table watchdog" More tips here: http://drupal.org/node/148461

How to fix skype-wrapper issue for skype 2.2 beta

I run Ubuntu 10.04, just upgraded skype and it would not start, got this message: ======================== Could not launch 'Skype' Failed to execute child process "skype-wrapper" (No such file or directory) ======================== I tried to uninstall/reinstall. Same message. Found the solution was to modify all the links (menu, startup, etc) to call 'skype' instead of 'skype-wrapper'. References: http://blogs.skype.com/linux/2011/04/2_2_beta.html