Tuesday, May 22, 2012

Bob marley quotes

Who are you to judge the life I live?

I am not perfect and I don't have to be!

Before pointing fingers,make SURE your hands Are clean...!-Bob Marley



Emancipate yourselves from mental slavery, none but ourselves can free

our minds! - Bob Marley





Life is one big road with lots of signs. So when you riding through

the ruts, don't complicate your mind. Flee from hate, mischief and

jealousy.

Don't bury your thoughts, put your vision to reality. Wake Up and Live!



Open your eyes, look within. Are you satisfied with the life you're living?



"Only once in your life, I truly believe, you find someone who can

completely turn your world around.

You tell them things that you've never shared with another soul and

they absorb everything you say and

actually want to hear more. You share hopes for the future, dreams

that will never come true, goals that

were never achieved and the many disappointments life has thrown at

you. When something wonderful happens,

you can't wait to tell them about it, knowing they will share in your

excitement. They are not embarrassed

to cry with you when you are hurting or laugh with you when you make

a fool of yourself. Never do they hurt

your feelings or make you feel like you are not good enough, but

rather they build you up and show you the

things about yourself that make you special and even beautiful. There

is never any pressure, jealousy or

competition but only a quiet calmness when they are around. You can

be yourself and not worry about what

they will think of you because they love you for who you are. The

things that seem insignificant to most people

such as a note, song or walk become invaluable treasures kept safe in

your heart to cherish forever.

Memories of your childhood come back and are so clear and vivid it's

like being young again. Colours seem brighter

and more brilliant. Laughter seems part of daily life where before it

was infrequent or didn't exist at all. A phone

call or two during the day helps to get you through a long day's work

and always brings a smile to your face. In their

presence, there's no need for continuous conversation, but you find

you're quite content in just having them nearby.

Things that never interested you before become fascinating because

you know they are important to this person who is

so special to you. You think of this person on every occasion and in

everything you do. Simple things bring them to

mind like a pale blue sky, gentle wind or even a storm cloud on the

horizon. You open your heart knowing that there's

a chance it may be broken one day and in opening your heart, you

experience a love and joy that you never dreamed possible.

You find that being vulnerable is the only way to allow your heart to

feel true pleasure that's so real it scares you.

You find strength in knowing you have a true friend and possibly a

soul mate who will remain loyal to the end.

Life seems completely different, exciting and worthwhile. Your only

hope and security is in knowing that they are

a part of your life."



"The truth is, everyone is going to hurt you. You just got to find the

ones worth suffering for."



Some people feel the rain. Others just get wet



Better to die fighting for freedom then be a prisoner all the days of your life.

Friday, May 18, 2012

STL & GNU C++ with codeblocks

If we are using STL program in codeblocks, we have to enable GNU c++ option

by selecting



Project->Build options->Have g++ follow the coming C++ 0x ISO C++

language standard [-std =c++0x]



Otherwise it wont compile in codeblocks editor. while submitting the

same code in codeforces.com, we have to select

GNU C++0x4 option for uploading the cpp file.

BHTML & BCSS codeforces problem log

BHTML & BCSS codeforces problem log:



What are all the steps I have done to solve this problem:





For a problem, I started by generating the strings and tried to

compare the strings as follows:



<a><b><b></b></b></a>



Generated string [from HTML] is as follows:

a

a b

a b b



pattern a b has occurence as 2 times.



Pattern should be there in the generated string.



we need to check all the patterns and count/increment the current occurence.



This approach is taking more time, I got "timeout exceeded".



Once again I got failed in substring test case.



for example, <sundar/>

for pattern :sun it should return 0. But it is returning some other values

I stored the values in hashtable and added the number in an array.

instead of comparing strings, I started comparing

integer values.







1)timeout exceeded

2)substring testcase failure <sundar/> query:sun but output is 1. it should be 0

3)string comparison takes time, I added the string in hashtable and

generated the int array to compare & reduce

time

4) Integer comparison also takes around 7 seconds for a problem &

failed in somecases giving improper output.

5) I checked the case of seulgi kim's code. Based on my understanding,

I have created

Nary trees from the HTML. From Nary trees, we will search for the

given query recursively.



6.Through debugging found that PushToStack should be available for

<tag/> cases too

7.Modified the PreOrder() fn return as Long

8.modified the readQuery() to read char by char

9.deleted the query array and created it for each query

10.Tried by changing the stack size limit.

#pragma comment(linker, "/STACK: 2000000")



11. I doubted the readQuery() but I am getting large size input for the query.

I changed the Maximum Query characters Count[MaxQueryCount] from 250

to 4000. Now I have posted it, it was working fine & accepted in the

codeforces.

I thought like query line will have maximum 250 characters. I haven't

read properly about the problem sentences:



" Each query is a sequence x1, x2, ..., xn, where xi is the i-th

element of the query, and n (1 ≤ n ≤ 200) is the number of elements in

the query. The elements are separated by single spaces. Each query

doesn't begin with and doesn't end with a space. Each query element is

a sequence of lowercase Latin letters with length from 1 to 10."



200[queries] * 10 [tag size]* 199 spaces = 398000 characters it can

be...But since the testcases are having less than this limit, I am

able to run with 4000



12.Eventhough I successfully submitted the code in codeforces, I could

found one more problem... that is allocated nodes are not released

properly. I released all the nodes including parent nodes & resubmitted it...

Monday, May 14, 2012

Competition Sites to practice

1 UVA:http://acm.uva.es/p - The Valladolid University Online Judge.

Over N problems, for a reasonable value of N. The problems are culled

from old contests, and online contests.

2.ZJU:Zhejiang University Online Judge - http://acm.zju.edu.cn

3.SGU:Saratov State University Online Contester - http://acm.sgu.ru

4.PKU: Peking University Judge Online of ACM ICPC -

http://acm.pku.edu.cn/JudgeOnline

5.topcoder

6.codeforces

Wednesday, May 09, 2012

Books recommended in codechef

1. Standard book on Algorithms - Introduction to Algorithms by T H

Cormen, C E Leiserson, R L Rivest, C stein ( Famously known as CLRS )

2. Basic Algorithms - Algorithms by Richard Johnsonbaugh, Marcus Schaefer

3. Game Theory - Winning ways for your mathematical plays by Elwyn R.

Berlekamp, John H. Conway, Richard K. Guy

4. Programming challenges - Steven Skienna

5. Concrete Mathematics - Knuth

6. How to solve it by a computer - Dromey

7. Structure and interpretation of computer programs - Elsevier

8. Programming Language Pragmatics - Micheal Scott : It gives

comparative study of various programming languages and helps you

decide choose the appropriate ones on the basis of time they take to

process information

How P frame seek support will be added in any multimedia framework

Some multimedia frameworks will have support for P frame seek. Some

frameworks wont have this support. So How can we add this support ?



For P frame seek, we can not start directly start decoding & rendering

from the P frame;

Since P frame doesnt have entire frame information, if we start

decoding & rendering from P frame, it will shows

green patches on screen and affect the user experience.





How P frame seek is supported in Directshow multimedia framework ?





For any seek timestamp, Parser will seek the I frame timestamp before

the seek timestamp.

Ex :

I frame is available in 10th second.

if the seek is done to 12th second, the Parser will fetch I frame from

10th second and give it do the decoder.



Source Filter will set IMediaSample's SetPreroll() as true. The

decoder will decode the frame,get necessary information and wont give

it to the renderer.



Once the timestamp reached the seek timestamp, Parser will set the

setPreroll as false, then frame will starts rendering.





OpenCORE:



In OpenCORE's frame have an option to set DoNotRender flag. If we set

this flag, it wont render the given frame.



In Generic, In any multimedia framework,



if we are calling seek to any timestamp, Upto seektimestamp is

reached, video and audio frames are dropped without rendering on

hardware device.In case of audio, we will have more I frames. But if

we are rendering audio alone, video takes more time to catchup

video.User might be able to observe the weird behaviour since ear is

more sensitive than eyes. In this scenario, rendering the audio also

causes the audio clock to increase. It will cause AV sync issues once

video starts rendering.



In any multimedia framework, we have to do the following steps to

do P frame seek:







1.ParserseekTo(Nearest_I_Frame to SeekTimesamp);

2.ParserRead(frame);

3.Decode(decodedAudioVideoFrame);



4. if (decodedAudioVideoFrameTimestamp < SeekTimestamp)

{

release audioVideoFrame;

}

else

render(decodedAudioVideoFrame);

weird video behaviour in Stagefright

In stagefright, if any weird behaviour is observed in video. Following

steps need to be taken:



1.we need to print time taken by parser and decoder.[To check any time

taken process involved]

2.Check any frame is dropped by enabling log [dropping late frame in

awesomeplayer.cpp]

3.Print logs in all sleep() fn in AwesomePlayer[while rendering

frames, threads might go to background and wont do anything because of

Sleep() fn

4.Check for any postVideoEvent(10000ms) this might delay the rendering

of frames. For optimization or any other reason, chipset vendors might

tune this

value

String comparison

Whenever we need to compare strings, what we can use it?



Text: abc bcd bcd abc

Pattern: abc bcd

[Ex: BHTML & BCSS codeforces problem]



we need to compare text and pattern using strcmp. But naive string

comparison takes more time.



Solution 1)we can use RobinKarp or KMP algorithm to reduce time. or

else we can do the following way to avoid the problem.





How to avoid this:



we can use array to store the strings without duplication.



Array [][]={ "abc","bcd"}



Text Array: {0,1,1,0}

Pattern Array: {0,1}



then apply naive comparison in TextArray and pattern Array.



Solution 2)Compare to string array, int array comparison will takes less time.



Solution 3) if we are using array also, we need to compare all the

elements in array on worst case to add or lookup.

in this case, what we can do to improve this ?



We can use Binary Search Tree to store strings. if the given

string is less than the root string,

we need to search it from left child of the string.if it is greater

than or equal to the rootstring, we need to search the

right child of the root.



STL map is using RedBlack tree implementation. we can make

use of map to store strings.STL map can also be used for Hashtable.

துன்பம்

துன்பம் ஒரு மனிதனை இரண்டு வகைகளில் மாற்றக் கூடும். அது அவனைக்
கசந்தவனாகவும் இறுக்கமானவனாகவும் மாற்றி அவன் உள்ளத்தை வன்மத்தால்
நிறைக்கக்கூடும். அல்லது பலரையும் இப்படிதான் மாற்றுகிறது - பகையின்
நெருப்புகள் ஒருவனைப் புடம் போடக் கூடும். துன்பம் உனக்கு வலிமை
கொடுப்பதாக இருக்கக்கூடும், ஆனால் அதே சமயம் அது உன்னை கருணை
நிறைந்தவனாகவும் மென்மையானவனாகவும் மாற்றலாம்.

அளவுகோல்

நம் தேசத்தின் முதன்மைக் கவிகளுள் ஒருவரான காளிதாசர், "புவியை அளக்க ஒரு
அளவுகோலை உருவாக்க இறைவன் நினைத்தான், அதைச் செய்ய அவன் இமய மலையைப்
படைத்தான்," என்று இமயத்தை வர்ணிக்கிறார். அதுவே அளவுகோல். மானுடம்
அடையக்கூடிய எழுச்சியை அளவிட இறைவன் ஒரு அளவுகோலைப் படைக்க
நினைத்திருக்கலாம். எனவே அவன் காந்தியைப் படைத்திருக்கலாம்.

காந்தி

காந்தி வெற்றி பெற்றாரா இல்லையா என்பது சர்ச்சைக்குரிய விஷயம். ஆனால்
அவர் அடைந்த வெற்றி எதுவானாலும், அதன் காரணம் என்னவாக இருக்கும்? மிக
முக்கிய காரணம் இதுதான்: அவரது சொல்லுக்கும் செயலுக்கும் இடையே இடைவெளி
கொஞ்சமும் இருக்கவில்லை. காந்தி ஒன்று சொன்னால் அது உண்மைதான் என்பதை
அவரை எதிர்த்தவர்களும் அறிந்திருந்தார்கள். அவரது வெற்றியைவிட காந்தியின்
நேர்மையைப் பொதுமக்கள் போற்றினார்கள். மானுட நல்லியல்பில் அவருக்கு
இருந்த நம்பிக்கை எங்களையும் தொற்றிக் கொண்டது. அவரிடமிருந்த மூன்றாவது
இயல்பு அவரது தொடர்முயற்சி. ஐம்பது ஆண்டுகளாக அவர் இடையறாது பாடுபட்டார்.
அனைவரும் அவர் உடைந்துவிட்டார் என்று நினைத்தபோதும் அவர் தொடர்ந்து
செயலாற்றினார். அவரே, "நான் இருளில் துழாவிக் கொண்டிருக்கிறேன்," என்று
சொன்னபோதும் காந்தி தன் முயற்சிகளைத் தொடர்ந்து கொண்டுதானிருந்தார்.

http://www.gandhitoday.in/2012/05/3.html

Tuesday, May 08, 2012

About Gandhi in Tamil

Monday, May 07, 2012

ஐந்து நெறிகள்

மகாவீரர் சரியான நம்பிக்கை (சம்யக்-தர்சனம்), சரியான அறிவு
(சம்யக்-ஞானம்), மற்றும் சரியான நடத்தை(சம்யக்-சரித்திரம்')தேவை என்பதை
வலியுறுத்தினார். நன்னடத்தைக்கு துணைநிற்க ஜைன மதத்தில் ஐந்து
உறுதிமொழிகள் எடுக்க வேண்டும்:
1.வன்முறை தவிர்த்தல் (அகிம்சை) - எந்தவொரு உயிரினத்திற்கும் தீங்கு
விளைவிக்காதிருத்தல்;
2.வாய்மை (சத்தியம்) - தீங்கில்லாத உண்மையை மட்டுமே பேசுதல்;
3.திருடாமை(அஸ்தேயம்) - தனக்கு கொடுக்கப்படாதது எதையும் எடுத்துக் கொள்ளாதிருத்தல்;
4.பாலுறவு துறவு (பிரமச்சரியம்) - பாலுணர்வு இன்பம் துய்க்காதிருத்தல்;
5.உரிமை மறுத்தல்/பற்றற்றிருத்தல் (அபாரிகிருகம்) - மக்கள்,இடங்கள்
மற்றும் பொருளியலில் பற்று அற்று இருத்தல்.

Thursday, May 03, 2012

உழைப்பு

4 பசுமாடுகளை மே‌ய்ப்பேனே தவிர அடுத்தவன் உழைப்பை உறிஞ்சமாட்டேன் : பாண்டிராஜ்!

DecodeButDoNotRender

Insights on How to implement DecodeButDoNotRender flag in any

multimedia framework ?

This will happen when we dont have more I frames.

முழு விழிப்புணர்வோடு இரு

"செயல்பட வேண்டிய நேரத்தில் முழு விழிப்புணர்வோடு இரு. கருத்துக்களாலும்,
வழக்கங்களாலும் சிறைப்பட்டு விடாமல் சுதந்திரமாக இரு. எதையும்
எதிர்பாராதே. விளைவைப் பற்றிய கவலை கொள்ளாதே. விருப்பு வெறுப்பு இல்லாமல்
இரு. இயல்பாக, எளிமையாக, தெளிவாக, முழுமையாக இரு. அப்போது தான் உள்ளது
உள்ளபடி தெளிவாகப் புரியும். பின் செய்ய வேண்டியதை கச்சிதமாகச் செய்வது
மிக சுலபமாகும்".-ப்ரூஸ் லீ