GIT and SFTP

Lots of complains adopting git, is not to have a server that support ssh let alone git. A nice post by jefferey way in nettuts suggests deployhq. Thats a nice service with nice GUI . But i was looking for a free solution and found one under a comment in that post.

https://github.com/git-ftp/git-ftp

This not only provides FTP protocol also support SFTP. Here are the steps that i took in my mac os environment.

  • I used brew to install git-ftp:
    $brew install git-ftp
  • This relies on libcurl so next thing i had to install curl with ssh support :
    $brew install curl –with-ssh
  • Brew does not overrides default curl library that comes with osx,  so i had to replace that using
    $sudo rm /usr/bin/curl
    $sudo ln -s /usr/local/Cellar/curl/7.35.0/bin/curl /usr/bin/curl
  • Now I cd into my repository and run :
    $git ftp init -u <username> -p – sftp://<host_url>/<path>
  • It syncs my current HEAD branch into the server and keeps track of last commit. So after making few other commits, i am ready to push latest changes to server. By running:
    $git ftp push -u <username> -p – sftp://<host_url>/<path>

I hope from now on you will use GIT for server deployment.

NOTE: git-ftp stores commit log in a file .git-ftp.log file. If any mishaps happens or you want to re-sync everything. Remove that file and you are good to go.

Advertisements

Sublimetext Plugins: Gitgutter

I am going to write series of posts showing my favorite plugins for Sublimetext editor. Sublimetext is one of the coolest editor around. Today we are going to learn about gitgutter . If you are using git for versioning then you have to have this plugin.  It shows a realtime git diff in your editor.

gitgutter

I was looking for  a plugin like this when i switched from netbeans. Netbeans has this cool plugin named nbgit which i loved most.

I hope this plugin grows more powerful.  BTW you can install this via package control too. More details

CodeIgniter Composer Twig Doctrine

Its not always the power of a framework, its (human) resource that acts as key factor for final selection. On such cases the best option is to add the best things from the new framework and incorporate with the selected one. I really liked symfony2 components and wanted to have that in my CodeIgniter pack also wanted to leverage the power of composer.

After digging and headbanging for few hours; its a SUCCESS. So now my pack relies on composer’s autoload, uses twig template engine and uses doctrine.

Here are my code : ( 99% are of others I just patched those for my need )

Thanks guys for your hard work which saved tons of hours for me. Here are the references:

  1. http://philsturgeon.co.uk/blog/2012/05/composer-with-codeigniter
  2. https://github.com/dilantha/codeigniter-twig
  3. http://www.joelverhagen.com/blog/2011/05/setting-up-codeigniter-2-with-doctrine-2-the-right-way/

I will try to update this code based on issues i face. Do let me know if anything  is missing or needs any modification.

Traffic Shaping using TC

A year ago I configured a local ISP server for my friend. Later I created a PERL script to generate tc commands for Traffic shaping. I wanted to share a step by step guide on how to do that. As usual that didn’t saw the daylight. Today I saw a nice post on tc in here. At last I decided to publish my PERL script. You can get the Script in here :  github.com/neotohin . The script does some very basic things:

  1. add/edit cilent
  2. Remove client
  3. Set bw limit to client
  4. Generate the script file to be run in startup.

This was my first PERL script so if you are a perl guru please share your thoughts.

Back

Nope !  i am not gone. Neither i have stopped coding nor i quit from my dev life. I am working my ass off more than any days from the past (bfr 2010). I have become more systematic(really!), more organized(WTF!) and more creative (Oh yeah!).  Don’t think i am not aware with the progress of CI to CI Reactor .. Starting of Drupal 7 or the new layout of Facebook. Though my current job forces me to stick with Drupal mostly but still my interest for CodeIgniter never withered .

So why this post — a modest warning of my coming back. Get ready for  some new posts — mostly drupal ( drush, git, management etc.) ..   BEST OF LUCK TO ME 🙂

 

 

 

Debugging CodeIgniter Project using Xdebug and Netbeans

Finding the right way to debug PHP projects has always been a hot topic. Primitive solutions like `echo`, `print_r`,`var_dump` has always been the power tool 🙂 for my type of ppl .  Let us forget those painful nights and go to a quick debugging solution with Xdebug and Netbeans 6.8; in a 1-2-3 step guide for CodeIgniter.

What i am expecting from you:

  • You already have a running web server [ Xampp/WAMP/ Uniform server ]
  • You know how to install Netbeans IDE 6.8 or it’s already running in your environment
  • You know what is CodeIgniter
  • You are not a complete Newbie

# STEP – 1

First add extension Xdebug in PHP. Download latest stable Xdebug version from Xdebug.org. Follow the procedures. If you are lazy like me and don’t want to read the whole thing [it’s a bad habit 🙂 ] copy the following settings and put at the end of your php.ini by not forgetting to change the path 🙂

zend_extension_ts="C:/wamp/bin/php/php5.2.9-1/ext/php_xdebug-2.0.4-5.2.8.dll"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

Note: If anything messes up later; come back and study those links over and over till u understand the whole thing.

# STEP – 2

Configure CodeIgniter to accept ‘?XDEBUG_SESSION_START=netbeans-xdebug’. You can follow one of my post or check in codeigniter forums for accepting GET data in CodeIgniter.

Start Netbeans IDE. Goto Tools >> Options >> PHP >> General: and check for settings in Debugging section. By default the port should be 9000 and Session-ID ‘netbeans-xdebug’.

#STEP -3 [ FINAL 😀 ]

Let’s say, You have installed a ‘test’ CodeIgniter application in your web server. Now add that application as a project in Netbeans 6.8 . Goto Project properties by right clicking on the project ‘test’.  Now go to ‘Run Configuration’ and click ‘advanced’  select ‘Ask Every time’ in Debug URL.

Now Open your ‘welcome’ controller and press ‘Ctrl+F5’ which will request for the URL:

specify url

insert ‘http://localhost/test/&#8217;  and press ‘Ok’.  Next select `Server side PHP`.

Clicking in ‘Debug’ button will open ‘http://localhost/test/?XDEBUG_SESSION_START=netbeans-xdebug‘ In you default web browser.

Now check in status bar for:

And check in toolbar for:

If those 2 shows up then u have successfully installed Xdebug+Netbeans. Your IDE is ready to do some debugging. Take your cursor over a line on index function of welcome.php; press ‘F4’ this will execute php scripts till that cursor. Dont worry if index.php is opened up focusing on first line.

Now You can watch for variables or step into functions or step over. You can check your code line by line.

Read this link which have brief discussion on what options you have for Debugging :).


My counting on steps could be wrong 🙂 .. bt it looks nice 1-2-3. I tried not to explain a lot; so for more details study provided links.  I hope this will make your life more easier. Enjoy !!