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
PhonyMcRingRing
Jun 6, 2002
Since we're talking about games, I'm curious about something with C++. In .Net, when you call a method/property/whatever on an object that you have casted to an interface(ie: using a List object passed to a method as IEnumerable), a few extra calls have to be made by the runtime to look up the right method to call on the actual object's type since the JIT compiler can't guarantee an exact type. Does that same problem crop up in C++ or XNA? Is it significant enough that it could cause problems if you're calculating game graphics?

Adbot
ADBOT LOVES YOU

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Sedro posted:

You should really differentiate points and vectors. You can't calculate the distance from a vector.

What you are saying is true in a strict mathematical sense, but XNA tends to use the looser 'a vector is an arrow starting at the origin that extends to some x,y,z point' definition, so it may actually be more confusing to define a floating point PointF class in this case.

For example, XNA is filled with methods like DrawASprite(Vector2 position). Replacing each of these with a more strictly mathematically correct DrawASprite(PointF position) convention would only confuse the heck out of things.

snorch posted:

e: seems to work pretty well with an interface.

You might find extension methods to be useful in conjunction with your interface definition. You'd define some extension method that operates on your IPrimitiveShape to, say, calculate a gradient and then Circle.GetGradient() or Square.GetGradient() would become available automatically.

Fastbreak
Jul 4, 2002
Don't worry, I had ten bucks.
I am about to buy a new laptop for personal dev use. Someone suggested that I get a mac, and run a virtual machine on it for my windows dev.

now I am a .Net dev by trade, but dabble in iOS development, php, etc. I am not trying to turn this into a "Should I get a mac or a pc" talk, but I was wondering if anyone who is a .Net dev has made the switch to a mac for their dev machine, and any drawbacks they found. From what I am reading, there is plenty of VM options out there with no downsides, but I would rather ask someone who has actually gone through the experience.

Will it just be a pain to get the dev environment right with a bunch of gotchas, or will I barely even notice?

epswing
Nov 4, 2003

Soiled Meat

Fastbreak posted:

now I am a .Net dev by trade, but dabble in iOS development, php, etc.

Wouldn't you want a windows machine with an iOS vm?

Fastbreak
Jul 4, 2002
Don't worry, I had ten bucks.

epswing posted:

Wouldn't you want a windows machine with an iOS vm?

Ideally, but to skip the long backstory, I may be forced into a mac. For the sake of this discussion, lets say that I could get a mac for free as a dev machine, but I am not sure if it's worth it.

I am not trying to be all super secret about it, but to explain it accurately would be a loving soap opera; I know it sounds dickish but trying to keep the scenario simple. Just any advice about VMing on a mac to a windows 7 instance for mostly asp.net dev is really what I am curious about; most of the things I find are pretty much fluff pieces about how great the VM software is and not sure how much I should trust it.

snorch
Jul 27, 2009

PDP-1 posted:

XNA stuff

Yeah, screw you nerd types and your "math" :argh:
I'm making a vidya game :downs:

wwb
Aug 17, 2004

Fastbreak posted:

Ideally, but to skip the long backstory, I may be forced into a mac. For the sake of this discussion, lets say that I could get a mac for free as a dev machine, but I am not sure if it's worth it.

I am not trying to be all super secret about it, but to explain it accurately would be a loving soap opera; I know it sounds dickish but trying to keep the scenario simple. Just any advice about VMing on a mac to a windows 7 instance for mostly asp.net dev is really what I am curious about; most of the things I find are pretty much fluff pieces about how great the VM software is and not sure how much I should trust it.

We got a few people who dual boot macs or run VMWare fusion all day and have no problems with it. If you want to go hardcore you could always pave it and put win7 on the laptop itself, no need for a VM.

Fastbreak
Jul 4, 2002
Don't worry, I had ten bucks.

wwb posted:

We got a few people who dual boot macs or run VMWare fusion all day and have no problems with it. If you want to go hardcore you could always pave it and put win7 on the laptop itself, no need for a VM.

Nice. So IIS setup, application pools, etc are exactly the same? This is what I am hoping for at least. or at least the guys you have that run it are cursing the hassle of doing it everyday.

wwb
Aug 17, 2004

You want a full-boned virtual machine, something like VMWare Fusion. But once you get there you are just running windows so all that stuff is the same. Performance is generally adequate from what I've heard, Macs are pretty beefy laptops after all.

ljw1004
Jan 18, 2005

rum

PhonyMcRingRing posted:

Since we're talking about games, I'm curious about something with C++. In .Net, when you call a method/property/whatever on an object that you have casted to an interface(ie: using a List object passed to a method as IEnumerable), a few extra calls have to be made by the runtime to look up the right method to call on the actual object's type since the JIT compiler can't guarantee an exact type. Does that same problem crop up in C++ or XNA? Is it significant enough that it could cause problems if you're calculating game graphics?

Incidentally, the C# and VB compilers already emit "CALLVIRT" in some cases where you'd think a regular call would do.

One issue that people face is that if you have say a structure that implements an interface, and you pass it as argument for a function parameter of the interface type, then it gets boxed. Boxing is a common perf problem. So what we might do is this:

code:
Interface I
   Sub f()
   End Sub
End Interface

Structure S : Implements I
   Sub f() Implements I.f
   End Sub
End Structure

Dim s As New S


' NOT this way because it will box "s"
Sub test(x As I)
   x.f()
End Sub

test(s)


' INSTEAD this way to avoid the boxing
Sub f(Of T As I)(x As T)
    x.f()
End Sub

test(s)
This way the JIT will generate one copy of the body of "f" if you pass it an argument of any reference type, plus one copy for each different structure type it gets given. Those specialized structure types will, I believe, involve a direct (non-virtual) call to f, since by the time the JIT specializes them it already knows the concrete type of "x".



This is all pretty esoteric, and invariably dwarfed by other costs -- costs due to algorithm choice, and costs due to the amount of heap allocation -- and it'd concretely be a mistake to try to optimize away the cost of virtual method dispatch unless (1) profiling told you to optimize, and (2) you'd already addressed algorithm+heap costs.

chglcu
May 17, 2007

I'm so bored with the USA.

Fastbreak posted:

I am about to buy a new laptop for personal dev use. Someone suggested that I get a mac, and run a virtual machine on it for my windows dev.

now I am a .Net dev by trade, but dabble in iOS development, php, etc. I am not trying to turn this into a "Should I get a mac or a pc" talk, but I was wondering if anyone who is a .Net dev has made the switch to a mac for their dev machine, and any drawbacks they found. From what I am reading, there is plenty of VM options out there with no downsides, but I would rather ask someone who has actually gone through the experience.

Will it just be a pain to get the dev environment right with a bunch of gotchas, or will I barely even notice?

My experience with a mid-2010 (I think, whichever one was the last with the nVidia 320m) Macbook Air 11", is that VMware Fusion worked fine for most development related things. I did have some rather severe performance problems with Visual Studio 2010, however. Didn't have any problems with previous VS versions. Think it was the WPF stuff that caused the problems. In the end, I just dual-booted into Windows to use it.

Edit: Another problem I had at first is the lack of home, end, page up and page down keys. Having to use a key combination instead drove me crazy for a while. Eventually mostly got used to it.

chglcu fucked around with this message at 18:38 on Jan 5, 2012

Dromio
Oct 16, 2002
Sleeper

wwb posted:

We got a few people who dual boot macs or run VMWare fusion all day and have no problems with it. If you want to go hardcore you could always pave it and put win7 on the laptop itself, no need for a VM.

I have a macbook pro with Win7 installed as a bootcamp partition for dual-booting. Then I also have VMWare Fusion set up with a VM that uses that same partition as a hard drive. It works perfectly. I can boot to "native" Win7 if I want to do something that requires more speed and memory (really just to play video games), and I can run the exact same environment in a VM with only a little performance penalty when I'm too lazy to reboot or I want all my OSX goodies too. I often just run VS.NET in "Unity" mode without any trouble, and don't really see any performance issues there.

Fastbreak
Jul 4, 2002
Don't worry, I had ten bucks.

prolecat posted:

My experience with a mid-2010 (I think, whichever one was the last with the nVidia 320m) Macbook Air 11", is that VMware Fusion worked fine for most development related things. I did have some rather severe performance problems with Visual Studio 2010, however. Didn't have any problems with previous VS versions. Think it was the WPF stuff that caused the problems. In the end, I just dual-booted into Windows to use it.

This is where I show how clueless I am about a mac environment in general. They say their whole network where I would be hooked into would be "all mac and mac servers" which I have no idea what that means. Which they claim is why I wouldn't be able to use my PC dev machine and I would have to use a mac. I have no idea how valid that is, but if I dual booted into windows, would I still have the same problem?

I may be turning this more into a mac question now instead of a dev one, but you guys have alleviated a lot of concerns about specifically the dev environment on a VM. Thanks.

wwb
Aug 17, 2004

What that means is they are using a lovely ldap implementation that can't do half the stuff that ActiveDirectory can but they can tell their mac fag friends they are running a mac network.

As for how that would effect using a PC, well, that really depends on what network resources you need access to but it should probably be workable in most cases.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Dromio posted:

I have a macbook pro with Win7 installed as a bootcamp partition for dual-booting. Then I also have VMWare Fusion set up with a VM that uses that same partition as a hard drive. It works perfectly. I can boot to "native" Win7 if I want to do something that requires more speed and memory (really just to play video games), and I can run the exact same environment in a VM with only a little performance penalty when I'm too lazy to reboot or I want all my OSX goodies too. I often just run VS.NET in "Unity" mode without any trouble, and don't really see any performance issues there.

Is that hard to get set up? I vaguely remember VMWare having to be tricked into using a partition as a VM's disk, but that was years ago. Has that changed?

Fiend
Dec 2, 2001
I tried using Parallels VM software on a mac notebook a couple years ago and enjoyed it. Now a days the cool kids install Windows 7 directly and put their Mac OS on a PC Card SSD.

chglcu
May 17, 2007

I'm so bored with the USA.

Munkeymon posted:

Is that hard to get set up? I vaguely remember VMWare having to be tricked into using a partition as a VM's disk, but that was years ago. Has that changed?

In the latest version of Fusion, there's a built-in option for creating a VM from a bootcamp partition. Not sure how long it's been there.

PhonyMcRingRing
Jun 6, 2002

ljw1004 posted:

Neat stuff.

Interesting! Thanks!

PhonyMcRingRing
Jun 6, 2002
I was just reading about how the .Net 4.5 update will be an "in place" update of 4.0. The dlls will still have the same version number as 4.0 and just magically replace 4.0 while still somehow appearing to be 4.0. But I don't get it. Who, exactly, is the inplace update system supposed to help?

It's not the server admins. Now they can't run one website for 4.5 without forcing every other 4.0 site hosted on the same server to be upgraded to 4.5.

It's not the developers. Now if they want to upgrade one website to 4.5, a website that might be using an incompatible 4.0 library that they don't have access to, they have to wait until the third party developer updates and patches the problem.

It's not the clients. Now if they want to upgrade their system to 4.5 because one application requires it, they risk breaking other existing installs that haven't been updated to work with 4.5. Not only that, they risk having to wait for the developers above to wait for other developers to release proper 4.5 versions before they can release their own fixes.

None of these things would be a problem if 4.5 could live side by side with 4.0. Server admins won't have to risk their hosted sites going down because one site requires 4.5. Developers won't have to sit and wonder if their apps will work because they can't tell if the client machine has the right framework. End users won't have to risk breaking any of their existing applications just to upgrade one app.

It seems like this inplace update system is supposed to make things "easy" for people who might be non-technical. And hell, inplace updates make sense if we're talking about something like Chrome updating transparently for the end user. But this is a huge framework that tons of applications rely on to be consistent. If you're a developer or a server admin, you shouldn't be afraid of having to change a version number in a config file somewhere. And an end user isn't gonna care either way, they have to run an installer for the framework no matter what you do.

I get that Microsoft is trying to run tests of a shitload of apps to see if they break anything, but they can't possibly test every single possible line of .NET 4.0 code that's ever been written.

wwb
Aug 17, 2004

Totally speaking out of conjecture here, but will it be like the .NET 2.0 / .NET 3.5 thing we lived through for most of the past decade? Situation was .NET 3.5 compiled down to 2.0 MSIL and was really compiler stunts and syntactic sugar. All your app pools were set to 2.0.5070whatever even if your apps were all built in .NET 3.5 with linq and such.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I wonder how much less complaining there'd be if it was named .NET 4.0 SP2 rather than 4.5.

Zhentar
Sep 28, 2003

Brilliant Master Genius
.NET 4.5 is the same in that it targets the same MSIL. But it isn't purely compiler stunts and syntactic sugar (and neither was .NET 3/3.5). There are API additions and behavior changes.

What makes .NET 4.5 "special" is that it's going to pretend to be .NET 4.0, right down to the build number. This is supposed to be totally okay because they're testing hundreds of applications for compatibility, which will ensure that nothing is broken by behavior changes (excepting of course the breaking changes they made on purpose), and hey, it's not like you were going to check if .NET 4.5 was installed before running your .NET 4.5 dependent application anyway, right?


As far as why they're doing this, that's easy. They're shaving precious megabytes off the Windows 8 install footprint to try to cram it onto devices with only 16GB of flash.

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

wwb posted:

Totally speaking out of conjecture here, but will it be like the .NET 2.0 / .NET 3.5 thing we lived through for most of the past decade? Situation was .NET 3.5 compiled down to 2.0 MSIL and was really compiler stunts and syntactic sugar. All your app pools were set to 2.0.5070whatever even if your apps were all built in .NET 3.5 with linq and such.

There was mscorlib 2.0, mscorlib 3.0, mscorlib 3.5 all targeting the 2.0 CLR...but there will be mscorlib 4.0 from the 4.0 framework and mscorlib 4.0 from the 4.5 framework both targeting the 4.0 CLR. I don't get the sudden reversal of practice which worked just fine last time around.

epswing
Nov 4, 2003

Soiled Meat
I'm not supposed to commit generated files into version control. So I've ignored .cs files generated by .tt files. Now when I clone and build the solution, it's full of errors telling me to re-run my custom tools. Can't I tell VS to just run all custom tools? Or even run them when compiling?

epswing fucked around with this message at 16:24 on Jan 6, 2012

wwb
Aug 17, 2004

Ugh. I'd rather have a distinct runtime if they are doing that.

@epswing: I would commit the generated files. The main advantage is when some dolt mis-generates them you've got a working copy to roll back to and deconstruct what said dolt did.

The other alternative is to make the generation part of the default build.

uXs
May 3, 2005

Mark it zero!

wwb posted:

@epswing: I would commit the generated files. The main advantage is when some dolt mis-generates them you've got a working copy to roll back to and deconstruct what said dolt did.

The other alternative is to make the generation part of the default build.

Another vote for committing the generated files.

The biggest problem with generated files is that they change all the time: each time you build, there's at least a version number or something changing. So whenever you'd change a line somewhere, you'd have a bunch of 'unrelated' files changing. That's useless and annoying.

Your .tt-generated files on the other hand should be the same each time, so you wouldn't commit any changes to source control. Unless of course something actually changed, then they would be committed. And that's a Good Thing.

epswing
Nov 4, 2003

Soiled Meat

wwb posted:

The other alternative is to make the generation part of the default build.

This is what I want, and I'm struggling. There's an VS add-in called Chirpy...but do I really need a whole add-in for this?

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

epswing posted:

This is what I want, and I'm struggling. There's an VS add-in called Chirpy...but do I really need a whole add-in for this?

If you want to do it yourself you can use the Pre Build event to compile your T4 templates before your application is compiled. If you go to the properties for your project there is a Build Events tab and you can run the command line T4 compiler on your files before your project is compiled by Visual Studio. Probably can do it with MSBuild, too.

Vintersorg
Mar 3, 2004

President of
the Brendan Fraser
Fan Club



I apologize in advance if this has been covered extensively, checked back the last couple pages and didn't see anything. The OP is a little out of date but it's regarding books.

I am moving from regular old .NET (creating various forms with file i/o, database, etc) to ASP. This is for a Co-Op and while most of the code remains similar (based on the couple days of coding) I want to get a crash course in ASP and have a reference manual. Any recommended books? My teacher said it shouldn't be too much of a big deal but I hate having to rely on random rear end searches. I'll be using VS 2010.

aBagorn
Aug 26, 2004

Vintersorg posted:

I apologize in advance if this has been covered extensively, checked back the last couple pages and didn't see anything. The OP is a little out of date but it's regarding books.

I am moving from regular old .NET (creating various forms with file i/o, database, etc) to ASP. This is for a Co-Op and while most of the code remains similar (based on the couple days of coding) I want to get a crash course in ASP and have a reference manual. Any recommended books? My teacher said it shouldn't be too much of a big deal but I hate having to rely on random rear end searches. I'll be using VS 2010.

VB or C#?

Vintersorg
Mar 3, 2004

President of
the Brendan Fraser
Fan Club



Sorry, VB.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Vintersorg posted:

Sorry, VB.

Webforms or MVC?

aBagorn
Aug 26, 2004

Ithaqua posted:

Webforms or MVC?

Speaking as a newbie, which is generally preferred and for what type of web app?

Yes I'm aware I could probably Google this but I'd rather hear some goofy opinions.

No Safe Word
Feb 26, 2005

aBagorn posted:

Speaking as a newbie, which is generally preferred and for what type of web app?

Yes I'm aware I could probably Google this but I'd rather hear some goofy opinions.

Generally speaking, MVC is The Way Forward and should be what you default to unless you have a good reason to use WebForms instead.

wwb
Aug 17, 2004

gariig posted:

If you want to do it yourself you can use the Pre Build event to compile your T4 templates before your application is compiled. If you go to the properties for your project there is a Build Events tab and you can run the command line T4 compiler on your files before your project is compiled by Visual Studio. Probably can do it with MSBuild, too.

Definitely can do it with MSBuild. I'd hack the project file (which is a msbuild file) and toss the appropriate execution statement in.

Fastbreak
Jul 4, 2002
Don't worry, I had ten bucks.
As the OP that has horribly abandoned this thread, I plan on updating it a bit next week. Let me know if you have any thoughts on what should be there.

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

No Safe Word posted:

Generally speaking, MVC is The Way Forward and should be what you default to unless you have a good reason to use WebForms instead.

My excuse for developing WebForms in 2012 is that I'm using Ext.Net and it fits into the WebForms model pretty well. :shobon:

Kekekela
Oct 28, 2004

aBagorn posted:

Speaking as a newbie, which is generally preferred and for what type of web app?

Webforms tends to abstract away a lot of stuff you should know as a web developer in order to provide a development experience that would be easy for someone that's transitioning from developing Winforms desktop apps. (this was pretty much necessary given their developer base when Webforms was introduced)

While there are probably valid reasons to use Webforms if you know what you're doing and are aware of its pitfalls, for someone starting out I think MVC will provide a much "cleaner" learning experience for web development in general. I've heard Webforms described as "training wheels that are rusty and covered with acid coated spikes", meaning you can probably get up and running quickly but its very easy to do things that are really wrong in a web development context.

In the interest of full-disclosure, I'm very biased and before ASP.NET had an MVC framework I was trying to craft my own using HttpHandlers in WebForms.

Vintersorg
Mar 3, 2004

President of
the Brendan Fraser
Fan Club



That I am not sure of and I can probably find out on Monday, sorta thrust into this. :3:

Adbot
ADBOT LOVES YOU

raminasi
Jan 25, 2005

a last drink with no ice
In C#, is there a way to create an auto-implemented property with a readonly backing field? I know about get; private set; but in that case the field is still mutable by this.

  • Locked thread