Pradyut's profileObject Oriented Programm...PhotosBlogListsMore Tools Help

Blog


    April 28

    Test for Idiocy

    Test for Idiocy B elow are four (4) questions and a bonus question. You have to answer them instantly. You can't take your time, answer all of them immediately . OK? Let's find out just how clever you really are.... Ready? GO!!! First Question: Y ou are participating in a race. You overtake the second person. What position are you in? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Answer: If you answered that you are first, then you are absolutel! y wrong! If you overtake the second person, you take his place, so you are second! Try not to screw up next time. Now answer the second question, but don't take as much time as you took for the first one, OK ? Second Question: If you overtake the last person, then you are...? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Answer: If you answered that you are second to last, then you are wrong again. Tell me, how can you overtake the LAST Person? You're not very good at this, are you? Third Question: Very tricky arithmetic! Note: This must be done in your head only. Do NOT use paper and pencil or a calculator. Try it. Take 1000 and add 40 to it.. Now add another 1000 . Now add 30. Add another 1000 . Now add 20. Now add another 1000 Now add 10 . What is the total? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Did you get 5000? The correct answer is actually 4100. If you don't believe it, check it with a calculator! Today is definitely not your day, is it? Maybe you'll get the last question right.... ...Maybe. Fourth Question: Mary's father has five daughters: 1. Nana, 2. Nene, 3. Nini, 4. Nono. What is the ! name of the fifth daughter? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Did you Answer Nunu? NO! Of course it isn't. Her name is Mary. Read the question again! Okay, now the bonus round: I may have sent this one before. I! 'm never sure. A mute person goes into a shop and wants to buy a toothbrush. By imitating the action of brushing his teeth he successfully expresses himself to the shopkeeper and the purchase is done. Next, a blind man comes into the shop who wants to buy a pair of sunglasses; how does HE indicate what he wants? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ He just has to open his mouth and ask... It's really very simple.... Like you! PASS TH IS ON TO FRUSTRATE THE SMART PEOPLE IN YOUR LIFE! -- Pradyut http://pradyut.tk http://oop-edge.blogspot.com/ http://pradyutb.blogspot.com/ http://praddy-photos.blogspot.com/ http://oop-edge.spaces.live.com/ http://www.flickr.com/photos/praddy http://groups.google.com/group/oop_programming India
    October 04

    Happy Durga Puja

    As the candlelight flame
    Ur life may always be happy,
    As the mountain high
    U move without shy,
    As sunshine creates morning glory
    fragrance fills years as Flory,
    All darkness is far away
    As light is on its way.

    Wishing U all a very Happy Durga Puja


    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    August 23

    my poems

    see my poems here: -
    http://acrosticy.blogspot.com/

    thanks

    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    August 06

    08 ka funda

    On 8th of this month at 8am or pm 8min, 8sec. Time/Date Will Be

    08:08:08.08/08/08

    Dis Rare Moment Doesn't Repeat In Our Life time.



    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India

    08 ka funda

    On 8th of this month at 8am or pm 8min, 8sec. Time/Date Will Be

    08:08:08.08/08/08

    Dis Rare Moment Doesn't Repeat In Our Life time.



    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    June 28

    Re: java code to evaluate a arithmetic expression....

    The code better implemented: -
    Please review and suggest a better implementation.
        Any comments are welcome.
        Download the code at: -
            http://myjavaserver.com/~pradyut/files/Calci.java
         The code: -
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------

    public class Calci {

       
        public static void main(String[] args) {
          
            String a = "4-(6-1)+3*9/2(8(6-1))(7-43)4-(6-1)+3.67*9/2(8(6.77+1))(7-4.3)"; //1*3+2*7-1-1
            //(2+1)-(4-2)3/(-5)
            //3*(1-2)
            //4-(6-1)+3*9/2(8(6-1))(7-43)
            //14-(4/(6-9))
           
            String[] b = null;
            String c = null;
           
            Calci obj = new Calci();
           
            System.out.println(obj.parse(a));
           
        }
        double func(String a) {
            double d = 0;

            return d;
        }
        String mult(String a, String b) {
            double c = func1(a) * func1(b);
            return (Double.toString(c));
        }
        String minus(String a, String b) {

            double c = func1(a) - func1(b);
            System.out.println(c);
            return (Double.toString(c));
        }
        String add(String a, String b) {
            double c = func1(a) + func1(b);
            return (Double.toString(c));
        }

        String divide(String a, String b) {
            double c = func1(a) / func1(b);
            return (Double.toString(c));
        }

        double func1(String a) {
            double d =0;
            try {
                d = Double.parseDouble(a);
            } catch (NumberFormatException n1) {
                System.out.println(n1);
            }
            return d;
        }
       
       
        String parse(String a) {
            String b = null;
            String c = null, d= null, e=null;
            int z=0, f=0;
            if(a.contains("(")) {
               
               
                //System.out.println(b[0]);
               
                z = a.lastIndexOf("(");
                f = a.indexOf(")", z)+1;
                c = a.substring(z, f);
               
                b =a.substring(0, z);
                d = a.substring(f, a.length());
               
                //processing b
                if(b.length() >=1) {
                    e = String.valueOf(b.charAt(b.length()-1));
                    if(e.equals("+") || e.equals("-") || e.equals("*") || e.equals("/") || e.equals("(")) {

                    }else
                    {
                        b = b+ "*";
                    }
                    //System.out.println("b is: " + b);
                }
                //processing d
                if(d.length() >1) {
                    e = String.valueOf(d.charAt(0));
                    if(e.equals("+") || e.equals("-") || e.equals("*") || e.equals("/") || e.equals(")")) {

                    }else
                    {
                        d = "*" + d;
                    }
                    //System.out.println("d is: "+d);
                }
                    c = check(brackets(c));
                    //System.out.println("c is: "+c);
                    //c = "5";
               
                a = b + c + d;
                    if(a.contains("*-")) {
                        //System.out.println("inside a is: "+a);
                        z = a.indexOf("*-");
                        b = a.substring(0, z);
                        //System.out.println("inside b is: "+b);
                        a = a.substring(z, a.length());
                        b = repl(b);
                       
                        //System.out.println("inside a is: "+a);
                        a= a.replace("*-", "*");
                       
                        a = b+a;
                    } else if (a.contains("--")) {
                        a= a.replace("--", "+");
                    } else if (a.contains("+-")) {
                        a= a.replace("+-", "-");
                    } else if (a.contains("/-")) {
                        z = a.indexOf("/-");
                        b = a.substring(0, z);
                        //System.out.println("inside b is: "+b);
                        a = a.substring(z, a.length());
                        /*if( b.lastIndexOf('+') > b.lastIndexOf('-'))
                            b=b.replace(b.charAt(b.lastIndexOf('+')), '-');
                        else
                            b=b.replace(b.charAt(b.lastIndexOf('-')), '+');
                        */
                        b=repl(b);
                        //System.out.println("inside a is: "+a);
                        a= a.replace("/-", "/");
                       
                        a = b+a;
                    }
                System.out.println("a is: "+a);
                    return parse(a);
               
                //System.out.println(a.substring(a.lastIndexOf("(")+1, a.indexOf(")", z)));
            }
            else
                return check(a);
        }
       
        String repl(String b) {
            int j,k,l;
            String h;
            if(b.length() >1)
            {
                    if(b.contains("+") || b.contains("-")) {
                        j = b.lastIndexOf('+');
                        k = b.lastIndexOf('-');
                        l = b.lastIndexOf(')');
                        if (l<j || l<k) {
                            if( b.lastIndexOf('+') > b.lastIndexOf('-'))
                            {
                                System.out.println("inside");
                               
                                b=b.replace(b.charAt(b.lastIndexOf('+')), '-');
                                return b;
                            }
                            else
                            {
                                //System.out.println("test B");
                                System.out.println("inside 1");
                                b=b.replace(b.charAt(b.lastIndexOf('-')), '+');
                                return b;
                            }
                        } else {
                            System.out.println("inside 2");
                            h = b.substring(0, b.lastIndexOf('('));
                            System.out.println("h is: "+h);
                            b = b.substring(b.lastIndexOf('('), b.length());
                            System.out.println("b is: "+b);
                            if( h.lastIndexOf('+') > h.lastIndexOf('-'))
                            {
                                //System.out.println("test A");
                                h=h.replace(h.charAt(h.lastIndexOf('+')), '-');
                                b = h+b;
                                return b;
                            }
                            else
                            {
                                //System.out.println("test B");
                                h=h.replace(h.charAt(h.lastIndexOf('-')), '+');
                                b = h+ b;
                                return b;
                            }
                        }
                    }
                    else
                    {
                        b = "-" + b;
                        return b;
                    }
                } else
                {
                    b = "-" + b;
                    return b;
                }
        }
       
       
       
        String brackets(String b) {
            b = b.replace("(", "");
            b = b.replace(")", "");
            return b;
        }
       
        String check(String a) {
            String[] b=null;
           
            if(a.indexOf('+')==0) {
                a=a.substring(1);
                check(a);
            }
            if(a.contains("+")) {
                //System.out.println("This is inside minus");
               
               
                /*if(a.indexOf('+') ==0) {
                    a=a.substring(1);
                }*/
                b = a.split("\\+",2);

                a=add(check1(b[0]),check(b[1])) ;
                return a;
            }
            else
                return check1(a);
        }

        private String check1(String a) {

            String[] b=null;
           
            if(a.contains("-")) {
               
               
                if(a.indexOf('-')==0)
                {
                    a =a.substring(1);
                    if(a.contains("-")) {
                        b = a.split("-", 2);
                        b[0] = "-" + b[0];
                        b[1] = "-" + b[1];
                        a = add(check2(b[0]), check1(b[1]));
                    }
                    else {
                        //System.out.println("this is here");
                        a = "-"+a;
                        a = check2(a);
                    }
                } else {
                    b = a.split("-", 2);
                    //b[0] = "-" + b[0];

                    b[1] = "-" + b[1];
                    a = add(check2(b[0]), check1(b[1]));
                }
                return a;
            }else
                return check2(a);
            //throw new UnsupportedOperationException("Not yet implemented");

        }

        private String check2(String a) {
            String[] b=null;
            if(a.contains("*")) {
                b = a.split("\\*",2);
                a = mult(check3(b[0]), check2(b[1])) ;
                return a;
            }

            else
                return check3(a);
            //throw new UnsupportedOperationException("Not yet implemented");
        }

        private String check3(String a) {
            String[] b=null;
            if(a.contains("/")) {
                b = a.split("\\/");
                a = divide(b[0], check3(b[1])) ;
                return a;
            }

            else
                return a;
            //throw new UnsupportedOperationException("Not yet implemented");
        }

    }

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Thanks

    On Sun, Dec 30, 2007 at 11:10 PM, Pradyut Bhattacharya <pradyutb@gmail.com> wrote:
    Java code to evaluate in arithmetic expression......

    following order...
    Division
    Multiplication
    Subtraction
    Addition

    The code: -

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    <snip>
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Reply any comments or suggestions.......

    Thanks....

    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India



    --
    Pradyut
    http://pradyut.tk
    http://www.pradyut.co.nr/
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://groups.google.com/group/oop_programming
    India
    June 05

    IT Companies Full Names...just don't miss it. :-)

    1. NIIT: Not Interested in IT

    2. WIPRO: Weak Input, Poor & Rubbish Output

    3. HCL: Hidden Costs & Losses

    4. TCS : Totally Confusing Solutions

    5. INFOSYS : Inferior Offline Systems

    6. HUGHES : Highly Useless Graduates Hired for Eating and Sleeping

    7. BAAN : Beggars Association and Nerds

    8. IBM : Implicitly Boring Machines

    9. SATYAM: Sad and Tired Yelling Away Madly

    10. PARAM: Puzzled and Ridiculous Array of Microprocessors

    11. C-DOT : Coffee during Office Timings

    12. AT&T : All Troubles & Terrible

    13. CMC : Coffee, Meals and Comfort

    14. DEC : Drifting & Exhausted Computers

    15. BFL : Brainwash first and Let them go

    17. TISL : Totally Inconsistent Systems Ltd.

    18. PSI : Peculiar Symptoms of India

    19. ORACLE: On-line Romance And Chatting with Lady Employees .

    20. PATNI : Pathetic Appraisal Techniques

    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    April 06

    Banta Sing Jokes !!!


    ***********************************************

     

     

     

    Prince Charles & Banta were having dinner.

     

    Prince said, "Pass the wine you divine".

     

    Banta thinks "how poetic"

     

    Babta says, "pass the custard you bastard".

     

    ***********************************************

     

    Banta at bar in New York .

     

    Man on his right says "Johny Walker single"

     

    Man on his left says "Peter Scotch single"

     

    Banta says - "Baljith Singh Married"

     

    ***********************************************

     

    Boss : am giving u job as a driver. STARTING salary Rs.2000/-, is it o.k

     

    Banta : U R great sir! Starting salary is o.k.......but??

     

    how much is DRIVING salary...?

     

    ***********************************************

     

    Babta's theory : Moon is more impt. than Sun, coz it gives light at

     

    night when light is needed & Sun gives light during the day when light

     

    is not needed!!!

     

    ***********************************************

     

    Banta and Santa  are driving a Car, one puts on the indicator and asks the

     

    other to check whether its working, he puts his head out and says

     

    YES...NO...YES...NO...YES...NO...

     

    ***********************************************

     

    Babta shouting 2 his girl friend " u said v will do register marriage

     

    and cheated me, I was waiting 4 u yesterday whole day in the post

     

    office....

    ***********************************************

     

    Banta and Santa looking at Egyptian mummy.

     

    Banta : Look so many bandages, pakka lorry accident case.

     

    Santa : Aaho, lorry number is also written...BC 1760!!!....

     

    ***********************************************

     

    Banta on an interview 4 da post detective.

     

    Interviewer : who killed Gandhi?

     

    Banta : Thank u sir 4 giving me d job, I will start investigating.......

     

    ***********************************************

     
     Banta for an exam had studied only one essay 'FRIEND', but in the

     

    exam the essay which came was 'FATHER' . he replaced friend with father

     

    in the essay and>it read: AM A VERY FATHERLY PERSON, I HAVE LOTS OF FATHERS,

     

    SOME OF MY FATHERS ARE MALE AND SOME ARE FEMALE. MY TRUE

     

    FATHER IS MY NEIGHBOUR.

     

    ***********************************************

     

    Interviewar: what s ur qualification?

     

    Banta : Sir I am Ph.d.

     

    Interviewar : what do u mean by Ph.d?

     

    Banta : (smiling) PASSED HIGHSCHOOL with DIFFICULTY....

     

    ***********************************************

     

    Amitab in KBC: In which state Cauvery flows?

     

    Banta : liquid state.....

     

    Audience clapped.. Amitab stunned, looks behind, ALL WERE banta's relatives.......

     

    ***********************************************


    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    March 24

    mind games....

    If your eyes follow the movement of the rotating pink dot, you will only see one color, pink. If you stare at the black + in the center, the moving dot turns to green. Now, concentrate on the black + in the center of the picture. After a short period of time, all the pink dots will slowly disappear, and you will only see a green dot rotating... if you're lucky!

    It's amazing how our brain works. There really is no green dot, and the pink ones really don't disappear. This should be proof enough, we don't always see what we think we see.

    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    March 16

    changing to absolute positioning in visual web 2008

    changing to absolute positioning visual web in visual studio 2008

    1. In VWD 2008 express goto Tools --> Options --> click show all settings --> expand HTML Designer --> select CSS Styling
    2. check the option to "change positioning to absolute for controls added using Toolbox, paste or drag and drop
    Now most controls will be able to placed anywhere on the design view. To be able to place Label's anywhere, first add a div  (from the html toolbox) and then add the Label control onto the div area in the designer. Now select that div and you can easily position the Label.


    Thanks
    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    March 15

    Re: simple css menu

    A better css menu...

    check it out...
                 http://myjavaserver.com/%7Epradyut/files/test2.html

    Sources at: -
                 http://myjavaserver.com/%7Epradyut/files/my menu.zip

    reply your comments....

    Thanks...

    On Fri, Mar 14, 2008 at 1:23 AM, Pradyut Bhattacharya wrote:
    Extract the 3 files in the rar...

    http://myjavaserver.com/%7Epradyut/files/my%20menu.rar

    the only difference between new2.html and new3.html is: -

    ------------------------------------------------------------------------------------------------------------------
    <STYLE TYPE="text/css" MEDIA="screen, projection">
    <!--
     
      @import url(menu.css);
      DT { background: yellow; color: black }
    -->
    </STYLE>
    -------------------------------------------------------------------------------------------------------------------

    wanna change the style.......... have fun with the css.........

    Thanks.....


    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India



    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India
    March 14

    simple css menu

    Extract the 3 files in the rar...

    http://myjavaserver.com/%7Epradyut/files/my%20menu.rar

    the only difference between new2.html and new3.html is: -

    ------------------------------------------------------------------------------------------------------------------
    <STYLE TYPE="text/css" MEDIA="screen, projection">
    <!--
     
      @import url(menu.css);
      DT { background: yellow; color: black }
    -->
    </STYLE>
    -------------------------------------------------------------------------------------------------------------------

    wanna change the style.......... have fun with the css.........

    Thanks.....


    --
    Pradyut
    http://pradyut.tk
    http://oop-edge.blogspot.com/
    http://pradyutb.blogspot.com/
    http://praddy-photos.blogspot.com/
    http://oop-edge.spaces.live.com/
    http://www.flickr.com/photos/praddy
    http://groups.google.com/group/oop_programming
    India