Wednesday, March 27, 2013

AWS Auto Scaling through UI

Only Third party tools exist : 

AWS Auto Scaling - Invalid Image Id Problem

If you get an error like : Invalid Image Id while creating a launch configuration : 
One possible reason is : 

1. That your AMI exists in a different region that the one you are creating your config for.

AWS Auto Scaling CLI

1. Step by Step Guide : http://docs.aws.amazon.com/AutoScaling/latest/GettingStartedGuide/SignUp.html
3. Summary of Config : 
In your .bash_profile (on CentOs 6.3), put the correct values for the following : 

export AWS_AUTO_SCALING_HOME=/mnt/aws/AutoScaling-1.0.61.2/
export JAVA_HOME=/usr/
export PATH=$PATH:$AWS_AUTO_SCALING_HOME/bin
export AWS_CREDENTIAL_FILE=/mnt/aws/myCredentialFile
export AWS_AUTO_SCALING_URL=https://autoscaling.ap-southeast-1.amazonaws.com

4. Format of the credentials File(/mnt/aws/myCredentialFile) :

AWSAccessKeyId=AKIAITFNHGOMJKLNJABC
AWSSecretKey=5aFNFbmXPNr/YYhEuFHBMX8czR+AjpdvrRE5nY6r

4a. Get your credentials from : https://portal.aws.amazon.com/gp/aws/securityCredentials#access_credentials

5. List of Other regions : 
http://docs.aws.amazon.com/general/latest/gr/rande.html#as_region


Monday, March 25, 2013

java

instantiating an object of an interface on the fly through anonymous classes : 
  IBlah blah = new IBlah() {      public void doBlah() {          System.out.println("Doing Blah");      }  };

Tuesday, March 19, 2013

Installing PHP Imagick extension on CentOs 6.3

yum install ImageMagick-devel
pecl install imagick
add extension=imagick.so in /etc/php.ini

Monday, March 18, 2013

Tiny Tiny RSS Reader - Unable to update through command line

I tried multiple things but I was unable to run update.php from command line.

Here is the solution.

I just copied the code required for feed updation and ran that script from command line. Here is the code :
Here is the cronjob command(if you are on hostmonster) :
wget complete_path_to update_feeds.php



update_feeds.php
#!/usr/bin/php53s
<?php
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
                get_include_path());

define('DISABLE_SESSIONS', true);

chdir(dirname(__FILE__));

require_once "functions.php";
require_once "rssfuncs.php";
require_once "config.php";
require_once "sanity_check.php";
require_once "db.php";
require_once "db-prefs.php";

if (!defined('PHP_EXECUTABLE'))
define('PHP_EXECUTABLE', '/usr/bin/php53s');

// Create a database connection.
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);

init_connection($link);
// Update all feeds needing a update.
update_daemon_common($link);

// Update feedbrowser
$count = update_feedbrowser_cache($link);
_debug("Feedbrowser updated, $count feeds processed.");

// Purge orphans and cleanup tags
purge_orphans($link, true);

$rc = cleanup_tags($link, 14, 50000);
_debug("Cleaned $rc cached tags.");

db_close($link);

if (file_exists(LOCK_DIRECTORY . "/$lock_filename"))
unlink(LOCK_DIRECTORY . "/$lock_filename");
?>

Sunday, March 17, 2013

Self Host Tiny Tiny RSS Reader

Steps : (Requires PHP 5.3 or above and MySql/PgSql)
If you are using HOSTMONSTER - here is how you can change your PHP version.

1. Get the tarball from http://tt-rss.org/redmine/projects/tt-rss/wiki
2. tar -xvzf <file> in your public_html/read
3. copy config.php.dist to config.php
4. Create a DB and update the info in config.php
5. source schema/ttrss_schema_mysql.sql into that DB.
6. In config.php - make SIMPLE_UPDATE_MODE true and SINGLE_USER_MODE to false.
6a. in the same file change SESSION_COOKIE_LIFETIME to 86400
7. Now login with admin/password

For those who are used to keyboard shortcuts j/k for prev/next article on Google Reader :
1. Enable the plugin googlereaderkeys in Preferences-> Plugins -> User Plugins -> googlereaderkeys


Disabling up/down arrow keys shortcuts :

1. Open include/functions.php
2. go to function get_hotkeys_map
3. comment these lines :

     "(38)|up" => "prev_article",
                                "(40)|down" => "next_article",




Blog Archive