Wednesday, May 18, 2011

My Encounter with TwitterOAuthPlugin for CakePHP

Plugin By: Neril Crookes
This is one of the finest (the only one I know for cakephp) plugins of its kind.

Common mistakes that consumed most of my time:
  1. oauth_token_secret length is not fixed, I took a length of 42 in my databases, so I had the wrong secret and therefore I was having Invalid Signature error.
    Took me a hell lot of time to figure out
  2. php if-else statements used in templates:
    The mistake I was making was like this-

    <?php if(condition) : <some php code> ?>
    while it should have been
    <?php if(condition) : ?> <?php <some php code> ?>




    .....

    Will continue to post such non-traditional errors :)
    .....
Will continue to post such non-traditional errors :)

Tuesday, October 26, 2010

ssh and tunnel- the college freelancer saviour

simple 2 lines to ssh to a server outside the campus:

  1. ssh -L 1090(local port):IP-of-external-server:22(port-which-allows-ssh) user@localserver
  2. In another terminal window type :
    ssh -p 1090 user@localhost


and you are done :D

Yes its that simple :)

Tuesday, October 5, 2010

Ubuntu terminal Aliases

Pretty interesting and they will save you a lot of time ...... lemme show you with an example:
Lets say you are tired of using "sudo apt-get install" again and again , and want to make an alias to it.... simple!

Follow these steps and you'll be good to go
  • Go to you home folder and create a file named:

.bash_aliases

(This can also be done via the terminal like so:

touch ~/.bash_aliases

  • edit the .bash_aliases file to contain:
alias fmp=’sudo apt-cache search'
  • Save the file and open the file named:

.bashrc

Find the section that is commented out (lines preceded with #’s) to looks like this:

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

  • Uncomment those lines. Save and close and then open a new terminal window.
Just try "fmp packageyouneed"
Simple ... ain't it? :)

First Steps to UBUNTU Setup

Ok!
So I'm blogging for the first time here. I had never even thought of it or planned it, but its actually a need .... a need for me myself as I tend to forget stuff that I had done in the past..... of which installing UBUNTU is a very frequent one :P

So...

1) Install Ubuntu via disk or iso file (install inside windows or independently) as you like.
2)After Ubuntu has finished installing, first step will be to set up ip and proxy settings.
IP can be set by using GUI ( Manage VPN connections).
For proxy, you can set it inside the browser (Firefox) itself.
3) Configuring software sources:
  • if the software source requires proxy, do this:
    Make a file apt.conf in /etc/apt and add a line "Acquire::http::Proxy "http://username:pass@server:port/"; "
  • Select the appropriate servers from System>>SoftwareSources
4) For a person like me, who is going to try his hands on Django (or Python) some essential packages are:
  • ipython (python wrapper for python CLI)
  • python-django
  • mysql-server
  • php5
  • phpmyadmin
phpmyadmin will take some efforts to run , here are some instructions to the same

Installing From Package

Install phpMyAdmin from the Universe repository see InstallingSoftware for detailed instructions on using repositories and package managers. (Note, however, that installation from a package manager often does not work).

From console:

sudo apt-get install phpmyadmin
  • If you're using Ubuntu 7.10 (Gutsy) or later select Apache2 from the "Configuring phpmyadmin" dialog box.

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf.

Include /etc/phpmyadmin/apache.conf
  • If you are using Ubuntu 9.04 (Jaunty), there is no need to modify /etc/apache2/apache2.conf as the package installer already copied the file phpmyadmin.conf into /etc/apache2/conf.d directory. You can also skip the set up step and go directly to http:///phpmyadmin and login with the user and password you set up during install.

Once phpMyAdmin is installed point your browser to http://localhost/phpmyadmin to start using it. You should be able to login using any users you've setup in MySQL. If no users have been setup, use admin with no password to login.

Should you get a 404 "Not Found" error when you point your browser to the location of phpMyAdmin (such as: http://localhost/phpmyadmin) this is likely caused by not checking the 'Apache 2' selection during installation. To redo the installation run the following:

 sudo dpkg-reconfigure -plow phpmyadmin

Then select Apache 2 for the webserver you wish to configure.

If this does not work, then you can do the following to include the phpMyadmin-shipped Apache configuration into Apache:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf

sudo /etc/init.d/apache2 reload

  • So, PhpMyAdmin is now set up :)
  • Also install python-mysqldb