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.
 
  • Post
  • Reply
Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Luigi Thirty posted:

I got an access violation still. I changed it to just SetPixel() but the results are wrong. Starting with a black image, this code:

code:
            vm.TestCharacter = new WriteableBitmap(64, 64, 96, 96, PixelFormats.BlackWhite, null);
            vm.TestCharacter.Lock();
            vm.TestCharacter.SetPixel(0, 1, Colors.White);
            vm.TestCharacter.Unlock();
gives me this image (minus the border). Shouldn't it be touching one pixel and not... many pixels?



Just a guess, but I think this might be because you're using PixelFormats.BlackWhite. Try Bgr32 or Pbgra32.

Adbot
ADBOT LOVES YOU

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Bognar posted:

Just a guess, but I think this might be because you're using PixelFormats.BlackWhite. Try Bgr32 or Pbgra32.

That got it working thanks.

EssOEss
Oct 23, 2006
128-bit approved

Uziel posted:

ASP.NET 5 is now RC1! Thank god as I started a new project just yesterday using beta8 and was running into weird issues.

http://blogs.msdn.com/b/dotnet/archive/2015/11/18/announcing-net-core-and-asp-net-5-rc.aspx

I have been checking out the new .NET Core and ASP.NET 5 stack and it all seems like very early beta to me. I mean, seriously, what is this: https://github.com/aspnet/KestrelHttpServer/issues/370. Just an isolated example but this and other things give me the impression that only the hot path in the codebase has seen any real testing and the whole thing is still very raw.

This "RC" seems to just be a marketing trick to get more testers (and Microsoft needed something to announce at Connect). So far, I am rather disappointed. The concepts behind the stack are quite exciting and I would love to use it but I just can't bring myself to take it seriously at this point.

EssOEss fucked around with this message at 09:09 on Nov 19, 2015

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.
Yeah I know what you mean. I'm not usually one to go for cutting edge stuff at work. The dot net versioning is weird as heck to me. I have no idea which run time to use.

I guess I don't understand the difference between using:
code:
  "frameworks": {
    "dotnet": { },
    "net461": { },
    "dnx461" : { }
I still do (for now) need to support a Winforms app, so I'm guessing I'll want to target the full dotnet?

Edit: this article helped me big time: http://odetocode.com/blogs/scott/archive/2015/10/13/dnx-framework-choices-and-asp-net-5.aspx

Uziel fucked around with this message at 15:41 on Nov 19, 2015

xgalaxy
Jan 27, 2004
i write code

Uziel posted:

Yeah I know what you mean. I'm not usually one to go for cutting edge stuff at work. The dot net versioning is weird as heck to me. I have no idea which run time to use.

I guess I don't understand the difference between using:
code:
  "frameworks": {
    "dotnet": { },
    "net461": { },
    "dnx461" : { }
I still do (for now) need to support a Winforms app, so I'm guessing I'll want to target the full dotnet?

Edit: this article helped me big time: http://odetocode.com/blogs/scott/archive/2015/10/13/dnx-framework-choices-and-asp-net-5.aspx

See also these two which break down the differences in some tables:
http://oren.codes/2015/06/09/pcls-net-core-dnx-and-uwp/
http://blog.nuget.org/20150729/Introducing-nuget-uwp.html#new-target-frameworks

ljw1004
Jan 18, 2005

rum

Uziel posted:

I still do (for now) need to support a Winforms app, so I'm guessing I'll want to target the full dotnet?

The whole "dnx / dotnet" is confusing at this stage. But I don't understand this question...

If you're writing a Winforms app, then you will continue to use the normal desktop .NET Framework (4.0 or 4.5 or 4.6 or 4.6.1 or whatever). The new .NET Core stuff doesn't apply to Winforms.

If you're writing a library which you want to be consumable by Winforms as well as by modern cross-plat ASP.NET5 stuff? then it's a bit more complicated. I wrote a detailed explanation here: http://blogs.msdn.com/b/lucian/archive/2015/09/15/writing-a-nuget-package-for-vs2015-rtm-repost.aspx



The tough thing is that, although the actual code inside the cross-plat CoreFX libraries is mostly there, the way it's packaged up and targeted inside NuGet isn't yet in final shape. So the work you do now in migrating your codebase to RC will represent 99% of the final work, migrating to use the right APIs. But as for the final step of packaging your libraries into NuGet and knowing whether they should target dotnet or dnx or whatever, well, that could well change.

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.

ljw1004 posted:

The whole "dnx / dotnet" is confusing at this stage. But I don't understand this question...

If you're writing a Winforms app, then you will continue to use the normal desktop .NET Framework (4.0 or 4.5 or 4.6 or 4.6.1 or whatever). The new .NET Core stuff doesn't apply to Winforms.

If you're writing a library which you want to be consumable by Winforms as well as by modern cross-plat ASP.NET5 stuff? then it's a bit more complicated. I wrote a detailed explanation here: http://blogs.msdn.com/b/lucian/archive/2015/09/15/writing-a-nuget-package-for-vs2015-rtm-repost.aspx



The tough thing is that, although the actual code inside the cross-plat CoreFX libraries is mostly there, the way it's packaged up and targeted inside NuGet isn't yet in final shape. So the work you do now in migrating your codebase to RC will represent 99% of the final work, migrating to use the right APIs. But as for the final step of packaging your libraries into NuGet and knowing whether they should target dotnet or dnx or whatever, well, that could well change.

Thanks, that's helpful. I wouldn't be publishing that code since 99% of what I do is for internal company use. Speaking of that, everything inside of Visual Studio 2015 is being blocked by our corporate firewall (logging in using my MSDN account), and even using Nuget via https. From what I'm reading it seems that VS2015 is using TLS 1.2. I sent it to the network team but I'm not too hopeful. =|

Uziel fucked around with this message at 20:19 on Nov 19, 2015

brap
Aug 23, 2004

Grimey Drawer
My Web API 2 project has gone bonkers.

I'm using Visual Studio 2015 to develop it and have found that spontaneously, only one of my controller actions gets hit when I'm running my app locally with IIS Express. All my other controller actions, which I have Route attributes for, just don't get hit now.

I have even tried checking out old, known working versions with git and I can still only get at the one endpoint. I've tried restarting VS and Windows 10 with no effect.

Is there some kind of settings that I can reset, more stuff I can poke, things I can reinstall? This is boggling my mind.

wwb
Aug 17, 2004

This is probably a routing issue. I'd start with the route debugger -- see http://blogs.msdn.com/b/webdev/archive/2013/04/04/debugging-asp-net-web-api-with-route-debugger.aspx for a start.

epswing
Nov 4, 2003

Soiled Meat
After reading ASP.NET Web API Routing several times, I simply could not wrap my head around routing by convention. The routes it would generate just Did Not Make Sense to me. I'll admit that it's probably just me failing to understand how it's "supposed to work". After dicking around for months with a wall full of crazy calls to config.Routes.MapHttpRoute, I said gently caress it, deleted them all, and added explicit [Route] attributes to everything. (This was the primary reason we updated to Web API 2.) With routing now dead simple and explicit, my life has improved markedly.

</rant>

wwb
Aug 17, 2004

Yup, declared on controller routes are pretty much the way to go.

I remember when MVC first came out and people didn't even realize you could have routes besides controller/action/id for a few years. I had to beat that one into people's heads . . .

Geisladisk
Sep 15, 2007

I've got a (possibly stupid) question regarding threadpools.

Our application's backend uses Smart Thread Pool (http://www.codeproject.com/Articles/7933/Smart-Thread-Pool) to manage our threads. Some tasks that are run periodically need to process lots (hundreds of thousands) of pieces of data.

Our extremely lazy implementation for this to use a thread pool like a queue; Each piece of data spawns a task, which is added to the thread pool qieie. The thread pool has a limit of how many are processed at each time, while the rest of the tasks are pending until a slot opens up for them and they are processed.

Is there any drawback to using a threadpool like a queue, and having hundreds of thousands of pending tasks? Cursory testing doesn't reveal any significant drawbacks, memory usage is just fine. But this just feels like a unbelievably lazy and wrong implementation, for some reason. I'd love for someone to either tell me I'm an idiot and my implementation is idiotic before I ship this.

e: "Threads" -> "Tasks"

Geisladisk fucked around with this message at 18:16 on Nov 23, 2015

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Geisladisk posted:

Our extremely lazy implementation for this to use a thread pool like a queue; Each piece of data spawns a thread, which is added to the thread pool. The thread pool has a limit of how many are processed at each time, while the rest of the threads are pending until a slot opens up for them and they are processed.

1. What's the point of using a thread pool if every task spawns a thread?
2. This seems like something that the TPL and async/await can handle out of the box.

EDIT: Oh wow, this Smart Thread Pool library has been around for over a decade. Most of the features it touts are available in .NET now. If the code using it isn't huge, I'd suggest ripping it out entirely and just using the features available in the language. It will be easier for others to maintain and easier to find information about.

Bognar fucked around with this message at 17:25 on Nov 23, 2015

ljw1004
Jan 18, 2005

rum

Bognar posted:

1. What's the point of using a thread pool if every task spawns a thread?
2. This seems like something that the TPL and async/await can handle out of the box.

Just to reinforce that, a threadpool which has lots of blocked threads (e.g. inside Thread.Sleep, or waiting synchronously for a file/network read to finish) is the worst possible use of a threadpool. It will take up lots of memory and confuse the threadpool.

But I might be misreading Geisladisk who said "Each piece of data spawns a thread, which is added to the thread pool". That can't be right. You must mean "each piece of data spawns a workitem which is added to the workitem queue, to be dispatched by the threadpool". That's a bit better.

brap
Aug 23, 2004

Grimey Drawer
Yeah rework your backend to use Tasks and report back.

Geisladisk
Sep 15, 2007

Bognar posted:

EDIT: Oh wow, this Smart Thread Pool library has been around for over a decade. Most of the features it touts are available in .NET now. If the code using it isn't huge, I'd suggest ripping it out entirely and just using the features available in the language. It will be easier for others to maintain and easier to find information about.

It's a pretty massive system that is well into it's second decade. I'm pretty loathe to rip out such a central piece of the system just because the library that provides it is old and lame, if it works. :shrug:

ljw1004 posted:

Just to reinforce that, a threadpool which has lots of blocked threads (e.g. inside Thread.Sleep, or waiting synchronously for a file/network read to finish) is the worst possible use of a threadpool. It will take up lots of memory and confuse the threadpool.

But I might be misreading Geisladisk who said "Each piece of data spawns a thread, which is added to the thread pool". That can't be right. You must mean "each piece of data spawns a workitem which is added to the workitem queue, to be dispatched by the threadpool". That's a bit better.

Yes, that's what I meant. Each piece of data spawns a task, not a thread. My bad.

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.
I am having an issue with the project settings for a C# app. The settings work fine when i debug the project on its own. But when I include that project as part of another project, the settings are not compiled and the .config file does not exist, then I get a null exception.

Here it is a little more specifically:
I am using Telerik reporting. The only thing that you can use for a datasource connection string is either a value of type connectionString from the project properties, or an embedded string. I don't want to use an embedded string if possible because that means pasting in the loving value for 20+ datasources, then going through and changing it everywhere when I switch to production.

So I have this type of project

MyApp.Reports - Has the reports and the datasources which are part of the report definitions.
MyApp.Reports.Properties.Settings.Default - Has the connectionString which the report definitions read just fine

MyApp.Reports works just fine by itself

Then i have something like this
MyApp.ReportViewerThing - Has a reference to MyApp.Reports and displays the reports in a WPF viewer

In MyApp.ReportViewerThing the MyApp.Reports.Properties.Settings.Default class does not exist so the reports take all take a poo poo unless I use an embedded connection string.

Any ideas on how I can fix this? I tried switching the visibility of the settings to public, but they are still not compiled.

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.
Ok, I solved this by exposing the data sources in the report as public and then setting the connection strings from the calling app after the report was created and before it was displayed. There are a bunch of threads on the telerik forums about this same problem with some convoluted workarounds suggested by their support.

I like Telerik for some things, but you have to use it in their specific way, as soon as you step outside of their workflow you are stuck with hacks such as this which is often frustrating.

xgalaxy
Jan 27, 2004
i write code
I'm working on a greenfield project at work and wondering what the go to unit testing framework is. xUnit seems to be making a lot of progress towards working well with DNX so I'm inclined to use that. But I've only ever used NUnit in the past so I'm not sure what to expect.

EssOEss
Oct 23, 2006
128-bit approved
I used to use MSTest because it was just there in Visual Studio. Then I moved to NUnit because its test runners worked better and also worked on Linux/Mono. Then I moved to xUnit because it suported UWP and has the same API surface across all the platforms.

They all have the same basic features, though I like the easy attribute-based way to run the same test on multiple pieces of data with xUnit. Then again, there are some retarded design decisions in xUnit - not having assembly level initializers, forcing me to subclass EVERY test case from a common class if I want some global initializer (like, say, setting up loving logging what the christ xUnit).

epswing
Nov 4, 2003

Soiled Meat
Hey EntityFramework 6.x Migrations crowd.

When I update my model and run Add-Migration, EF will take a snapshot of the current schema, and include it in my migration. As I understand, this turns into quite a painful situation when my co-worker does the same thing before pulling my code. We have 3 developers, and our policy for now is simply to notify each other whenever we change a model class, and synchronize (push/pull) immediately.

How do teams with 10 (or 1000) developers deal with this?

Or for that matter, how do teams of 2 developers deal with this, when they have long-running feature clones/branches?

epswing fucked around with this message at 21:54 on Nov 27, 2015

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
Dumb log4net question, is there some sort of global option I can pass in to force it to write to a log in a way tail picks up on? Actually, better question - is my problem that log4net isn't appending 'right' or is the problem that I'm tailing logs that are on a SMB share?

chippy
Aug 16, 2006

OK I DON'T GET IT

epalm posted:

Hey EntityFramework 6.x Migrations crowd.

When I update my model and run Add-Migration, EF will take a snapshot of the current schema, and include it in my migration. As I understand, this turns into quite a painful situation when my co-worker does the same thing before pulling my code. We have 3 developers, and our policy for now is simply to notify each other whenever we change a model class, and synchronize (push/pull) immediately.

How do teams with 10 (or 1000) developers deal with this?

Or for that matter, how do teams of 2 developers deal with this, when they have long-running feature clones/branches?

This is pretty useful: https://msdn.microsoft.com/en-us/data/dn481501.aspx

epswing
Nov 4, 2003

Soiled Meat

Oops. Thanks!

chippy
Aug 16, 2006

OK I DON'T GET IT

epalm posted:

Oops. Thanks!

No need for oops! I didn't mean to sound snarky, I was just on my phone and didn't have time to type anything more useful. Hopefully that article helped though. None of the solutions are exactly ideal, unfortunately. I've only used it in a team of two but we used to just try to push and pull any migrations we generated straight away. That doesn't work so well on long running feature branches through. Another way is to wait until we've merged it into to master and then roll back your database, delete and regenerate the migrations in the correct order. That also has the useful side effect of squashing down multiple migrations onto a single one for the feature.

chippy fucked around with this message at 13:58 on Nov 28, 2015

invision
Mar 2, 2009

I DIDN'T GET ENOUGH RAPE LAST TIME, MAY I HAVE SOME MORE?
Alright, I'm pulling my hair out and cannot google up an answer.

I've got a client/server that I'm rebuilding the client for. I don't have access to the client code just wireshark caps. Not a huge deal, it uses it's own weird SOAP implementation, shouldn't be too hard.

Issues:
-Server requires *very specific* HTTP headers from the client that 0 of the 30000 libraries I've looked at can do. It seems stupid. Try sending a GET request with your favorite library that looks like "GET [url]http://[/url]" + serverIP + ":8080/ HTTP/1.1\r\nRange: bytes 0-\r\n\r\n".
If you find one, please god let me know.
e:Seriously. It can't have Connection:Keep-Alive, or Connection:Close in the header, at all. WebClient + everything else insists on including this.

-I cannot figure out how to effectively use the "Content-Length: 247" HTTP header when reading from the server. I should be able to use that to set a buffer size to read the data immediately following it, correct? By the time I've got one set up, the stream is already far past what I need, giving me wrong or incomplete data.

-When I read the alarm data XML from the server, it (obviously) stops reading the first time it hits the </AlarmList> XML tag and then sends it to be parsed. The issue is that if there are multiple alarms on the server, it will send multiple of the <alarmlist> reply without any way to know how many there are until it just stops sending data. I cannot figure out how to set up a loop to keep reading in alarm data until there's nothing. When it's finished, generally the buffer is all 0's, but I don't know how to verify that it's not just lagged out.

-The server will also send random other data in the middle of transmitting alarms. I.E. "alarm, alarm, hardware inventory, alarm alarm, nothingness".
I do know that when it's sending alarms it will preface them with an http header that has content-length and the "206 partial content" flag. This goes back to being able to use the HTTP headers to create a buffer.


e:removed code and moved it to pastebin
http://pastebin.com/qgXjcdY5

invision fucked around with this message at 01:36 on Nov 30, 2015

Mr Shiny Pants
Nov 12, 2012
Have you tried curl? It is usually the first stop I make when dealing with HTTP servers.

At least it is interactive and you can test out which requests do work, capture the settings and model those in the webclient or something else?

xgalaxy
Jan 27, 2004
i write code
The Visual Studio 2015 Update 1 completely hosed my Visual Studio install. Lovely.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
I've installed Update 1 on four computers so far. Worked every time.

Then again, three of them had Update 1 RC before that, so maybe that's why it worked? :shrug:

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
Just installed Update 1 from a vanilla Professional install. No issues so far.

epswing
Nov 4, 2003

Soiled Meat

xgalaxy posted:

The Visual Studio 2015 Update 1 completely hosed my Visual Studio install. Lovely.

Define "hosed"

xgalaxy
Jan 27, 2004
i write code

epalm posted:

Define "hosed"

At startup I was getting a warning saying something about an xml file is missing or damaged and when I try and use the menu at the top I get an error box that says something about "object creation failed". I tried repairing the install and still get the same issue. Uninstalling now and fully reinstalling and hopefully thats it.

SirViver
Oct 22, 2008
Just installed Update 1 (without problems) and I'm very happy to report that Edit and Continue performance on large projects has been significantly improved :thumbsup:

Though I do find it kinda funny that there doesn't seem to be any kind of comprehensive list of fixed issues, or maybe I just can't find it. The official page only shows like "Fixed issues: (3 entries), Known issues: (19 entries)", which doesn't exactly tell the whole truth and would be very depressing if it did.

Kekekela
Oct 28, 2004
Somehow I'm always current on the latest esoteric javascript libraries my boss wouldn't let within 1000 miles of production, and yet find out about updates to Visual Studio, the IDE for 99% of my work related programming, via CoC. :smith:

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.

Kekekela posted:

Somehow I'm always current on the latest esoteric javascript libraries my boss wouldn't let within 1000 miles of production, and yet find out about updates to Visual Studio, the IDE for 99% of my work related programming, via CoC. :smith:

Visual studio told me with the little update flag that appeared in the upper right.

Kekekela
Oct 28, 2004

Begby posted:

Visual studio told me with the little update flag that appeared in the upper right.

Good point, I usually notice that little thinger, maybe I turned something off at some point....


e: hmm, apparently its now a rather understated purple for me now

Kekekela fucked around with this message at 22:54 on Dec 1, 2015

Begby
Apr 7, 2005

Light saber? Check. Black boots? Check. Codpiece? Check. He's more machine than kid now.
Hey, guess what, literally within seconds after replying I noticed the flag turned white. They released NuGet 3.3 and I am happy to say its no longer a filthy steaming pile of poo poo interface.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

How the heck do I let my app connect to a server using an ODBC driver? Using Visual Studio 2015 Express and trying to connect to an IBM iSeries as an OBDC source on my machine. I see Access Database File, SQL Server, and SQL Server Database file (as well as <other>) in the 'Choose Data Source' dialog when I try to add a database.

SirViver
Oct 22, 2008
That's weird. Maybe your VS install is borked? Or maybe it's a VS Express thing? On Enterprise edition it shows fine:

Adbot
ADBOT LOVES YOU

Sedro
Dec 31, 2008

Bob Morales posted:

How the heck do I let my app connect to a server using an ODBC driver? Using Visual Studio 2015 Express and trying to connect to an IBM iSeries as an OBDC source on my machine. I see Access Database File, SQL Server, and SQL Server Database file (as well as <other>) in the 'Choose Data Source' dialog when I try to add a database.
Do you have Client Access installed? Does the driver show up in the ODBC Administration outside of VS?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply