Monday, December 19, 2011
Think clearly
Friday, December 16, 2011
Wednesday, December 07, 2011
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.
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:
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.
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
I am not so smart
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.
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
Thursday, October 20, 2011
Sunday, October 16, 2011
Knowledge
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
― Jorge Luis Borges
Tuesday, October 11, 2011
To learn an algorithm
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
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
Petr quotes
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
Saturday, August 06, 2011
truth
Thursday, August 04, 2011
Wednesday, August 03, 2011
You must keep your mind on the objective, not on the obstacle
Monday, August 01, 2011
Thursday, July 21, 2011
All a man needs in this life
warning
Every evening I died, and every evening I was born again, resurrected.
Tuesday, July 12, 2011
First day
Friday, July 01, 2011
How to Solve it by G.Polya
- 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?
- 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?
- 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?
- 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 air away, but
do not take from me your laughter-pablo neruda
Thursday, June 30, 2011
bad action
Thursday, June 23, 2011
il Postino dialogs
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
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
Thursday, May 12, 2011
Wednesday, May 04, 2011
Quotes
"STRUGGLE"
This 8 letter word will exhaust you, irritates you and some times demoralize you, but it gives an elegant reward called SUCCESS."
Re: source of your energy
against myself since I don't measure myself against anyone. That way, there is no room for complacency.
-Vasanthi, RJ
What is the source of your energy ?
Simple. I love what I do
-Vasanthi , RJ
robert frost
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 |
|
Monday, February 28, 2011
what these functions will do in socket programming [ htons(), htonl(), ntohs() and ntohl() ]
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:
host to network short | |
host to network long | |
network to host short | |
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 ?
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++
#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 ????
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
**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
Possible is my love.
Impossible is my aim.
Dangerous is my game.
Don't play with me.
Because "SUCCESS" is my name