Friday, July 01, 2011

How to Solve it by G.Polya

  1. UNDERSTANDING THE PROBLEM
    • First. You have to understand the problem.
    • What is the unknown? What are the data? What is the condition?
    • Is it possible to satisfy the condition? Is the condition sufficient to determine the unknown? Or is it insufficient? Or redundant? Or contradictory?
    • Draw a figure. Introduce suitable notation.
    • Separate the various parts of the condition. Can you write them down?
  2. DEVISING A PLAN
    • Second. Find the connection between the data and the unknown. You may be obliged to consider auxiliary problems if an immediate connection cannot be found. You should obtain eventually a plan of the solution.
    • Have you seen it before? Or have you seen the same problem in a slightly different form?
    • Do you know a related problem? Do you know a theorem that could be useful?
    • Look at the unknown! And try to think of a familiar problem having the same or a similar unknown.
    • Here is a problem related to yours and solved before. Could you use it? Could you use its result? Could you use its method? Should you introduce some auxiliary element in order to make its use possible?
    • Could you restate the problem? Could you restate it still differently? Go back to definitions.
    • If you cannot solve the proposed problem try to solve first some related problem. Could you imagine a more accessible related problem? A more general problem? A more special problem? An analogous problem? Could you solve a part of the problem? Keep only a part of the condition, drop the other part; how far is the unknown then determined, how can it vary? Could you derive something useful from the data? Could you think of other data appropriate to determine the unknown? Could you change the unknown or data, or both if necessary, so that the new unknown and the new data are nearer to each other?
    • Did you use all the data? Did you use the whole condition? Have you taken into account all essential notions involved in the problem?
  3. CARRYING OUT THE PLAN
    • Third. Carry out your plan.
    • Carrying out your plan of the solution, check each step. Can you see clearly that the step is correct? Can you prove that it is correct?
  4. Looking Back
    • Fourth. Examine the solution obtained.
    • Can you check the result? Can you check the argument?
    • Can you derive the solution differently? Can you see it at a glance?
    • Can you use the result, or the method, for some other problem?

Take bread

Take bread away from me, if you wish,
take air away, but
do not take from me your laughter-pablo neruda

Thursday, June 30, 2011

bad action

if you wish to discover the person behind a bad action, you must first try to find out who could benefit by it

Fight

Kings never fought themselves, but paid others to fight for them

Thursday, June 23, 2011

il Postino dialogs

Postman : I am in love
pablo neruda: There is a remedy for love
Postman: No,No, I want to stay sick
   -from il Postino

Your smiles spread like butterfly

Poetry does not belong to who write it.but those who need it.

Monday, June 20, 2011

KungFu Panda quotes

  • One often finds his destiny on the path he takes to avoid it.
  • [repeated lines] There are no accidents.
  • Your mind is like this water my friend, when it get's agitated it becomes difficult to see. But if you allow it to settle the answer becomes clear.
  • Quit. Don't quit. Noodles. Don't noodles. You are too concerned with what was and what will be. There's a saying. Yesterday is history, tomorrow is a mystery, but today is a gift. That is why it is called the "present".

KungFu panda quotes

The only thing that matters is what you choose to be now
Your story may not have such a happy beginning, but that doesn't make you who you are. it is the rest of your story, who you choose to be... So, who are you?



Wednesday, June 15, 2011

worth fighting for

"'The world is a fine place and worth fighting for.' I agree with the second part. " - Ernest Hemingway

Thursday, May 19, 2011

Solving Problems

We cannot solve the problems by the same way we created it

Wednesday, May 04, 2011

Quotes

"defeat is not when you fall down,It is when you refuse to get up" - "Alexander Great"

"STRUGGLE"
This 8 letter word will exhaust you, irritates you and some times demoralize you, but it gives an elegant reward called SUCCESS."

Quotes

http://www.jittery.com/quotes/book-quotes-c-1.html

Re: source of your energy

I am constantly critical of myself. And I am constantly competing
against myself since I don't measure myself against anyone. That way, there is no room for complacency.

-Vasanthi, RJ

On Wed, May 4, 2011 at 2:58 PM, sundar rajan <sundararajan.svks@gmail.com> wrote:
What is the source of your energy ?

Simple. I love what I do

-Vasanthi , RJ

source of your energy

What is the source of your energy ?

Simple. I love what I do

-Vasanthi , RJ

robert frost

"The
woods are lovely, dark and deep, But I have promises to keep; And miles
to go before I sleep, And miles to go before I sleep." - Robert Frost

Monday, March 07, 2011

Illegal stack operations

Illegal Stack Operations

Illegal stack operations can lead to hard to detect crashes. This typically takes place when a program passes a pointer of the wrong type to a function. The example given below shows a case of a function expecting an integer pointer and the caller passes a pointer to a character.

http://www.eventhelix.com/realtimemantra/Basics/debugging_software_crashes.htm

char pointer/int pointer mixup
main()
{
char count;
// The routine expects a int pointer but a char pointer has been passed
// Older compilers and non ANSI C compilers do not catch this error
GetCount(&count);
// The called function was expecting an int (say 4 byte) variable. It was
// however passed a char pointer with one byte space. GetCount will still
// write four bytes, thus corrupting local variables or parameters on the
// stack
}

bool GetCount(int *pCount)
{
. . .
*pCount = returnValue;
return true;
}

Monday, February 28, 2011

what these functions will do in socket programming [ htons(), htonl(), ntohs() and ntohl() ]

By Order of the Realm! There shall be two byte orderings, hereafter to be known as Lame and Magnificent!

I joke, but one really is better than the other. :-)

There really is no easy way to say this, so I'll just blurt it out: your computer might have been storing bytes in reverse order behind your back. I know! No one wanted to have to tell you.

The thing is, everyone in the Internet world has generally agreed that if you want to represent the two-byte hex number, say b34f, you'll store it in two sequential bytes b3 followed by 4f. Makes sense, and, as Wilford Brimley would tell you, it's the Right Thing To Do. This number, stored with the big end first, is called Big-Endian.

Unfortunately, a few computers scattered here and there throughout the world, namely anything with an Intel or Intel-compatible processor, store the bytes reversed, so b34f would be stored in memory as the sequential bytes 4f followed by b3. This storage method is called Little-Endian.

But wait, I'm not done with terminology yet! The more-sane Big-Endian is also called Network Byte Order because that's the order us network types like.

Your computer stores numbers in Host Byte Order. If it's an Intel 80x86, Host Byte Order is Little-Endian. If it's a Motorola 68k, Host Byte Order is Big-Endian. If it's a PowerPC, Host Byte Order is... well, it depends!

A lot of times when you're building packets or filling out data structures you'll need to make sure your two- and four-byte numbers are in Network Byte Order. But how can you do this if you don't know the native Host Byte Order?

Good news! You just get to assume the Host Byte Order isn't right, and you always run the value through a function to set it to Network Byte Order. The function will do the magic conversion if it has to, and this way your code is portable to machines of differing endianness.

All righty. There are two types of numbers that you can convert: short (two bytes) and long (four bytes). These functions work for the unsigned variations as well. Say you want to convert a short from Host Byte Order to Network Byte Order. Start with "h" for "host", follow it with "to", then "n" for "network", and "s" for "short": h-to-n-s, or htons() (read: "Host to Network Short").

It's almost too easy...

You can use every combination of "n", "h", "s", and "l" you want, not counting the really stupid ones. For example, there is NOT a stolh() ("Short to Long Host") function—not at this party, anyway. But there are:

htons()

host to network short

htonl()

host to network long

ntohs()

network to host short

ntohl()

network to host long

Basically, you'll want to convert the numbers to Network Byte Order before they go out on the wire, and convert them to Host Byte Order as they come in off the wire.

How to detect memory leaks in C/C++ program ?

Answer:
Let us first see, How malloc and free works.

int * p = (int*)malloc(sizeof(int));
//malloc allocates memory and returns address to p. Let us say memory address 1000 is returned by malloc.

while freeing the memory, we will make use of the same address.

free(p); //free the memory address pointed by p [ in our case the memory address is 1000]

To detect memory leaks in a multiple file:


The concept is we have to use a Linked List to store the every malloc information.

Let us say malloc() is called in 100th line in 1.C.

At the time of malloc, We need to store the following informations in a linked list.
1.address returned by the malloc() fn
2.CPP filename [To get the c/cpp filename, we can use _FILE_ macro which will gives the cpp filename]
3.Line number at which malloc is called [_LINE_ macro gives us the line number]

Whenever we are freeing the memory, we need to check the linked list whether memory to be freed is available in where we stored the malloc() information.
if it is available in a linked list, then we need to delete that particular node and then free the memory.

Ex:
1.cpp

Line No:50: int * p = malloc(sizeof(int));
Line No:70: int* q = malloc(sizeof(int));
End of the program:
free(q);
//we forget to free the p;

For the above program, we will create the linked list with two nodes to represent two malloc info in 1.cpp.
while freeing the memory, the address to be freed will be checked with the linked list. if any node in a linked list matches, then we will remove that entry.
At the end of the program,Linked list will contains information about whichever pointer is not freed from memory.

Reference:http://www.codeproject.com/KB/cpp/MemoryLeakDetectionIn_CPP.aspx

Wednesday, February 23, 2011

awesome usage of function pointers in android C/C++

I have observed some awesome usage of function pointers in android C/C++. My sample application similar to that code:

#include <conio.h>

void fn( void (*seekDoneCb)() )
{
    void (*mSeekDoneCb)() = seekDoneCb;   

    (*mSeekDoneCb)();    
}

void Seek()
{
    printf("Seek()fn Called");
}

int main(int argc, _TCHAR* argv[])
{
    fn(Seek);
    getch();
    return 0;
}

Output:Seek()fn Called

Tuesday, February 22, 2011

How Negative values are stored in system ????

How Negative values are stored in system ????

int a = -1;
printf("Value of a:%x",a );

what will be the result ??? Can you tell me the value of it ???

Is it possible to predict this value ??


Result is:

 Value of a:0xffff ffff

Yes it is possible to predict the value of it.

Reasoning:
 
   Every bit is on or off / binary coded system. In binary coded system,
the negative values can be represented in two ways:

   1.One's complement [convert the zeroes to ones and ones to zeroes]
   2.Two's complement [ Two complement = one's complement value + 1]   


                      value of  1: 0000 0001
 One's complement to represent -1: 1111 1110 [changing the zeroes and to 1s and ones to zeroes in 0000 0001]
 Two's complement value          : 1111 1111 [1111 1110 +1]   

 To represent -1, the values will be stored as 1111 1111  in memory.



In my system, size(int) is 4 bytes.
   
To represent value 1 in Hex: 0x00000001 [ single value represents 4 bits].
         Value 1 in binary  : 00000000 00000000 00000000 00000001
One's complement for -1 in binary: 11111111 11111111 11111111 11111110
       
Two's complement for -1 in binary: 11111111 11111111 11111111 11111111
Two's complement for -1 in Hex   : 0x ffff ffff [single digit represents 4 binary digits]

In the same way, we can try for different negative values too.


int a = -1;
printf("Value of a:%x",a );

what will be the result ??? Can you tell me the value of it ???

Is it possible to predict this value ??


Result is:

 Value of a:0xffff ffff

Yes it is possible to predict the value of it.

Reasoning:
 
   Every bit is on or off / binary coded system. In binary coded system,
the negative values can be represented in two ways:

   1.One's complement [convert the zeroes to ones and ones to zeroes]
   2.Two's complement [ Two complement = one's complement value + 1]   


                      value of  1: 0000 0001
 One's complement to represent -1: 1111 1110 [changing the zeroes and to 1s and ones to zeroes in 0000 0001]
 Two's complement value          : 1111 1111 [1111 1110 +1]   

 To represent -1, the values will be stored as 1111 1111  in memory.



In my system, size(int) is 4 bytes.
   
To represent value 1 in Hex: 0x00000001 [ single value represents 4 bits].
         Value 1 in binary  : 00000000 00000000 00000000 00000001
One's complement for -1 in binary: 11111111 11111111 11111111 11111110
       
Two's complement for -1 in binary: 11111111 11111111 11111111 11111111
Two's complement for -1 in Hex   : 0x ffff ffff [single digit represents 4 binary digits]

In the same way, we can try for different negative values too.

Saturday, January 15, 2011

Bsnl Broadband Connection setup in Ubuntu

Bsnl Broadband Connection setup in Ubuntu

We need to create a point to point protocol connection to make the modem interface active.
**Method I:
Connecting broadband through command-line-Bridge Mode
/* all ubuntu versions*/
Note: your modem must be set in bridge mode
Steps:
1. Open a terminal
2. Type sudo pppoeconf
3. Enter sudo password if prompted
4. A window with blue screen pops up notifying the devices that are found
5. Follow the on screen instructions and press yes till you reach the screen which asks you to enter username
6. Backspace to delete the text username and then enter the username your ISP has provided you with
7. Press yes again and then enter the password
8. Follow the instructions till it asks you "Do you want to start the connection at start up."
Give yes if you want.
9. After setup is complete you will be prompted with a message in the terminal
10. To start the connection type pon dsl-provider in the terminal
Now, your internet connection gets activated.

11. To terminate this connection type poff in terminal


**Method II:
Ubuntu 8.10(hardy) and 9.04(jaunty) users often face a problem
Problem:The network menu does not appear in System>Administration
The solutions are:
*Method I:
1. Goto Applications>Add/Remove
2. In Show, from the drop-down menu select All available applications
3. In Search tab: type network
4. In Application: check the box next to Network(configure network devices and connections)
5. Apply changes
/*To download this file you need active internet connection*/

*Method II:
1. Open a terminal
2. Type network-admin
3. If your Network Settings is not installed then it will ask you to type
sudo apt-get install network-admin
4. If there is an active internet connection the Network Settings will be installed and it can be located under System>Administration>Network


Now,coming to configuration of Bsnl broadband connection through Network Settings
Steps:
1. Switch off your modem
2. Open Network Settings dialog box form System>Administration>Network
3. Select Wired Connection and click on Properties
4. In the Connection Settings Menu select Static IP and type in the following values and save:

IP Address : 192.168.1.2
/*Assigning the Ethernet Card an IP different from that of the modem*/

Subnet Mask: 255.255.255.0
Gateway address: 192.168.1.1

/* The Modem is being made the default gateway*/

5. Switch on the Modem .
6. Open the Terminal and type sudo pppoeconf
7 .A window with blue screen appears notifying the devices found
8. Press yes till the screen appears that asks you to enter username
9. Backspace to delete the text username and then enter the username your ISP has provided you with
10. Press yes again and then enter the password

Now, your internet connection gets activated.

Note: To check the IP configuration open a terminal and type ifconfig ppp0
The IPV4 address, default gateway and subnet mask addresses are shown

From:
----------
 http://priyanka-nit.blogspot.com/2009/09/bsnl-broadband-connection-setup-in.html

Thursday, January 06, 2011

SUCCESS

Risk is my life.
Possible is my love.
Impossible is my aim.
Dangerous is my game.
Don't play with me.
Because "SUCCESS" is my name

Tuesday, January 04, 2011

limitations / possibilities

Stop thinking in terms of limitations and start thinking in terms of possibilities

Friday, November 12, 2010

*புண்ணியவான்*

*புண்ணியவான்*

*பேச்சுத் துணைக்கு ஆளின்றி
மூச்சுத் துணைக்கு ஆளாயிருந்தார்
சாப்பாட்டுக்கும் சகலத்துக்கும்
பெத்த பிள்ளையை அண்டியிருந்த
கடைசி காலக் கந்தசாமி.*

*தனியறையின்
தறிக் கட்டிலில்
புதைந்துபோன மனுசனுக்கு
வேளாவேளைக்குச் சாப்பாடும்
காலாகாலத்துக்குச் சாவும்
வந்து சேரவில்லை.*

*முணுமுணுப்புடன்
எரிச்சலும் கலந்து வீசப்படும்
உப்பில்லாப் பண்டத்தின் முன்
ஓய்ந்துகிடக்கும் பசி
கண்ணீர் கலந்து பிசைந்தால்
சரியாகிடும் ருசி.*

*இயலாமை சேர்த்து
விழுங்கும்போது
தொண்டையை அடைக்கும்
வயோதிகத் தனிமை.*

*ஒரு திங்கள் மதியம்
தீர்ந்துபோனது
கந்தசாமியின் கஷ்டங்கள்.*

*கூடிய கூட்டம் பேசிற்று
'யாருக்கும் எந்தக் கஷ்டமும் தராம
போய்ச் சேர்ந்துட்டான்
புண்ணியவான்!'*

*- கணேச குமாரன்*

Friday, October 29, 2010

Business plans

http://www.bestbusinessplans.net

Do You Have It In You?

Do You Have It In You?

There is no single sure-shot recipe that makes an entrepreneur, but if you answer a confident 'yes' to most of these questions, then you have high chances of making it

1. Can you bear great financial risk?

Willingness to take risk is one thing, being able to bear it is another. Do you have enough savings stacked up to pay your bills in case the business does not take off? Does your spouse have an income you can fall back on?

2. Do you have a unique service or product?

What you offer need not be 'new', but it should have a value proposition in terms of time, money, or quality over existing products. In other words, even an improvement over previous products can be successful.

3. Are you passionate enough?

If you don't believe in what you are doing, chances are you will never make it. Self-belief and faith in your idea are among the key factors that make a difference to a business. Many real-world case studies confirm the power of passion.

4. Do you have adequate resources?

Can you sustain yourself till profits start rolling in? Make an estimate of probable costs and worst-case scenarios and see whether you can handle them. If you do not have the money, can you borrow it? 

5. Do you have the necessary experience?

You should start your business in an area where you have experience. This isn't mandatory, but crucial if you are starting on a small budget and cannot hire external help. Else, get someone with the required experience.

6. Are you willing to sacrifice your lifestyle?

Any business usually takes a while to succeed. You must be prepared to lead an extremely frugal life for at least a few years. This might mean few vacations, little eating out and even spending less time with the family.

7. Do you like all aspects of running a business?

Running a business means doing all the unglamorous work—from paying utility bills to running around and negotiating with people who might not be particularly excited about your idea. Are you ready to go?\

8. Are you comfortable making decisions on the spot?

With a new business, you call all the shots—and there are a lot of decisions to be made without any guidance. This instant decision-making ability is vital for success.

9. What's your track record of executing your ideas?

Examine your past objectively to see whether you have assumed leadership roles or initiated solo projects. This will give you a clear idea of where you stand when it comes to taking initiative.

***

How Much Money Do I Need?

Start-up capital means money needed till your business starts earning revenues. Assume expenses would be incurred under these heads for between six months to a year. Add 15-20 per cent for unplanned expenses.

1. Preliminary expenses Expenses incurred on initial surveys or for setting up a website

2. Professional expenses To hire professionals like chartered accountants

3. Cost of goods sold To develop a product or service or total income earned minus the profit

4. Selling and distribution expenses Expenses during the sales process

5. Marketing expenses Mainly advertisements or promotions

6. Cost of technology On mobile phones, computer hardware and software, Internet

7. Administration expenses Postage, stationery, rent, telephone and insurance

8. Salary and bonus Founders usually go without salaries for the first few years

9. One-time expenditure Permits, licenses, starting inventory, housing, among others

10. Monthly expenses Telephone bills, rent, wages and salaries and cost of advertisements

Source: www.smartentrepreneur.net

***

The Tight Fist

When you have a small budget, you have to make each penny count. Here is how

Running Your Office

  • Work out of home, use existing infrastructure like laptops and phones—don't buy new ones.
  • Buy cheap PCs and try for good deals on laptops. Don't fall for expensive warranties.
  • Look for cheaper hosting and domain plans.
  • Use Skype to save on phone bills.
  • Take your time while selecting cell phone and Internet plans, review them on a monthly basis.
  • Watch your utility bills—switch off the lights, AC, fans and other appliances when you leave.
  • Print double-sided and in economy mode with lower tones to save toner; use cheaper paper.
  • Rent your non-critical office equipment like ACs, photocopiers, coffee machine.
  • Instal an electric hand dryer in your toilet to save on more expensive paper towels.
  • Watch stationery costs—take free stationery from conferences or vendor (but don't steal!).
  • Recycle scrap—keep pins, rubber bands and clips that you get in the mail.
  • Instal open-source operating systems or use free cloud computing software.

Business Travel

  • Stay with friends or relatives. If you must stay in a hotel, look for cheap options close to meeting locations. Share rooms with colleagues.
  • Use air-miles if you have any.
  • Take afternoon flights: they are cheaper.
  • If you can, get a hotel industry association discount card. You can then get discounts.
  • Plan travel in advance: look for deals. Try to club meetings in a particular city or part of a city.

Hiring People

  • Hire people at less than market rates. Hire only if work can't be done by existing employees.
  • Hire interns, freshers and train them.
  • Find contacts to assist you with legal work, finances etc., instead of outsourcing such work.
  • Don't outsource. Founders should have the core skill-sets to build and sell products. If not, get a person with the skill-set on board.

Managing Expenses

  • Don't invest too much for future needs: think up to one year ahead.
  • Change lifestyle to match cash flows.
  • Create monthly budgets for expenses. Document all expenses.
  • Analyse expenses on a 1-2 week basis and see what can be reduced further.
  • Negotiate deals with vendors or customers to give you discounts for later benefit.
  • Use the Internet extensively for advertising.

Business plan


Aruna Kappagantula Co-founded Bamboo House India, a social enterprise that promotes the use of bamboo products to provide sustainable livelihoods to rural and tribal people. The market is estimated to grow to Rs 26,000 crore by 2015.
Cover Story
30 Small Business Ideas
We thought things were slowing down in this country. Then we found these 30 companies set up by young entrepreneurs for under Rs 5 lakh each. We caught up with them to find out how they did it and how you can too


The businesses we looked at, what they started with, their perceived strengths, how they spread the word and, most vitally, why they think their idea would work today

Part 1

Part 2

***

Talent Equity: A year ago, Indrojit D. Chaudhuri and Manish Raghuvanshi started talent equity solutions in Noida, a forum for employees to voice their opinions about their workplace and salaries. users can log on and read and write anonymously

  

Mogo's Food: Sid Khullar and friends launched it two months ago, to deliver fusion food at economical prices in noida. their reasoning: good food is recession-proof. their usp: easy to order and healthy food

Evam Entertainment: Karthik Kumar teamed with Sunil Vishnu K. to create live entertainment and workshops in Chennai. revenue comes from ticket sales, corporate clientele and brand partnerships. they ride on their creativity and the scope of what they consider an unrecognised field

Bamboo house india: Aruna Kappagantula and Prashant Lingam of Hyderabad try to use bamboo to provide livelihood to rural and tribal people. bamboo, they say, is a viable alternative to wood and plastic

Thunk in india: Suren Vikash U. is a 'best out of waste' type of ideator. his brainchild provides waste management solutions to companies in Bangalore, creates products from waste raw materials and sells them. a viable opportunity, he says, if the final product is of good quality

***

ABCs Matter>>

The questions that shape a business plan


Sec 1.0 an introduction When was the company formed and by whom? Where is it based? What does the company uniquely offer?

Sec 2.0 Market opportunity What is the opportunity, need or problems in the market? Who is experiencing the need? How big is the opportunity? How fast is the opportunity growing?

Sec 3.0 Offering What is being offered to address the need? What are the different components of the offer?

Sec 4.0 The competition Why and how is the offering unique? How will it successfully compete?

Sec 5.0 Market Who are the customers? How will they use it? How is the market segmented? What does this offer mean to them?

Sec 6.0 Business model How will the offering be delivered to customers? What does the delivery chain look like? How will the support process work? How will revenue and costs flow across the chain?

Sec 7.0 Sales and marketing plan How will customers be acquired? What are the different modules or components to be sold? What are the price points?

Sec 8.0 Development plan What are the timelines and technologies? What is the strategy for product development?

Sec 9.0 Roadmap Over the next 24 months, what will be the sales and marketing objectives? What will be the company's objectives? What are the product development objectives? What is the exit strategy?

Sec 10.0 Current situation What is the present status of the offer? Are any customers testing or using it? How much money has been invested? How many employees are there?

Sec 11.0 Financials How much money do you need? When, how and at what levels will you break even? What is the monthly outlook for the next 12-18 months?

Tips: Keep the business plan about 20-25 pages in length. Number the pages, check spellings, and make sure the document is logically consistent.

Sunday, October 24, 2010

மகிழும்

அவளின் பூவிழிச் சிரிப்பினில் பூலோகம் மகிழும்

Wednesday, October 20, 2010

bind() function failure

Issue description:  bind() function is failed with error code -1.

RCA:[Root Cause Analysis]

  For this issue, I checked why bind () fn is failed.
Usually all the socket functions will return -1 for failure cases.
To know more about why it is failed, We can use WSAGetLastError() fn in case of windows.
But in case of unix/linux, There is no such function.
Instead the error value will be set to "errno" variable. We have to check this errno to know the failure.

Solution:
  I got the the file does not exit error.
Some junk  IP address value is passed to bind() function's input arguments. That is the reason, we observed this error.
I set the IP address as zero before bind() fn [which is working fine for successful cases, for failure cases,we are getting

junk IP addresses]

  I set the IP address to zero to resolve this issue.

 

Sunday, October 17, 2010

How to find the crash point in mipsandroid platform/C/C++ program

How to find the crash point in mipsandroid platform:


ps  - to list down all the processes


ps id : 568 for /system/bin/mediaserver.

 

It is best to put the following command while the application is executing/try to play streaming.

Issues I observed:
         librtsp.so is not loaded without try streaming. rtsp.so is loaded at runtime, so it has to be

 

cat /proc/568/maps


00080000-00082000 rwxp 00000000 08:05 64767      /system/bin/mediaserver
00082000-000a0000 rwxp 00082000 00:00 0          [heap]
10000000-10100000 rw-p 10000000 00:00 0
2aaa8000-2aab0000 r--s 00000000 00:07 160        /system_properties (deleted)
2aab0000-2abae000 r--p 00000000 08:05 56876      /dev/binder
5060d000-50611000 rwxp 5060d000 00:00 0
50700000-50778000 rwxp 00000000 08:05 64939      /system/lib/librtsp.so
50800000-50880000 rwxp 00000000 08:05 64873      /system/lib/libhttp.so

69f00000-69f39000 rwxp 00000000 08:05 64875      /system/lib/libbinder.so
6d800000-6d80f000 rwxp 00000000 08:05 64892      /system/lib/libdrm1.so
6d80f000-6d810000 rwxp 6d80f000 00:00 0
76180000-762e6000 rwxp 00000000 08:05 64905      /system/lib/libopencore_common.so
78400000-7859b000 rwxp 00000000 08:05 64933      /system/lib/libopencore_player.so
78700000-78706000 rwxp 00000000 08:05 64919      /system/lib/libopencore_mp4localreg.so

I/DEBUG   (  484): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  484): Build fingerprint: 'generic/generic/generic/:2.1-update1/ECLAIR/eng.root.20100819.121118:eng/test-keys'
I/DEBUG   (  484): pid: 568, tid: 842  >>> /system/bin/mediaserver <<<
I/DEBUG   (  484): signal 11 (SIGSEGV), fault addr 00000000
I/DEBUG   (  484):  zr 00000000  at 00091d65  v0 00000000  v1 00000000
I/DEBUG   (  484):  a0 00000000  a1 00091d65  a2 00000025  a3 00000000
I/DEBUG   (  484):  t0 00000000  t1 00000000  t2 00000000  t3 00000000
I/DEBUG   (  484):  t4 203e3e20  t5 00000001  t6 00000000  t7 79616c50
I/DEBUG   (  484):  s0 785a1ab0  s1 7859a248  s2 7855f060  s3 00093f24
I/DEBUG   (  484):  s4 00000000  s5 761b4e78  s6 762e5594  s7 762e5590
I/DEBUG   (  484):  t8 00000008  t9 7ef0fca0  k0 00091d65  k1 00000000
I/DEBUG   (  484):  gp 7ef6fd60  sp 2b0aecc8  s8 2b0aee28  ra 78552da4
I/DEBUG   (  484):  hi 30bb3c31  lo 718c07e0 bva 00000000 epc 78552da8
I/DEBUG   (  484):          #00  pc 78552da8  /system/lib/libopencore_player.so
I/DEBUG   (  484):          #01  ra 78552da4  /system/lib/libopencore_player.so
I/DEBUG   (  484):
I/DEBUG   (  484): code around pc:
I/DEBUG   (  484): 78552d98 8f999dc8 0320f809 8e048788 8e24000c
I/DEBUG   (  484): 78552da8 8c8b0000 8d790024 0320f809 00000000
I/DEBUG   (  484): 78552db8 8fbc0010 144000fd ae620000 240d0008
I/DEBUG   (  484):
I/DEBUG   (  484): code around lr:
I/DEBUG   (  484): 78552d94 8fbc0010 8f999dc8 0320f809 8e048788
I/DEBUG   (  484): 78552da4 8e24000c 8c8b0000 8d790024 0320f809
I/DEBUG   (  484): 78552db4 00000000 8fbc0010 144000fd ae620000
I/DEBUG   (  484):
I/DEBUG   (  484): stack:
I/DEBUG   (  484):     2b0aec88  00000000
I/DEBUG   (  484):     2b0aec8c  00000000
I/DEBUG   (  484):     2b0aec90  00000000
I/DEBUG   (  484):     2b0aec94  00000000
I/DEBUG   (  484):     2b0aec98  00000000
I/DEBUG   (  484):     2b0aec9c  00000000
I/DEBUG   (  484):     2b0aeca0  2b0aec98
I/DEBUG   (  484):     2b0aeca4  00000001
I/DEBUG   (  484):     2b0aeca8  00000000
I/DEBUG   (  484):     2b0aecac  00095c14  [heap]
I/DEBUG   (  484):     2b0aecb0  00000025
I/DEBUG   (  484):     2b0aecb4  761b4e78  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aecb8  785a1ab0
I/DEBUG   (  484):     2b0aecbc  7859a248  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecc0  7855f060  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecc4  78552da4  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecc8  0009ba70  [heap]
I/DEBUG   (  484):     2b0aeccc  00000000
I/DEBUG   (  484):     2b0aecd0  00000000
I/DEBUG   (  484):     2b0aecd4  00000001
I/DEBUG   (  484):     2b0aecd8  7859f4b0
I/DEBUG   (  484):     2b0aecdc  761b62d8  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aece0  785a1ab0
I/DEBUG   (  484):     2b0aece4  0009ba70  [heap]
I/DEBUG   (  484):     2b0aece8  00095bb8  [heap]
I/DEBUG   (  484):     2b0aecec  00095c14  [heap]
I/DEBUG   (  484):     2b0aecf0  00000000
I/DEBUG   (  484):     2b0aecf4  7853e094  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecf8  00095c14  [heap]
I/DEBUG   (  484):     2b0aecfc  7853c9e8  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aed00  00093d90  [heap]
I/DEBUG   (  484):     2b0aed04  00000006
I/DEBUG   (  484):     2b0aed08  00093f24  [heap]
I/DEBUG   (  484):     2b0aed0c  00095c14  [heap]
I/DEBUG   (  484):     2b0aed10  7859f4b0
I/DEBUG   (  484):     2b0aed14  761b4e78  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed18  00094038  [heap]
I/DEBUG   (  484):     2b0aed1c  00000006
I/DEBUG   (  484):     2b0aed20  00093d90  [heap]
I/DEBUG   (  484):     2b0aed24  785454e4  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aed28  00093d90  [heap]
I/DEBUG   (  484):     2b0aed2c  0009ba70  [heap]
I/DEBUG   (  484):     2b0aed30  7ef6fd60
I/DEBUG   (  484):     2b0aed34  00095c64  [heap]
I/DEBUG   (  484):     2b0aed38  00000000
I/DEBUG   (  484):     2b0aed3c  00095c68  [heap]
I/DEBUG   (  484):     2b0aed40  00095c14  [heap]
I/DEBUG   (  484):     2b0aed44  00000000
I/DEBUG   (  484):     2b0aed48  761b4e78  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed4c  762e5594  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed50  762e5590  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed54  7ef52a7c  /system/lib/libc.so
I/DEBUG   (  484):     2b0aed58  2b0aedd0
I/DEBUG   (  484):     2b0aed5c  00000000
I/DEBUG   (  484):     2b0aed60  00095bc4  [heap]
I/DEBUG   (  484):     2b0aed64  761a441c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed68  7ef6fd60
I/DEBUG   (  484):     2b0aed6c  00000001
I/DEBUG   (  484):     2b0aed70  fffffffb
I/DEBUG   (  484):     2b0aed74  00000000
I/DEBUG   (  484):     2b0aed78  7859f4b0
I/DEBUG   (  484):     2b0aed7c  00000000
I/DEBUG   (  484):     2b0aed80  00000001
I/DEBUG   (  484):     2b0aed84  7ef52b4c  /system/lib/libc.so
I/DEBUG   (  484):     2b0aed88  7ef6fd60
I/DEBUG   (  484):     2b0aed8c  2b0aed90
I/DEBUG   (  484):     2b0aed90  00000000
I/DEBUG   (  484):     2b0aed94  00000000
I/DEBUG   (  484):     2b0aed98  00000000
I/DEBUG   (  484):     2b0aed9c  00000000
I/DEBUG   (  484):     2b0aeda0  00000000
I/DEBUG   (  484):     2b0aeda4  00095bb8  [heap]
I/DEBUG   (  484):     2b0aeda8  00095c14  [heap]
I/DEBUG   (  484):     2b0aedac  00095c60  [heap]
I/DEBUG   (  484):     2b0aedb0  7ef6fd60
I/DEBUG   (  484):     2b0aedb4  7ef118ac  /system/lib/libc.so
I/DEBUG   (  484):     2b0aedb8  00095c14  [heap]
I/DEBUG   (  484):     2b0aedbc  761b8e04  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedc0  762eac70
I/DEBUG   (  484):     2b0aedc4  00095c14  [heap]
I/DEBUG   (  484):     2b0aedc8  7ef6fd60
I/DEBUG   (  484):     2b0aedcc  00093d94  [heap]
I/DEBUG   (  484):     2b0aedd0  00095c7c  [heap]
I/DEBUG   (  484):     2b0aedd4  761b4f3c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedd8  00093d94  [heap]
I/DEBUG   (  484):     2b0aeddc  00095c54  [heap]
I/DEBUG   (  484):     2b0aede0  00095c14  [heap]
I/DEBUG   (  484):     2b0aede4  761b7e9c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aede8  00093f98  [heap]
I/DEBUG   (  484):     2b0aedec  761a441c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedf0  762eac70
W/ActivityManager(  661): Activity pause timeout for HistoryRecord{2e933808 com.player.mp/.MediaPlayer}
I/DEBUG   (  484):     2b0aedf4  761a4974  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedf8  00094038  [heap]
I/DEBUG   (  484):     2b0aedfc  762e5494  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aee00  00093d94  [heap]
I/DEBUG   (  484):     2b0aee04  00095c7c  [heap]
I/DEBUG   (  484):     2b0aee08  00095bb8  [heap]
I/DEBUG   (  484):     2b0aee0c  761b5104  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aee10  00095bb8  [heap]
I/DEBUG   (  484):     2b0aee14  00093d94  [heap]
I/DEBUG   (  484):     2b0aee18  7ef6fd60
I/DEBUG   (  484):     2b0aee1c  00000000
I/DEBUG   (  484):     2b0aee20  762eac70
I/DEBUG   (  484):     2b0aee24  00000000
I/DEBUG   (  484):     2b0aee28  00000000
I/DEBUG   (  484):     2b0aee2c  00000000
I/DEBUG   (  484):     2b0aee30  00000000
I/DEBUG   (  484):     2b0aee34  00093f80  [heap]
I/DEBUG   (  484):     2b0aee38  2b0aee2c
I/DEBUG   (  484):     2b0aee3c  00095c00  [heap]
I/DEBUG   (  484):     2b0aee40  00093f80  [heap]

 


Crash library address range:

78400000-7859b000 rwxp 00000000 08:05 64933      /system/lib/libopencore_player.so


PC :
-------
#00  pc 78552da8  /system/lib/libopencore_player.so


Diff/Lookup Address: (78552da8-78400000) =  0x152DA8

How to calculate lookup address:

Lookup Address = (Crash address  - loadingAddress of a library)

Find crash point address Using addr2line along with Lookup address:

root@laptop:/opt/mips-4.3/bin# ./mips-linux-gnu-addr2line -e

/home/Streaming/mipsandroid/out/target/product/generic/symbols/system/lib/libopencore_player.so 0x152da8
/home/Streaming/mipsandroid/external/opencore/android/MediaControl.cpp:415
root@laptop:/opt/mips-4.3/bin#

The crash is at 415 th line in /home/Streaming/mipsandroid/external/opencore/android/MediaControl.cpp file.

Reason: Null pointer in mStack that is the reason for the crash.
The code is as below without NULL check
aResult = mStack->stackStop();

To resolve this issue, I added the below code:

 if(!mStack)
 {
  return; 
 }
 aResult = mStack->stackStop();

Friday, October 15, 2010

Buddha quotes 2

Do not believe what you have heard.
Do not believe in tradition because it is handed down many generations.
Do not believe in anything that has been spoken of many times.
Do not believe because the written statements come from some old sage.
Do not believe in conjecture.
Do not believe in authority or teachers or elders.
But after careful observation and analysis, when it agrees with reason and it will benefit one and all, then accept it and live by it.

- Gautama Buddha

buddha quotes

The secret of health for both mind and body is not to mourn for the past, nor to worry about the future, but to live the present moment wisely and earnestly – Buddha


Tuesday, September 28, 2010

Ground work needed before joining to work in foreign countries

This is someone's work done for Korea offer[ which is suitable to all countries.]

Let me tell you what all ground work I did before accepting an offer in
Korea:

1) I googled for Work culture in Korea. That prepared me mentally for
'long-working' hours.
2) Googling again told me that 'Seoul' is one of the 5-costliest cities
in the world and inflation is a-bit high here.
3) I mailed to all the friends in my network asking if they know
anybody who ever been to Korea? I got 10-11 references.
4) I mailed all of them 10-11 questions asking about:
a) Indian Food Availability.
b) Working hours.
c) Taxation rules. And, as consultant committed falsely that tax is
0%, I made sure that I do not have to pay any tax back in India.
d) As 95% of companies provide accommodation, I asked for
approximate 'Flat maintenance charges' + 'Water-n-Room Heating
expenses' + 'Society maintenance charges' and 'Internet/ TV/ phone/
mobile Connectivity charges'.
e) Cost of Transportation (to-from company and personal).
f) A rough estimate on eatables/ fruits spendings.
g) Kid's education (its extremely costly)....and some more.

5) Through one of my friend, who is International HR, got a rough
salary idea. She suggested me **most important** thing... To ask my
employer to provide me a 'Sample Salary-Slip' before signing the
Contract.

Indian consultants for Korea make a fool of us by telling that
Tax is 0% and your Salary will be 2-times OR 2.5-times of Indian Salary
without telling us anything about high cost-of-living!

Thanks to my employer, they provided me salary slip in KRW and U$D.
After comparing it with the Indian consultant's 'commitments', there
was a difference of ~2000 U$D!

6) As I was not going to use food-coupons of my employers, I made sure
to add KRW 5000 per day instead. Not much for him but fair enough for
me.

7) Knowing about 'Long working hours' and 'working on weekends' helped
me to CrossCheck the rules with employer. My employer mentioned KRW
50,000 for working on weekends (which they actually give to their
regular employees).

If anything is NOT mentioned in Contract, it won't be given
;)

8) Through 'Sample Salary Slip' I got to know that, after end-of-year
when I will return back the 'National Insurance Fund' amount (may range
from $1000-$1500) can be deposited into your Indian Bank account. And
you need to fill a form for that in the last week, before you leave.

9) Though Employers mention in contract OR consultants commit that
"every company has IP-phone... and u can make any number of calls from
office desk..blah...blah..." Its you who should make sure that u GET
this facility actually, through Contract.

U can always ask ur employer for a 'Rough Draft-of-Contract'
before u sign.

9) My employer is very honest. However there may exist some employers
who *may* create problems in ur last month's salary. Keep a Check on
that!

The Indian consultant started with and offer of 25K U$D p.a. (in-hand +
accom + all charges).. and finally his words were -"this is the biggest
offer any Korean company has made for your Experience-slot".
...Not that much actually... But, I am really carefree about miscellaneous spendings!

All I did was, I spent ~2-weeks in all this. Ground-Work! Afterall, its my
life... it me who is sacrificing!!!

On the contrary, when I reached here... I met 2-friends in Pyeongchon
who were looking frustrated as Consultant showed them a mirage of 2-2.5
times salary.
They didn't negotiate for anything!!!!

Maintenance charges + Internet + Food + Room-Water heating charges all
these they were paying from their pocket and worked for free on
weekends as it wasn't mentioned in contract! Unfortunately, they
breached the contract and went back to India on -ve notes! :(

Sunday, September 26, 2010

Self-Employment

Self-Employment:
1.aadu,kozhi valarthal
2.vellai panni valappu
3.Meen pannai
4.Maadu valarthal
5.Food Exports
6.garments exports
7.Leather factory[ Shoe, chappal]
8.Making Electronics items as kudisai thozhil[Cellphones,TV,Owens,AC,fans,Refrigerator,LCD,LED,Computer peripherals]
9.Assembling systems and sell it for low prices
10.Running Browsing center, Fax, Telephone booth to make ISD calls through internet,
Xerox machine,stationaries for writing[notebooks, ]
11.Prepare quality notebooks and sell it
12.prepare quality clothes & fashion clothes and target only to indians
13.Making of electronics items with innovative styles
14.develop the devices to make use of sun to generate electricity
15. Buy clothes and have tailors to make it and sell shirts and pants
16.Chain of food restaurants as like McDonalds
17.Chain of super markets as like Reliance Fresh
18.Constructing houses and selling it for middle class ppls
19. Inventing / R & D products in electronics
20. Computer interfaced with electronics, Automation
[Door locker, Micro controller products]

Saturday, September 25, 2010

Eatables Checklist needed for official trip

If I go to any official travel trip, Things needed.


1.vathal kuzhambu
2.Kongura
3.pattaani, kondaikadalai
4.oil -1 litre
5.Lion dates - 1kg
6.Lion honey-200g
7.Paruppu podi
8.lemon pickle
9.Garlic pickle
10.Electrical rice cooker with world travel apapter
11.Noodles
12.Ready to eat items[MTR]
13.Moong dal
14.masala powder
15.pepper powder
16.cheera powder
17.Biryani powder
18.Wheat flour
19.Ghee
20.malli kuzhambu
21.Dosa mix
22.Bisibele Bhath rice
23.Rasam Rice
24.jeera rice
25.Sambar Rice
26.lemon Rice
27.Tamarind Rice
28.Tomato Rice
29.Puli
30.Ready made chapathi packets
31.Ginger Paste
32.Tomato sauce for noodles
33.Instant Idiyaappam [ we can buy milk and mix sugar on it]
34.White Sugar

MTR ready to eat items:
1.avial
2.Alu muttar
3.channa masala
4.Dal Fry
5.panneer butter masala
6.Bhindi masala [ladies finger with spices]
7.Mix. Veg Curry
8.Palak panneer
9.Peas and mushroom curry
10.Veg. Pulao
11.Pav Bhajji
12.Ajowan Paratha
13.Alu Paratha
14.Lacha paratha
15.Plain Paratha
16.Nawabi Paratha
17.Methi muttar Paratha

Thursday, September 23, 2010

Gandhi quotes

If I want to deprive you of your watch, I shall certainly have to fight for it; if I want to buy your watch, I shall have to pay for it; and if I want a gift, I shall have to plead for it; and, according to the means I employ, the watch is stolen property, my own property, or a donation.

I do believe that, where there is only a choice between cowardice and violence, I would advise violence..

I believe that nonviolence is infinitely superior to violence, forgiveness is more manly than punishment.

Wednesday, September 22, 2010

Chinese words for vegetarian

Chinese words for vegetarian

symbol for veg. food in taiwan

If you don't speak or read Chinese, there are two common symbols that mark vegetarian food. One is the lotus flower, and the other is the swastika. The characters for vegetarian food (su4 shi2) look like this: 素食

Monday, September 20, 2010

Jains

Jains not only strictly prohibit their members from eating any animal meat, but they go a step further. They don't allow root vegetables, such as onions and potatoes, lest some germs be attached to them.

Principles for Satyagrahis

Principles for Satyagrahis

Gandhi envisioned satyagraha as not only a tactic to be used in acute political struggle, but as a universal solvent for injustice and harm. He felt that it was equally applicable to large-scale political struggle and to one-on-one interpersonal conflicts and that it should be taught to everyone.[17]

He founded the Sabarmati Ashram to teach satyagraha. He asked satyagrahis to follow the following principles (Yamas described in Yoga Sutra):[18]

  1. Nonviolence (ahimsa)
  2. Truth — this includes honesty, but goes beyond it to mean living fully in accord with and in devotion to that which is true
  3. Non-stealing
  4. Chastity (brahmacharya) — this includes sexual chastity, but also the subordination of other sensual desires to the primary devotion to truth
  5. Non-possession (not the same as poverty)
  6. Body-labor or bread-labor
  7. Control of the palate
  8. Fearlessness
  9. Equal respect for all religions
  10. Economic strategy such as boycotts (swadeshi)
  11. Freedom from untouchability

On another occasion, he listed seven rules as "essential for every Satyagrahi in India":[19]

  1. must have a living faith in God
  2. must believe in truth and non-violence and have faith in the inherent goodness of human nature which he expects to evoke by suffering in the satyagraha effort
  3. must be leading a chaste life, and be willing to die or lose all his possessions
  4. must be a habitual khadi wearer and spinner
  5. must abstain from alcohol and other intoxicants
  6. must willingly carry out all the rules of discipline that are issued
  7. must obey the jail rules unless they are specially devised to hurt his self respect

Rules for satyagraha campaigns

Gandhi proposed a series of rules for satyagrahis to follow in a resistance campaign:[12]

  1. harbour no anger
  2. suffer the anger of the opponent
  3. never retaliate to assaults or punishment; but do not submit, out of fear of punishment or assault, to an order given in anger
  4. voluntarily submit to arrest or confiscation of your own property
  5. if you are a trustee of property, defend that property (non-violently) from confiscation with your life
  6. do not curse or swear
  7. do not insult the opponent
  8. neither salute nor insult the flag of your opponent or your opponent's leaders
  9. if anyone attempts to insult or assault your opponent, defend your opponent (non-violently) with your life
  10. as a prisoner, behave courteously and obey prison regulations (except any that are contrary to self-respect)
  11. as a prisoner, do not ask for special favourable treatment
  12. as a prisoner, do not fast in an attempt to gain conveniences whose deprivation does not involve any injury to your self-respect
  13. joyfully obey the orders of the leaders of the civil disobedience action
  14. do not pick and choose amongst the orders you obey; if you find the action as a whole improper or immoral, sever your connection with the action entirely
  15. do not make your participation conditional on your comrades taking care of your dependents while you are engaging in the campaign or are in prison; do not expect them to provide such support
  16. do not become a cause of communal quarrels
  17. do not take sides in such quarrels, but assist only that party which is demonstrably in the right; in the case of inter-religious conflict, give your life to protect (non-violently) those in danger on either side
  18. avoid occasions that may give rise to communal quarrels
  19. do not take part in processions that would wound the religious sensibilities of any community

Tuesday, August 31, 2010

எது எதுக்கோ ட்ரையல் பார்க்கிறீர்களே , பாடையில் ஏறி படுத்து பார்த்திருக்கிறீர்களா?

எது எதுக்கோ ட்ரையல் பார்க்கிறீர்களே , பாடையில் ஏறி படுத்து பார்த்திருக்கிறீர்களா?

Thursday, August 05, 2010

Japanese

Japanese Saying :- If one can do it, U too can do it!
If none can do it, U must do it!


Wednesday, July 14, 2010

Tamil books

அகத்தியர் பனிரெண்டாயிரம்
போகர் ஏழாயிரம்

Tuesday, June 29, 2010

Bash shell shortcuts

Bash shell shortcuts

Bash, which is the default shell in Linux contains a whole lot of key bindings which makes it really easy to use . The most commonly used shortcuts are listed below :

____________CTRL Key Bound_____________
Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen
Ctrl + r - Search the history backwards
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + u - Delete backward from cursor
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command
____________ALT Key Bound___________
Alt + < - Move to the first line in the history
Alt + > - Move to the last line in the history
Alt + ? - Show current completion list
Alt + * - Insert all possible completions
Alt + / - Attempt to complete filename
Alt + . - Yank last argument to previous command
Alt + b - Move backward
Alt + c - Capitalize the word
Alt + d - Delete word
Alt + f - Move forward
Alt + l - Make word lowercase
Alt + n - Search the history forwards non-incremental
Alt + p - Search the history backwards non-incremental
Alt + r - Recall command
Alt + t - Move words around
Alt + u - Make word uppercase
Alt + back-space - Delete backward from cursor

----------------More Special Keybindings-------------------

Here "2T" means Press TAB twice

$ 2T - All available commands(common)
$ (string)2T - All available commands starting with (string)
$ /2T - Entire directory structure including Hidden one
$ 2T - Only Sub Dirs inside including Hidden one
$ *2T - Only Sub Dirs inside without Hidden one
$ ~2T - All Present Users on system from "/etc/passwd"
$ $2T - All Sys variables
$ @2T - Entries from "/etc/hosts"
$ =2T - Output like ls or dir

Friday, June 25, 2010

Present

Today is a gift, that is why it is called as 'The present'


Monday, June 21, 2010

How to make use of find to search files ??

find  ./ -name 'alsa*'

This will displays the filenames started with 'alsa' in a current directory


How to use grep command ??

To search for the given PATTERN in a current directory recursively :


grep -r PATTERN   DIR_PATH 

grep -r  init()  ./

it will displays the files which are having init() fn.


grep -r  init()  ./  -n

it will displays the files with init() fn and its occurence line number too...



 

How 2 Unpack/pack the android images:

How 2 Unpack the android images:
---------------------------------
1. ./unyaffs system.img  (unpack the yaffs file system.img) yaffs - file system
2.gunzip -c ramdisk.img |cpio -i
3../unpack-bootimg.pl boot.img

To Pack System.img:
---------------------
mkyaffs2image tool

./mkyaffs2image ./system (folder) system.img

will creates the system.img from system folder.

Tuesday, June 15, 2010

What good will they do you

However many holy words you read,

However many you speak,

What good will they do you

If you do not act upon them?

Are you a shepherd

Who counts another man's sheep,

Never sharing the way?

Read as few words as you like,

And speak fewer.

But act upon the dharma.

Give up the old ways -

Passion, enmity, folly.

Know the truth and find peace.

Share the way.

success

SUCCESS IS NOT TO BE EQUATED WITH GOODNESS.To believe in yourself and to follow your dreams, to have goals in life and a drive to succeed, and to surround yourself with the things and the people that make you happy----this is what we can call it as real success.

80/20 principle

 80/20 principle which  lays down that in an any organisation 80 percent of the work was done by 20 percent people and 20 percent work done by 80 percent people. "

Monday, June 07, 2010

what she is to me

what she is to me ? Words cannot express ...

Tuesday, June 01, 2010

hero

A hero never chooses his destiny. His destiny chooses him.

Tuesday, May 25, 2010

Register Node/Recognizer/OMX decoder component

Register Node/Recognizer/OMX decoder component:
----------------------------------------------------------------------------

//Add the dummy recognizer code in Recognizer folder;

1.#include the rec_factory.h in external\opencore\engines\player\config\core\pv_player_node_registry_populator.cpp
2.Create the instance in RegisterAllRecognizers() fn of the same file.


3.BUILD_MACRO defns available in \external\opencore\build_config\opencore_dynamic\pv_config.h file

4.We need to add our Node/register's library & android.mk in
\external\opencore\build_config\opencore_dynamic\Android_opencore_player.mk file

 

5.Configure Node/recognizer/decoder (pvyuvffrecognizer_lib=m) in \external\opencore\build_config\opencore_dynamic\pv_config_selected.mk

6.Configure the shared recognizer/node/decoder's library make path(/pvmi/recognizer/plugins/pvyuvffrecognizer/build/make)
in \external\opencore\build_config\opencore_dynamic\pv_config_derived.mk

 

Wednesday, May 19, 2010

red-faced gentleman

I know a planet where there is a certain red-faced gentleman. He had never smelled a flower. He has never looked at a star. He has never loved any one. He has never done anything in his life but add up figures.

essential things

The essential things in life are seen not with the eyes, but with the heart.

You are attempting with incorrect version of javac in Ubuntu while building android source code

Situation:

I have copied the JRE & JAVA SDK folder and set the environment variable . (without installing java, make it as
like an installed). with this one, I am able to compile android checkout.
I have checked the version of the java. its version is JDK_1.0.5_19;
Once I tried to install eclipse, then old version or updated version is installed in my laptop ,
so I couldnt be able to compile android source code and got the error as follows:


Error: You are attempting with incorrect version of javac in Ubuntu while building android source code


Solution:
We can get current java version by typing "java -version". I found that the java version is different from working version (android compiled code);
So we have to remove the recently installed version and reinstall the java .

We have to search the recently installed version by typing the command:

"aptitude search jdk"

it will lists out the JDK packages.

Remove all the JDK packages (Our JDK package doesnt need installation) by typing the following command:

aptitude purge $1 ($1 is the package listed in "aptitude search jdk")

install java_1_5_0_19 .bin file and then now try recompiling the code.Now it is working.

Environment variable was not set in Ubuntu

Error:

 if we are setting the environment variable PATH, its value is not reverted back to last value once the
terminal is closed.

Solution:
To overcome this problem, we need to set the environment variable in
.bashrc file in root folder.

Monday, May 17, 2010

Chetan Bhagat speech at symbiosis

Following is the speech by Chetan Bhagat given at the orientation programme for the new batch of MBA students at Symbiosis, Pune.

Good Morning everyone and thank you for giving me this chance to speak to you. This day is about you. You, who have come to this college, leaving the comfort of your homes (or in some cases discomfort), to become something in your life. I am sure you are excited. There are few days in human life when one is truly elated.  The first day in college is one of them.  When you were getting ready today, you felt a tingling in your stomach. What would the auditorium be like, what would the teachers be like, who are my new classmates – there is so much to be curious about. I call this excitement, the spark within you that makes you feel truly alive today. Today I am going to talk about keeping the spark shining. Or to put it another way, how to be happy most, if not all the time.

Where do these sparks start? I think we are born with them. My 3-year old twin boys have a million sparks. A little Spiderman toy can make them jump on the bed. They get thrills from creaky swings in the park. A story from daddy gets them excited. They do a daily countdown for birthday party – several months in advance – just for the day they will cut their own birthday cake.

I see students like you, and I still see some sparks. But when I see older people, the spark is difficult to find. That means as we age, the spark fades. People whose spark has faded too much are dull, dejected, aimless and bitter. Remember Kareena in the first half of Jab We Met vs the second half? That is what happens when the spark is lost.   So how to save the spark?

Imagine the spark to be a lamp's flame. The first aspect is nurturing – to give your spark the fuel, continuously. The second is to guard against storms.

To nurture, always have goals. It is human nature to strive, improve and achieve full potential. In fact, that is success. It is what is possible for you. It isn't any external measure – a certain cost to company pay package, a particular car or house.

Most of us are from middle class families. To us, having material landmarks is success and rightly so. When you have grown up where money constraints force everyday choices, financial freedom is a big achievement. But it isn't the purpose of life. If that was the case, Mr. Ambani would not show up for work. Shah Rukh Khan would stay at home and not dance anymore. Steve Jobs won't be working hard to make a better iPhone, as he sold Pixar for billions of dollars already. Why do they do it? What makes them come to work everyday? They do it because it makes them happy. They do it because it makes them feel alive Just getting better from current levels feels good. If you study hard, you can improve your rank. If you make an effort to interact with people, you will do better in interviews. If you practice, your cricket will get better. You may also know that you cannot become Tendulkar, yet. But you can get to the next level. Striving for that next level is important.

Nature designed with a random set of genes and circumstances in which we were born. To be happy, we have to accept it and make the most of nature's design. Are you? Goals will help you do that. I must add, don't just have career or academic goals. Set goals to give you a balanced, successful life. I use the word balanced before successful. Balanced means ensuring your health, relationships, mental peace are all in good order.

There is no point of getting a promotion on the day of your breakup. There is no fun in driving a car if your back hurts. Shopping is not enjoyable if your mind is full of tensions.

You must have read some quotes – Life is a tough race, it is a marathon or whatever. No, from what I have seen so far, life is one of those races in nursery school, where you have to run with a marble in a spoon kept in your mouth. If the marble falls, there is no point coming first. Same with life, where health and relationships are the marble. Your striving is only worth it if there is harmony in your life. Else, you may achieve the success, but this spark, this feeling of being excited and alive, will start to die.

One last thing about nurturing the spark – don't take life seriously. One of my yoga teachers used to make students laugh during classes. One student asked him if these jokes would take away something from the yoga practice. The teacher said – don't be serious, be sincere. This quote has defined my work ever since. Whether its my writing, my job, my relationships or any of my goals. I get thousands of opinions on my writing everyday. There is heaps of praise, there is intense criticism. If I take it all seriously, how will I write? Or rather, how will I live? Life is not to be taken seriously, as we are really temporary here. We are like a pre-paid card with limited validity. If we are lucky, we may last another 50 years. And 50 years is just 2,500 weekends. Do we really need to get so worked up? It's ok, bunk a few classes, goof up a few interviews, fall in love. We are people, not programmed devices.

I've told you three things – reasonable goals, balance and not taking it too seriously that will nurture the spark. However, there are four storms in life that will threaten to completely put out the flame. These must be guarded against. These are disappointment, frustration, unfairness and loneliness of purpose.

Disappointment will come when your effort does not give you the expected return. If things don't go as planned or if you face failure. Failure is extremely difficult to handle, but those that do come out stronger. What did this failure teach me? is the question you will need to ask. You will feel miserable. You will want to quit, like I wanted to when nine publishers rejected my first book. Some IITians kill themselves over low grades – how silly is that? But that is how much failure can hurt you. But it's life. If challenges could always be overcome, they would cease to be a challenge. And remember – if you are failing at something, that means you are at your limit or potential. And that's where you want to be.

Disappointment' s cousin is  Frustration, the second storm.  Have you ever been frustrated? It happens when things are stuck. This is especially relevant in India. From traffic jams to getting that job you deserve, sometimes things take so long that you don't know if you chose the right goal. After books, I set the goal of writing for Bollywood, as I thought they needed writers. I am called extremely lucky, but it took me five years to get close to  a release. Frustration saps excitement, and turns your initial energy into something negative, making you a bitter person. How did I deal with it? A realistic assessment of the time involved – movies take a long time to make even though they are watched quickly, seeking a certain enjoyment in the process rather than the end result – at least I was learning how to write scripts, having a side plan – I had my third book to write and even something as simple as pleasurable distractions in your life – friends, food, travel can help you overcome it. Remember, nothing is to be taken seriously. Frustration is a sign somewhere, you took it too seriously.

Unfairness – this is hardest to deal with, but unfortunately that is how our country works. People with connections, rich dads, beautiful faces, pedigree find it easier to make it – not just in Bollywood, but everywhere. And sometimes it is just plain luck. There are so few opportunities in India, so many stars need to be aligned for you to make it happen. Merit and hard work is not always linked to achievement in the short term, but the long term correlation is high, and ultimately things do work out. But realize, there will be some people luckier than you. In fact, to have an opportunity to go to college and understand this speech in English means you are pretty damm lucky by Indian standards. Let's be grateful for what we have and get the strength to accept what we don't. I have so much love from my readers that other writers cannot even imagine it. However, I don't get literary praise. It's ok. I don't look like Aishwarya Rai, but I have two boys who I think are more beautiful than her. It's ok. Don't let unfairness kill your spark.

Finally, the last point that can kill your spark is Isolation. As you grow older you will realize you are unique. When you are little, all kids want Ice cream and Spiderman. As you grow older to college, you still are a lot like your friends. But ten years later and you realize you are unique. What you want, what you believe in, what makes you feel, may be different from even the people closest to you. This can create conflict as your goals may not match with others. And you may drop some of them. Basketball captains in college invariably stop playing basketball by the time they have their second child. They give up something that meant so much to them. They do it for their family. But in doing that, the spark dies. Never, ever make that compromise. Love yourself first, and then others.

There you go. I've told you the four thunderstorms – disappointment, frustration, unfairness and isolation. You cannot avoid them, as like the monsoon they will come into your life at regular intervals. You just need to keep the raincoat handy to not let the spark die.

I welcome you again to the most wonderful  years of your life. If someone gave me the choice to go back in time, I will surely choose college. But I also hope that ten years later as well, your eyes will shine the same way as they do today. That you will Keep the Spark alive, not only through college, but through the next 2,500 weekends. And I hope not just you, but my whole country will keep that spark alive, as we really need it now more than any moment in history. And there is something cool about saying – I come from the land of a billion sparks.

Wednesday, May 12, 2010

Multiple Target patterns error with mak files in android/linux

Gnu make looks for tab space after the target line.
For ex:
$(TARGETDIR)/test.lib : $(TEST_SRC)
$(group_test)

The above line in.mak file would throw multiple target patterns error.

correct format would be

$(TARGETDIR)/test.lib : $(TEST_SRC)
<adding tab space here>$(group_test).
 
Solution:
By giving  some tabspace it will compile without any problem.

Android_Out of memory error

I got a wierd problem with android emulator, I have created a virtual device through Android AVD manager (newly created emulator with platform 2.1 and api level 7), I have tried with standard settings and with added hardware parameter for larger (256 mb) device ram size but nothing changed.

I need to come files to the system partition to test a project (called haggle), but for some reason the system partition has no space from start.

aa a@aaa /home/haggle-0.2-android $ adb -s emulator-5554 shell

# df df /dev: 47084K total, 0K used, 47084K available (block size 4096) /sqlite_stmt_journals: 4096K total, 0K used, 4096K available (block size 4096) /system: 73600K total, 73600K used, 0K available (block size 4096) /data: 65536K total, 18464K used, 47072K available (block size 4096) /cache: 65536K total, 1156K used, 64380K available (block size 4096)

As you can see the system partition has 0K space available. When a connect a non-rooted HTC Nexus One and do the same I get these values:

/dev: 108896K total, 0K used, 108896K available (block size 4096) /sqlite_stmt_journals: 4096K total, 0K used, 4096K available (block size 4096) /system: 148480K total, 116364K used, 32116K available (block size 4096) /data: 200960K total, 22296K used, 178664K available (block size 4096) /cache: 97280K total, 1852K used, 95428K available (block size 4096) /sdcard: 3864064K total, 118496K used, 3745568K available (block size 32768)
 
Solution:
 
 

When starting the emulator you can specify the partition size by -partition-size x emulator_name.

done through the terminal that is.

Example: emulator -partition-size 125 @b

What I am wondering is why the system partition on the emulator has 0K free space from beginning and what can I do to change that? Even if I make the partition write-able with mount/remount I get the same 0K values.

Becoming an artist does not merely mean learning something, acquiring professional

Becoming an artist does not merely mean learning something, acquiring professional

techniques and methods. Indeed, as someone has said, in order to

write well you have to forget about grammar. Though, of course, in order to forget it you have first to know it.
- Andrey tarkovsky