Category Archives: technology

How to save iptables on a GoDaddy VPS that will stay after a reboot – hint: its not iptables-save!

There is a lot of information on iptables on the internet – a lot of great posts, however it took me a while to find out how to save iptables on a GoDaddy VPS (virtual private server ) in a way that is persistent (stays after a reboot).

The rules your VPS uses when iptables are restarted or the server is rebooted are found in file /etc/sysconfig/iptables. Best practice is to add rules to your server using the iptables command, but as you know, those rules won’t stay after you restart the service or reboot the server.

Once you have iptables running the way you want – you can type iptables-save and it will output on the screen your iptable rules as you would want them in the /etc/sysconfig/iptables file, but it does not save those rules to your /etc/sysconfig/iptables file. It just outputs it to the screen – no matter how many forums and blogs out there say otherwise.

So here is what I do when working with iptables, in order to save my changes:

  1. add rules using iptables commands
  2. validate they work as expected
  3. backup my existing /etc/sysconfig/iptables file using this command:
    • cp /etc/sysconfig/iptables /etc/sysconfig/iptables.rules
  4. run the iptables-save command, redirecting the output to /etc/sysconfig/iptables using this command:
    • iptables-save > /etc/sysconfig/iptables

If you did that correctly – your new rules will persist after a reboot or restart of the iptables service.

On a sidenote – its good practice to setup a cron job to stop iptables every 5 mins while you are working on them. This way, if you lock yourself out, all you have to do is wait 5 mins and you can get back on the box to undo whatever you have done. Just don’t forget to stop the cronjob after you are done working with iptables.

WordCamp Phoenix started today!

I’m at the 401 level class for WordCamp Phoenix! So for, its been pretty great. There was a little bit of a debate regarding smart phone adoption verses “feature” phones and a good conversation around QR codes. I’m learning a lot regarding developing plugins that interact with the admin panel – specifically best practices around the code itself. Very geeky and pretty cool!

Tomorrow is the main event. I’m pretty excited about it!

Showing Sharepoint Appended Comments in a dataview webpart

I searched for hours on this one when I came across a few good posts.  The first one I came across talks about using a custom form in display mode to show all of the history from an “Append Changes to Existing Text” field.  Here is a link to that post:

http://unitedsupplyco.sharepointsite.net/publicfacing/bensblog/Lists/Posts/Post.aspx?ID=41#Comments

The author suggests that he/she doesn’t know how to make this work in a dataview webpart.  When I tried this, I got this error:

object reference not set to an instance of an object

I would have likely lived with a custom form as the solution, however since it didn’t work for me, I continued to search.  Next I found a post that basically gives the same solution but this time in a dataview webpart! That post is here:

http://sympmarc.com/2011/02/07/showing-all-versions-of-append-changes-to-existing-text-in-a-data-view-web-part-dvwp

Awesome, except I was still getting an error.  Both posts suggest the solution is to replace the xsl line:

<xsl:value-of select=”[your column name]” disable-output-escaping=”yes” />

with this line:

<SharePoint:AppendOnlyHistory runat=”server” FieldName=”[your column name]” ControlMode=”Display”/>

You should, obviously, replace the [your column name] with the name of your SharePoint column.  Since this was the same solution in both posts (one in a custom form webpart and the other in a dataview webpart), I knew my error message must be from something I’m missing.

Then I figured it out through trial and error.  When I replaced my column name – I took the name from the xsl line – in my case it was {@Project_x0020_Notes} – and put it in the new non-xsl line.  That is when I get the error message.  So I tried removing the curly brackets – no luck.  I tried removing the @ sign – still no luck.  Then, in a total shot in the dark, I tried using the SharePoint friendly name “Project Notes” instead of the xsl formated name Project_x0020_Notes.

BAM! That worked and now I can display all the appended comments in a dataview webpart!  Hope that helps you!

 

How to Make Gmail your Default Email Program in Windows 7 (Updated… again!) – LINKS FIXED!

Here is something I get asked alot – How do I make GMail my default email program in Microsoft Windows 7?  In MS Windows 7, you have the option to change your Default Programs to which ever email program you have installed – but GMail isn’t installed on your computer and doesn’t show up in Default Programs.

You could installed GMail Notifier and set it to open gmail for you when an email link is clicked – but there is another way if you are willing to edit the registry.  I know this can sound a bit technical, but its not difficult to do.  If it does scary you off – then go with the GMail notifier option – otherwise follow these steps:

  1. Right Click on the link below for your browser below
  2. Select Save As
  3. Save to your computer
    1. if you are using chrome – open the txt file you just saved and replace {username} with the username you log in with
  4. Find where you saved the file and change the file extension from .txt to .reg
  5. import the registry file to your computer – (Update: I didn’t mean to sound “geeky” here… to “import” just double click the .reg file, or right click and select import – Windows will do all the “heavy lifting” from there)

If step 4 has you hung up – you need to change your folder options to not hide extensions for known file types.

chrome-gmail <– YOU MUST EDIT {USERNAME} BEFORE YOU IMPORT THIS TO YOUR REGISTRY

IE-gmail

IE64-gmail <– this is for the 64bit version of IE however I don’t use it and don’t recommend using it.

 

Update for Firefox users: According to a comment below, if you’re using Firefox, all you have to do is:
Tools>Options>Applications, then change the mailto action to Use Gmail.

Please leave a comment if that worked for you. Otherwise, here are the registry hacks for Firefox:

firefox-gmail

firefox-gmail-32bit

 
If this post has helped you – help me back by watching my 5 min standup set at StandUp Live in Phoenix AZ. Its free, its funny, and I like the attention! http://www.youtube.com/watch?v=6Eu9DokpBjo

Magento pre-checks – how to install curl, gd, mcrypt, and pdo using cpanel whm – yeah its easy!

I searched for hours and hours after I attempted to install Magento on a godaddy vps only to get this:

Your server does not meet the following requirements in order to install Magento.
The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:
  • You are missing the curl extension
  • You are missing the gd extension
  • You are missing the mcrypt extension
  • You are missing the pdo_mysql extension
  • You are missing the pdo extension
The following requirements were successfully met:
  • You have PHP 5.2.0 (or greater)
  • Safe Mode is off
  • You have MySQL 4.1.20 (or greater)
  • You have the dom extension
  • You have the hash extension
  • You have the iconv extension
  • You have the pcre extension
  • You have the simplexml extension
After hours of searching I found “pecl install pdo” which worked great to address the pdo and pdo_mysql extension issues.  But sadly, “pecl install curl” did nothing (btw, its not supposed to – but I was hopeful).  I found a lot of information about updating the php.ini – most of which talked about removing the ; from the lines required to enable curl, gd, and mcrypt.  Which I did – then restarted apache, then restarted my server, then rebooted my laptop… ok, the laptop was because I loaded patches to it completely unrelated to my server problem, but why not throw that in there?
I found several posts saying “just run /scripts/easyapache”.  Most of these posts assume a certain level of knowledge that I obviously didn’t have.  Once I found that I can actually just type “/scripts/easyapache” at an SSH command line (I know I may have just ‘assumed’ a level of knowledge you may not have but keep reading, it gets easy!)  I ran easyapache and was presented with a text based menu that made no sense to me.  I felt like I was on the right track, but still not there.  The forum where I found the easyapache hint (http://forums.theplanet.com/index.php?showtopic=26527) had several comments with questions about what it does and how to use it – but one comment caught my eye by Erwin:

In CPanel 7, you can now do this in WHM by going to the Software section and choosing:

Update Apache

Then choose mcrypt or any other module you want to recompile PHP with.

And it will do so automatically. Similar to easyapache, but easier to use. I upgraded to PHP 4.3.2 just like that with the modules I want.

So I tried that – realizing the post was pretty old and my screens might be very different.  They were, but I was able to work it out. I went to
  • “Main >> Software >> EasyApache (Apache Update)”.
  • Then I selected the PHP Encryption / E-commerce option.
  • Then “start customizing based on profile”.
  • From there I selected Apache 2.2 (I was currently running 2.0),
  • clicked Next and selected php5, selected build 5.3.2,
  • scroll to the bottom of the page and click “
  • Now we are COOKING! – you can now select curl, gd, mcrypt, pdo, and a whole host of other options.

After selecting those options, I clicked ““.  Now it goes and goes while building apache with all of the options you selected – NO COMPILING, MAKE, MAKE INSTALL, ETC!  It does all of that for you!

I go back to my magento-check.php page and I’m in magento precheck heaven:

Congratulations! Your server meets the requirements for Magento.

  • You have PHP 5.2.0 (or greater)
  • Safe Mode is off
  • You have MySQL 4.1.20 (or greater)
  • You have the curl extension
  • You have the dom extension
  • You have the gd extension
  • You have the hash extension
  • You have the iconv extension
  • You have the mcrypt extension
  • You have the pcre extension
  • You have the pdo extension
  • You have the pdo_mysql extension
  • You have the simplexml extension