Click here to Skip to main content
15,909,896 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: CCC (themed) Pin
The pompey5-Dec-19 21:52
The pompey5-Dec-19 21:52 
GeneralRe: CCC (themed) Pin
musefan5-Dec-19 21:59
musefan5-Dec-19 21:59 
GeneralRe: CCC (themed) Pin
Richard Deeming6-Dec-19 1:09
mveRichard Deeming6-Dec-19 1:09 
GeneralRe: CCC (themed) (WINNER!) Pin
Pete O'Hanlon5-Dec-19 23:45
mvePete O'Hanlon5-Dec-19 23:45 
GeneralBe careful what you wish for Pin
CodeWraith5-Dec-19 20:39
CodeWraith5-Dec-19 20:39 
GeneralRe: Be careful what you wish for Pin
Mike Hankey5-Dec-19 20:42
mveMike Hankey5-Dec-19 20:42 
GeneralRe: Be careful what you wish for Pin
musefan5-Dec-19 21:42
musefan5-Dec-19 21:42 
GeneralWhat's one of your least favorite repeated patterns to code? Pin
honey the codewitch5-Dec-19 15:25
mvahoney the codewitch5-Dec-19 15:25 
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.

C#
bool ICollection<T>.Remove(T item)
{
        // short circuit for easy case at the front
	if (Equals(_array[_head],item))
	{
		Dequeue();
		return true;
	}
	else // first find it
	{
		for(var i = 0;i<_count;++i)
		{
			var idx = (_head + i) % _array.Length;
			if(Equals(_array[idx],item))
			{
                                // this gives me a headache in my eye
				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.

GeneralRe: What's one of your least favorite repeated patterns to code? Pin
Super Lloyd5-Dec-19 16:42
Super Lloyd5-Dec-19 16:42 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
honey the codewitch5-Dec-19 16:53
mvahoney the codewitch5-Dec-19 16:53 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
Super Lloyd5-Dec-19 17:04
Super Lloyd5-Dec-19 17:04 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
honey the codewitch6-Dec-19 4:14
mvahoney the codewitch6-Dec-19 4:14 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
harold aptroot5-Dec-19 22:20
harold aptroot5-Dec-19 22:20 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
honey the codewitch6-Dec-19 4:07
mvahoney the codewitch6-Dec-19 4:07 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
harold aptroot6-Dec-19 6:47
harold aptroot6-Dec-19 6:47 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
honey the codewitch6-Dec-19 12:05
mvahoney the codewitch6-Dec-19 12:05 
GeneralRe: What's one of your least favorite repeated patterns to code? Pin
Sander Rossel5-Dec-19 22:40
professionalSander Rossel5-Dec-19 22:40 
GeneralWhen there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
RedDk5-Dec-19 13:00
RedDk5-Dec-19 13:00 
GeneralRe: When there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
Eddy Vluggen5-Dec-19 13:49
professionalEddy Vluggen5-Dec-19 13:49 
GeneralRe: When there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
RedDk5-Dec-19 14:33
RedDk5-Dec-19 14:33 
GeneralRe: When there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
BillWoodruff5-Dec-19 16:57
professionalBillWoodruff5-Dec-19 16:57 
GeneralRe: When there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
Eddy Vluggen6-Dec-19 0:16
professionalEddy Vluggen6-Dec-19 0:16 
GeneralRe: When there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
RedDk6-Dec-19 8:07
RedDk6-Dec-19 8:07 
GeneralRe: When there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
Eddy Vluggen6-Dec-19 8:40
professionalEddy Vluggen6-Dec-19 8:40 
GeneralRe: When there's nothing on a monitor, shouldn't it go blank/ black automatically? Pin
RedDk6-Dec-19 9:28
RedDk6-Dec-19 9:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.