nitin1 15

Hi,

I am creating a form in jsp.

<form action="" method="post"> 
<input type="hidden" name="status_1" value="0" /> 
<input type="checkbox" id="status_1" name="status_1" value="1" />
<input type="hidden" name="status_2" value="0" /> 
<input type="checkbox" id="status_2" name="status_2" value="1" />
<input type="hidden" name="status_3" value="0" />
<input type="checkbox" id="status_3" name="status_3" value="1" />
<input type="submit" /> </form>

I was referring this link: http://stackoverflow.com/questions/19239536/how-get-value-for-unchecked-checkbox-in-checkbox-elements-when-form-posted

So, can you tell how this is priortized? I mean if I am marking chekcbox as checked, then how does it decide which value to take in the req parameter?

Also, is there any order dependent thing in this? if hidden input is written after the checkbox or before this?

Note: Although this answer is accepted, but it doesn't work for me if I place hidden input before checkbox. When I say not working means it was always taking hidden input value when I place hidden input before checkbox with same name.

Thanks in advance.

nitin1 15

Hi,

I have been working in Java for more than 8-9 months now. I want to have deep understanding of Java concepts now. For ex: Collections properties, threading, interfaces detailed concepts etc. I mean I have been using all these things for a while now but want to know about the things of Java in detail. Can you suggest some online source/Java book or something like this which I can follow? Usually, I search on web whatever I want to study and read the top 3-4 links. But, some book or course will help me better. Thanks in advance.

nitin1 15

I have made very simple code to larn the functionality.

String str = "ABC";
        InputStream input = new ByteArrayInputStream(str.getBytes());

        BufferedReader reader = new BufferedReader(new InputStreamReader(input));
        System.out.println(Character.valueOf((char) reader.read()));
        System.out.println(reader.read());
        System.out.println(reader.read());
        System.out.print(reader.read());

Secondly this one,

String str = "ABC";
        InputStream input = new ByteArrayInputStream(str.getBytes("UTF-8"));

        System.out.print(input.read());
        System.out.print(input.read());
    }

output is same for the ways. Which way is good, and when should I use the each one of them? Thanks.

nitin1 15

@mike. Thanks mike. but please tell me this thing that I have one string say :

"nitinkdjdhdgshs/djjkdkd"

mark that slash in it. Now when I add it into json string then it should be like this:

"cipher": "nitinkdjdhdgshs\/djjkdkd"

then: when i put that again in one json string, it should be like this:

"payload" : {"cipher": "nitinkdjdhdgshs\\/djjkdkd"}

Is it correct as per the json-glib? How should I achieve this?

nitin1 15

What, and where is the problem in the code? Mention the problem you facing so that we can help you to solve the issue.

nitin1 15

There are many ways to do it. You can use the XOR operations as ruberman has done it.

You can try one more method using addition and substraction:

void swap(int a,int b)
{
      a = a + b;
      b = a - b;
      a = a - b;
}

It will also work as it is without third variable. Hope this helps.

nitin1 15

It is quite simple if you know the maths behind this.

All these are just bases in which you can write your any number. For example, n = 9 can be written as 1001 in base 2(binary) and it is 9 in base 10(decimal).

How am I writing 9 as 1001 in base 2?

Start with 9 and divide it it with 2. Take Quotient and remainder. Here, Quotient = 4 and remainder = 1. Now, Save this remainder anywhere. Now take quotient = 4 and again divide it by 2. Again, Quotient is 2 and remainder =0. Add this remainder where you have stored initial remainder. Repeat this until you get remainder 1 or 0. Note: Save the last remainder also. Still, you didn't get the answer.

Your answer is: If you read all the remainders from the last remainder to first remainder, that's your answer.

Here is code snippet for binary.

Void convertTOBinary(int n)
{
       while(n>0)
       {
             //save this remainder
             int remainder = n%2;
             n/=2;
       }
}

So, How to do for Hexadecimal. Can you relate now? When base was2, I was diving by 2, but in your case base is 16. So you will divide by 16 here as per the case. Difference is that in base 2, you can have only 2 remainders, but in Hexa, you can have 16 remainders. Remainders between 0-9 will be as it is, but after 9 it will be like this:

10 = A
11 = B
12 = C ...

nitin1 15

If you are in hurry, at least pay some time to explain the problem. We will help you if you can explain what is wrong with the code. And don't be in urgency, here things will go in their normal pace.

Arjun_4 commented: Mate i need to know how to Balance a Binary Tree in C , Thats about it :) +0

nitin1 15

Although, My speaking skills are fine, but I make lot of grammtical errors while writing. Can you suggest some ways so that I cam improve my writing and speaking skills ? As many of you have English as your mother tongue language, but I don't have this thing with me.I have seen that prit and deceptikon English is really very good. As I am not American, could you please suggest me how can I improve my commuunication skills? Thanks.

Assembly Guy commented: From what I've seen, your English is some of the best I've seen on the forum from a non-native-speaker +0

nitin1 15

Start learning C first, You can start by reading yashwant or Let US C for learning it. Then you can try Dennis Ricthie for intensive learning. Then write some short codes and then learn what is Arithmetic progression and then try to write this code. You will learn a lot.

nitin1 15

freopen() OR fopen(). try to read about them, you will find them useful. thanks.

nitin1 15

No body can help in your home work. You can put your doubts here , We all will help you. You should show something first, then we can solve if there is any doubt related to that. put some efforts into this, and if you find any problem, we will definitely help you. thanks.

nitin1 15

Click Here It will surely help you. hope it helps! thanks.

<M/> commented: ok +0

nitin1 15

umm.. may be if you want it right now, then i think this may be solved by google on 1-2 links. If you can wait, then I think other can help you very soon. thanks.

<M/> commented: i'll do both +8

nitin1 15

@rahul, i know. never try to propose like this(directly). Indians girls have attitude problem with them, no matter they deserve that or not :p. So, try to go on dates, movies, restraunts, pubs etc. If she is comfortable with you at these places without any problem, then it is GREEN signal for you. If she says "no! akele ? kabhi nahi!", but if she says this in normal way, that means GREEN signal. Tell her stories about relationship of your mutual friends. Like this , in the moon light , sit on your knees and say her "will you be my partner ?". aww!! (looking damn easy, but trust me! Indians girls are damn tuff). This is my long term experience. :)

<M/> commented: lol +0

nitin1 15

haha.. yey!! party time. congo bongo songo songs must be there now. yipee!! yo yo yo!! enjoy!! party hard.. ;)

JorgeM commented: thanks nitin1. +0

nitin1 15

the extent of knowledge which people on daniweb has is incredible. they are GOd of thier subjects. it is a boon to me by god when i came across the daniweb. :-) thanks to all of you. :-)

AndreRet commented: Always a pleasure!! +0
ddanbe commented: Keep up the good spirit! +0

nitin1 15

#include<stdio.h>

int gcd(int a,int b)
{
    if(b>a)
    return gcd(b,a);

    if(b==0)
    return a;

    return gcd(b,a%b);
}

int lcm(int a,int b)
{
    int k=gcd(a,b);

    a/=k;

    return a*b;
}

int main()
{
    int a[]={5,10,15,20,40};
    int n=sizeof a/sizeof a[0];
    int n1=n;
    int k=a[0];

    n--;

    while(n>=1)
    {
           k=lcm(k,a[n--]);
    }

    printf("LCM of N numbers is: %d\n",k);

    return 0;
}

i have calculates the time complexity as O(nlogn). Am i right ? please verify.
And can anyone improve this any more ? thanks.

m4ster_r0shi commented: Yeap, you got the idea. +6

nitin1 15

purple color is damn awesome dani ;) seriously, this forumn presentation is awesome as compared to any other CS forumns i have ever met. if this color was chosen by you, then hats off to your colour selection. (it seems you are very good at selecting dresses(kidding) ;) )

Dani commented: Thanks +0

nitin1 15

yes! it is true ! but is it the reason ? i mean it is not a well defined answer if a high-grade person(interviewer/teacher/professor) asks and i counter question him/her like this. i know that it is a function and it can't be executed at the compile time.

np complete commented: good question :) +4

nitin1 15

though, i am in red eye of all administartors , mod of daniweb team, but seriosuly i am getting too much help from daniweb. all mates asks me who tells me all the doubts?. ,My C concepts are improving day by day, all are astonished which book i am reading, but i never say anyone about my awesome and fabulous source is. ;) all people are great here but problem is at the point when i break the rules and get infraction points(though i will improve on this). my RAM get crashed , deceptikon helped me out in one hour only which results that my PC working superb now, i broke rules happygeek taught me professionalism, in short all are awesome and very awesome people. in return of this, i can't do anything for this. thanks alot guys. keep it up! got highest marks in C aptitude test this semester, cracked TI, deolitte, amazon, microsoft C aptitude test. in the last 2 months, how greatly people has helped on daniweb with my stupid doubts without any ego and anger. ;) thank you dani for all this to the entire world ;)

nitin1 15

s.o.s ohh come on! read my post again. I have just asked deceptikon to reply. i am not insisting him/her to reply. as nobody was replying and he said he know about that, so that why i asked him to reply. if he/she still don't want to reply, then it's simplt okay with me. i hope i am clear in my thinking and motive for saying him. thanks. okay! sorry for this, i am deleting my that post virtually. think as if i haven't said him to reply. ;)

~s.o.s~ commented: As long as you understand, it's all good. +0

nitin1 15

use Dev C++ as the software to code your programs and you may use gcc as the compiler. I have very good experice with it. start using it. ;)