Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Shaggar
Apr 26, 2006
whats great about correlation ids is you ask the user to provide them to you and most of the time they cant so you can just close the ticket as not enough information.

Adbot
ADBOT LOVES YOU

LordSaturn
Aug 12, 2007

sadly unfunny

if I really want to use a Java-style enum on my C# project, what can I do to get close? just an enum and a static wrapper class to go with?

Luigi Thirty
Apr 30, 2006

Emergency confection port.

look I didn't write this application buddy and I know how bad that is

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

LordSaturn posted:

if I really want to use a Java-style enum on my C# project, what can I do to get close? just an enum and a static wrapper class to go with?
meaning you want to use them in a switch?

HoboMan
Nov 4, 2010

meaning he wants to be able to define methods on them, and have them have some additional attributes too

Shaggar
Apr 26, 2006

LordSaturn posted:

if I really want to use a Java-style enum on my C# project, what can I do to get close? just an enum and a static wrapper class to go with?

Extension methods https://msdn.microsoft.com/en-us/library/bb383974.aspx

HoboMan
Nov 4, 2010

I feel like there should be a data structure for this, but I can't think of what
C# code:
List<KeyValuePair<string, string>>

HoboMan fucked around with this message at 21:34 on Jun 10, 2016

Luigi Thirty
Apr 30, 2006

Emergency confection port.

HoboMan posted:

I feel like there should be a data structure for this, but I can't think of what
C# code:

List<KeyValuePair<string, string>>

Dictionary<string, string>?

LordSaturn
Aug 12, 2007

sadly unfunny

HoboMan posted:

meaning he wants to be able to define methods on them, and have them have some additional attributes too

yep


it did not occur to me that you could extend an enum, namaste

HoboMan posted:

I feel like there should be a data structure for this, but I can't think of what
C# code:
List<KeyValuePair<string, string>>

is this a weird joke about dictionaries

Luigi Thirty
Apr 30, 2006

Emergency confection port.

oh you have to pay $100 to child's play in order to submit games to steam greenlight

my end goal is to make a whole DOS casino games package and put it on steam as like, a lost shareware game from 1992 for 99 cents a la retro city rampage (you can package stuff with dosbox without violating its license)

HoboMan
Nov 4, 2010

valve keeping out shovelware by asking the hard questions, like: "do you think your game will make at least $100?"

Shaggar
Apr 26, 2006

HoboMan posted:

I feel like there should be a data structure for this, but I can't think of what
C# code:
List<KeyValuePair<string, string>>

Dictionary<K,V> implements IEnumerable<KeyValuePair<K,V>>

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

HoboMan posted:

meaning he wants to be able to define methods on them, and have them have some additional attributes too

so a class?

HoboMan
Nov 4, 2010

also yes :thejoke: is this code I'm looking at is using List<KeyValuePair<string, string>> everywhere when Dictionary exists

PokeJoe
Aug 24, 2004

hail cgatan


how do i learn junit

HoboMan
Nov 4, 2010

Wheany posted:

so a class?

so in Java enums are weird. they are basically classes but they only have the set number of instances you specified

it's actually super useful, but also super easy to misuse

Shaggar
Apr 26, 2006
List<KeyValuePair<String,String>> allows for dupes where Dictionary<String,String> does not

raminasi
Jan 25, 2005

a last drink with no ice

Shaggar posted:

List<KeyValuePair<String,String>> allows for dupes where Dictionary<String,String> does not

and elements with null keys

not that that's ever a good idea

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

HoboMan posted:

so in Java enums are weird. they are basically classes but they only have the set number of instances you specified

it's actually super useful, but also super easy to misuse

a class with a private constructor and a few public static final instances.

HoboMan
Nov 4, 2010

Shaggar posted:

List<KeyValuePair<String,String>> allows for dupes where Dictionary<String,String> does not

oh poo poo, nice catch

LordSaturn
Aug 12, 2007

sadly unfunny

Wheany posted:

so a class?

the use case is that I have a grid and I want to track a unit's facing on that grid, so I need to be able to do things like currentFacing.CCW(1);

the wrinkle is that I want to have eight values and then use a flag value to determine whether I'm on a square or hex grid, are diagonals allowed, which way do the hexagons go, etc, and then do the calculations correctly given that

there are other solutions but this one seems the most readable

Wheany posted:

a class with a private constructor and a few public static final instances.

does C# have final? are you just picking fights with anyone who wants an enum with methods? tia

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
so doesn't this work:

code:
public class Direction {
	private Direction() {

	}

	public void SomeMethod() {

	}
	
	public static readonly LEFT = new Direction();
	public static readonly RIGHT = new Direction();
}

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Shaggar posted:

List<KeyValuePair<String,String>> allows for dupes where Dictionary<String,String> does not

also the list is ordered, dictionary is only arbitrarily so

LordSaturn
Aug 12, 2007

sadly unfunny

Wheany posted:

so doesn't this work:

code:
public class Direction {
	private Direction() {

	}

	public void SomeMethod() {

	}
	
	public static readonly LEFT = new Direction();
	public static readonly RIGHT = new Direction();
}


I need a method like

code:
public Direction CCW( int x = 0 )
{
	Direction result = ~magic~;
	return result;
}
where ~magic~ is code that considers what grid style we're set to and how many steps to spin and determines the direction to return

I could do this with a big wad of conditionals and recursive stuff but lol to that, so instead I'd need to store a value on each instance to tell it which one it is so it knows what to do. this value could be an enum, but then why did I bother making a class to wrap an enum if an enum can have methods

Luigi Thirty
Apr 30, 2006

Emergency confection port.

I don't like how my global namespace is polluted with enums since watcom doesn't support class-style enums added in c++11

HoboMan
Nov 4, 2010

HoboMan posted:

I feel like there should be a data structure for this, but I can't think of what
C# code:
List<KeyValuePair<string, string>>

ok, this but unironically now

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

HoboMan posted:

ok, this but unironically now

It's called a p-list. Short for property list. Is that what you are asking for?

Shaggar
Apr 26, 2006

Wheany posted:

a class with a private constructor and a few public static final instances.

wont work quite the same as an enum tho.

HoboMan
Nov 4, 2010

Zaxxon posted:

It's called a p-list. Short for property list. Is that what you are asking for?

only finding poo poo about plist files


anyways, connection pooling. if I call several functions where several of them are
C# code:
using(a database connection)
will c# take care of optimizing that or do i need to nest all the calls in larger using statement to get them to pool?

Shaggar
Apr 26, 2006
ado.net will handle it for you. it gives you one from the pool on connect and returns it to the pool on dispose.

qntm
Jun 17, 2009

Zaxxon posted:

It's called a p-list. Short for property list. Is that what you are asking for?

dang I knew there was a name for that but I was having a hard time googling for it

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

HoboMan posted:

only finding poo poo about plist files


anyways, connection pooling. if I call several functions where several of them are
C# code:
using(a database connection)
will c# take care of optimizing that or do i need to nest all the calls in larger using statement to get them to pool?

it's from lisp stuff. There are a-lists and p-lists

P lists look like ( key val key val key val key val)
A lists look like ( (key . val) (key . val) )

EDIT:

gently caress I had it backwards. List<KeyValPair<X,Y>> is an A-List. The other one is a P-List.

I mean really they are pretty much the same and I'm still not sure what your actual question is.

Zaxxon fucked around with this message at 23:29 on Jun 10, 2016

TwoDice
Feb 11, 2005
Not one, two.
Grimey Drawer

Shaggar posted:

List<KeyValuePair<String,String>> allows for dupes where Dictionary<String,String> does not

does c# not have multimaps? what's wrong with you guys

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
I have seen a map of maps of maps of hashtables.

Space Whale
Nov 6, 2014
Just posting that if you end up playing monkey in the middle between two higher ups who want you to do different things, the correct option is always "cover your rear end."

Also if I wish to make a SPA toy page and I am a C# dev, would ReactJS just be the best thing to sit on some MVC and get it done in an afternoon?

brap
Aug 23, 2004

Grimey Drawer

Space Whale posted:

Just posting that if you end up playing monkey in the middle between two higher ups who want you to do different things, the correct option is always "cover your rear end."

Also if I wish to make a SPA toy page and I am a C# dev, would ReactJS just be the best thing to sit on some MVC and get it done in an afternoon?

react is the best thing for making a SPA toy page, yes.

Space Whale
Nov 6, 2014
OK, cool.

So in the future how do you avoid getting told you're the bad fit if two leads argue over how to push code you're writing? What's the CYA except to shrug and run to the bathroom?

Or have your manager say only push reviewed code, then have your team lead say push first so the crucible integration works, then later push revision patches?

Feels like I left a disaster but I hate having to deal with this poo poo and would rather just dodge this bullshit the next time it happens.

I'm glad the industry is booming right now. My whole year here in Austin has been a comedy of errors, but at least one of them was not my fault and the business will cop to it.

JewKiller 3000
Nov 28, 2006

by Lowtax
Make sure you interview with the person who would be your boss.
Assess your rapport with this person based on first impressions and how the interview goes. Does he seem chill and interested in working with you? Or overbearing and excited to poz your neg rear end?
Take the job only when you have a positive impression.

Space Whale
Nov 6, 2014

JewKiller 3000 posted:

Make sure you interview with the person who would be your boss.
Assess your rapport with this person based on first impressions and how the interview goes. Does he seem chill and interested in working with you? Or overbearing and excited to poz your neg rear end?
Take the job only when you have a positive impression.

Adbot
ADBOT LOVES YOU

30 TO 50 FERAL HOG
Mar 2, 2005



Space Whale posted:

OK, cool.

So in the future how do you avoid getting told you're the bad fit if two leads argue over how to push code you're writing? What's the CYA except to shrug and run to the bathroom?

Or have your manager say only push reviewed code, then have your team lead say push first so the crucible integration works, then later push revision patches?

Feels like I left a disaster but I hate having to deal with this poo poo and would rather just dodge this bullshit the next time it happens.

I'm glad the industry is booming right now. My whole year here in Austin has been a comedy of errors, but at least one of them was not my fault and the business will cop to it.

do what I did and get the fck out of austin

  • Locked thread