Saturday, October 15, 2011

Random Thoughts



 Sandip More 

Really how many of 40M users who subscribed of G+, actually using it?
 Sandip More 

Google killing buzz, jaiku, code search...What will happen to the Curious case of Google +? - Netizens asking!
 Sandip More 

Are all facebook users can now be called as socialites?
 Sandip More 

New Social Networking thing has redefined, original meaning of Social!
 Sandip More 

Can you call a person working for any social service like Facebook - Social Worker? :)

Wednesday, October 12, 2011

Mac - MySQL - CodeIgniter - Issue (Solved)

My CodeIgnited just stopped working with New MySQL server installed on Macbook, Osx 10.5.


following blog post+some my own tricks, saved my lots of effort to make it work.


Mysql & php configs were missing from system, earlier my system used to work with MAMP.


I copied my-huge.cnf (as my m/c has more than 1G ram) to /etc/my.cnf from /usr/local/mysql/support-files/


I copied existing /etc/php.ini.default to /etc/php.ini and did following changes.




http://drupal.org/node/46300


The version of PHP that Apple included with Mac OS X 10.4.4 has mysql.default_socket set to "/var/mysql/mysql.sock", before it was "/tmp/mysql.sock". They change it for some security reasons I believe.
The binary version of MySQL from mysql.com use "/tmp/mysql.sock" so one has to change.
I choose to make PHP look for "/tmp/mysql.sock" by setting this in /etc/php.ini.
; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock
I also tried to go the other way by setting this in /etc/my.cnf.
#Name of the socket file to use.
socket=/var/mysql/mysql.sock



Wednesday, October 05, 2011

Linux Mint 10 - Sound problem (Solved)

We have installed Linux Mint 10 on one of our machines, I chose Linux Mint because its based on Ubuntu and had impressive UI.

but after sometime, got complaint that sound is not working on it. then I rememberd my year long struggle during my college days to make sound working on Redhat-Athlon machine of mine, which didnt work.

Today no one was using m/c, so I just gave a try to make it work. and it worked.

Here is how.
I searched on google..after frantic search for 10-15 minutes. I got following link
Linux Mint Forum - Sound problem

I followed advice from someone called  "mads"

1. Run
$ cat /proc/asound/modules'
The output shows the modules.
0 snd_intel8x0
1 snd_hda_intel


2. Add the following lines at the end of your alsa-base.conf file:
# The next two lines prevent my sound modules from switching
options snd_intel8x0 index=0
options snd_hda_intel index=1
Save and exit. Reboot to make changes take effect





Use AlsaMixer to adjust volume.







for me
$ cat /proc/asound/modules gave
  1 snd_hda_intel


2nd step i followed as it is.
alsa-base.conf is resides in /etc/mod-probe.d/ 


I rebooted  m/c and login welcomed me with Sweet Startup Sound!
lekin picture abhi baki hai mere dost.. I played a song in mplayer and it didnt work. 


I thought I might need to do something extra. but just pulling headphone jack out and putting in solved the problem.


Music is now enabled on Linux Mint 10.




















Super Cool - Dynamic Templates from Blogger

Classic
Super Cool
Super fast Search
I am super awed by kind of superb innovation produced by Blogger.

It just neat and clean!

It just gives Wow Feeling!








Monday, September 05, 2011

Whats the Sen's Side?

I smell some conspiracy here. Need to check out Soumitra Sen's story.




Sen courted trouble as Receiver - J. Venkatesan - copied from hindu


For the beleaguered Justice Soumitra Sen of the Calcutta High Court, trouble started in 1983, when the Steel Authority of India Ltd. filed a money suit in the court against the Shipping Corporation of India for sale of Periclase Spinal Bricks lying at the Bokaro Steel Plant.

On April 30, 1984, the court appointed Justice Sen, who was a lawyer at that time, as a Receiver to make an inventory, sell these goods, and keep the proceeds until the case was decided. Between April 1, 1993 and June 1, 1995, he received the sale amount of Rs. 33.23 lakh.

In 1996, though he was entitled to keep only five per cent, Rs 1.66 lakh, towards remuneration, he kept the entire money in a fixed deposit with ANZ Grindlays (which later merged into Standard Chartered) and later transferred it to Lynx India Ltd, a company authorised by the RBI.

On January 20, 1997, another High Court Bench directed Mr. Sen to be the Receiver in another case and to keep Rs. 70 lakh for distribution among workers of Calcutta Fans. But he deposited this amount also in Grindlays Bank. Between May 14, 1997 and August 6, 1997, he issued several cheques to the workers.

On February 26, 1997, he deposited Rs. 25 lakh (from out of Rs. 70 lakh) with Lynx India, which sank. The shortfall was made up by taking Rs. 25 lakh from the SAIL money and depositing it in the Calcutta Fans account

On February 27, 2003, the SAIL filed an application in the High Court asking the Receiver to return the entire sales proceeds and render true and faithful accounts. He failed to do so until he was appointed judge on December 3, 2003.

On August 3, 2004, the High Court appointed a new Receiver, without asking Justice Sen to refund money lying with him till then.

Subsequently on February 15, 2005 when the matter was posted before another judge, he issued notice to Justice Sen for return of the money. On June 30, 2005 after the High Court ordered an enquiry, it came to light that Justice Sen, as Receiver, never filed any accounts, though he was required to do so every six months.

On November 1, 2005 he deposited Rs. 5 lakh. On April 10, 2006, the court directed him to repay Rs. 57.65 lakh, which included an interest of Rs. 26.26 lakh. Justice Sen went on leave and on his return, he was not allotted judicial work. Between June 27, 2006 and September 5, 2006, he repaid Rs. 40 lakh and on November 21, 2006, he repaid the balance amount.

On September 25, 2007, a Division Bench quashed single judge's order and expunged remarks. The Bench held that there was no material to hold that Justice Sen had misappropriated any amount or made any personal gain.

But on a report from the then Chief Justice of the High court, the then Chief Justice of India K.G. Balakrishnan formed a three-member committee to probe the charge

In February 2008, the in-house committee, found Justice Sen guilty of breach of trust and misappropriation. It said he did not have any honest intention since he mixed the money received as Receiver with his personal money. There was misappropriation, at least temporary, of the sales proceeds.

Acting on the report, he was asked to resign or to seek voluntary retirement, but he declined.

In August 2008, the then CJI, K.G. Balakrishnan, asked Prime Minister Manmohan Singh to initiate removal proceedings against Justice Sen for his misconduct.

On February 27, 2009, 58 MPs of the Rajya Sabha moved a motion seeking Justice Sen's removal.

On March 4, 2009, the Chairman of the Rajya Sabha appointed a probe panel headed by the then Supreme Court judge, B. Sudershan Reddy.

On September 10, 2010, the committee held him guilty on two counts — misappropriation of money and misrepresentation of facts to the High Court — and recommended his removal.

On August 18, 2011 the Rajya Sabha voted the resolution to remove Justice Sen.

Monday, August 08, 2011

Boot options for Macbook

You want to try ubuntu or want to boot from live cd. here are options.

Products Affected
MacBook Pro, MacBook Air, MacBook, iMac, Mac mini, Mac Pro
Keystroke Description
Press C during startup Start up from a bootable CD or DVD, such as the Mac OS X Install disc that came with the computer.
Press D during startup Start up in Apple Hardware Test (AHT).
Press Option-Command-P-R until you hear two beeps. Reset NVRAM
Press Option during startup Starts into Startup Manager, where you can select a Mac OS X volume to start from. Note: Press N to make the the first bootable Network volume appear as well.
Press Eject, F12, or hold the mouse or trackpad button Ejects any removable media, such as an optical disc.
Press N during startup Attempt to start up from a compatible network server (NetBoot).
Press T during startup Start up in Target Disk Mode.
Press Shift during startup Start up in Safe Boot mode and temporarily disable login items.
Press Command-V during startup Start up in Verbose mode.
Press Command-S during startup Start up in Single-User mode.
Press Option-N during startup Start from a NetBoot server using the default boot image.

original link

http://support.apple.com/kb/ht1533

Tuesday, August 02, 2011

Jungle Tourism Should Stop!

Last weekend I visited Kanheri caves at National Par, Borivali Mumbai.

It was great to visit this spot in the Monsoon. Great view of Real Forest amidst Mumbai which is known to have Jungle of Concrete. It was amazing to see so many Caves in such interiors of Dense forest. One does not stop wondering about people, who carved these beautiful caves and managed to Stay with Tigers and wild beasts aroung.

But something was not great! which is crowd of Mumbaikars Gathered there to Enjoy the monsoon and Small Waterfall near caves. With this beauty around, Indian Junta who dont miss to create a crowd at any chance provided, Why will they spare this Spot.

While watching the Monkeys sitted on tree branches, I felt the rage amongst them, some scared, some aggressive staring helplessly at Vehicles, Crowd of People who encroached on their own piece of land. These animals are owners of jungle, with curious tourists visiting these, What they want is just enjoy the beauty of the space, Click some pictures of their own, to get some instant fame on their Facebook Walls or some just to have fun in Wild.

How it will feel to you if you asked to stay in a home made of Glass and have people around you watching all your movements.

Todays NDTV showing some guy fighting to stop Tourism in jungle. Though It brings lots revenue for Forrest department to maintain jungle well, Tourism is helping to increase pollution in jungle, killing many creatures under vehicles.


I Support this unknown guy in his Cause,

Please Stop this Jungle Tourism!


In the words of Ravindranath Tagore

Into that heaven of freedom, my Father, let "our jungles" awake.

Friday, July 15, 2011

Linode - RAM, Disk resize, Linode upgrade

We are using linode.com for hosting. So far they have provided very good service and support is quick.

We started with basic version of Linode380. and as we are getting more load on server we wanted to increase capacity.

There are multiple ways to increase capacity..

1) We can buy extra RAM/Hard disk.
2) We can upgrade to New Linode.
3) Buy One more linode and redo setup on new linode.


We chose 3rd option as 1st was costly and in 2nd one, we are not sure abt what will happen to our data in upgrade process.
also we wanted to upgrade our Operating system also.

After that we experimented some things on Old Server, here are observations..

1. Resize RAM (in case you upgrade only RAM)
You just need to reboot your system. You will see extra RAM added after reboot.

2. Resize Disc
no data loss and downtime 5min, system need to shutdown, then you resize disk and reboot. After reboot, you will see disk capacity increased.

3. deploy New linux distribution
We have Ubuntu 9 server installed, We wanted to use Ubuntu 10.04, after deploying new distribution, it automatically created partiition and deployed new Ubuntu there. We have our old data intact in old deployment.

4. upgrade from 512Linode to 768Linode # TBD on 15/07/2011
1. System shutdowns
2. Auto Migration of OS happens - it takes around 5-10 minutes for full migration. Data remains intact. but better have backup

feel free to ask if you need clarification on any point.

Thursday, June 30, 2011

Cat5-Cat6 difference

The most obvious difference is their transfer capability. CAT5 has four pairs of twisted copper wire and supports up to 100m of Fast Ethernet (100Mbps) transfers. Although CAT5 has four twisted pairs, it only makes use of two pairs. CAT6 also has four pairs of twisted copper wire which supports Gigabit Ethernet (1000 Mbps) of up to 100m. Unlike CAT5, CAT6 takes advantage of all four pairs. CAT6 has a 2x transfer rate compared to CAT5 but due to the higher price tag of CAT6, it isn't used alot yet.

There is also CAT5e (enhanced). Like CAT6 is makes use of all four pairs but it isn't quite as fast at transferring as CAT6 but does support Gigabit Ethernet so is a popular choice.

There is also talk of CAT7, but thats going beyond your question.

Hope thats of some help.

This is repost from http://www.ozzu.com/hardware/cat5-cat6-cable-t34232.html

Office LAN design using Common Sense and expenses

In the past I always wonder how lan is designed.

but recently got chance to put lan setup in office.

We moved to quite big place with around 25 people sitting capacity.

I first thought to put 24 connectors

2 * 8 port switch- Rs.1900 (950*2)
1 24 port switch - Rs. 3800
--------------
wall jacks - 250* 24

labour - 300 per jack

we used Cat 6 cable instead of Cat-5 cable (still need to figure out difference)
Cat 6 100mtr cable - Rs. 2800
Cat 5 100mtr cable - Rs. 1900

Our electrician was not available so We called some electrician to do wiring work but he asked 3500. We tried to negotiate with him to take 2700 for work but he didnt want to negotiate. so we fell back to our trusted guy. He did whole work in just Rs. 1700

so It was going out of budget as we are only 8 people team so I reduced total jacks to 10 and cost got reduced accordingly.

Total cost was Rs. 11000 (including labour and material cost to setup lan with 10 pcs)

here comes interesting part lan designing, please refer to lan diagram attached.

Office has 2 floors, Basement and ground floor. Challenge was to keep everyone on single LAN also provide additional lan for ground floor.

Wednesday, June 29, 2011

Installing MySQLdb with Python 2.6 on Mac OSX10.5

It seemed easy but took quite time for me to install MySQLdb library on Python on Mac Osx 10.5

here are 2 links which saved day for me..

http://stackoverflow.com/questions/3061277/python-mysql-wrong-architecture-error

I have a fresh MacBook Air, and I managed to get MySQLdb working by doing the following: (Snow Leopard 10.6.6, preinstalled Python)

uname -a
Darwin Braindamage.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

Download the MySQL 32-bit dmg file from mysql pages, Install it.

Add the following lines to your ~/.profile (or ~/.bash_profile):

PATH="/usr/local/mysql/bin:${PATH}"
export PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
export VERSIONER_PYTHON_PREFER_64_BIT=no
export VERSIONER_PYTHON_PREFER_32_BIT=yes


http://stackoverflow.com/questions/1448429/how-to-install-mysqldb-python-data-access-library-to-mysql-on-mac-os-x

here are numerous step-by-steps on how to build and install the MySQLdb libraries. They often have subtle differences. This seemed the most popular to me, and provided the working solution. I've reproduced it with a couple of edits below

Step 0: Before I start, I assumed that you have MySQL(32 bit version) and Python installed on the mac.

Step 1: Download the latest MySQL for Python adapter from SourceForge.

Step 2: Extract your downloaded package:

tar xzvf MySQL-python-1.2.2.tar.gz

Step 3: Inside the folder, clean the package:

sudo python setup.py clean

COUPLE OF EXTRA STEPS, (from this comment)

Step 3b: Remove everything under your MySQL-python-1.2.2/build/* directory -- don't trust the "python setup.py clean" to do it for you

Step 3c: Remove the egg under Users/$USER/.python-eggs

Step 4: Originally required editing _mysql.c, but is now NO LONGER NECESSARY. MySQLdb community seem to have fixed this bug now.

Step 5: Create a symbolic link under lib to point to a sub-directory called mysql. This is where it looks for during compilation.

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

Step 6: Edit the setup_posix.py and change the following

mysql_config.path = "mysql_config"

to

mysql_config.path = "/usr/local/mysql/bin/mysql_config"

Step 7: In the same directory, rebuild your package (ignore the warnings that comes with it)

sudo python setup.py build

Step 8: Install the package and you are done.

sudo python setup.py install

Step 9: Test if it's working. It works if you can import MySQLdb.

python

>>> import MySQLdb

One final hiccup though is that if you start Python from the build directory you will get this error:

/Library/Python/2.5/site-packages/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /Library/Python/2.5/site-packages/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg/_mysql.pyc, but XXXX/MySQL-python-1.2.3c1 is being added to sys.path

This is pretty easy to Google, but to save you the trouble you will end up here (or maybe not... not a particularly future-proof URL) and figure out that you need to cd .. out of build directory and the error should disappear.

As I wrote at the top, I'd love to see this answer generalised, as there are numerous other specific experiences of this horrible problem out there. Edit away, or provide your own, better answer.

Friday, June 24, 2011

Ubuntu - set Server time to UTC

Create a symlink to file localtime:
# ln -sf /usr/share/zoneinfo/UTC /etc/localtime

OR some distro use /usr/share/zoneinfo/dirname/zonefile format (Red hat and friends)
# ln -sf /usr/share/zoneinfo/UTC /etc/localtime

OR if you want to set up it to IST (Asia/Calcutta):
# ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime

You can use TZ environment variable to display date and time according to your timezone:
$ export TZ=America/Los_Angeles
$ date

Wednesday, June 08, 2011

mod_rewrite to another server

We have hosted our company blog at blogspot.

We wanted to have blog hosted on org website. as people should not leave our website.

First solution was to host blog with some blog engine like wordpress.

Second solution I thought it might be possible to use apache mod-rewrite to internally redirect http://screen-magic.com/blog to
our screen-magic.blogspot.com

I never did it. but I started by websearching. Apache mod rewrite it bit tricky. You never know whats happening.

after several unsuccessful attempts and pemutation and combinations finally got it work.

here is the solution



Options -Indexes FollowSymLinks MultiViews
AllowOverride all
Options +FollowSymLinks
RewriteEngine on
RewriteRule blog http://screen-magic.blogspot.com/ [P]
Order allow,deny
allow from all


Here is working demo
Click to see ScreenMagic Blogs

Friday, May 06, 2011

Salesforce : Non-selective query against large object type (more than 100,000 rows) - Solved

We are customizing SMS Magic package to enable feature for customer where he wants SMS's received
in inbox to be autolooked up in Contacts and should get attached to particular contact.

This is very easy in normal case.
You add lookup field on Incoming SMS object and lookup mobilenumber in Contacts using SOQL. and
assigns lookup field with matching Contacts's Id. I wrote the code and written test cases and everything was good
contactList = [select Id, OwnerId, Name from Contact where MobilePhone = :senderMobileNumber];

till I tried sending actual SMS to his org though SMS went thru to his inbox
but Contact lookup failed.

Now I was stuck. I enabled debug logs and tried to see whats happening and got this.

System.QueryException: Non-selective query against large object type (more than 100,000 rows) . Consider an index filter.

And I was clueless. I tried to search across salesforce forum but every one was stuck on it. I even told my colleague, this seems impossible lets refund client if we have charged him.
Someone suggested on discussion forum, that you need to add index using external_field but Contact is standard object so it was not possible.
then I tried adding another filter
contactList = [select Id, OwnerId, Name from Contact where MobilePhone != null and MobilePhone = :senderMobileNumber];

but thing didnt work.



but sometime later, I thought lets give a try with SOSL.
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sosl_examples.htm

I tried following :-

List<List<SObject >>searchList = [FIND :senderMobileNumber RETURNING Contact ];
contactList = ((List<Contact>)searchList[0]);
object.Contact__c = contactList[0].Id;
it worked beautifully without any issue.

Another solution for this as per Salesforce documentation is as follows:
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_VLSQ.htm
I didnt try this solution. It should also work.

Thursday, March 10, 2011

Apple Gyan: How to tell if your Intel-based Mac has a 32-bit or 64-bit processor

# Choose About This Mac from the Apple () menu in the upper-left menu bar, then click More Info.
# Open the Hardware section.
# Locate the Processor Name.

4. Compare your Processor Name to information below to determine whether your Mac has a 32-bit or 64-bit processor.

Processor Name 32- or 64-bit
Intel Core Solo 32 bit
Intel Core Duo 32 bit
Intel Core 2 Duo 64 bit
Intel Quad-Core Xeon 64 bit
Dual-Core Intel Xeon 64 bit
Quad-Core Intel Xeon 64 bit


for much beautiful page :
http://support.apple.com/kb/ht3696

Thursday, February 24, 2011

MySQL setup

When you install mysql server, on your system, you need to some basic things so
taht you can seamlessly access it from any other machine.

1) By default, root user is created without password for Mysql server.

2) From Server , you can connect to MySQL Server using commandline mysql client.
using user root

$ mysql -u root -p

do not enter any password.

3) by default, MySQL Server is binded locally because of this you can not access it from other machines.
You need to comment out following in /etc/mysql/my.cnf

#bind-address = 127.0.0.1


4) Still with root, you can not access mysql server from remote machine, solution to this is to create a user with sufficient permissions.

mysql> CREATE USER 'magic'@'localhost' IDENTIFIED BY 'magic123'
-> ;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'magic'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER 'magic'@'%' IDENTIFIED BY 'magic123';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'magic'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)


I did this mysql setup for number of times but still everytime I go to following link http://dev.mysql.com/doc/refman/5.1/en/adding-users.html


Disclaimer:
This post is for my own reference.

HOWTO - Apache2 + Subversion + SSL

We wanted to install Subversion which can be accessed using HTTP protocol while searching on google, we got to nice article at

http://www.debuntu.org/2006/05/20/54-how-to-subversion-svn-with-apache2-and-dav

Here are details...


I needed install Apache2 + Subversion and i have searching for info, etc. and now i'm decide to create this tutorial, i hope you like!

Here we go:

INSTALL APACHE2

To install apache2 run that command:
Code:

sudo apt-get install apache2

(if you want also install php and mysql just follow this Link)

After you will install subversion:
Code:

sudo apt-get install subversion

(in that moment doens't exist the pre-buil binary of the last version (1.2.1), but when it's out you can simple upgrade )

To use svn with apache you need install libapache2-svn:
Code:

sudo apt-get install libapache2-svn

Now is better restart apache :
Code:

sudo /etc/init.d/apache2 restart

If you don't want SSL go to the last instructions (dav_svn.conf configurations, and users accounts).

Run:
Code:

a2enmod ssl

Add "Listen 443" to /etc/apache2/ports.conf:
Code:

sudo gedit /etc/apache2/ports.conf

Run:
Code:

apache2-ssl-certificate

Create a new SSL configuration file:
Code:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/myown-ssl

Edit myown-ssl file:
Code:

sudo gedit /etc/apache2/sites-available/myown-ssl

Change:
Code:

NameVirtualHost *

to
Code:

NameVirtualHost *:443

and
Code:



to
Code:



Add before
:
Code:

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM

Run:
Code:

a2ensite myown-ssl

Restart Apache:
Code:

sudo /etc/init.d/apache2 restart

Last instruction:

Edit dav_svn configuration file and follow the instructions:
Code:

sudo gedit /etc/apache2/mods-available/dav_svn.conf

Restart apache:
Code:

sudo /etc/init.d/apache2 restart

Create SVN folder:
Code:

sudo svnadmin create /srv/svn
sudo chown -R www-data:www-data /srv/svn
sudo chmod -R g+ws /srv/svn

Create the users account file:
Code:

sudo htpasswd2 -c /etc/apache2/dav_svn.passwd svnuser

(after asks for a password)

Test SVN:
Code:

svn import .bashrc https://localhost/svn/testfile -mlogentry

That is all!!!


For the SSL instructions i have follow this Tutorial.
About how using SVN see the official SVN book here or visit the official website (Link).

Any error, please report! (and not only in the istructions but also in the english...)

Tuesday, February 08, 2011

Product FAQ

• Is my product compelling to our target customer?
• Have we made this product as easy to use as humanly possible?
• Will this product succeed against the competition? Not today’s competition, but the competition that will be in the market when we ship?
• Do I know customers that will really buy this product? Not the product I wish we were going to build, but what we’re really going to build?
• Is my product truly differentiated? Can I explain the differentiation to a company executive in two minutes? To a smart customer in one minute? To an industry analyst in 30 seconds?
• Will the product actually work?
• Is the product a whole product? How will customers actually think about and buy the product? Is it consistent with how we plan to sell it?
• Are the product’s strengths consistent with what’s important to our customers? Are we positioning these strengths as aggressively as possible?
• Is the product worth money? How much money? Why? Can customers get it cheaper elsewhere?
• Do I understand what the rest of the product team thinks is good about the product? Is it consistent with my own view?


From SVPG guide

Tuesday, January 25, 2011

MySQL - Restart - AutoInc resets to zero

I noticed fact recently that MySQL Table autoincrement Id value resets to zero, if table is empty.

solution to this is, you can reset the counter to

mysql> ALTER TABLE tbl AUTO_INCREMENT = 1000;

Wednesday, January 19, 2011

Crontab/Cron analyzed - not working issues

It has now become routine job to write shell scripts to schedule jobs on server. (Ubuntu)

Although its routine, still sometime we got stuck with same issues. so I thought lets write a small article
to type out common errors I made.

1) Path -
By default, in cron environment, no Path is defined, so you can not even run simplest of shell file with simple
command like 'date'

you need to define
PATH=/home/sandip/bin:/bin:/sbin:/usr/bin:/usr/sbin/$PATH

your script testCronFile.sh can reside in /home/user/bin. it should have 755 perms.
chmod 755 testCronFile.sh


additionally to make sure that Script is executing.

you can do it using following 2 ways..
1) sudo tail -f /var/log/syslog
You would see something like following..

Jan 19 10:08:01 localhost CRON[11593]: (root) CMD (testCronFile.sh)


2) In testCronFile.sh, You can include line like

echo "Testing Shell file" >> /home/sandip/cron.log

so after execution of script, cron.log file would get created with "Testing Shell file" written in it.

for accessing files under root permission from cron, use sudo
$ sudo crontab -e


You can add comments, if you have something else regarding cron files.

Tuesday, January 04, 2011

MySQL export large data from command promt to CSV file

If you can cope with table-at-a-time, and your data is not binary, use the -B option to the mysql command. With this option it'll generate TSV (tab separated) files which can import into Excel, etc, quite easily:

% echo 'SELECT * FROM table' | mysql -B -uxxx -pyyy database
Alternatively, if you've got direct access to the server's file system, use SELECT INTO OUTFILE which can generate real CSV files:

SELECT * INTO OUTFILE 'table.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM table


Courtesy:
Stack Overflow

http://stackoverflow.com/questions/467452/dump-a-mysql-database-to-a-plaintext-csv-backup-from-the-command-line

Tuesday, September 28, 2010

Story of Elephant

A king had 17 elephants. Then the king died. He had three sons. According to his will, the first son was entitled to one-half of the number of elephants, the second to one-third, and the third to one-ninth. The size of the share couldn't be changed. As 17 is an odd number, and difficult to share among the three, they were unable to find a solution to the challenge. Fortunately for them, a wise man was passing through their country. He was an old friend of their father's as well. The young men described their predicament and asked for his help. The wise man asked them not to worry and set about solving the problem immediately.

He added his elephant to the 17 elephants; they were now 18. He separated 9 elephants or one-half of 18, and gave them to the first son. The second son was given six elephants or one-third of 18. Lastly, the third son was given two elephants, two being one ninth of 18. The total number of elephants given away was 17 (9+6+2). The eighteenth elephant left was that of the wise man who took his elephant back and left, with everybody happy and satisfied. The last elephant is like maya: it came to solve a problem, and having solved it, it removes itself from the scene, leaving no trace of its previous presence.



flicked this story from :
http://timesofindia.indiatimes.com/life-style/spirituality/speaking-tree/Indefinable-nature-of-maya/articleshow/6636437.cms



I see this wise man as Entrepreneur and last elephant as his Efforts to make things better and no emotions attached.

Monday, August 09, 2010

30 Books Everyone Should Read Before They’re Thirty

30 Books Everyone Should Read Before They’re Thirty

I read 6 out of these... 24 to go and 2 years remaining..need lot to catch.


1. Siddhartha by Hermann Hesse
2. 1984 by George Orwell
3. To Kill a Mockingbird by Harper Lee
4. A Clockwork Orange by Anthony Burgess
5. For Whom the Bell Tolls by Ernest Hemingway
6. War and Peace by Leo Tolstoy
7. The Rights of Man by Tom Paine
8. The Social Contract by Jean-Jacques Rousseau
9. One Hundred Years of Solitude by Gabriel García Márquez
10. The Origin of Species by Charles Darwin
11. The Wisdom of the Desert by Thomas MertonThe Wisdom of the Desert by Thomas Merto
12. The Tipping Point by Malcolm Gladwel
13. The Wind in the Willows by Kenneth Graham
14. The Art of War by Sun Tzu
15. The Lord of the Rings by J.R.R. Tolkien
16. David Copperfield by Charles Dickens
17. Four Quartets by T.S. Eliot
18. Catch-22 by Joseph Heller
19.The Great Gatsby by F. Scott Fitzgerald
20 The Catcher in the Rye by J.D. Salinger
21. Crime and Punishment by Fyodor Dostoyevsky
22. The Prince by Niccolo Machiavelli
23. Walden by Henry David Thoreau
24. The Republic by Plato
25. Lolita by Vladimir Nabokov
26. Getting Things Done by David Allen
27, How To Win Friends and Influence People by Dale Carnegie
28 Lord of the Flies by William Golding
29, The Grapes of Wrath by John Steinbeck
30. The Master and Margarita by Mikhail Bulgak

30 Books Everyone Should Read Before They’re Thirty

30 Books Everyone Should Read Before They’re Thirty

Saturday, May 01, 2010

Pollard ko itna late kyun bheja?

Today Gangadhar kids were playing against relatively stronger uncle's team. Uncles are all in mid twenties so do not exactly fit to be called uncles but kids are actual kids between 5-14 age group so no option. Even I am an uncle for these kids.

So this uncles team blasted 50 runs of 5 overs. with New rules and DLF maximums, allowed in the ground. they were completely overshadowed. so big score to chase and uncles team being stronger on bowling side too, cut through their batting line up
to take all wickets for some 10 runs. then somehow I shifted my self from fielding team to batting team as I fielded for them for 2-3 balls. as I know how these kids are sensitive to winning the games, I have no option to start aggressive,
so I started wiith 2 sixes of 2 balls, suddenly baccha camp was all excited and started shouting Pollard,
Pollard,
so I got in more enthu and hit one more boundry next ball... and the comment came on..
"Arre lekin hamne pollard ko itna late kyun bheja?", (originally in marathi, अरे पण, पोल्लार्डला एवढे लेट का पाठविले? ) With perfect timing and context and with such a innocence that kid spoke,
I just cant stop blushing :) as this is the sentence was on everyones mouth a week back when MI lost to Chennai in IPL,
and at End everyone has this question..."Why do they sent pollard so late?" as pollard blasted 22 in 5 balls still mumbai lost, so Gangadhar kids..:)

Monday, April 05, 2010

Salesforce: Timezone, CreatedOn - trivial fix

I was showing list of records with createdDateTime. Created date was being shown in GMT at one place for same record
and it was shown in IST format at other place. I thought both places I am doing same thing but result was different.
It was all Salesforce's magic Apex languange rendering.

following code was showing date in GMT despite global setting being IST.
< apex:pageBlockTable value="{!recentList}" var="item" >
< apex:column >
< apex:facet name="header" >Created On< / apex:facet >
< apex:outputText value="{!item.CreatedDate}" />
< / apex:column >

< / apex:pageBlockTable>

Slight change in the code fixed this issue. removed facet and outputText.

< apex:pageBlockTable value="{!recentList}" var="item" >
< apex:column value="{!sms.CreatedDate}" headerValue="CreatedOn" / >

< / apex:pageBlockTable>

Saturday, March 06, 2010

Authentication for CodeIgniter done right

Got good piece of information from stack overflow, by Jens Roland

http://stackoverflow.com/questions/346980/what-code-igniter-authentication-library-is-best

Just republishing it...
Disclaimer: none of the golden words below are written by me.


Authentication for CodeIgniter done right

Here's my MINIMAL required list of features from an authentication library. It also happens to be a subset of my own library's feature list ;)

1. Tiny footprint with optional test implementation
2. Full documentation
3. No autoloading required. Just-in-time loading of libraries for performance
4. Language file support; no hard-coded strings
5. reCAPTCHA supported but optional
6. Recommended TRUE random salt generation (e.g. using random.org or random.irb.hr)
7. Optional add-ons to support 3rd party login (OpenID, Facebook Connect, Google Account, etc.)
8. Login using either username or email
9. Separation of user and profile data
10. Emails for activation and lost passwords
11. Automatic cookie login feature
12. Configurable phpass for hashing (properly salted of course!)
13. Hashing of passwords
14. Hashing of autologin codes
15. Hashing of lost password codes
16. Hooks into CI's validation system
17. NO security questions!
18. Enforced strong password policy server-side, with optional client-side (Javascript) validator
19. Enforced maximum number of failed login attempts with BEST PRACTICES countermeasures against both dictionary and DoS attacks!
20. All database access done through prepared (bound) statements!

Note: those last few points are not super-high-security overkill that you don't need for your web application. If an authentication library doesn't meet these security standards 100%, DO NOT USE IT!

Recent high-profile examples of irresponsible coders who left them out of their software: #17 is how Sarah Palin's AOL email was hacked during the Presidential campaign; a nasty combination of #18 and #19 were the culprit recently when the Twitter accounts of Britney Spears, Barack Obama, Fox News and others were hacked; and #20 alone is how Chinese hackers managed to steal 9 million items of personal information from more than 70.000 Korean web sites in one automated hack in 2008.

These attacks are not brain surgery. If you leave your back doors wide open, you shouldn't delude yourself into a false sense of security by bolting the front. Moreover, if you're serious enough about coding to choose a best-practices framework like CodeIgniter, you owe it to yourself to at least get the most basic security measures done right.

Friday, March 05, 2010

Find the hidden Atlas :)

Can you see him?



Now ?




Atlas shrugged... tired so flew and hidden behind tree...

MySQL timezone setting for IST

Normally on US based servers, default US timezone is used, when creating DateTime in mysql. If your application is served to only India based customers then better to set mysql timezone to show Indian time.

check time_zone* tables in mysql db. if they are empty fill them using following command

shell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

Zone Info database on system.
Such systems are Linux, FreeBSD, Solaris, and Mac OS X. One likely location for these files is the /usr/share/zoneinfo directory.

mysql>SET GLOBAL time_zone = "Asia/Calcutta";


This blog is writter based on info from mysql website .

Friday, February 26, 2010

The Sachin Tendulkar

The Great Sachin Tendulkar.


Full name Sachin Ramesh Tendulkar
Born April 24, 1973, Bombay (now Mumbai), Maharashtra
Current age 36 years 309 days
Major teams India, Asia XI, Mumbai, Mumbai Indians, Yorkshire
Nickname Tendlya, Little Master
Batting style Right-hand bat
Bowling style Right-arm offbreak, Legbreak googly
Height 5 ft 5 in
Education Sharadashram Vidyamandir School


Wednesday, February 24, 2010

Java.lang.OutOfMemoryError: Java heap space

It means that the JVM has run out of all the memory that has been allocated to it. You can change the amount of memory allocated for use by your JVM using the -Xms and -Xmx command line parameters.

For example, the following says run MyApp in a JVM and allocate a minimum of 5 Megabytes and a maximum of 15 Megabytes off of the heap in order to do so.

java -Xms5m -Xmx15m MyApp

republished from
http://www.jguru.com/faq/view.jsp?EID=1300058

Friday, January 15, 2010

installing lxml on Mac.

STATIC_DEPS=true sudo easy_install lxml

works while
sudo STATIC_DEPS=true easy_install lxml doesnt work

Tuesday, January 12, 2010

CodeIgniter - removing Index.php from path and enable $_GET

Enable Mod_rewrite in apache

in htaccess file

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

check in your apache config:

AllowOverride All
It works
http://example.com/foo/fun should work
also
http://example.com/index.php/foo/fun works

Get request issue solution got from Al James. republishing it here. thanks Al James.

I have recently added $_GET support to my CI project.

I wanted to do this in such a way as to avoid hacking the CI code. Its actually quite simple.

Firstly, set the config item for uri_protocol to use PATH_INFO:

$config['uri_protocol'] = "PATH_INFO";
This ensures that query string parts dont get treated like the rest of the CI uri structure (resulting in lots of 404 not founds).


Secondly, you need to extend the default Input library in order to stop it clearing the $_GET variable. Place the following file (called MY_Input.php) in your application/libraries/ folder:

class MY_Input extends CI_Input {

function _sanitize_globals()
{
$this->allow_get_array = TRUE;
parent::_sanitize_globals();
}

}
This basically overrides the Input.php class to allow $_GET variables, but does not open up CI to query string URI routing (as it would if we simply set $config[‘enable_query_strings’] = TRUE).

Of course you will need to make sure that your config file specifies you subclass_prefix to be ‘MY_’, i.e.:

$config['subclass_prefix'] = 'MY_';
If its not, you can change the filename and classname of the above code accordingly!

That works for me anyway

Tuesday, January 05, 2010