Thursday, May 03, 2012

DecodeButDoNotRender

Insights on How to implement DecodeButDoNotRender flag in any
multimedia framework ?
This will happen when we dont have more I frames.

Wednesday, April 25, 2012

what is structure padding ?

what is structure padding ?

if the system is 32 bit system,
we are allocating memory like this:

struct test
{
char a;
int b;
};

It will allocate 8 bytes of memory in 32 bit system. For char,compiler
will allocate the 4 bytes. [char may be 1 or 2 bytes]
this is called data alignment. Data alignment means putting the data
at a memory offset equal to some multiple of the word size,
which increases the system's performance due to the way the CPU handles memory.
For char, 4 bytes are allocated. it will use only 1 bytes.Rest of the
bytes are filled with junk values. this is called structure padding.

For example, in 32 bit system,the data to be read should be at a
memory offset which is some multiple of 4.
if the data starts from the 18th byte, computer has to read two 4
bytes chunks to read the data.
if the data starts from multiple of 4[4,8,12,16,20], computer can read
4 byte chunk once to read the data.
If the read is from two virtual memory pages, then it will take more
time than expected.

In this way, padding improves performance.


if the data members are declared in descending order it will give
minimal wastage of bytes.

struct Test
{
char a;
int b;
char c;
};

sizeof(Test) is 12 bytes.

But if we declared like this, 8 bytes will be allocated for structure "Test".


struct Test
{

int b;
char c;
char a;
};

How to avoid structure paddding?
if we dont want to waste memory & tradeoff the performance,
we need to use pragma pack to align data.

Tuesday, April 24, 2012

How OMX core library is loaded for stagefright by chipset vendor like Qualcomm /Nvidia ?

How OMX core library is loaded for stagefright by chipset vendor like
Qualcomm /Nvidia ?

Qualcomm and NVIDIA processors will have built-in hardware codecs support.
They will provide the OMX components too. Their OMX core will be
loaded from libstagefrighthw.so .
This libstagefrighthw.so library will be loaded by stagefright in
OMXMaster.cpp in

addPlugin("libstagefrighthw.so");

vertical/horizontal sync in video

Video Is Composed of a Series of Still Images.
changing fast enough that it looks like continuous motion.
timing informations are called vertical sync/horizontal sync.

vertical sync - indicates when a new image is starting
horizontal sync -indicates when a new scanline is starting

Each still is composed of series of scanlines.

Interlaced vs Progressive:
For displays that "paint" an image on the screen, such as a CRT,
Interlaced-each image is displayed starting at the top left corner of
the display, moving to the right edge of the display.

Interlacing: First odd number of pixels are sent to display and then
even number of pixels are sent to display the image.
Advantage: we can reduce memory transfered to display by half for every image.

Progressive: pixels are displayed by sequence of lines.For Higher
resolution, we go for progressive.
Interlaced: First half of image is displayed on screen and then next
half of image is displayed

string searching algorithms with code

http://www-igm.univ-mlv.fr/~lecroq/string/string.pdf

Friday, April 20, 2012

code forces FileList problem

Code forces FileList problem :

PseudoCode:
==============

#define MAX_FILENAME 8
#define TwoContinuousDots 0
#define SingleCharBetweenTwoDots 1
#define MAX_FILE_EXT 11
#define EndsWithDot 0
#define MAX_EXT 3


1.read the string input
2.Identify the dot & break the loop
3.if (stringBeginsWith == Dot) return NO;
4.if (CurrentCharPosition > MAX_FILENAME) //DotPosition exceeds
MAX_FILENAME allowed || Dot is not available within 8 character
return NO;
5.Store the ++LastDotPos
6.start loop through the string till EOS reached
7.if [ currentDotPos - lastDotPos == TwoContinuousDots ] { return NO;}
8.if ( CurrentDotPos - lastDotPos == SingleCharBetweenTwoDots ) { return NO;}
9.if ( CurrentDotPos - lastDotPos > MAX_FILE_EXT ) return NO;

At Last of the string,
10.if( CurrentDotPos - lastDotPos == EndsWithDot ) return NO;
11.if( CurrentDotPos - lastDotPos > MAX_EXT ) return NO; //Last
extension exceeds MAXIMUM_EXTENSION size
12.Yes... we are going to parse the valid String
13.create loop1... Search First Dot
14.if (char == FirstDOT) create loop2 and look for SecondDOT
15.if no second DOT and EOS reached,print string. [Ex: t.txt]
16.if(TwoDotsDiff <= MAX_EXT) printf( secondDot + 1 char);Move i by 1
17.else print (3 characters) Move i by 3

Thursday, April 19, 2012

Solve contest problems

To Solve any codeforces contest problems:

1)Prepare the testcases from the given problem statement
2)Prepare test samples
3)Prepare design
4)Check if any datastructure can be used & what will be the cons & pros
5)If multiple datastructure can be used, Identify the best
suitable datastructure
6) Sometimes tradeoff clarity/simplicity over efficiency
7) Once completed the code, test with test samples
8) if anyone has already submitted the problem, we can see the
testcases used for testing the solution.
we can check our code with codeforces simple testinputs
This will clarify if we misunderstood the problem statement.
[Ex: For Cd and PWd commands problem, from the problem
statement, I assumed that .. or / wont come at end.
But from the testsamples,I came to know this as a valid input]
9) Think on how to improve the code

After seeing others code,

1) Prepare testcases from code
2) Prepare testsamples to break the code
3) Randomly remove some lines of code and try to fix it...
This will give a chance to understand/read others code.

4.Identify any language functions/features used in code for
addressing particular scenarion & think of it
how to use it
5.Check the efficient code[less execution time] written by others
6.Check others code which is having clarity and simplicity

Tuesday, April 17, 2012

How to traerse/print character by character in a string without using strlen() ?

How to traerse/print character by character in a string without using strlen() ?


Usually we will do like this:

char szString[100]={0};
scanf("%s",szString);

for(int i = 0; i <strlen(szString); i++);
{
printf("%c",szString[i];
}


without knowing strlen(), we can print the same thing as below:

char szString[100]={0};
scanf("%s",szString);

for(int i = 0; szString[i]; i++);
{
printf("%c",szString[i];
}

if szString reaches NULL, it will returns zero, so for loop will be
terminated for that case.

Monday, April 16, 2012

find trailing zeros & its importance

How to find trailing zeros in factorial ?

Input : 6 = 2 * 3 * 4 * 5 = 120 = Trailing zeros = 1
Output : 1

For more detailed tutorial :
http://www.purplemath.com/modules/factzero.htm


#include <stdio.h>

void main()
{
long n =0;
long div = 5;
long sum = 0;

printf("Enter N! value:");
scanf("%ld",&n);

while(n >= div)
{
sum += n/div;
div *= 5;
}
printf(" Output is :%ld", sum);
}

Importance of finding the trailing zeros will be useful in floating
point representation.

It will be used to represent floating numbers
as 2 * (10 ^ 3)
mantissa: 2
exponent: 3

Same will be used to represent negative numbers in floating point
representation;

2 * (10 ^ -3)

Wednesday, April 11, 2012

Self synchronization Explicit AV synchronization in Stagefright

Self Synchronization or Explicit AV synchronization:
This is used in any file format. while creating AVI/MPEG4 file,
audio and video encoder data wont be written as such.
Encoded Video and audio frames are written to the file based on interleaving.
AudioFrame: A0 A1 A2
VideoFrame: V0 V1 V2
After interleaving, the data will be as like this: V0 A0 V1 A1 V2 A2
Interleaved data is written into file.
Interleaving can be based on number of frames or duration. Let us say
inteleaved duration is for 1 seconds.
Android stagefright is supporting this interleaved duration. Until
interleave duration is reached, MPEG4Writer will buffers data
in list. Once the interleaved duration is reached, it will be
signalled to MPEG4WriterThread.
MPEG4 Writer thread will write the queued samples in to the file.

Tuesday, April 10, 2012

DirectX Transform Editing Services

http://sworks.com/keng/da/multimedia/dtrans/c++/ - we can have the code for the DirectX Transform samples
http://com.it-berater.org/COM/webbrowser/filters_reference.htm

course on search engine/ text mining

http://net.pku.edu.cn/~course/cs502/2003/

Wednesday, March 14, 2012

AV Sync, Mixing two audio tracks in android

1. AV sync is undetectable if sound is rendered -100ms to +25 ms to video
- Sound Delayed
+ Sound advanced


2.How android audio flinger is mixing two or more tracks in mixer thread ?

 [How to mix two or more audio streams/tracks together ?]

If you want to mix streams A & B, you simply sum the corresponding samples: A1+B1=C1, A2+C2=B2... An+Bn=Cn...
Of course, both streams must have the same sample rate (and with integer formats, both must have the same bit-depth) before you sum.

    With integer formats you have to scale the input streams before summing (i.e. divide by 2), or you need to allow for
larger numbers (more bits) in the output stream. Even with 32-bit floating point, you'll normally want to scale before or after mixing to avoid clipping.
(The 32-bit data won't clip, but you can clip the DAC output.)

And frequently with audio mixing, you'll want to scale the input levels because you don't always want a 1:1 mix... You may want one signal to be louder in the mix.  Audio flinger is mixing one or more tracks as mentioned above.

 

From:http://www.hydrogenaudio.org/forums/index.php?showtopic=79430

 

Sunday, March 11, 2012

How localplayback errors are notified from C++ to java mediaplayer/ mediarecorder layer/Application in android ?

How localplayback errors are notified from C++ to java mediaplayer/ mediarecorder layer/Application in android ?


Java layer will have

MediaPlayer
{
  public static void postEventFromNative() { Notifies Error or Information events to Application thru InfoListener or ErrorListener }

};

JNI:
=====

JNIMediaPlayerListener/ JNIMediaRecorderListener is passed to underlying c++ mediaplayer or mediarecorder [libmedia] object.

whenver C++ mediaplayer or media recorder encounters errors it will call JNIMediaPlayerListener's notify () fn.

JNIMediaPlayerListener's notify/JNIMediaRecorderListener's notify is implemented in JNI.


void JNIMediaPlayerListener/JNIMediaRecorderListener::notify(int msg, int ext1, int ext2, const Parcel *obj)

{
   
    fields.post_event = env->GetStaticMethodID(clazz, "postEventFromNative",
                                               "(Ljava/lang/Object;IIILjava/lang/Object;)V");
  env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
                msg, ext1, ext2, NULL); //This will call the postEventFromNative() fn in Java...
 
}

Tuesday, February 28, 2012

How to detect if one of the linked list pointer is corrupted or not ?

How to detect if one of the linked list pointer is corrupted or not ?

0.In case of doubly linked list, by checking the prev/next pointer, we can identify whether the pointer is valid or not...
1.We can add some extra field to store the count of the linked list node  from 1,2,... and so on. For any node we can check the value with previous node value
2.we can make use of virtualquery() fn in windows to check whether the given address is valid or not.
In the same way, in linux, we will be having mprotect() fn. if we are passing the invalid address in mprotect(), it will notifies the application
with SIGSEGV signal, Application need to catch this signal and do the necessary things.
 

Monday, February 27, 2012

blessing

There is no disaster that cannot become a blessing and no blessing that cannot become a disaster - Richard Bach

Soviet Era math. books link

http://mirtitles.org/

Thursday, January 26, 2012

Lock based synchronization and Lock free synchronization

Lock based synchronization provides the following problems
1.Deadlock

2.LiveLock

3.Priority Inversions

4.Caravan Formation

To avoid these problems, we are going for lock free synchronization. AsynchronousProgramming is a typical technique for achieving lock free synchronization.

Example: Android Stagefright is having lock based synchronization mechanism

PV's OpenCORE is having lock free synchronization mechanism

Tuesday, January 03, 2012

How to add logs into android.mk [to display the information at compile time]

How to add logs into android.mk file:
 
This log will be printed whenever we are compiling.
Usecases: In a large project, somewhere the values will be set, User wont be aware of it.
So that time,to print which device macro is enabled, we can make use of this warning in android.mk

within Android.mk,

ENABLE_CODEC =1
ifeq(ENABLE_CODEC,true)
$(warning SUNDARA::ENABLE_CODEC is true)
else
$(warning SUNDARA::ENABLE_CODEC is false)
endif

#How to print the variable from Android.mk

TARGET_PLATFORM := MSM7227
$(warning SUNDARA::Target Plarform is '$(TARGET_PLATFORM)')

output:
SUNDARA::ENABLE_CODEC is true
Target Plarform is MSM7227

Monday, December 19, 2011

Think clearly

 The scientists of today think deeply instead of clearly. One must be sane to think clearly, but one can think deeply and be quite insane.

Friday, November 25, 2011

Tao Te Ching.

Tao Te Ching. Although it's a philosophy book and not a programming book, some of it's principles are very applicable to programming:

"Know when it's time to stop. If you don't know then stop when you are done."

Translation: Knowing your requirements means you know when to stop. If you don't know when to stop, you need to stop because the requirements have yet to be defined.

"The harder one tries, the more resistance one creates for oneself."

Translation: How many times have you worked on a problem for several hours, only to find the answer after taking a 15-minute break? The more you hammer at a problem, the harder it is going to be for you to solve it.

"One whose needs are simple can fulfill them easily."

Translation: Simple requirements lead to simple designs.

"When we lose the fundamentals, we supplant them with increasingly inferior values which we pretend are the true values."

Translation: Hubris is never a good substitute for good programming standards. If you get lax, no amount of design patterns will ever substitute for the lack of quality in your code.

Gmail Tricks

Tricks of Gmail:
===================
1.if your gmail id is something like this.

   a.sundara@gmail.com

Then you can login gmail as asundara or a.s.u.n.d.a.r.a@gmail.com [Any number of dots in between your mail user ID]

if anyone is sending mail to asundara@gmail.com, then you will receive mail in your inbox.

Monday, November 14, 2011

Putty Inactive problem

Problem:

1.Usually I will put some compilation in server through putty and leave for the lunch. after some timeout period, putty will goes to inactive mode.
But the server is compiling our code
2.After sometimes, I come back. There is a chance like due to slowness of the server,it might takes some more time to complete the compilation.
    
        How can we ensure the completion of compilation in this scenario ?

Solution:
  we can give compilation command | tee log.txt and redirects the compilation output to file log.txt. Once the compilation is done, the compilation message /errors will be stored in log.txt. From this log.txt, we can figure out whether compilation is completed or not.

Thursday, November 10, 2011

Tuesday, November 08, 2011

Wednesday, November 02, 2011

Harvesting techniques to use right side of the brain:

Harvesting techniques to use right side of the brain:

1.Free Form Journaling – Writing is a great way to relax your mind and allow your R-mode thoughts and ideas to escape your brain and present themselves onto paper. When ideas pop into your head, write them down, and then elaborate on those ideas. Simple brainstorming on paper can give you the opportunity to clarify your thoughts.

2.Walking – Sometimes the best way to come up with ideas is to simply step away from your desk, relax your mind, and go for a walk. While you're walking though, try not to think about anything, especially the problem you are trying to solve. The goal is to silence your L-mode and give your R-mode the chance to do some work.

3.Image Streaming – This is the process of deliberately observing images in your mind and paying close attention to them. First, pose a problem to yourself or ask yourself a question. Then shut your eyes and relax. As images start to cross your mind describe them out loud. Try to describe as many details as you can using all five senses. This type of thinking can help you discover fresh insights to the problem or question you presented yourself.


 

PQ RAR for effective reading


Try the PQ RAR reading-study method as you read or teach your next textbook chapter.

P-First of all, preview the reading selection. Try to limit the reading selection to a manageable size. Overly long chapters, say over six pages for

elementary students, eight for middle school students, twelve for high school students, and sixteen for college students should be "chunked" into manageable

reading sections.

1. Preview the first and last paragraphs of the chapter and the chapter review, if one is provided.

2. Preview all subtitles and any book study helps at the beginning of the chapter.

3. Preview all graphics such as photographs, charts, maps, etc. and their captions.

Q-Secondly, make use of text-based questions to read textbooks effectively.  Good questions produce good answers and significantly increase expository

comprehension. Determining questions before reading provides a purpose for reading, that is-to find the answers as you read.

1. Develop questions from the subtitles and write these down on binder paper or on your computer, skipping lines between each question. Try "What," "How,"

and "Why" question-starters. Avoid the "Who" and "When" questions, as these tend to focus attention on the minor details of expository text.

2. Write down any chapter review questions not covered by your subtitle questions, skipping lines between each question.

R-Read the chapter and "talk to the text" by taking notes in the textbook margins. Use yellow stickies and paste them in the textbook margins, if you can't

write in the textbook. Write down comments, questions, predictions, and connections to other parts of the reading and your own life experiences. List

examples, key details, and important terms with their definitions. Internal monitoring of the author's train of thought and the connection to your own

knowledge and experience increases comprehension as you read textbooks.

A-Answer both the subtitle questions and the book questions as you read. Write down your answers underneath your questions. Don't be concerned if the

textbook did not answer some of your reader-generated questions.

R-Review the questions and answers within the next 24 hours to minimize the effects of the "forgetting cycle." Generate possible test questions and
develop  memory tricks for key concepts and details.
 

SQ3R process

SQ3R is a simple strategy that can be used to actively engage yourself in whatever it is you are reading. The SQ3R process is as follows:

Survey – Scan the chapter headings and summaries for an overview.
Question – Note any questions you have.
Read – Read in its entirety.
Recite – Summarize, take notes, and put in your own words.
Review – Reread, expand notes, and discuss with colleagues.

Tuesday, November 01, 2011

From Pragmatic programmers

A tourist visiting England's Eton College asked the gardener how he got the lawns so perfect. "That's easy,"
he replied, "You just brush off the dew every morning, mow them every other day, and roll them once a
week."
"Is that all?" asked the tourist.
"Absolutely," replied the gardener. "Do that for 500 years and you'll have a nice lawn, too."
Great lawns need small amounts of daily care, and so do great programmers.

"Kaizen" is a Japanese term that captures the concept of continuously making
many small improvements. It was considered to be one of the main reasons for the dramatic gains in productivity and
quality in Japanese manufacturing and was widely copied throughout the world. Kaizen applies to individuals, too.
Every day, work to refine the skills you have and to add new tools to your repertoire. Unlike the Eton lawns, you'll
start seeing results in a matter of days. Over the years, you'll be amazed at how your experience has blossomed and
your skills have grown.

Friday, October 21, 2011

infancy

If life were measured by accomplishments, most of us would die in infancy- A.P.Gouthey

Sunday, October 16, 2011

Knowledge

Practice Drill #1:   Write your resume. List all your relevant skills, then note the ones that will still be needed in 100 years. Give yourself a 1-10 rating in each skill.
 
This drill will help you see where you need practice. It won't turn up your "blind spots" -- i.e., areas that you don't know anything about (hence aren't on your resume) but that you should know something about. But it'll at least help you see how current your working skillset is, and how long you expect it to stay current.
 
math, computer science, writing, and people skills are for the most part timeless, universal skills even after 100 years also, it will be useful. Most specific technologies, languages and protocols eventually expire, to be replaced by better alternatives.

10 great books

http://sites.google.com/site/steveyegge2/ten-great-books

reg. amazon

http://sites.google.com/site/steveyegge2/five-essential-phone-screen-questions

Thursday, October 13, 2011

MutexLock hangs in StageFright:


MutexLock hangs in StageFright:

   1.This might happens due to invalid use of[if we have added any] the mutex lock / invalid call sequence.

We observed mutex lock hang for the below scenario:

    mPlayer.SeekTo(10);
    mPlayer.Start();


We should call like this:

  mPlayer.SeekTo(10);
  mPlayer.OnSeekCompletionListener()
  {
    mPlayer.Start();
    
  }

or


  mPlayer.SeekTo(10);
  WaitForEvent();
  mPlayer.Start();

   OnSeekCompletionListener()
  {
    TriggerEvent();
  }

 

time

“Being with you and not being with you is the only way I have to measure time.”
Jorge Luis Borges

Tuesday, October 11, 2011

To learn an algorithm

To learn an algorithm well, one must implement it. Accordingly, the
best strategy for understanding the algorithm is to
implement and test them, experiment with variants, and try them out on
real problems.

Monday, October 10, 2011

Ruler multiplication

File:Slide rule example2.svg

2 * 3 = 6 we can match slide ruler 1 and ruler 2.

Sunday, October 09, 2011

why stability is important in sorting algorithms?



Ans1: For parallelization purposes? eg: merge sort is stable and can be parallelized well and so is quicksort.


Ans2:

Background: a "stable" sorting algorithm keeps the items with the same sorting key in order. Suppose we have a list of 5-letter words:

peach straw apple spork

Stable-sorting by the first letter gives us:

apple peach straw spork

In an unstable algorithm, straw or spork may be interchanged, but in stable sort, they stay in the same relative positions (that is, since 'straw' appears

before 'spork' in the input, it also appears before 'spork' in the output).

Ans 3:
There's a few reasons why stability can be important. One is that, if two records don't need to be swapped by swapping them you can cause a memory update, a

page is marked dirty, and needs to be re-written to disk (or another slow medium).

Ans 4:
  Stable sort will allways return same solution (permutation)

Ans 5:

Sorting stability means that records with the same key retain their relative order before and after the sort.

So stability matters if, and only if, the problem you're solving requires retention of that relative order.

If you don't need stability, you can use a fast, memory-sipping algorithm from a library, like heapsort or quicksort, and forget about it.

If you need stability, it's more complicated. Stable algorithms have higher big-O CPU and/or memory usage than unstable algorithms. So when you have a large

data set, you have to pick between beating up the CPU or the memory. If you're constrained on both CPU and memory, you have a problem. A good compromise

stable algorithm is a binary tree sort;


memory usage on Merge Sort is O(N), while on Quicksort it's O(log N).

Monday, October 03, 2011

Petr quotes 2

"Do not spend all your time on training or studying - this way you will probably become very exhausted and unwilling to compete more. Whatever you do - have fun. Once you find programming is no fun anymore - drop it. Play soccer, find a girlfriend, study something not related to programming, just live a life - programming contests are only programming contests, and nothing more. Don't let them become your life - for your life is much more interesting and colorful."

Petr quotes

"I think that two main keys to programming contests are training and thinking. You have to solve a lot of problems to become really successful, but you also need to have good math knowledge and the ability to solve uprising problems. Mathematical puzzles and olympiad problems, for example, can help develop it very well. And you have to be confident. Confident that you'll be successful. That you'll win eventually. And the feeling of being a winner, it will reward you for all the difficulties."

Thursday, August 18, 2011

Pablo Neruda

We the mortals touch the metals,
the wind, the ocean shores, the stones,
knowing they will go on, inert or burning,
and I was discovering, naming all the these things:
it was my destiny to love and say goodbye."

— Pablo Neruda (Still Another Day)

Tuesday, August 16, 2011

desire

Some desire is necessary to keep life in motion

Saturday, August 06, 2011

truth

when you have eliminated the impossible, whatever remains, however improbable, must be the truth- sherlock holmes

Thursday, August 04, 2011

Mirror

Mirror is my best friend because when I cry it never laughs at me

Wednesday, August 03, 2011

You must keep your mind on the objective, not on the obstacle

You must keep your mind on the objective, not on the obstacle

Monday, August 01, 2011

Be the change

Be the change you want to see in the world -Gandhi

Thursday, July 21, 2011

All a man needs in this life

All a man needs in this life is someone to love. If you can't give him that, give him something to hope for. If you can't give him that... give him something to do.

warning

Warning: If you are reading this then this warning is for you. Every word you read of this useless fine print is another second off your life. Don't you have other things to do? Is your life so empty that you honestly can't think of a better way to spend these moments? Or are you so impressed with authority that you give respect and credence to all that claim it? Do you read everything you're supposed to read? Do you think every thing you're supposed to think? Buy what you're told to want? Get out of your apartment. Meet a member of the opposite sex. Stop the excessive shopping and masturbation. Quit your job. Start a fight. Prove you're alive. If you don't claim your humanity you will become a statistic. You have been warned- Tyler.

Every evening I died, and every evening I was born again, resurrected.

Every evening I died, and every evening I was born again, resurrected.

free to do anything

It's only after we've lost everything that we're free to do anything.

Tuesday, July 12, 2011

First day

Today is the first day of the rest of your life"? Well, that's true of every day but one - the day you die

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