Copy SSH Key to Remote Server

This is quite handy when needing to upload your local ssh ket to a remote server.

1. Generate a new SSH key.

2. Copy Key to Remote Server.

3. Log into server without password.

Amazon Kindle. Delete old Documents

So I have in the past use the amazon kindle and kindlefeeder.com to view rss feeds about various topics. Its a great little service, and had been using this for quite some time.

I did however see one drawback. This was in my Amazon.co.uk account I had literally 100′s of kindlefeeder documents building up. The issue was the only way to remove these documents was deleting them 1 by 1.

Then I came across a post on how to run a small piece of java-script to delete en-mass..

All you need to do is open the chrome console and add the following line.

Note: the var docType defines what documents to remove. In my case I wanted to delete all Personal Documents. This is where the kindlefeeder.com documents are posted to automatically.

Also, be aware this works on a page by page basis. But at least it speeds up the process of removing old content.


javascript:(function(){
var docType = "PersonalDocuments";
var v = new RegExp(docType);
if (!v.test(document.URL)) {
return false;
}
{a=document.getElementsByClassName('rowBodyCollapsed');
for(var i = 0; i Fion.deleteItem('deleteItem_'+a[i].getAttribute('asin'));
};
return; }
}
)
();

TAR File Extraction

Another handy tip when extracting a tar file and stripping out any sub directories.

[code]
tar -zxvf filename.tar.gz --strip [number]
[/code]

Note: Where number is the folder level

[code]
tar -zxvf filename.tar.gz --strip 2
[/code]

Install PHP APC from Shell

The following steps are used to install APC from source onto a Ubuntu Server.

[code] sudo aptitude install apache2-dev php5-dev build-essential [/code]

Get current version of apc and install it

[code] wget http://pecl.php.net/get/APC-3.1.13.tgz [/code]
[code] tar xzf APC-3.1.13.tgz [/code]
[code] cd APC-3.1.13 [/code]
[code] phpize [/code]
[code] sudo ./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/bin/php-config --with-libdir=/usr/lib64 [/code]
[code] sudo make [/code]
[code] sudo make install [/code]

Stop Magento Success Page From Completing

The following change is only intended to be used when you are testing the checkout process. Say for example, you would like to stop the posting the orders into magento at the end of the success page. As this will redirect you away from the success page.

[php]
/app/code/core/Mage/Checkout/controllers/OnepageController.php
[/php]

[php]
public function successAction()
{
/*
$session = $this->getOnepage()->getCheckout();
if (!$session->getLastSuccessQuoteId()) {
$this->_redirect(‘checkout/cart’);
return;
}

$lastQuoteId = $session->getLastQuoteId();
$lastOrderId = $session->getLastOrderId();
$lastRecurringProfiles = $session->getLastRecurringProfileIds();
if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
$this->_redirect(‘checkout/cart’);
return;
}

$session->clear();
*/

$this->loadLayout();
$this->_initLayoutMessages(‘checkout/session’);
Mage::dispatchEvent(‘checkout_onepage_controller_success_action’, array(‘order_ids’ => array($lastOrderId)));
$this->renderLayout();
}
[/php]

Visual Studio Permission Error Running from Share

When trying to build a Visual Studio Application from a shared folder I came across the following error:

[vb]
Request for the permission of type ‘System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed. Z:\GIT\WebAPI\API\SBT\Maintenance\Pricing\frmImportProductPriceSpecial.resx Web-API
[/vb]

Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.	Z:\GIT\WebAPI\API\SBT\Maintenance\Pricing\frmImportProductPriceSpecial.resx	Web-API

The fix is as follows:

From an Administrative console window run the following command:

[vb]
caspole.exe -m -ag LocalIntranet_Zone -url \\ip address\Share\ FullTrust -n FullTrustShare
[/vb]

Visual Studio Console Update

Posts from a Developer