Log – 1: Network Server and B/W Re-seller

Some Background Talk:

It was way back when I first got my hand on linux in 2002. It was a Red-hat. My neighbour Zakir Uncle introduced it to me. He told me at that time, linux holds gr8 features and u can do so many things with it. But all I did was ( cd .. / cd. / mkdir / touch / ).  I removed linux after 1month cause it was boring( what do u expect from a 3month old experienced computer user? ). Later, I experiment with different linux versions ( fedora, mandrake); and did able to make it popular enough that my late cousin (she died in 2008), my little sister and even my aunt used linux. Just to play Shishanshu and Mahjong.

In February, 2009 jhoroTEK configured the network server at Skyinnova (experimental work), where we configured a central server with Fedora Core 10 and squid. Adnan made it a success. [ He was suppose to write an article on it. Hopefully he will put it sooner.] My  friend Harun-ur Rashid who is a B/W  re-seller in our area was using squid as a proxy server and tc for traffic shaping.  No visual admin section and no DHCP.  So I got the perfect opportunity to experiment at his place.

For the Reader:

It’s not a complete tutorial on Configuring a network Server using CENT OS rather an experience sharing.  If you can take the clues and see the rose line u will find the destiny 😉 .  My task is still on-going;  if you have better suggestion then drop a comment.

If you want more details or consultancy then contact me.

Follow me on twitter  @neotohin  to see which step i am right now and some tips 🙂 .

Things in my hand:

  1. An 1 mbps B/W from ISP provider
  2. A Core-2-duo Machine ( server ), A Pentium 4 client Machine)
  3. 1 switch,  1 hub
  4. CentOS 5.2

Task :

  1. Share the B/W with clients in sub-network
  2. Traffic Shaping Each client will have different kind of B/W plan like  16KB to 64KB shared.
  3. DHCP Server + MAC binding [ future PPP ]
  4. Proxy Server
  5. FTP, WEB server ( Simple extensions )
  6. More interesting things to come 😉

Let the Journey Begin ====================================

Advertisements

Another Captcha Library for CodeIgniter

One of our client wanted a different captcha in his website. We were using the default captcha plugin which bundles with CodeIgniter. I have used this script on a different project long ago and that one was a scratch coding. So, i took some of my time and ported it to CodeIgniter.

Features:

  • Change the Captcha Background Color
  • Choose Font / Random Font from fonts folder
  • Increase Number of lines for Noise Creation
  • Different color or custom colors for Line used for Noise.
  • Captcha Letters have different colors or you can provide your own color set.
  • Custom Image Height/Weight/Font-size
  • Many more…

Expected Look :

Captcha CI libraray

Captcha CI libraray

Requirment: CodeIgniter 1.7.* , GD, PHP 4/5

SOURCE CODE: In github [ How to  Use?  Check wiki page. ]

Using Drush ( Power tool for Drupal ) in Windows XP

At first when I saw drush i thought it’s not that handy as it seems to be. I thought some geek created this just to have fun and feel command line flexibility. But after i dig deeper i found it amazing. If you understand how to use drush you will be amazed by it’s power.

Now what is drush .. drush is a command line shell and Unix scripting interface for Drupal. as stated in here.  The most noteable features of drush from my point of view is :   module enable/disable, update script,  module download, cache clear. Just from command mode i can check latest version of module and dl them and enable them in just simple 3 to 4 commands.

I am not going to briefly explain drush functionality but will try to explain how to run drush in your system in this case Windows XP ( 😛 ) .  Here it goes:

  • Download the latest version of drush from drupal
  • Now open Command prompt and check and set initial settings.
    • Type ‘php’ and press enter if php command is not found then set php.exe path in your Environment
    • Also add the drush path into the environment path
    • By Closing and opening  command prompt again. check by typing ‘drush’
    • If by typing ‘drush’ shows error regarding drush.php open drush.bat file in an editor and  add the abosulute path of drush.php in that bat file.
    • This will fix the drush.php path problem.
  • Let’s play with drush. Open command prompt again and traverse to a drupal installation for example:  ‘cd d:/www/mydrupal’  and then type  ‘drush status’. It will show initial settings of mydrupal installation. If it does not check for settings and environment path.

Drush has some nice extensions. You can play around with them. Here is another simple tip for you. If you study drush you will definately like “drush -v dl ” and ‘drush info” command. “drush info <module_name>” shows particular modules downloadable version and “drush -v dl” can help you to download and copy the file directly into your installation by just 1 single command. But to use ‘drush -v dl’ is little tricky. It uses gzip and tar command to extract the downloaded module file. You can download gzip and tar exe for windows from here.

It seems some ppl did able to use gzip and tar without any hasle but in my case i had trouble with tar. So i hacked into the core of drush and changed the tar command into izarce . If you face problem with tar then go with izarce. It worked for me.

Oops. To use izarce first install the command line version. Then add the izarce location into your environment path. THen goto drush directory and open file ‘drush\commands\pm\package_handler\wget.inc’.  Now find the line which says:

drush_shell_exec(“tar -xf $tarpath -C \”$path\””);

Now replace this with

drush_shell_exec(“izarce -e -d -p”. $path . ” $tarpath”);

It worked for me hope this does for you too. Have a nice drushed life.

[ N.B. At first i tried to use 7zip instead of izarce and gzip+tar but they have some absolute path issue; the solution of which i could not find. So, if you do know of any solution better than this do let me know.

For setting environment   press “windows key+ pausebreak” >> Advanced >> ‘environment variable’ >> now find variable path .. 🙂 enjoy]

CodeIgniter and GET Method working to-gether

This is a personal note kind of post.. So, those who knew already about this… just can skip.. 🙂 . But for a short summary, to use the power of GET method by not setting the CI as Query string based URL. 

Target To achieve: 

http://localhost/myapp/mycontroller/mymethod/?possible=yes

create file MY_Input.php in your application/library/
[ Reason: SO that CI does not destroy GET Method ] 

<?php
class MY_Input extends CI_Input {
    function _sanitize_globals()
    {
        $this->allow_get_array = TRUE;
        parent::_sanitize_globals();
    }    
Change following variable in your Config.php 
$config[‘permitted_uri_chars’] = ‘a-z 0-9~%?=&.:_\-‘;
$config[‘index_page’] = “”;
.htaccess File [ Thanks to Adnan ]
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 
Some Workaround: 
1. If you want to accept GET data in your controller’s index method.. have to use 
Reference:
It worked out fine for me. My CI version is : 1.6.3

Some Firefox Add-on that makes me say ‘WOW’

Here i am mentioning some of the firefox add-ons which makes me say ‘Wow’ in a not geekish way.  Though this is late but i found them just today and could not restrain myself from sharing these to all :D.

 

Cooliris
Full-Screen, 3D — Cooliris transforms your browser into a lightning fast, cinematic way to browse online photos and videos.

 This takes image/video searching   in a new height. Must see.

FoxTab

It’s better than FastDial in sense of look … But i like them both. 🙂 

Let me know if you have seen such kind of innovative add-ons or application .. Do share. 😉

Jhoro T-Shirt

At last we ( JhoroTEK ) got our own T-shirt.. . Here is a visual demo of our T-Shirt…

From now on we are going to wear this T-shirt in our office.  Except in some formal meeting or other situation.