Wednesday, December 21, 2011

Unload/Uninstall Trend Micro Office Scan client 10.5

Trend Micro.svg

I wonder why to block the everything instead of trying to grow the culture for trust and reliability and ownership ? I wonder why this freaking Trend Micro's Office Scan to narrow down the accesses ?! I was ok with it untill when they locked access to my external devices which is really essential for me to back all my things up. After couple of google here is the solution I got to Unload(disable) or Uninstall Trend Micro Client where a prompt comes up for a password.

  • Go to the ..\Trend Micro\OfficeScan Client directory. Usually, it would be: 

C:\Program files\Trend Micro\Officescan Client\

  • Locate and open the Ofcscan.ini[this is the file where all the configuration setting for the OfficeScan client is stored ] file using any text editor. You may use notepad to edit. 
  • Find [INI_CLIENT_SECTION] section. 
  • Change the value of the Uninstall_Pwd to 

  • Change the value of the Unload_Pwd to 
  • Save and close the file.
  • Right click on the Officescan client on your system tray then click on Unload Officescan
  • Once it prompts you for the password type trendmicro as the password.
You should be able to see your officescan client on the system disappear. Now you are free from all the blocking imposed by this tool. I can access my external devices... o la la :D

  • If you can't save the Ofscan.ini file [windows 7] open the editor as administrator - right mouse on the editor program and click run as administrator.
  • If Client_Allow_Uninstall / Client_Allow_Unload set to 0 make it 1.
  • If UnloadProtect is set to make it 0.

Wednesday, December 7, 2011

My Instant Continuous Integration environment for development

A simplest dev environment for continuous integration for a dev team [considering a php project with mysql db] :
1. Install Visual SVN server - its for windows and easy to install and manage SVN server.
2. Create a post commit hook for the repo; to do that - In the VisualSVN Server GUI Tool:
-Select your repository
-Right click Properties Select the Hooks tab
-Select the Post-commit hook
-Click the Edit button.
-Enter a line like this into the textbox:
c:\program files\visualsvn server\bin\svn.exe" export C:\inetpub\wwwroot\YourWebsite --quiet --non-interactive --force --username youruser --password yourpassword
-Click Ok.
3. Now for the DB Sync follow the steps in the following article : [However, you might need some modification to meet your need]

Surely, You can add more flavor to this environment, like you can add a script to run each day so that it grabs all the commit logs and emails to the test team and/or stack holders or may to the entire team - so that everybody remains better informed.

Hope this will help us a to remain synced in an Agile team.
Those who is not aware of the term Continuous Integration, you can check this wikipedia link

Sunday, November 13, 2011

Installing php driver for MongoDB

PHP      &   mongoDB

This is the post where I will configure php to work with mongoDB. On my previous post I have put the teps I followed to install mongoDB on my Ubuntu [TurnKey Linux] running on VirtualBox.
sudo pecl install mongo
2.Open your php.ini file and add to it:
It is recommended to add this to the section with the other "extensions", but it will work from anywhere within the php.ini file.
3.Restart your web server (Apache, nginx, etc.) for the change to take effect.
pecl requires that pear be installed. For those using apt-get, you may need to run the following:
sudo apt-get install php5-dev php5-cli php-pear
However, you can download the source for the driver and can compile it manually :
shell> tar -xzvf mongo-1.2.6.tar.gz
shell> cd mongo-1.2.6
shell> phpize
shell> ./configure
shell> make
shell> make install
Check with the phpinfo

Starting MongoDB and php on Ubuntu

Installing MongoDB on Ubuntu:
1. Add 10gen package to source.list 
The 10gen package contains the latest mongoDB version, append below line to the end of the file “/etc/apt/sources.list
deb dist 10gen
For example, you can vim the “source.list” and append the 10gen package like this :
$ sudo vim /etc/apt/sources.list
File : /etc/apt/sources.list
#...content omitted ...
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb natty main
deb-src natty main
 #mongo repo ##########
deb dist 10gen

 2. Update package
Update the modified “/etc/apt/sources.list” :
sudo apt-get update
Now, a new “mongodb-10gen – An object/document-oriented database” is available for install.
  3. Add GPG Key
10gen package required GPG key, import it :
sudo apt-key adv --keyserver --recv 7F0CEB10
   4. Install mongodb-10gen
Everything is ready, now you can Install the mongoDB package :
sudo apt-get install mongodb-10gen
    5. Post-InstallationVerification
Now, mongoDB is installed, started, and auto start mongoDB script is generated to “/etc/init/mongo” and “/etc/init.d/mongo“. In addition, all mongoDB files are copied to “/usr/bin” folder.

The main configuration file “mongodb.conf” is located at “/etc/mongodb.conf“, change the values to customize your mongoDB server.

File : mongodb.conf
# mongodb.conf
# Where to store the data.
# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
#where to log
logpath=/var/log/mongodb/mongodb.log logappend=true
#port = 27017
   6. Verification
To verify it, just connect it with “mongo”
$ mongo
MongoDB shell version: 1.8.1 connecting to: test
on my next post I will try to connect php with this mongoDB.

Friday, November 4, 2011

Parsing Email with PHP

I was working for a Email Advertisement tool,recently. And the first thing I was put to work with is to develop a parser that parses and incoming email and decides whether it is a bounced back email. After couple of googling I got some fare enough solution that I wanted to use for the solution. The steps I followed for the solution are adopted from the following :
HOWTO: Email Bounce handling with PHP, Exim & CPanel, Catch bounces from non-deliverable emails

And the very basic parser I wrote can be downloaded from the following location:
Download the email parser for bounce management
[Bascially It's a codeIgniter controller, but you can use it as you wanna use it]

However, I had to go some more details parsing, later to decide the type of bounce or the reason for the bounce.First I tried parsing the log file for the exim [exim_mainlog file] and then parsing the entire body of the bounced back emails. I will share two more posts on them in this series.

Monday, October 3, 2011

Hack a Blackberry 9700 Bold to access internet without BlackBerry data service

[I kept this post for long as Draft; thought I shud l publish; ]
Playing with the Blackberry 9700 from Sujoy who was not using it because it cost a lot to enable Blackberry service with the Operators who are offering BB services.
So I picked it up just to see why should such a device left unused just because some kinda service is not available or bcz its expensive. Following are the things what I am currently doing with it :
Setting the Internet connection without the Blackberry data service :
First of all you have to set up your tcp settings. In your BlackBerry menu go to => Options - Advanced Options - TCP and enter your APN information for your GSM Service.You can ask your customer care for the APN information.When you finish the settings you need a browser to surf the net. The best one is Opera Mini Browser. You download the Opera Browser to your BlackBerry and in the Opera Browser menu you go through automatic network setup. Once the Opera Browser finds out your settings you are ready to surf the net from you BlackBerry for free. (Excluding standart connection charges- for the GPRS/Edge from your GSM service provider)
Happy, browsing then without paying the BB service :P.

Saturday, July 2, 2011

Node.js : Simple push from server to browser

Here you go a test that a tasted while playing with Nodejs.I must say that it is a great fun playing with Nodejs.I always love to create real time environment for the web. Here is a little example of it. With this piece of code you'll be able to monitor any changes in a file in real time directly from your browser. Nothing too efficient but still a very good start. 

My flavor : On this video you will see Pedro is using a log file. Instead, I used a simple text file and updated the file manually.

Issue I faced : Din work for me on google chrome but was good on firefox. After investigation here seems a little convincing reason :

For getting started with  Node.js,  You'll get a complete set of video tutorials at the following location : [the video I have shared here is the second episode from the series]

Happy Techifying the world :)    
Update: just got another example of similar push server ; utilizing

Simple Hacks for windows using regedit

Following is a list of some interesting restrictions, which can be made in Windows 2000, XP, 2003, Vista, 2008 and 7. Like you can restrict Display properties, task bar properties, folder options, etc. All tricks are based on Registry editing. So I'll tell the key name and the value, that you have to create for the restriction. If the key is not present, then simply create it.

1.) Restrict Display Properties:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\System
create DWORD value NoDispCPL and set its value to 1

2.) Restrict Taskbar Properties:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoSetTaskbar and set its value to 1

3.) Restrict Folder Options:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoFolderOptions and set its value to 1

4.) Restrict Locking/Unlocking the taskbar:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value LockTaskbar and set its value to 1

5.) Restrict Active Desktop:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoActiveDesktop and set its value to 1

6.) Restrict adding/deleting items from Toolbars:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoToolbarCustomize and set its value to 1

7.) Restrict adding/deleting toolbars:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoBandCustomize and set its value to 1

8.) Restrict right-click in Start Menu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value NoChangeStartMenu and set its value to 1

9.) Restrict Desktop Cleanup Wizard:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value No Desktop Clean up Wizard and set its value to 1

10.) Restrict notification at low disk space:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value No Low Disk Space Checks and set its value to 1

11.) Restrict Taskbar Context Menu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
create DWORD value No Tray Context Menu and set its value to 1

12.) Restrict Programs to run:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer\DisallowRun
create String value with any name, like 1 and set its value to the program's EXE file.
e.g., If you want to restrict msconfig, then create a String value 1 and set its value to msconfig.exe. If you want to restrict more programs, then simply create more String values with names 2, 3 and so on and set their values to the program's exe.

13.) Restrict Registry Editor:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\System
create DWORD value Disable Registry Tools and set its value to 1

14.) Restrict Task Manager:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\System
create DWORD value Disable TaskMgr and set its value to 1

15.) Restrict Writing to USB Drives:
HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\ ControlSet \Control\ Storage Device Policies
Create DWORD value Write Protect and set its value to 1

16.) Restrict New option in context menu:
HKEY_CLASSES_ROOT\Directory\Background\ shellex\ Context Menu Handlers\New
And delete the value of Default, e.g., empty it.

17.) Restrict Send To in context menu:
HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenu Handlers\Send To
And delete the value of Default, e.g., empty it.

18.) Restrict Balloon Tips:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\Advanced
Create DWORD value EnableBalloonTips and set its value to 0

19.) Restrict Users to enable New XP StartMenu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
Create DWORD value No Simple Start Menu and set its value to 1

20.) Restrict Command Prompt:
Create DWORD value Disable CMD and set its value to 2

21.) Restrict Drives in My Computer:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
In right-side pane, create a new DWORD value No View On Drive and change its value as following:

3 : To Restrict A and B drives only.
4 : To Restrict C drive only.
7 : To Restrict A, B, and C drives only.
8 : To Restrict D drive only.
F : To Restrict A, B, C, and D drives only.
03FFFFFF : To Restrict all drives.

And if you want more specific restrictions, like you want to restrict a combination of other drives, then you can use decimal no. instead of hexadecimal no. Following is a list for all drives decimal no.:

A: 1
B: 2
C: 4
D: 8
E: 16
F: 32
G: 64
H: 128
I: 256
J: 512
K: 1024
L: 2048
M: 4096
N: 8192
O: 16384
P: 32768
Q: 65536
R: 131072
S: 262144
T: 524288
U: 1048576
V: 2097152
W: 4194304
X: 8388608
Y: 16777216
Z: 33554432
ALL: 67108863

So if you want to disable a combination of drives, just sum their numbers and give the same value to NoViewOnDrive. e.g., for restricting C, D, E and F drives, give the value: 4+8+16+32 = 60
NOTE: You can also hide the drives using No Drives DWORD value. The location and its value remain same as the above trick.

22.) Restrict RUN in New XP Start Menu:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
Create DWORD value No Run and set its value to 1

23.) Restrict Control Panel:
HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\Explorer
Create DWORD value No Control Panel and set its value to 1

NOTE: If you want to remove the restriction, then simply delete the DWORD value or set its value to 0
So, that's some simple hacks that you can try to fight the battle against any virus, worms, trojan horse, malware or spyware or even your naive system admin :P Have fun :) .

Thursday, June 23, 2011

Fun with SAPI

Following vb script pronounces what you write- I tried on my win7 box and I thought it's fun to get started with SAPI. Write the code on Notepad and save the file with extension .vbs.

Then clicking the vb script file will show you the following window - write what you want to listen on the text box and press ok, did you hear that ? :P

I have some more idea based on it; do you ? Will share once I can create some more fun with it :)

Resources for Face Detection

I always had some interest in working with faces :B - yeah face detection and recognition. following is a list I have found once on the internet; thought might be helpful for me someday when I'll get some time to work with seriously :S.
Face detection (or more generally Image Matching resources):
Facedectection in C# with less than 50 LoC
Face Detection in (pure) C#
Easy to use Wrapper (DLL) for Intel’s OpenCV Library with Examples
OpenCV (Open Source Computer Vision) for C#
Emgu CV
SharperCV Project
[C#] OpenCV
Webcam in C#: with OpenCVDotNet
OpenCV / SURF How to generate a image hash / fingerprint / signature out of the descriptors?
Face Detection and Identification
Phase Correlation in OpenCV

A proprietary tool but had a lot of fun with the following tool:

Wednesday, June 8, 2011

Free hosting and services for Node.js

If you wanna start playing with Node.js the best way I think is burning a box with Ubuntu or CentOS and start with installing and creating simple hello world  servers. But if the box is instantly not available to you and you are dieing of testing (!! or tasting !!) this incredible technology (it is already being called the future of web !!) then there are some good folks who have come up with the solutions where you can experiment with your thirst for Node.js.
As I always try to check how it works first - instead
of starting from the root of it - I was looking for free
hosting that comes up with Node.js already built in and easy-to-utilize. Here I am going to share the list of them and my experience and/or what others think of them :
  • Nodester : Fair enough. Just registered will update the review soon. Ref link :
  • Nodejitsu. :(Seems the folks are fond of Martial Arts :P ) Still not open for public. Request only. I have requested for a Coupon- don get the response yet- but seems good enough. Ref link :
  • Joyent Node: I kinda like there url : Just requested for a coupon and waiting for the response. will update with my experience soon.

Monday, May 30, 2011

Playing with Node.js

I was watching a lot of noises speaking high about an incredible technology - a server framework : Node.js.
I was looking for a chance to play with it and this is what I was doing for the last two hours :
Installing Node.js on CentOS box :
1. You will need gc++ if you wanna compile from the source ; so if you don have it just do :
yum install gc-c++
2. You will need python; if you don have it already just do :
yum install python
3. Now download the Node.js source available as tarball from the website : Node.js.
4. Extract the tarball, cd within the directory and sequncially do the following :
make install
5. Hurrah, most possibly you are done ;) You wanna check ? just do :
node --version
possibly you are seeing the installed node version :)

On the next post I will try to create couple of example apps to play even more with Node.js.So, Stay tuned :P

Wednesday, April 6, 2011

Installing ffmpeg and other extensions and tools to use with php

Installing FFMpeg
yum install ffmpeg ffmpeg-devel
If you get package not found, then you will need to add few lines in the yum repository for dag packages installation. Create a file named dag.repo in /etc/yum.repos.d with the following contents on it
name=Dag RPM Repository for Red Hat Enterprise Linux
yum install ffmpeg ffmpeg-devel
If everything is fine, then the installation should proceed smoothly. If not you will get something like warning GPG public key missing .

Common Errors

To fix rpmforge GPG key warning:
rpm -Uhv
For more information refer to this faq depending on Centos version
Missing Dependency Error:
If you get missing dependency error like shown below, in the middle of ffmpeg installation
Error: Missing Dependency: is needed by package ffmpeg
Error: Missing Dependency: is needed by package ffmpeg
Error: Missing Dependency: rtld(GNU_HASH) is needed by package ffmpeg
Error: Missing Dependency: is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package gsm
Error: Missing Dependency: is needed by package x264
Error: Missing Dependency: rtld(GNU_HASH) is needed by package xvidcore
Error: Missing Dependency: is needed by package lame
Error: Missing Dependency: is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faad2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package x264
Error: Missing Dependency: rtld(GNU_HASH) is needed by package lame
Error: Missing Dependency: is needed by package xvidcore
Error: Missing Dependency: is needed by package faac
Error: Missing Dependency: is needed by package faad2
Error: Missing Dependency: is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faac
Error: Missing Dependency: is needed by package gsm
Error: Missing Dependency: is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package libmp4v2
Error: Missing Dependency: is needed by package libmp4v2
then most commonly you have GLIB 2.3 installed instead of GLIB 2.4 version. To check the current GLIB version installed on your server. just use
yum list glib*
and it should list the latest GLIB package version.

The reason i was getting this error was my rpmforge packages was pointed to centos 5 versions instead of centos 4.6.

To fix dependency error:

To fix this error, you might need to check your rpmforge packages compatible to the release of your existing CentOS version.
Check the file /etc/yum.repos.d/rpmforge.repo and it should look like for Centos 4.6(Final). If you have lines like you might need to make changes to therpmforge.repos like shown below

Note: Backup the original rpmforge.repo file before you edit its content.
name = Red Hat Enterprise $releasever - - dag
#baseurl =$basearch/dag
mirrorlist =
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
To know what linux type and version you are running
cat /etc/redhat-release
Once this is done, do again yum install ffmpeg.
This trick resolved the problem in my linux box running Centos 4.6 and this is the only way i found to install ffmpeg using yum.
To check the FFmpeg working:

Finally, check the ffmpeg whether it is working or not.
ffmpeg -formats
ffmpeg --help
// This lists path of mpeg, its modules and other path information
ffmpeg -i Input.file Output.file
To check what audi/video formats are supported
ffmpeg -formats > ffmpeg-format.txt
Open the ffmpeg-formats.txt to see the output
D means decode
E means encode
V means video
A means audio
T = Truncated

Install FFMPEG-PHP Extension
FFmpeg-php is a very good extension and wrapper for PHP which can pull useful information about video through API interface. Inorder to install it you will need to download the source file and then compile and install extension in your server. You can download the source tarball :
wget /path/to/this/file/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-0.6.0.tbz2
make install
Common Errors

1. If you get command not found error for phpize, then you will need to do yum install php-devel
2. If you get error like "ffmpeg headers not found" while configuring the source.
configure: error: ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option
then it means you have not installed ffmpeg-devel packages.
To Fix: Just install ffmpeg-devel using
yum install ffmpeg-devel
3. If you get an error like shared libraries not found problem and the program halts in the middle, then you must specify the ffmpeg installed path explicitly to the ./configure.
configure: error: ffmpeg shared libraries not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option
To Fix:
1. First find out the ffmpeg path with ffmpeg --help command. The prefix default path should be like /usr/local/cpffmpeg
2. Configure the FFmpeg-php with --with-ffmpeg option
./configure --with-ffmpeg=/usr/local/cpffmpeg
That should resolve the problem!

Issue that I faced while installing the ffmpeg-php of version 0.6.0 :
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_toGDImage’:
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_ffmpeg_frame’:
/tmp/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Erreur 1
Fix to this issue :
Just open the ffmpeg_frame.c file and replace the PIX_FMT_RGBA32 with PIX_FMT_RGB32. With vi you can do it as :
vi ffmpeg_frame.c
However I just opened it on a text editor on my windows and applied find and replace ;)
After the replacement is done you have surely you have to do the configure and make and make install as :
make install
[before performing a make this time it is recommended you do a make clean]

Editing php.ini
Once you have done that without any problems then you will see the php extension file /usr/lib/php/modules/ and you will need mention that extension in php.ini file
vi /etc//php.ini
Put the below two lines at the end of the php.ini file
Then restart the server service httpd restart. In my case I had a server from godaddy and I had to do the following to restart the webserver :
/usr/sbin/apachectl graceful
To check whether ffmpeg enabled with php, point your browser to test.php file. It should show the confirmation of installed ffmpeg php extension
// #test.php
This is what you are suppose to get :
If any case the ffmpeg does not show in the phpinfo() test make sure that php.ini path to is correct. Still the problem occurs, the reason could be you might be using older versions of ffmpeg-php which is buggy. Just download the latest version of ffmpeg-php source then compile it.
Installing Mplayer + Mencoder
To know more about Mplayer
Just issue the following yum commands to install the rest of the packages.
yum install mplayer mencoder
Installing FlvTool2
Flvtool2 is a flash video file manipulation tool. It can calculate metadata and can cut and edit cue points for flv files.
If you are on Centos 5 try yum install flvtool2 [worked fine with me] with dag repository and if you get package not found you will need to manually download and compile the flvtool2. You can download latest version of flvtool2 here:
ruby setup.rb config
ruby setup.rb setup
sudo ruby setup.rb install
If you get command not found error, it probably means that you dont have ruby installed.
yum install ruby
Thats it! Once ffmpeg works fine with php extension, download a sample video, convert to .flv format in the command line and plug it to flowplayer to see it work on your web browser. Try also to download the video file offline and see whether the converted flv file works well with both audio and video.
Now following is how you might wanna play with this beautiful tool/toolset :
This is how ffmpeg actually works :

Here is a some tutorials to play with ffmepg.

Reference :

Wednesday, March 30, 2011

Konami Code : Fun way to show up some secret information (!!)

"The Konami Code, known in Japan as the Konami Command(コナミコマンド Konami Komando), is a cheat code that appears in many Konami video games, although the code also appears in some non-Konami games."
To get more information you can check the best of the bests information source wikipedia pages. And to get more interested seeing who else on the web are utilizing this fun way to publish (!!) information please visit : [you have to try the Konami Code to get the list though :| ]
I thought why not I secretly embed my information into whatever I develop. So there came the jQuery solution for it. I basically merged two of the plugins from jQuery.
There are a number of Konami code plugins online - you can grab any of them - But make sure that the one you are trying works for all browser [the browser compatibility as they say :P I found couple of them not compatible to some browsers] . Following are couple of them that you can check :
And then to show up the information nicely I have plugged in the jQuery notification plugin jNotify
BTW, I'm gonna submit my code soon [sorry I don have a clean copy of my work right now :S] Till then stay tuned and help thyself :P

iGoogle like interface using CodeIgniter and jQuery

iGoogle-like Interface

I was asked to develop an interface that would look like iGoogle webtop. And as always do I instantly started googling and this post is the result of what I got and what I lastly went for.
I googled and I got some solutions already there :
  1. Picok : Which I got hectic to configure and modify [as I was in hurry I din check it very well thought but I think it has some potential]
  2. jPolite : I loved this solution but thought might be little tricky to implement the back end.I strongly suggest if you have some time please look at this solution.
But finally I actually decided to go with a simpler solution starting from an interface developed utilizing jQuery and creating a Codeigniter back end for it.
How to create the UI, you will get the complete article from net.tuts+  . However, to get the Codeigniter version you can download it from the following location. I am telling you the implementation is not a rocket science so far, but I have a plan to extend it and may be will create a complete opensource project some day.
Till then wait or Download and start one by yourself :)
Please comment some other opensource reference if you got any. 

Thursday, January 20, 2011

How to deploy DKIM email authentication in 4 steps

DKIM is an emerging e-mail authentication standard supported by Yahoo, Google and others ISPs, as well as a growing number of Email Service Providers that was developed by the Internet Engineering Task Force. DKIM allows an organization to cryptographically sign outgoing e-mail to verify that it sent the message. Deploying DKIM for your company is pretty straightforward. If you are managing all of your own email servers and outbound email, including sales, marketing and transactional emails, there are 4 steps. If you are using an ESP there are 2 very simple steps that take about 10 minutes. Here’s the rundown.
DKIM provides email authentication and often complements Email authorization. Email authorization is implemented using 'Sender Policy Framework' ("SPF") and/or SenderID. I'll explain how to configure SenderID/SPF in a related posting.
Configuring DKIM (Companies Managing their Own MTAs)
If you are hosting your own email servers, your company needs to take these 4 steps to deploy the emerging DomainKeys Identified Mail (DKIM) standard:
Step #1:
Figure out all the domains that are allowed to send outbound mail on its behalf. Often this includes multiple corporate domains as well as third-party e-mail Service Providers (like Pinpointe). This is often the hardest step - especially for large organizations.
Step #2:
Next you’ll use an online wizard to create the DKIM public / private key pairing and the policy record. The ‘public’ key is a key that will be placed in your public-facing DNS record along with what’s called a ‘policy record’.
The ‘private’ key is a long key that is installed on the MTA/Email sending system(s). When you send an email, the outgoing email server (or the outgoing server of your Email Service Provider, such as Pinpointe), adds the
Here are two online wizards you can use to create the public/private key pair and the policy record. You just enter your sending domain and a ’selector’ - which is kind of like a password key (if you use an ESP - the ESP does all this for you):
Step #3:
Create DNS text records that include DKIM information for every domain that is used to send e-mail. These records will be inserted in your public facing DNS record for each sending domain. If you don’t know how to insert / modify your DNS entry, you can find a description in our description of setting up an SPF record - the process is pretty much the same:
Step #4:
Upgrade your emails servers and/or software to support DKIM. (Note - In the Email world, Email servers are often called “message transfer agents” or “MTAs”).” MTAs are the last component of a messaging system to touch outbound e-mail. That’s where DKIM signatures are attached.

Steps to Implement DKIM With an Email Service Provider :
If you are using an ESP, the process is trivial:

Step #1 - Ensure you have access to your domain’s DNS Entry (see step #2 above)
Step #2 - Call your ESP. Your ISP can provide you the key information and policy entries for your DNS entry.

Sunday, January 16, 2011

Running CodeIgniter from shell on Cronjobs

I am actually tuklifying from the CodeIgniter wiki - just adding my experience - things I faced and solution to the issue.
Steps :
1.Make a directory for your cron scripts. I just used scripts and put it in the same directory that my CI system folder is in.
2. Copy the index.php file from your DOCUMENT_ROOT (the script that normally initiates a connection to CI from a web browser) to the scripts directory, and rename it to something meaningful, such as mailsender.php.
3. Add the following line at the very first line of the mailsender.php:
#!/usr/local/bin/php -q
4. Edit this file and make some slight adjustments. First, we don’t want the script to timeout during execution, so somewhere toward the top we add:
5. Set the path to the system folder, if it isn’t correct:
$system_folder = "../system";
6. We need to let CI know what controller/method we want to access, and any other URI variables we need. Normally this happens in the URL, so we emulate it by setting PATH_INFO manually:

$_SERVER['PATH_INFO'] = '/mailprocessor/sendmail';
$_GET = ''; // Required for some installations
However, if the config uri protocol is set to REQUEST_URI, then CI doesn’t use PATH_INFO, so instead, emulate REQUEST_URI manually:

$_SERVER['REQUEST_URI'] = '/mailprocessor/sendmail';
7. You create a mailprocessor.php controller (in the application/controllers dir) with a sendmail method, and make it do what it needs to do, load libraries/models/etc, execute them, then exit. What you don’t want to happen is output anything. Just make sure you don’t echo any content to stdout (echo, loading views, etc.) If you are sending emails, you would load a view file, but return the contents to a variable instead of displaying it (pass true as third param), then run through normal procedures for sending emails.
One thing to be aware of regarding security, you probably don’t want anyone accessing /mailprocessor/sendmail from a web browser[In my case I don put the scripts on the web directory- so no need to worry about ], so in the mailprocessor.php controller constructor, you may want to do some kind of check to make sure we are coming from a cron script. Probably the easiest method would be to test the SCRIPT_FILENAME variable:

if($_SERVER['SCRIPT_FILENAME'] != 'mailsender.php')
8.Once everything looks good, add your crontab entry to execute the script, and there you have it! Sample cronjob [from cPanel  can easy do that- you just need to put the script location to run]:
# execute cronjob every day at 2am
00 02 * * * /HOME/myusername/misc/scripts/mailsender.php
My addition : 
8. You need to edit the BASEPATH on the mailsender.php.  You need to put the absolute path instead of relative path.

Original post - You will get some other alternative ways to do the things :)
Update-05/16/2011: On version 2, CodeIgniter has implemented a feature to run sccript from CLI. :)