|
PIEBALDconsult wrote: new string ( '*' , 255 ).Length
Someone's getting paid by the character!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I don't understand language of your tribe, but I would go with extension method in C#. Something like this:
public static Int32 GetStringLength(this Int32 value)
s.Length.GetStringLength()

|
|
|
|
|
Smart K8 wrote: I don't understand language of your tribe
My guess is python
John
modified 8-Sep-14 14:19pm.
|
|
|
|
|
|
It's Scala actually and both Forogar and PIEBALDconsult are right about the function purpose. It is taken from a small example that reads a text file and prints it out displaying each line's length before it and the function makes sure that all lines are aligned/tabulated correctly.
|
|
|
|
|
Computer memory is amazing
We start out with this wonderful sandbox
A place where we can mold objects out of thin air
and the space is limitless in every direction
It's just the only way in or out is up
It may seem like the sandbox is small because we can see the edge of it
but as programmers we can expand the memory space so we never reach the edge
until that moment we run out of memory
which isn't such a big problem any more
but it has been
so now we have all this code that cleans up memory
So like a 3D game as we navigate through the map loading and unloading happens
on top of that
the scopes now plague us
global level, local level, and room level (procedure level)
So now we find ourselves locked in a bathroom
with the only way out of the sandbox
whish is up
the sky is out a tiny window
|
|
|
|
|
|
just can't get a hold of him ATM
That's cuz his fancy computer achieved self awareness and assimilated him...it's coming after us next 
|
|
|
|
|
According to your magical fairy tail you had 64 machines each with 500 GB of ram and each with 8 cores, which you called desktops- a desktop is currently around 16GB of RAM no where close to 500.
64 bit limitation is 18,446,744,073,709,551,616 so if you had 64 TB which is probably only 64 GB it wouldn't matter you would get the whole thing not a magical 32 TB.
The current limitation for Linux is 1 TB of RAM.
It's 64 GB with a G is probably the truth. and FYI we are getting 200 GB's in one machine so the guy is going through a crap load of work that windows does not natively support.
|
|
|
|
|
Reading some of the posts on this forum reminds me of a piece of C++ code written many years ago which went something like:
Class MyClass
{
public:
~MyClass()
{
delete this;
}
}
Life is like a s**t sandwich; the more bread you have, the less s**t you eat.
|
|
|
|
|
See my sig.
Software Zen: delete this;
|
|
|
|
|
I come before you with a question, a yearning in my heart. What <dramatic pause=""> is null..... Equal to?
...
if (value == null || value.equals(null)) {
return "null";
}
...
Evidently, the concept of "null" and "null pointers" and "null pointer calls" is lost on the guys who wrote this particular line of code. It doesn't make any errors, probably because someone added the first condition after a few NPEs happened...
EDIT: Clarification - the title is rhetorical.
|
|
|
|
|
What is the sound of two nulls equating?
|
|
|
|
|
Silence from Lorrha [^]
[Update} Well, that's pretty useless: the audio track doesn't work.
Or maybe that's the point: literally the sound of nothing at all: null in the truest sense. 
|
|
|
|
|
In programming a null object means that this doesn't exist in the memory. For example,
int i;
if(i == null) {
MessageBox.Show("Yes, Null!");
} else {
MessageBox.Show("No, value was added somewhere in the code stack");
}
This, would execute if there is no value in i , or the i was never initialized. The code that you're having is something like this
if (value == null || value.equals(null)) {
return "null";
}
The method signature would be like,
public string Function1 () {
}
Favourite line: Throw me to them wolves and close the gate up. I am afraid of what will happen to them wolves - Eminem
~! Firewall !~
modified 25-Aug-14 13:29pm.
|
|
|
|
|
I understand the concept of null, however, evidently "those who came before" didn't...
Hence why I'm posting this here 
|
|
|
|
|
|
OriginalGriff wrote: But you'd have to be a complete moron to write that!, and think that it is good code!
Oops. I just did...
FTFY!
What do you get when you cross a joke with a rhetorical question?
---
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
|
|
|
|
|
Mmmh, yeah, there's stuff like that in there too. I'll have to see if I can anonymize it enough to be internet postable. Let's just say someone did not understand object oriented coding and how Java works. We got to use this library before we actually took over developing it as contractors, and all the problems we had with it before are starting to make sense now...
|
|
|
|
|
OriginalGriff wrote: But you'd have to be a complete moron to write that!
Q.E.D.
(Sorry too easy)
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Q.E.D.
(Sorry, it was just sitting there waiting for it).
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
The problem is not the result of "null", the problem is the value.equals(null) .
The first part of the if is right (value == null). The second is wrong and it would actually never execute when the value is null (and when it does execute, value will not be null, avoiding an exception).
|
|
|
|
|
euhm, isn't
int i;
never null (it can't be null, that's where int? i is for )
(in C# that is)
(just double checked, you cannot even compile if not initialized, in the immediate window it initialized to 0)
|
|
|
|
|
Well, clearly they didn't apply the proper Yoda-ordered syntax in the if statement. Should have read thus:
if (null == value || (null).equals(value)) {
|
|
|
|
|
Which can be simplified to
if (null==value)
{
throw new NullPointerException();
}
else
{
}
|
|
|
|