Jun 4 2009

Mysql Table Editor

In a php project, if we get the requirement , we usually start design and database. But the data entry procedure is very hard. In this case PhpMyadmin is a good comfort. 

Here is another tool from phpguru.org , MySQL Table Editor. Using this library you can make your database table editable from your php code. 

You can  :

  1. Select the table to be displayed
  2. decide which column should be hidden
  3. Whether a column should be editable or not
  4. Add advanced searching option
  5. Download the table as csv format
  6. Add pagination
  7. Set alias display name for your column
Download Library from: 
Documentation:
Sample Code Below:
 
<?php
require_once('TableEditor.php');
//database connection object 
$db_conn = mysql_connect('localhost','root','');
mysql_select_db('mydbname'); 
 
 
 
 
//select the table to be edited, here it is accounts
$editor = new TableEditor($db_conn, 'accounts');
//I dont want to display id and password column
$editor->noDisplay('id');
$editor->noDisplay('password');
//the email column should not be editable
$editor->noEdit('email');
//set display name for column email and login
$editor->setDisplayNames(array('email'       => 'Email',
                              'login'     => 'Username'
                              ));
//sort order of first name
$editor->setDefaultOrderby('namefirst', 0);
//set which are the filed to be searchable
$editor->setConfig('searchableFields', array('namefirst', 'namelast', 'email'));
//can set the type of input field
$editor->setInputType('available', 'select');
//finally display the editor window
$editor->display();
?>

Jun 3 2009

XAJAX

Basically using xajax “You can directly call php functions from your javascript code”

Xajax will do the rest. 

For example, if you are going to write a javascript function Capitalize which captilaze your textbox content when you press a button.

Here is the pure html/javascript code for that:

=============================================

<script>

function Capitalize()

{

      var t = document.getElementById(’cap’).value;

      document.getElementById(’update’).innerHTML = t.toUpperCase() ;

}

</script>

 

<input type=”text” id=”cap” name=”cap” />

<input type=”button” id=”capbutton” value=”Capitalize” onclick=”Capitalize()” />

<div id=”update”></div>

==============================================

Now see the difference when we use xajax, we can write this Capitalize function in php code and can call from javascript.

function Capitalize($value)

{

    $objResponse = new xajaxResponse();

    $objResponse->assign(”update”,”innerHTML”,strtoupper($value));

    return $objResponse;

}

and you can call from your button’s onclick function:

 onclick=”xajax_Capitalize(document.getElementById(’cap’).value)” 

Here the same functionality we moved from client to server. Thus the point is you can simply call all the functions you written in php (Server Side) from javascript code via onClick, onMouseOver or window.onLoad etc.

You can get the full source code of Capitalize example here:

http://www.sajithmr.com/downloads/capitalize.zip

To download and for documentation go: 

http://xajaxproject.org/

Thanks

Sajith

Jun 3 2009

JQuery - Play with html

Start jquery for manipulating html file and execute javascript just like sql queries.

Simply pointer the dom object with a $  and manipulate with different built in function.

For example 

$(”p.neat”).addClass(”ohmy”).show(”slow”);

Don’t need to write javascript inside each node. It is like prototyping. Insted of adding an onClick=”function()” inside the node, jquery define the onclick function from the top level. Your html code will be clean and tidy. If CSS removes all the styling bits, Jquery removes all the javascript bits from html.

You can remap every default action from an html object.

For example normally when you click a link  (<a> tag) it navigate you through the href value. But if you add the jquery code as below:

$(document).ready(function(){
   $("a").click(function(event){
     alert("Thanks for clicking!");
   });
 })
It adds a thanks alert for every click in links.
and if you add :
event.preventDefault();
It prevents the default action also.
You can go to JQuery homepage: http://jquery.com/
and can learn more about JQuery.
The intention of this post was not an explaination about jquery, but some addition website which develops addons based on jquery.
Those are:
http://jqueryui.com/
jquerystyle.com/
visualjquery.com/
http://15daysofjquery.com/
http://usejquery.com/

http://blog.themeforest.net/?s=jquery
Comment me if you know any other jquery websites.
Logging out
-Sajith

Jun 2 2009

Symfony V/S Codeigniter

symfony Web PHP framework     V/S     CodeIgniter

I have developed more than 7 web projects using Symfony framework. Mobshare.in, Amvizone.com, Campaignmanger.in , Movieonline.in etc are some of the websites. But for the past 5 months my developement is in Codeigniter. It is very very lighter than Symfony and has almost all the features of Symfony. Both are MVC framework. But symfony has 4 layer while the latter has only two. Symfony uses modules (extra layer) for Controllers. But Codeigniter eleminates  that layer. It is similer to Ruby on Rails. 

Symfony uses naming convention to map controller and view. For example controller index need indexSuccess.php file as view or indexError.php as error. But in Codeigniter, we have to specify the view manually from the controller

$this->load->view(’myview.php’); 

Symfony has command line tool to develop all the model classes. One thing you have to do is specify the scheme.yml file. But in Codeigniter, you have to make model classes from the scratch. However a lot of database operation libraries are available with it to make the coding life easier. Since we have to load each libraries manually, Codeigniter gaurantee the speed of execution. (Autoloading option is there, but in most of the case we can eliminate unwanted libraries from autoloading - just like execute on the fly)

There is no built in ajax and javascript function in codeigniter. But you can add it as plugin. Like Symfony it also has cache management, logs, testing, helpers, url rules, documentator, scaffolding etc

Codeigniter has a simple folder hierachy that everybody can understand and very less learning curve than Symfony. 

 

Go through this link if you wanna know about all the features of codeigniter : http://codeigniter.com/user_guide/toc.html

I found another interesting comparison of these two in : http://www.devtrench.com/codeigniter-vs-symfony/

Mar 22 2009

Check website in different browsers

Last day i got a good website in which we can test the rendering of a particular website through different versions of interenet explorer. From a designer’s view, internet explorer is a life long head ache due its different alignment, floating problem, iframe problem, script execution problem and all.

Here , http://ipinfo.info/netrenderer/index.php , You can check your website through different internet explorer version. It will be useful for linux developers to test the website via internet explorer.No need to boot windows operating system.

Mar 20 2009

Save your passwords and secured files using TrueCrypt

Hello programmer,

If you are a programmer, you  might experience on saving your different ftp , email , website credintals (usernames and passwords) . Someone uses google documents for saving passwords. Some use email itself as a password storing medium. To be more secured, you have to save your passwords in you local machine rather than putting them into any other 3rd party online medium.

Truecrypt is an open source software for saving secured data (Folders and files). It is available for most of the operating systems (Windows, Linux, Mac etc). The advantage of TrueCrypt is, it creates a seperate partition or storage device as a normal USB memory stick. When you mount the partition it asks for a secured password. You can save your personal and secret files inside this partition. You can creates more than on partition using this software. So you can seperate your data files if you needed.

Here is the website url: http://www.truecrypt.org/

It also provides two level security. It adds a hidden file inside another secured file, so that when an adversary forces you to reveal your password, or forces you to open the secured folder, there is no chance for them to view the hidden encrypted file.

For more details visit:

http://www.truecrypt.org/hiddenvolume.php

Mar 20 2009

Google Street View For UK

Google enabled its street view feature for  25 UK cities including london. Google team arrived with 360 degree camera and took photographs of different streets. Today I found my living place in google street view.

(Google Street View: Hermit Road,Canning Town, London)

(Browning Road, East Ham, London)

Dec 2 2008

How the new feature in Orkut (My Events) ruined an event

Recently we decided to organize the 3rd barcamp of kerala on 7th December 2008. The cheif organanizers Kenney Jacob and Anand Subramanian started promotions and publicity for the event. They stated mailing, sending sms and further online promotions. Our greate, romantic, family , friends Orkut Community introduced a new feature called  My Events, in which you can create and event and inform your friends which will remind them at the day of the event.

Very enthusiastic young chap Mr Anand created an event in orkut and invited all the tech savy friends into it. All accepted the event and saved in their orkut. The real story started when anand , by mistake , deleted the event in orkut. It is just a removal of the event node. But the funny thing happened is,  everybody got this message in their email   is :

“The Event Barcamp Kerala - 3 has been Cancelled”

Don’t worry Friends, Today is  dec 2nd , we have long 5 days to go for the real barcamp.  Anyway it is going to happen @ the rite time as announced …

Cheers

Sajith

Nov 30 2008

The Project Team - Funny Quotes

Recently some quotes struck my mind from a forwared email. It is basically , i think, 100% true , even though described in as a  funny way.

See:

  1. Project Manager is a Person who thinks nine Women can deliver a baby
    in One month
  2. Developer is a Person who thinks it will take 18 months to deliver a Baby.
  3. Onsite Coordinator is one who thinks single Woman can deliver nine
    babies in one month
  4. Client is the one who doesn`t know why he wants a baby
  5. Marketing Manager is a person who thinks he can deliver a baby even
    if no man and woman are available
  6. Resource Optimization Team thinks they don`t Need a man or
    woman;They`ll produce a child with zero resources
  7. Documentation Team thinks they don`t care whether the child is
    delivered, they`ll just document 9 months.
  8. Quality Auditor is the person who is never happy with the PROCESS to
    produce a baby.And lastly……
  9. Tester is a person who always tells his wife that this is not the Right baby

Courtesy: Some Forwared Email

Nov 19 2008

Plugin Age

We know Stone Age, Iron Age , Bronze Age . My friend  Binny started new Technical Age named Plugin Age. He announced this week as a plugin age. From Monday  (17-11-2008) to Friday (21-11-2008) he projected to release each plugin a day. He already released his two  wordpress plugins Eventr & Autofields Wordpress plugin

Lets wait for the other three endearing plugins from Binny. Good luck Binny

Regards

Sajith M.R

TAGS:
Nov 18 2008

How Gmail Video Chat Works ?

Recently Gmail Introduced Video Chat. For a platform, to support the video chat you need to install the flash activex plugin.

You can get the plugin from http://mail.google.com/videochat

But when you click on Install voice and video chat button, Some of you see the page which shows

“The installer should complete in seconds.

 

If you are having trouble with the download, click here. “ 

But some other see a auto installer page which downloads the Setup.exe file and automatically start installation and prompts you to restart the browser.

Who did this installation without any security problem or violation and we saw a different window which shows the progress bar of the installation. This happens only when , if you have google tool bar installed on your browser , or google desktop, or google gears. For those browsers if the above three is not present, the previous message gets result , and which provide the direct link of the GoogleVoiceAndVideoSetup.exe

It is http://dl.google.com/googletalk/googletalkplugin/GoogleVoiceAndVideoSetup.exe

My Chrome browser does not support automatic installation. Because it is a new guest for my OS and the google additional plugin installation happend before its arrival. So Only Download and manual installation works in that case.

 

Then what the script exectued behind is 

 

window.google.update.oneclick.install (install via click) 

and 

 

location.href =  http://dl.google.com/googletalk/googletalkplugin/GoogleVoiceAndVideoSetup.exe (install manually )

Note the first bit of script window.google , A new object for google, which is created as the result of any one of the above mentioned google services. My Chrome Browser (Since he is a new member) does not know about the window.google (he knows the default methods like window.location, window.document)

Thats allabout the installation part. 

Now About the Video Chat. Obviously it is a flash based video chat mechanism , but the difference is it uses rtcp and udp protocol for video /audio chatting. Did you check the speed of your video chat ? Amaze  rite ?

 

 

Then lets check about the video chat request.

When you request someone for a video chat, google ajax posts the following data

 

req4_jid c2143377409

req4_json            ["jc","xyz@gmail.com","c2143377409",[["192.168.1.100","3801","video_rtp","dgE9SG8VMVdQFrYo","gyB0pRw5dkoEtq21","1","udp","0","local","0"]]]

req4_type          j

req5_jid c2143377409

req5_json            ["jc","xyz@gmail.com","c2143377409",[["116.68.66.85","3784","rtcp","iqV9/3HhhqkjQ4kp","wMSi7BsiOVNtnbJR","0.9","udp","0","stun","0"]]]

req5_type          j

Here xyz@gmail.com is the person , to whom you are going to chat. It sends the video_rtp protocol parameters. To know more about rtcp and udp go to: http://www.javvin.com/protocolRTCP.html

Here 192.168.1.100 is my local area ip (LAN) and 116.68.66.85 is my internet IP address and the numbers starts in 3000 are the port number for the protocol

In addition to this, google also sends its usual parameters like mouse movement detector (To know the state of a chatter, idle or busy / normal )

It also sends the cpu speed info to google server to know about the video processing time. And your bandwidth and speed of internet is already there in google’s hand (See my post on Gmail Architecture to know about the 1pix speed calculation method of gmail)

 

 

 

count    3

req0_evtype       mousemove

req0_time          263866

req0_type          i

req1_focused     1

req1_type          cf

req2_jid

req2_json          ["mf","mf1.0","1.0.2.0",2,{"caps":7,"cpuSpeed":1664,"cpus":2}]

req2_type          j

 

 

Gmail sends request for every 3 seconds, and if your counterpart accepts the video chat invitation, your chat iframe loads with a flash object tag .

 

<embed id=”flash_yj_c_player2″ wmode=”window” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash” seamlesstabbing=”false” allowfullscreen=”true” allowscriptaccess=”sameDomain” bgcolor=”#000000″ flashvars=”dbg=true&ap=player&nm=yj_c_player2&cb=Recv_yj_c_player2&os=windows&plugin=true&” src=”im/media-player.swf?ver=1.1.6″ style=”width: 100%; height: 100%;” name=”yj_c_player2″ quality=”high”/>

And this flash application does the later works.  This flash application communicate with google media server with Real Time Protocol and your video chat happens that way. The flash activex plugin support helps in accessing your webcam and mic.  Good day , have a nice chat … 

Mail Me for more information

Thanks and Regards

Sajith

 

 

 

Nov 6 2008

Contact Grabber

If you are a social media website developer , sometimes you might search for grabbing contacts from a particular email account if the password is given. I also did the same.  In most of the cases it did not work properly. But recently i got a contact grabber from phpclasses.org which works perfectly on Gmail, Hotmail, Rediff, Yahoo, Orkut, MySpace, Indiatimes, Linkedin , AOL and lycos

screen shot

screen shot

But the zip file i got is not well arranged, so it shows some errors . I arranged it in proper way and uploaded here:

Download:

http://sajithmr.com/downloads/grabber.zip

(Under GNU Public License)

Using this php code , you can export the email contacts as csv file.

Here is the actual source website : http://www.phpclasses.org/browse/package/3895.html

Page 1 of 1112345»...Last »

Recent Comments

  • Sajith M.R: Press shift and enter key for a new line in chat
  • Borellus: Nice little function there, I think I may try to use it at some point.
  • Abhishek: Can we have newline characters…. i want something like this Line 1 Line 2 Line 3
  • Joanne Cox: Thanks for sharing this; your input is appreciated and has made me change my opinion slightly. About the...
  • Saboor: hi i also want to implement a chatting like Gmail or FaceBook , please, email me the source code on...

Recent Posts