|
Member 14658748 wrote: how to open source files thanks
You're welcome.
|
|
|
|
|
Untamed Land - In Darkness Awakened[^]
About two weeks ago, Google recommended a blog with top 10 epic black metal albums.
I do like me some epic black metal from time to time, so I checked out the list.
I already knew the first five and the final four were mostly more of the same.
Not so for #6 on the list though, Untamed Land.
Where about 90% of epic black metal bands are inspired by Tolkien and the remaining 10% by winter, Untamed Land is inspired by... Spaghetti westerns!
This is what Ennio Morricone would sound like if he made black metal.
|
|
|
|
|
A set of drawers goes mental on the fire at Christmas (9)
A nice easy one to finish the week.
modified 6-Dec-19 6:00am.
|
|
|
|
|
Pete O'Hanlon wrote: A nice easy one to finish the week.
A little too easy... I would feel dirty answering it
I will save it for Griff, he likes to do Mondays
|
|
|
|
|
|
A group of chess players checked into a hotel and stood in the lobby talking about their tournament victories. Suddenly the manager came out and asked them to disperse. “But why?” They asked. “Because I can’t stand chess nuts boasting in an open foyer.”
|
|
|
|
|
It must be December - it's time for the annual telling of the ancient "chess nuts boasting" joke.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It probably comes as no surprise to you to find out you are the winner.
|
|
|
|
|
Xou might get it: Wizard of Id[^].
I have good connections to the guys who test these[^].
It's still not going to be cheap, but women love expensive cars.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
CodeWraith wrote: It's still not going to be cheap, but women love expensive cars.
and Jewelry and Clothes and Shopping and ...
They call me different but the truth is they're all the same!
JaxCoder.com
|
|
|
|
|
Mike Hankey wrote: and ...
Not the ones I have met, they are usually grumpy as hell during "that time"
|
|
|
|
|
Mine has to be inserts and deletions in containers implemented over arrays:
Below is some ugly code. I hate this. B-trees are FAR worse though.
bool ICollection<T>.Remove(T item)
{
if (Equals(_array[_head],item))
{
Dequeue();
return true;
}
else
{
for(var i = 0;i<_count;++i)
{
var idx = (_head + i) % _array.Length;
if(Equals(_array[idx],item))
{
if (_head + _count < _array.Length)
{
Array.Copy(_array, idx + 1, _array, idx, _count - idx - 1);
}
else if (idx == _array.Length - 1)
{
_array[idx] = _array[0];
if(_count+_head!=_array.Length)
{
Array.Copy(_array, 1, _array, 0, (_count + _head) % _array.Length - 1);
}
}
else if (idx < _head)
{
Array.Copy(_array, idx + 1, _array, idx, (_count + _head) % _array.Length - 1);
}
--_count;
unchecked
{
++_version;
}
return true;
}
}
}
return false;
}
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I can feel the lack of love in ya code...
you can do nicer, I believe in ya!
Also there is a bug!
If T is a reference type, you would leave the reference at the head index being duplicated (and NOT garbage collected)... you should set newly empty spot to default(T)
as in, if you remove B
your underlying array will go from
A | B | C
to
A | C | C
The last C will prevent garbage collection of C
|
|
|
|
|
yeah that's true. I wasn't considering the collection of ref types there. Now I can see why microsoft cleared their arrays. I didn't put 2 and 2 together and think about garbage collection. meh. thanks.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Here you go corrected version.. though I feel I might be wrong a little bit by +/- 1 on some indexes, you gotta proof read it!
EDIT (oops got the count wrong on my removes... buut I still hope the general outline ispire you for its simplicity! )
v1
bool ICollection<T>.Remove(T item)
{
for(var i = 0; i < _count; ++i)
{
var idx = (_head + i) % _array.Length;
if(!Equals(_array[idx],item))
continue;
if (_head + _count < _array.Length)
{
Array.Copy(_array, idx + 1, _array, idx, _count - idx - 1);
}
else if (idx < _head)
{
Array.Copy(_array, idx + 1, _array, idx, ((_head + _count) % _array.Length - idx - 1));
}
else
{
Array.Copy(_array, idx + 1, _array, idx, _array.Length - idx - 1);
_array[_array.Length - 1] = _array[0];
Array.Copy(_array, 1, _array, 0, _head - 1);
}
_array[_head + _count - 1] = default(T);
--_count;
unchecked { ++_version; }
return true;
}
return false;
}
v2
bool ICollection<T>.Remove(T item)
{
var i = FindIndex(item);
if (i == -1)
return false;
var idx = (_head + i) % _array.Length;
if (_head + _count < _array.Length)
{
Array.Copy(_array, idx + 1, _array, idx, _count - idx - 1);
}
else if (idx < _head)
{
Array.Copy(_array, idx + 1, _array, idx, (_head - idx - 1));
}
else
{
Array.Copy(_array, idx + 1, _array, idx, _array.Length - idx - 1);
_array[_array.Length - 1] = _array[0];
Array.Copy(_array, 1, _array, 0, _head - 1);
}
_array[_head + _count - 1] = default(T);
--_count;
unchecked { ++_version; }
return true;
}
modified 5-Dec-19 23:11pm.
|
|
|
|
|
I didn't factor it that much just because I whipped it up so fast. It's on my TODOs, which is why it's sitting in my prelim folder.
Before I extensively factored it, I wanted to dogfood it, so I used it in my backtracking parsers.
Now that it works, and I've tested it in a real world situation, I'm ready to go back and clean it up, I just haven't gotten to it yet.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I nominate the old (x + m) % m to avoid the old "if x is negative then % works in a weird way".
It's not big, but happens a lot, and often after a debugging session and cursing. Bad vibes.
|
|
|
|
|
To me modulo is a so second nature that I don't find it confusing it all.
When I see it, I automatically think - this is probably a bounding value for the target it is modifying.
For example:
return _array[i % _array.Length];
That tells me that i 's value is wrapped to the array's length.
It's instinct to me. What's less clear is when people use if to accomplish the same thing, IMO.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Modulo is fine, I meant the annoying pattern to deal with negative dividends. -1 % _array.Length = -1 and that's usually not what you want from a modulo.
modified 7-Dec-19 1:10am.
|
|
|
|
|
ahh, i see. =)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
if (something)
DoSomethingOnThisLineWithoutBraces(); I never do it, but I see it a lot
|
|
|
|
|
|
No?
Why should it in your mind?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
This question, Googled, returns 108 hits which ALL have nothing to do with what is implicit to it, as a question. So, yeah, I guess "No" is really the most useful thing anyone would expect to gain by typing the question, or any question for that matter, into that pile of ... nonsense.
So thanks for this.
|
|
|
|
|
This is a good example of the hidden esoteric teaching (gematria) behind Google's search engine.
I am not allowed to say too much, but, note that 108 is a sacred number in Buddhism, and Hinduism, Sikh religion, and Jainism ... it also happens to be the hyperfactorial of 3 : sum of two squared and three cubed. Each interior angle of a pentagon is 108.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|