Saturday, September 13, 2008

configure idea GPRS

After trying out Airtel GPRS for an year and half i have now planned to move on to Idea connxn recently.  Last week i was struggling with configuring my new Idea GPRS connection...

Even after putting all the settings in place, i was still getting connection failure errors. 

Reason :- my modem configuration was set for airtel gprs . which was the culprit.

I connect to my laptop using bluetooth..

Solution : -
  1. Go to Control Panel > Select Phone & Modems > Select the Required Modem (Bluetooth DUN Modem) > Go to Properties of that Modem > Select Advance TAB & insert Extra Initialization Command (AT+CGDCONT=1, "IP", "INTERNET")

this command for Airtel is somewhat like this...
(AT+CGDCONT=1,"IP","airtelgprs.com"")

Wednesday, June 18, 2008

PHP Warning: PHP Startup: Unable to load dynamic library 'php_mysql.dll' - The specified procedure could not be found.

Well, i m highlighting this line, so that you all vl know the intensity with which this one has bugged me. Yeah, i was struggling with this one for 3 looooooonnnnnnng days.. After trying my hand @ jsp now jus came in the php-room to have a lil bita dancing in the party.. ;D... well, first i installed php5+apache2.2+mysql5.0.41. It was gr8 to see the hello world on my browser. I then thought of creating a small application insert, update, delete. But guess what?? i started getting the above error. After a lotta googling around, on 90% of the forums i found only a single answer, i.e. this bug is with the libmysql.dll supplied with Mysql, so weel have to use the libmysql.dll supplied with the zip installer.
Reinstalled php using php zip package, but no luck.
Only solution to this i found on somewhere third page of a google result was resolve this error using the Apache way.
Jus add following lines to ur Apache httpd.conf file and it does it all. No need to copy any dll's.

LoadFile "C:/Software/PHP/libmysql.dll"
PHPIniDir "C:/Software/PHP/"

LoadModule php5_module "C:/Software/PHP/php5apache2_2.dll"


Well, what apache does is its loads the specified dll before any one else search for it. Thanx to Apache and Sander for finding this out. Well this guy has kept his comments Off, so i cudnt thank him on his blog.. No matter. Now my php5+mysql5.51+Apache2.2 on Windows is working like a Maska [Desi word for smooth ;)]

Please change your directory accordingly in the path. Above code is specific to my settings.
Tip: Dont rely on the MSI- Installer of php. Windows go mad, use the zip installer, works gr8!

njoy ;)

Wednesday, June 11, 2008

InnoDB v/s MyISAM

InnoDb
1) recovers from crash/ shutdowns by replying its logs. Hence, InnoDB approach is approximately fixed time.
2) Caches reads and writes to data rows within the engine itself.
3) Stores data rows physically in primary key order. Uses MS SQL Server featrue of "Clustered Indexes."
4) Doesnt support compression and terse rowformats.
5) Can be used for tables which needs performance and data security.

MyISAM
1) fully scans and repairs any indexes which had been updated. Time taken using MyISAM approach depends on the size of the data files.
2) Relies on OS for caching reads and writes to data rows.
3) Stores data rows mostly in the order in which they are added. Uses Oracle feature known as "Index Organized Tables".
4) Support compression and terse rowformats.
5) Can be used for tables which are used for search purposes.


The last point is possible b making the database as InnoDB and selective tables in that DB as MyISAM. This is possible in MySQL

Monday, June 9, 2008

Cools gadgets : Digital Photo Keychain


Hi folks, the world is becoming smaller, closer and more compact... and all this is possible coza technology.. Every where we can see small gadgets which are self running. Every gadget has a tiny lil silicon chip, which does all the dirty work.. Right from mobile phone to our iPod's.. everything has a chip in it.. Last week i found a similar gadget which is very tiny but vei vei handy.. Well this gadget sits inside an attractive Digital Photo Keychain and has a 1.5inch 128X128 LCD display. Apart from this it has 4.8 MB internal memory which can store abt 72 pictures with formats supporting JPG, BMP, GIF, PNG. A slideshow with adjustable slide time, time display, auto cropping of pictures, rechargeable battery. And guess what it weighs jus 85gms... gr8 isnt it??? So.. how about changing ur key chain pics daily as if u change ur clothes... :P...

Wednesday, June 4, 2008

Apache + Tomcat + mod_jk.. how does it work...

In a nutshell a web server is waiting for client HTTP requests. When these requests arrive the server does whatever is needed to serve the requests by providing the necessary content. Adding a servlet container may somewhat change this behavior. Now the web server needs also to perform the following: Load the servlet container adapter library and initialize it (prior to serving requests). When a request arrives, it needs to check and see if a certain request belongs to a servlet, if so it needs to let the adapter take the request and handle it. The adapter on the other hand needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests. Things are even more complex when the user wants to set a configuration that uses virtual hosts, or when they want multiple developers to work on the same web server but on different servlet container JVMs.

Sunday, May 4, 2008

Installing ROR on linux

1) Install Ruby
yum update
yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc ruby-mysql


2) Get Gem

cd /usr/local/src
wget http://rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz


3) Install Gem

tar -xvzf rubygems-0.9.2.tgz
cd rubygems-0.9.2
ruby setup.rb
cd ..


4) Install Rails

gem install rails --include-dependencies


5)
Install MySql
yum install mysql mysql-server

6)
Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start


Thursday, April 24, 2008

INSTALLING AND SETTING UP APACHE & MONGREAL ON FEDORA

Make sure u r are a root user

1. installing apache
yum install httpd

2. install and setup mongrel
gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies

3. Configuring the cluster
cd /var/www/app_directory
[u in app directory]$ mongrel_rails cluster::configure -e production \\
-p 8000 \\
-a 127.0.0.1 \\
-N 3 \\

-e : which type of setup.. production or development
i used development. since mine was under dev..

-p : starting port for mongrel_cluster
-a : ip address
-N : number of mongrel instances u wanu run...

this will create a mongrel_cluster.yml file inside /var/www/app_dir/config

4. commands to start and stop mongrel_cluster

[u in app directory]$mongrel_rails cluster::start/restart/stop

Completed this part ur mongrel setup is done dona done done.....

Next step is to configure apache..

5. now move on to ur /etc/httpd/conf directory
Since there is lotta junk in the httpd.conf file
we wil make separate config files for our app...

there ll be four config files in all.. which are as follows...
myapp.common
The common portions of our configuration. Refactoring this out makes it easier
to add additional VirtualHosts down the road (e.g., SSL) while still maintaining
exactly the same configuration.
myapp.conf
The main entry, tying everything together to produce a working Rails app.
myapp.proxy_cluster.conf
A proxy balancer with which to interface with the Mongrel cluster.
myapp.proxy_frontend.conf
An (optional) HTTP front-end for managing the proxy load balancing configuration
on the fly.

===============
myapp.common
===============

ServerName myapp.com
DocumentRoot /var/rails/myapp/current/public


Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all


RewriteEngine On

# Make sure people go to www.myapp.com, not myapp.com
RewriteCond %{HTTP_HOST} ^myapp\.com$ [NC]
RewriteRule ^(.*)$ http://www.myapp.com$1 [R=301,L]
# Yes, I've read no-www.com, but my site already has much Google-Fu on
# www.blah.com. Feel free to comment this out.

# Uncomment for rewrite debugging
#RewriteLog logs/myapp_rewrite_log
#RewriteLogLevel 9

# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]

# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]

# Rewrite to check for Rails cached page
RewriteRule ^([^.]+)$ $1.html [QSA]

# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml
application/xml application/xhtml+xml text/javascript text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html

# Uncomment for deflate debugging
#DeflateFilterNote Input input_info
#DeflateFilterNote Output output_info
#DeflateFilterNote Ratio ratio_info
#LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
#CustomLog logs/myapp_deflate_log deflate


============
myapp.conf
============

Include /etc/httpd/conf.d/myapp.common

ErrorLog logs/myapp_errors_log
CustomLog logs/myapp_log combined

======================
myapp.proxy_cluster.conf
======================
This is loaded by Apache to configure a mod_proxy_balancer cluster mapped to
the internal Mongrel servers.

BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002

=======================
myapp.proxy_frontend.conf
=======================

This provides a front-end for the proxy load balancing, which you can access
from inside your server at http://localhost:8080.

Listen 8080
SetHandler balancer-manager
Deny from all
Allow from localhost

6. restart ur httpd
[u in app directory]$/sbin/service httpd restart

Actaully i posted it for my personal reference..
U will find a very good document on the same here
Thanx to Coda Hale... :)

Mongrel cluster restart issues...

hi,
Error : !!! Path to pid file not valid: tmp/pids/mongrel.8000.pid
mongrel::start reported an error. Use mongrel_rails
mongrel::start -h to get help.


Solution : jump into ur application directory
mine is
/var/www/MY_APP
go to config directory..
open your mongrel_cluster.yml file



check out for the log file path
log_file: log/mongrel.log

which is relative... mongrel cant find it... so change it to ...:

log_file: /var/www/MY_APP/log/mongrel.log

similarly, u l have to change the path for pid file

which ll be ... :
pid_file: tmp/pids/mongrel.pid

change it to ... :
pid_file: /var/www/MY_APP/tmp/pids/mongrel.pid

replace MY_APP with ur app name..
and u r done..

Monday, March 31, 2008

javascript array comparison


var master = new Array("11", "12", "13", "14", "15","16","17","18","19");
var all = new Array("11", "12", "13", "14", "15","16","17","18","19");
var has_app = new Array("11","12","16", "17", "19");
// expected out put = 13,14,15,18
var exp = "13,14,15,18";
var count = 0;
function compareAndRemove(){
outer :for(var i=0; i(is less than)master.length; i++){
inner :for(var j=0; j(is less than)has_app.length; j++){
if(master[i] == has_app[j]){
count = i - j;
all.splice(count,1);
}
}
}
alert(" All:"+all+" exp :"+exp);
}

Thursday, March 20, 2008

OS:Passing data to apps and navigation

Passing data to your application through requestNavigateTo()

If you are using the opensocial.requestNavigateTo() calls, you may supply an optional parameter containing data to be passed to the new page.

The following code passes two variables: foo and bar to the canvas surface of the current application:

  function gotoCanvas(params) {
var canvas_surface = new opensocial.Surface("canvas");
opensocial.requestNavigateTo(canvas_surface, params);
};

var my_params = {
foo : 12345,
bar : "Bar value"
};

gotoCanvas(my_params);

In the canvas view, check for these values with the following code:

  var prefs = opensocial.getEnvironment().getParams();
var foo = prefs["foo"];
/* foo contains 12345 */

var bar = prefs["bar"];
/* bar contains "Bar value" */

You should see that after the navigation has taken place, your URL will look similar to:

http://sandbox.orkut.com/Application.aspx?appId=xxxxxx&uid=xxxxxx&appParams=foo%3D12345%26bar%3DBar%20value

This follows the same format as discussed in Passing data to your application through the querystring

Wednesday, February 27, 2008

OS: passing params to views..

var my_params = {
thumUrl : thumb
};
if(viewer != null){
document.getElementById("some_id").onclick = function(){gotoCanvas(gadgets,my_params);};
}

/*********************************************************/
//function definition...
function gotoCanvas(gadg,params) {
var canvas_view = new gadg.views.View("canvas");
gadg.views.requestNavigateTo(canvas_view, params);
}

/*********************************************************/
retrieve this on canvas page using :
// name matches the myparams variable declared on top...
var xx = prefs["thumUrl"];

OS: content navigation

[content type="html" view="profile"]
[!--[CDATA[ [h1]Profile[/h1][br /] ]]--]
[/content]
[content type="html" view="canvas"]
[!--[CDATA[ [h1]Canvas[/h1][br /] ]]--]
[/content]
[content type="html" view="canvas,profile"]
[!--[CDATA[ [h2]This shows up in canvas and profile views[/h2][br /] ]]--]
[/content]
[content type="html"]
[!--[CDATA[ [h1]Default[/h1][br /] [h2]The content in this section only shows up if no other content sections are applicable[/h2][br /] ]]--]
[/content]


Note : replace all "[" with "<" and "]" with ">"