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
New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

ljw1004 posted:

I believe that the "Plex" part of code-contracts can explore EVERY POSSIBLE outcome of a program. Including every possible interleaving of concurrent stuff.


(It's not humanly possible to use unit-tests to sniff out rare concurrency bugs, as far as I can tell -- the programmer's brain naturally thinks about how concurrent stuff is meant to interleave, and subconsciously shies away from the bad cases. And honestly -- how many of you have written unit tests where you mock HttpClient and then simulate it doing a POST action which reports timeout failure but which nevertheless succeeds in modifying the back-end server?)

You're thinking of pex, which is intellitest in vs 2015.

Adbot
ADBOT LOVES YOU

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

I've run into a strange issue with CookieContainer splitting a cookie, which contains a JSON object, into N different cookies. I used RestSharp and the cookies it returned in its response were also in this form.

I'm not sure why it's doing it but the cookie seems fine in the browser but not when I'm making an HttpRequest or using RestClient.

Basically the cookie value is in this form:

code:
{
  "key1":"value1",
  "key2":"value2"
}
When I look at the cookies in the CookieContainer, the cookie I'm looking for is present but it's been chunked into several different cookies..

e.g. I now have a cookie named "myCookie" and it's value is: {\"key1\":\"value1\"

And then there's another cookie named \"key2\":\"value2\"} with a null/empty value.

I don't get what's causing this, has anyone ever run into this or happen to know how to fix it?

I would appreciate any help, this has been bothering me all day.

Thanks

Gul Banana
Nov 28, 2003

is anyone having a problem running built .net applications after the most recent round of windows updates? my programs are crashing in Task.Run - Run() itself, not the lambda that's passed into it!
the exception is the incomprehensible "Exception from HRESULT: 0xFEDF6408" - this code does not appear anywhere on the internet, and nor does the name of the method that throws it: AsyncCausalityTracer.TraceOperationCreation

looks like it's a call through a COM import into some CLR internals... :/

Gul Banana
Nov 28, 2003

system restore to pre-update fixed it. time to hold off on those patches a while

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Acer Pilot posted:

I've run into a strange issue with CookieContainer splitting a cookie, which contains a JSON object, into N different cookies. I used RestSharp and the cookies it returned in its response were also in this form.

RFC 2109:

quote:

Informally, the Set-Cookie response header comprises the token Set-Cookie:, followed by a comma-separated list of one or more cookies.

RFC 6265:

code:
 set-cookie-header = "Set-Cookie:" SP set-cookie-string
 set-cookie-string = cookie-pair *( ";" SP cookie-av )
 cookie-pair       = cookie-name "=" cookie-value
 cookie-name       = token
 cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
 cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
                       ; US-ASCII characters excluding CTLs,
                       ; whitespace DQUOTE, comma, semicolon,
                       ; and backslash
You shouldn't put commas in cookies. Consider using something like URL encoding to store multiple values in a single cookie.

Bognar fucked around with this message at 14:43 on Jun 26, 2015

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick
Does VS2015's built in git module support git+ssh:// repositories? VS2013 can only commit locally, but can't push to a remote git+ssh:// repo.

Acer Pilot
Feb 17, 2007
put the 'the' in therapist

:dukedog:

Bognar posted:

RFC 2109:


RFC 6265:

code:
 set-cookie-header = "Set-Cookie:" SP set-cookie-string
 set-cookie-string = cookie-pair *( ";" SP cookie-av )
 cookie-pair       = cookie-name "=" cookie-value
 cookie-name       = token
 cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
 cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
                       ; US-ASCII characters excluding CTLs,
                       ; whitespace DQUOTE, comma, semicolon,
                       ; and backslash
You shouldn't put commas in cookies. Consider using something like URL encoding to store multiple values in a single cookie.

You're a lifesaver, thank you!

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.
Is RabbitMq the best .net solution for offloading tasks such as sending emails or compiling reports? I'm wanting to move some processes like that.

epswing
Nov 4, 2003

Soiled Meat

Uziel posted:

Is RabbitMq the best .net solution for offloading tasks such as sending emails or compiling reports? I'm wanting to move some processes like that.

You might want to keep everything in the MS family and use MSMQ.

We used RabbitMQ for about a year. It worked as advertised, the only complaint was that it depends on Erlang, and sometimes erl.exe would inexplicably and indefinitely peg the cpu once in a while (never figured out why). I'm not knocking Erlang, I don't know anything about Erlang, so this is purely anecdotal.

Rather than our app having a RabbitMQ dependency, and RabbitMQ having an Erlang dependency, we just moved to MSMQ, which can be installed in a few click on most windows machines, and has built in .NET libraries.

Uziel
Jun 28, 2004

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

epalm posted:

You might want to keep everything in the MS family and use MSMQ.

We used RabbitMQ for about a year. It worked as advertised, the only complaint was that it depends on Erlang, and sometimes erl.exe would inexplicably and indefinitely peg the cpu once in a while (never figured out why). I'm not knocking Erlang, I don't know anything about Erlang, so this is purely anecdotal.

Rather than our app having a RabbitMQ dependency, and RabbitMQ having an Erlang dependency, we just moved to MSMQ, which can be installed in a few click on most windows machines, and has built in .NET libraries.
Thanks, that's good to know!!! Any gotchas or issues with MSMQ that you can recall?

UberJumper
May 20, 2007
woop
I need to write a ton of integration tests for our restful API (test pretty much end to end). Unfortunately the ASP.NET WebAPI seems to require .NET 4.5. Unfortunately our internal standard is still stuck on .NET 4.0 (mostly due to two stupid libraries).

Is there any decent alternative?

epswing
Nov 4, 2003

Soiled Meat

Uziel posted:

Thanks, that's good to know!!! Any gotchas or issues with MSMQ that you can recall?

We have a really simple use case, both publisher(s) and consumer(s) are running on the same machine. We never had to deal with "The Internet", or even "A Network", so we stuck to Private (local) queues. I've no idea if suddenly gets brutal when you leave localhost, but I would hope that's what MSMQ was designed for. Worth investigating, at least.

Uziel
Jun 28, 2004

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

epalm posted:

We have a really simple use case, both publisher(s) and consumer(s) are running on the same machine. We never had to deal with "The Internet", or even "A Network", so we stuck to Private (local) queues. I've no idea if suddenly gets brutal when you leave localhost, but I would hope that's what MSMQ was designed for. Worth investigating, at least.
We would actually be running it on the same machine (dedicated to our app) since its an intranet application. Guessing private queues would work then!

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

UberJumper posted:

I need to write a ton of integration tests for our restful API (test pretty much end to end). Unfortunately the ASP.NET WebAPI seems to require .NET 4.5. Unfortunately our internal standard is still stuck on .NET 4.0 (mostly due to two stupid libraries).

Is there any decent alternative?

WebAPI is for creating RESTful services, not testing them.

UberJumper
May 20, 2007
woop

Ithaqua posted:

WebAPI is for creating RESTful services, not testing them.

However the HttpClient class is part of the WebAPI, which requires a lot less boilerplate code compared to HttpWebRequest.

clandestine cactus
Feb 5, 2009

Hot Rope Guy

UberJumper posted:

However the HttpClient class is part of the WebAPI, which requires a lot less boilerplate code compared to HttpWebRequest.

System.Net.WebClient is not part of WebAPI, and is available on 4.0.

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer

Uziel posted:

We would actually be running it on the same machine (dedicated to our app) since its an intranet application. Guessing private queues would work then!
I've seen Hangfire (free version) used for this before too, it uses an SQL backend to manage it's queues so if you've already got one up there's not much added infrastructure. Pretty easy to configure, not sure how well it does under massive load but for intranet stuff you should be fine.

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
When is MVC6 coming out, anyway? We have a project we're starting soon and would like to use it.

raminasi
Jan 25, 2005

a last drink with no ice
I have a WPF question that might not be the right question:
code:
<ControlTemplate TargetType="{x:Type UserControl}">
    ...some stuff...
    <ControlTemplate.Triggers>
        <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDefaultTextShown" Value="False">
            <Setter TargetName="aThingInTheTemplate" Property="Visibility" Value="Collapsed" />
        </DataTrigger>
    </ControlTemplate.Triggers>
</ControlTemplate>
What I want this to do is collapse one of the things in the template when a particular property of the DataContext of the thing the template is applied to is false, but it's not working. The binding trace shows:
code:
System.Windows.Data Warning: 56 : Created BindingExpression (hash=32610412) for Binding (hash=35632012)
System.Windows.Data Warning: 58 :   Path: 'IsDefaultTextShown'
System.Windows.Data Warning: 60 : BindingExpression (hash=32610412): Default mode resolved to OneWay
System.Windows.Data Warning: 61 : BindingExpression (hash=32610412): Default update trigger resolved to PropertyChanged
System.Windows.Data Warning: 62 : BindingExpression (hash=32610412): Attach to MyCustomControl.NoTarget (hash=24197721)
System.Windows.Data Warning: 67 : BindingExpression (hash=32610412): Resolving source 
System.Windows.Data Warning: 70 : BindingExpression (hash=32610412): Found data context element: <null> (OK)
System.Windows.Data Warning: 72 :   RelativeSource.TemplatedParent found <null>
System.Windows.Data Warning: 78 : BindingExpression (hash=32610412): Activate with root item <null>
System.Windows.Data Warning: 106 : BindingExpression (hash=32610412):   Item at level 0 is null - no accessor
System.Windows.Data Warning: 80 : BindingExpression (hash=32610412): TransferValue - got raw value {DependencyProperty.UnsetValue}
And I can't tell whether Attach to MyCustomControl.NoTarget indicates that it can't resolve the DataContext, or it can't resolve the property for some other reason. Or what to do about it in either case. This feels like something that shouldn't be this difficult.

edit: I fixed this by changing {Binding RelativeSource={RelativeSource TemplatedParent}} to {Binding RelativeSource={RelativeSource Self}}

raminasi fucked around with this message at 19:38 on Jun 29, 2015

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

uncurable mlady posted:

When is MVC6 coming out, anyway? We have a project we're starting soon and would like to use it.

Soon. A few weeks at most.

Horn
Jun 18, 2004

Penetration is the key to success
College Slice

epalm posted:

We have a really simple use case, both publisher(s) and consumer(s) are running on the same machine. We never had to deal with "The Internet", or even "A Network", so we stuck to Private (local) queues. I've no idea if suddenly gets brutal when you leave localhost, but I would hope that's what MSMQ was designed for. Worth investigating, at least.

Private queues are local to the domain I believe, not the machine.

Also you may not care about this for things like sending email but make sure you're setting Durable to true. Otherwise you'll lose messages if the box restarts.

Mr Shiny Pants
Nov 12, 2012

Did you bind it two ways?

Edit: Nevermind, is see you want to bind it and read it from a property on the model..

Mr Shiny Pants fucked around with this message at 07:25 on Jun 28, 2015

Dromio
Oct 16, 2002
Sleeper

Uziel posted:

Is RabbitMq the best .net solution for offloading tasks such as sending emails or compiling reports? I'm wanting to move some processes like that.

As others mentioned, MSMQ is a fine message bus that is as easy to install as adding the feature to windows.

We're using RabbitMQ at work and I really like it, but our use case is considerably more complex. We're distributing the load across multiple machines, and RabbitMQ can do this "out of the box", making it very easy to make sure only one machine handles a message (so "SendAnEmail" results in one and only one email, not every machine doing it). With MSMQ you'd need to write a Distributor service of some sort that determines which node actually ends up handling the message.

It has a pretty decent admin UI (I disliked the default MSMQ admin), and is free and easy to use. We've been using it in production handling 10,000+ messages an hour without the issues mentioned by epalm, but our production rabbit servers are running on CentOS, not windows, so that might be a big difference.

So yeah, it's probably perfectly save to use MSMQ for your use case. I just wanted to pitch in with a few of the nice features I've found using Rabbit. Not having to write distributors has saved me a pretty decent chunk of time.

Funking Giblet
Jun 28, 2004

Jiglightful!

uncurable mlady posted:

When is MVC6 coming out, anyway? We have a project we're starting soon and would like to use it.

I imagine the same time as Windows 10, would make sense. Try developing using OWINn to get a taste that can easily be ported.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
VS 2015 / TFS 2015 on July 20th.

http://blogs.msdn.com/b/somasegar/archive/2015/06/29/save-the-date-visual-studio-2015-rtm-on-july-20th.aspx

Calidus
Oct 31, 2011

Stand back I'm going to try science!
If I want to mess around with AngularJS and MVC, is it best to just to wait for ASP.NET 5 to be released?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Calidus posted:

If I want to mess around with AngularJS and MVC, is it best to just to wait for ASP.NET 5 to be released?

AngularJS is basically client-side MVC.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

Ithaqua posted:

AngularJS is basically client-side MVC.

Yeah, Angular is your front end, and you would use a WebAPI for getting/storing/whatever-ing your data. If I recall, the default single page application in vnext now uses Angular and WebAPI, so there should be templates for it there, but you don't need to wait vnext to use it. Just make an Angular site and implement a WebAPI on top of it.

RICHUNCLEPENNYBAGS
Dec 21, 2010

Calidus posted:

If I want to mess around with AngularJS and MVC, is it best to just to wait for ASP.NET 5 to be released?

...Huh? No, not really. Start up a WebAPI project and go.

wwb
Aug 17, 2004

The bogeyman in the angular room is Angular 2.0 which will break your 1.3 apps pretty bad.

@UberJumper -- we consumed many APIs before all this HttpClient hoo-ha. In fact, you could argue that HttpClient is really a bad port of RestSharp on some levels. Check that out, it should handle most API client tasks and there are 4.0 compatible versions about.

RICHUNCLEPENNYBAGS
Dec 21, 2010

wwb posted:

The bogeyman in the angular room is Angular 2.0 which will break your 1.3 apps pretty bad.

Might as well never develop anything if you're going to worry about that.

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

wwb posted:

The bogeyman in the angular room is Angular 2.0 which will break your 1.3 apps pretty bad.

I think the real bogeyman is that Angular 2.0 is going to require a bunch of extra steps since it's geared towards ES6 which means Typescript or another transpiler like Babel. Getting started in vNext with the whole Grunt/Gulp pipeline will be a head start to get you to Angular 2.0 even if you write Angular 1.x. The Adventures in Angular podcast was talking about it. Even if you don't want to listen to it you should at least look at the link and some of the links the show notes are pointing to.

uXs
May 3, 2005

Mark it zero!
What would be a good way to add data to EF7 migrations? Say if I want to have a table that should contain a few options and I want to add them right after that table is created.

Do I just add the data in code to the 'Up' method in the migration?

RICHUNCLEPENNYBAGS
Dec 21, 2010

gariig posted:

I think the real bogeyman is that Angular 2.0 is going to require a bunch of extra steps since it's geared towards ES6 which means Typescript or another transpiler like Babel. Getting started in vNext with the whole Grunt/Gulp pipeline will be a head start to get you to Angular 2.0 even if you write Angular 1.x. The Adventures in Angular podcast was talking about it. Even if you don't want to listen to it you should at least look at the link and some of the links the show notes are pointing to.

You don't have to use Typescript or ES6 with it. ES5 will work fine.

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

RICHUNCLEPENNYBAGS posted:

You don't have to use Typescript or ES6 with it. ES5 will work fine.

I wasn't saying ES5 wouldn't work but ES6 brings more concise constructs for writing Javascript. If you head to the Angular site they have examples in both Typescript and ES5. Maybe it's because I don't write a lot of JS but I think the Typescript examples are much easier to read.

The bigger issue here is the speed of JS improvements vs the browser implementation. We are now at the point where you can start to assume ES5 (if you can drop IE8). The ES5 spec was finished in December 2009 so 5ish years to assume you can just use it without polyfills. How long for ES6 (Javascript 2015) until you can assume more browsers support it? Maybe 3 years? There's already proposals for ES7 (Javascript 2016). When will that be in all browsers? I think writing your JS and transpiling it down to a more common version of Javascript like ES6->ES5 is going to become the norm for Javascript for a long time. You might as well get used to it.

RICHUNCLEPENNYBAGS
Dec 21, 2010
I guess. ES5 isn't really bad. I don't like TypeScript, personally.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

RICHUNCLEPENNYBAGS posted:

Might as well never develop anything if you're going to worry about that.

This is my problem. I worry about that, and I never develop anything. Sigh.

ATM Machine
Aug 20, 2007

I paid $5 for this
I've got an entity framework question of my own, at least I think it's EF related. Anyway, what I need is a joining table that links 2 PKs from the default user table, with another table that basically tracks edits made and links them to a user.

Now I could just have the editHistory table have a column that links to the ID in the user table, but that goes against n:n, and I'm hoping this wouldn't be the correct thing to do. I'm using MSSQL for this, so I know I can have a table that just has 2 FKs, but how do I a) create this code first when one of the tables is the default user table created by EF or whichever framework is responsible for it, and b) Is it possible to just add rows to this table by sending (userId = user, editId = edit) to the FK table, or would I need to get the ID from the user table first (and add the history to the editHistory table then get its Id), then add that to the FK table?

Sorry if it's hard to understand, and if this is better off as a database question, as I'm not completely used to how EF works yet, and there isn't much help on this matter online either, the main problem being that one of the tables I want to link isn't a table I've created.

Draup
Jun 19, 2008

uXs posted:

What would be a good way to add data to EF7 migrations? Say if I want to have a table that should contain a few options and I want to add them right after that table is created.

Do I just add the data in code to the 'Up' method in the migration?


Make all your model changes. If you haven't run update-database yet, you can run add-migration <previousmigrationname> and it will overwrite with your updates. If you have run update-database, just run add-migration with a new name.

Adbot
ADBOT LOVES YOU

EssOEss
Oct 23, 2006
128-bit approved
Yes, I have always just stuck that stuff in the "Up" method. Maybe there is a more "proper" way but it has worked fine for me.

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