« first day (3545 days earlier)      last day (1398 days later) » 

4:50 AM
dreams of electric sheep
 
 
1 hour later…
5:53 AM
Hi guys,
Sorry to interrupt. If anybody knows about Web Firm Framework (Java framework) please join this group https://chat.stackoverflow.com/rooms/217349/wffweb
 
@Michael No, I mean literally I've never been one of these
It hasn't affected me and I don't generally get calls for urgent issues
 
 
4 hours later…
dhS
10:17 AM
HI
guys i need to ask mymodal is not working
 
\o
 
o/
 
dhS
could you please see where i am doing wrong
 
Somewhere in those 500(!) lines of code I would assume. Anything in the console? Otherwise try to boil that monstrosity down to something more managable (ideally around 100 lines) that still produces the error and come back. I have strong doubts that someone will actually go through half a thousand lines, sorry
 
dhS
@geisterfurz007 sorry i will do that
 
dhS
10:44 AM
updated code
modal not working in it
 
11:07 AM
Hi
 
dhS
Hi
<div id="myModal1" class="modal fade">
<div class="modal-dialog">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="modal-content">
<div class="modal-body">
<p align="center">Old Password does not match.Please Try Again.</p>
</div>
</div>
</div>
</div>
it is invisible in code
 
 
1 hour later…
12:23 PM
@Neil Ah, that's nice.
 
 
6 hours later…
6:23 PM
dreams of electric sheep
 
 
5 hours later…
10:58 PM
Hi guys, I have a question regarding bit shifting for unsigned long:

System.out.println(Long.parseUnsignedLong("18446744073709551615") & (1L << 63));

gives me: -9223372036854775808 - this number is supposed to be a defacto unsigned long. All other bit shifts are correct. But somehow the MSB is interpreted as negative number even though it is unsigned the way I wrote it.
 
Zoe
/javadoc Long#parseUnsignedLong
 
@Zoe Sorry, I can't find that method. :(
 
Zoe
2
 
Zoe
well, that's a mess
System.out.println(Long.parseUnsignedLong("18446744073709551615")); (tbf, in an online compiler because I'm lazy) prints -1
 
11:02 PM
https://www.jdoodle.com/online-java-compiler/

public static void main(String args[]) {

System.out.println(Long.parseUnsignedLong("18446744073709551615") & (1L << 63));

for (int i = 1; i < 65; i++) {
System.out.println("bit: " + String.format("%02d", i) + " = " + toBinaryString(64, getNthBit(i)) + " =>\t" + String.format("%19s", getNthBit(i)));
}
}

public static long getNthBit(long x) {
if (x < Integer.SIZE) {
return Integer.MAX_VALUE & (1 << (x - 1));
} else {
return Long.parseUnsignedLong("18446744073709551615") & (1L << (x - 1));
 
Zoe
it shouldn't be negative even if it overflowed. Subtracting 1 oooooh
Derp
 
Yeah isn't that odd? xD
 
Zoe
it's -1 because it's 2^64 - 1 or whatever
An unsigned long is twice as big as a signed long
It's -1 because it's stored as a signed long
 
I know. But why would you need the MSB to be special?
No need to store an extra bit for the sign.
 
Zoe
that explains the negative number, which means...
5
A: Why am I getting a value back from Long.parseUnsignedLong when I shouldn't be

KeiwanJava 8 does (somewhat) support unsigned longs, however, you can't just print them directly. Doing so will give you the result that you saw. If you have an unsigned long Long number = Long.parseUnsignedLong("FBD626CC4961A4FC", 16); you can get the correct string representation with the functio...

System.out.println(Long.toUnsignedString(Long.parseUnsignedLong("18446744073709551615") & (1L << 63)));
The "unsigned" long is a signed long, so unless you use the fancy string conversion method, Java will just print a signed number
 
11:08 PM
Aha. Interesting. Thanks, I was about to go nuts on this.
 
Zoe
Or more specifically, the parseUnsignedLong method just uses a method that wraps the value around from the max long value to the min long value. 18446744073709551615 is -1, but -1 to MIN_LONG and MAX_LONG to 0 is 18446744073709551615. That's also why it requires a special function for converting the software unsigned numbers as unsigned numbers and not in the normal way
 
Ahm, I did not get this one. What do you mean by "wraps the value around ..."?
 
Zoe
It basically allows overflowing from the max value to the min value. if you're at the max long value and add 1, you get the min long value. That's what I mean by wrapping around
 
11:24 PM
I kinda get it but also not ^^. So overflowing would be "more numbers than the long can hold" therefore << 1? Why is LONG.MIN_VALUE -1? Because of the MSB?
Sorry for this dumb question. I just find it confusing.
 
Zoe
It's not dumb - and it is confusing
So normal longs still have a sign bit, right? Now, when you're at the max value, all the numbers except the sign bit are 1. When you add 1, it causes all the numbers to turn to 0, and the sign bit to turn to a 1. If the number was a real unsigned number, this wouldn't be a problem - the number wouldn't turn negative, because it doesn't interpret the sign bit. Normal longs in Java do interpret the sign but, so it overflowing is equivalent to this (except 64 bit, obviously):
ughh
The gif on the right here:
The Year 2038 problem (also called Y2038 or Y2k38 or Unix Y2K) relates to representing time in many digital systems as the number of seconds passed since 00:00:00 UTC on 1 January 1970 and storing it as a signed 32-bit integer. Such implementations cannot encode times after 03:14:07 UTC on 19 January 2038. Similar to the Y2K problem, the Year 2038 problem is caused by insufficient capacity used to represent time. == Cause == The latest time since 1 January 1970 that can be stored using a signed 32-bit integer is 03:14:07 on Tuesday, 19 January 2038 (231-1 = 2,147,483,647 seconds after 1 January...
which also embedded in the onebox, apparently
anyway, that means all the negative numbers in java's "unsigned" long are equivalent to the max value plus the distance from the minimum value. Does that make sense?
An unsigned long and a signed long can technically hold the same number. The major difference is that the min value of an unsigned long is 0. If you take the difference between the min and max value of a signed long, you get the same value as an unsigned long.
Java's unsigned long (or at least this variant of it; there's probably libraries) uses - as an indicator that the value is over the max value of a signed long, which puts it between the max signed long value and the max unsigned long value
 
11:41 PM
I understand how a normal unsigned works and how ints work. I also understood how it flips to 100000... it is like int it goes from -128... to +127 while it switches to negative at 0x80 but this time with "unsigned long".
"The major difference is that the min value of an unsigned long is 0". I got that. So for the "java way" it is just -1 instead of 0?
Okay, and min and max are just 1 away - because of this "I switch to negative" behavior that we know from singed int for example.
Is that correct?
signed* actually xd
 
Zoe
No, the Java way is using a hacky technique that makes certain methods interpret numbers as unsigned. Using a byte is actually a good idea for an example - -128 to +127 is a signed byte. An unsigned byte would be 0-255. Using the Java approach, you can also represent -128 as 127 + 1. -1 would be 127 + 128 = 255.
It's just an extremely backwards way of hacking unsigned numbers into signed numbers
@F.Müller not entirely sure what you mean by this
It's also late, so I'm gonna go sleep. I can try to answer tomorrow if you haven't figured it out (or no one else tries to explain), but right now, I need sleep.
 
So to clarify in the post above I wrote int but I meant byte ofc.

Yes as you wrote I can store unsigned 255 bits in a byte in it also. So this is just pretty much the same principle here.
I think I got it now. Thanks a lot for your help. Wish you a pleasant rest. :)
 
Zoe
11:57 PM
No problem ^^
 

« first day (3545 days earlier)      last day (1398 days later) »