|
Ciaphas posted:ReSharper, I vaguely remember the dev team I'm helping was working on getting that, I think. I'll have to look at what it is, I've never heard of it, but if it helps me deal with bullshit boilerplate like that Equals stuff (thanks for that by the way) I'm all for it I hate Resharper every time I type a period and continue typing and it lags JUST long enough for Intellisense to not kick in at all for the remainder of the symbol unless I go back and type the period again. But I love Resharper every time I ctrl-t.
|
# ? Jul 30, 2015 18:06 |
|
|
# ? May 19, 2024 00:25 |
|
Sedro posted:You need to implement GetHashCode, and yours will throw exceptions when comparing to null. The comparison I highlighted above can caused issues with dynamic proxies, so ensure either you skip it, or unwrap the proxy before comparison.
|
# ? Jul 30, 2015 20:03 |
|
It's best not to mix inheritance with custom equality anyway. Make the class sealed and get rid of the comparison.
|
# ? Jul 30, 2015 20:14 |
|
The class in question already overrides ToString() using all of its members; would overriding GetHashCode to return ToString().GetHashCode() be an okay thing to do or is that a faux pas?
|
# ? Jul 30, 2015 20:37 |
|
epalm posted:rant Back from several business trips, sorry for the delayed responses! Essential posted:Unfortunately I can't provide any help on your current situation, however I can tell you that I pay the $30 per month support fee for 1 of my azure accounts and I can say the help was tremendous the 2 times I've needed it. I decided to bite the bullet and purchase developer support. When I try to open a support ticket, I'm asked to choose a subscription, and developer support isn't in the list. If I choose my BizSpark subscription, I'm asked to choose a support plan, and developer support isn't in the list. Now what. RICHUNCLEPENNYBAGS posted:Well, I'm using Azure SQL and Azure Web sites at work and haven't experienced that, so I think there's something about your instance or setup in particular that's defective. How on earth would I go about solving such a problem while the app is live? Bognar posted:Ditto this, I haven't had the SQL transient exception more than once a month, and I haven't seen it at all since we used the SQL Azure Execution Strategy. What region are you using? Am I the only one who thinks "well it only happens once a month" is unacceptable? My resources are all in East US. Fiedler posted:Are you using Azure SQL DB V12? Yes. EssOEss posted:I can confirm that I experience the same type of random interruptions multiple times a day. 10 GB database, quite low load (average 1 request per second). Funny thing is that SqlAzureExecutionStrategy does not catch all of the random errors! We had to add some custom retry logic on top for whatever reason, to really make it retry on all the retry-worthy cases. Re-engineer my application because Microsoft doesn't like transactions? What??
|
# ? Jul 30, 2015 21:30 |
|
Ciaphas posted:The class in question already overrides ToString() using all of its members; would overriding GetHashCode to return ToString().GetHashCode() be an okay thing to do or is that a faux pas?
|
# ? Jul 30, 2015 21:38 |
|
Fair enough! I'll be sure to do it properly. Thanks again
|
# ? Jul 30, 2015 21:44 |
|
epalm posted:I decided to bite the bullet and purchase developer support. When I try to open a support ticket, I'm asked to choose a subscription, and developer support isn't in the list. If I choose my BizSpark subscription, I'm asked to choose a support plan, and developer support isn't in the list. Now what. I just tried this and was able to get there by doing this: Log into windowsazure (this is the old portal). Select username from top-right, select Contact MS Support (this now redirects to the new azure portal: portal.azure). Select Create Support...On step 4 choose Additional Options from dropdown and below the BizSpark Access ID/Contract ID there should be a link "Purchase support plan". When I click that link I see the different support plans, Developer being one of them.
|
# ? Jul 31, 2015 02:00 |
|
Kekekela posted:And yeah, code comments and other largely ceremonial things seem to be for some reason the trappings that new developers associate with "good code" that are in fact (usually) the opposite. It was parroted in a really poor way throughout my CS education. I imagine that has a hand in why so many developers prefer the kind of commenting from a few pages back.
|
# ? Jul 31, 2015 02:04 |
|
Iverron posted:It was parroted in a really poor way throughout my CS education. I imagine that has a hand in why so many developers prefer the kind of commenting from a few pages back. Yeah as I don't have a formal, modern CS education and I'm a bit oldschool (in my 30s) I guess I've picked up commenting along the way. If it's an outdated concept, then that is something this thread has taught me
|
# ? Jul 31, 2015 02:45 |
|
Just to confuse you even more: well-commented code is a good thing, but good comments are not what most people think they are.
|
# ? Jul 31, 2015 03:34 |
|
ljw1004 posted:* Occasional unexplainable sluggishness/hangs in opening Extensions&Updates, opening NewProject, ToolsOptions -- for these again, if you have time, it'd be great to "send a frown". We haven't had any other reports of these kinds of hangs yet. I'll see if I can properly reproduce it later, I hope you don't mind the duplicate reports - I tag all of them with the attention thing you mentioned. E: Also sent a report regarding the EnC hang. SirViver fucked around with this message at 08:59 on Jul 31, 2015 |
# ? Jul 31, 2015 08:44 |
|
hahaha It's Alive! So I decided OpenXML would not get the best of me and I finally did it! With judicious use of the Productivity Tool I can finally create my reports the way I want them. It has: Nicely styled tables with a nice colored header and odd even row colors, styled headers, Auto Table of contents, right sized pictures and hyperlinks to various parts in the document all generated from a JSON file which my RT app generates. Phew. Thanks for your moral support! Weekend!
|
# ? Jul 31, 2015 09:17 |
|
One of my apps uses a third party REST api and they've recently implemented a 5 requests per second limit. We're hitting that limit a lot mostly because we have 15 systems spread out across the US and some of them run at the same time (each one fires off about 25 requests). So while an individual account doesn't have the issue, when 5 run at the same time it becomes a problem. Currently we use HttpResponseMessage to send the request async and await the result. The requests do not come from the client, but from an azure cloud service. The clients send an alert to the cloud service, which then builds & sends the requests on behalf of the client. This is fire-and-forget, the clients do not need to know the response. I'm guessing that we need to implement a queue system for this? We have an azure account, so 2 queue systems are available (Queue Storage and Service Bus Queue). The queue will only be for these requests so I'm not worried about multiple apps being able to subscribe. Or maybe this isn't a good implementation for a queue and instead there is something else we should do? Maybe we can use the existing cloud service and implement rate limiting on it? Whatever we come up with needs to be fair to their servers, so we can't retry over and over until it goes through. We want to make sure that we're being responsible on our end and eliminate any unnecessary calls to their server. Anyone have any advice/direction? Essential fucked around with this message at 16:52 on Jul 31, 2015 |
# ? Jul 31, 2015 15:45 |
|
Assuming these 15 systems are expecting some sort of response from that server, then I don't think a queue is a great thing to use. If what you're doing is more fire-and-forget then a queue would be fine. My immediate thought is to set up a proxy server for the API. Your servers make requests to the proxy, it forwards the requests on to the API but also rate limits itself. The other option is to get on the phone and see if you can work something out with the API provider so you have a higher limit.
|
# ? Jul 31, 2015 15:53 |
|
Bognar posted:Assuming these 15 systems are expecting some sort of response from that server, then I don't think a queue is a great thing to use. If what you're doing is more fire-and-forget then a queue would be fine. Sorry, I forgot to include that it is fire-and-forgot, nothing about these requests needs to make it's way back to the systems. I probably should have explained this better but the requests come from an azure cloud service, not the clients themselves. The clients just send an alert to the cloud service that they are finished, and then the cloud service makes and sends the requests on behalf of the client. So in effect, I already have a central spot that the requests are being built & sent, but I don't have any rate limiting. I'll take a look into the proxy server as well, I wasn't aware I could do that. And I've already been on the phone with them and this is my only option. Edit: I edited my first post on this to better explain how the current system works. Essential fucked around with this message at 16:44 on Jul 31, 2015 |
# ? Jul 31, 2015 16:41 |
|
Essential posted:So in effect, I already have a central spot that the requests are being built & sent, but I don't have any rate limiting. Sounds like you should just build in rate limiting to the cloud service, then it is basically doing the same thing as the proxy would be. The only reason to use an actual proxy would be if the clients expected a response. The benefit of using an actual queue like Azure Service Bus would be durability, e.g. if you are worried about the cloud service crashing before servicing pending rate-limited requests. Bognar fucked around with this message at 18:17 on Jul 31, 2015 |
# ? Jul 31, 2015 18:14 |
|
Here's a dead simple async rate-limiter I just threw together:C# code:
C# code:
Bognar fucked around with this message at 18:36 on Jul 31, 2015 |
# ? Jul 31, 2015 18:33 |
|
Just ran into a VS2015 code suggestions bug.code:
|
# ? Jul 31, 2015 19:03 |
|
Bognar posted:Just ran into a VS2015 code suggestions bug. I'd say because at compile your enum is just integers under the covers anyway so it is kind of redundant.
|
# ? Jul 31, 2015 19:28 |
|
Bognar posted:Here's a dead simple async rate-limiter I just threw together: Wow, you're awesome, thank you! I've never used SemaphoreSlim before, can you clarify how this works? Is the ratelimiter basically a 250 millisecond delay that creates it's own thread via SemaphoreSlim? And therefore it won't block the main thread? This is a WCF Cloud Service and to be honest I don't have any idea/understanding of what thread(s) are in play. Because other methods in this wcf service are being called constantly, does using SemaphoreSlim make sure that no other methods are blocked? I'm not sure I'm even thinking about this right, I just know that all other methods handled by the cloud service must continue to function while the rate limiter is doing it's thing. I also don't know what kind of performance impact this will have. We can always increase the performance on this server or I suppose create a new server just to handle this if it was ever necessary.
|
# ? Jul 31, 2015 19:30 |
|
A semaphore(1) is a mutex, so you can read it as a lock { ... } with async semantics. It will block on the async context, which by default uses the thread pool (which is quite smart at awaiting I/O without blocking threads). That code ensures that at most one request happens every 250ms. That's quite aggressive--you really only need to throttle requests as you approach the rate limit.
|
# ? Jul 31, 2015 19:52 |
|
mintskoal posted:I'd say because at compile your enum is just integers under the covers anyway so it is kind of redundant. Except that the result of that interpolated string would be "0, One" so the cast is definitely not redundant. Essential posted:I've never used SemaphoreSlim before, can you clarify how this works? Is the ratelimiter basically a 250 millisecond delay that creates it's own thread via SemaphoreSlim? And therefore it won't block the main thread? A semaphore is a synchronization primitive that only lets N things access it at once (where N here is one, aka a mutex). The C# SemaphoreSlim implementation allows us to wait on it asynchronously, so there shouldn't be any thread blocking. The RateLimiter just uses the semaphore as a barrier to entry for its WaitAsync method (_semaphore.WaitAsync()), so only one task can be executing that code at once (released with _semaphore.Release()). The other two lines just wait on a delay task, then create a new delay task for the next caller to wait on. The best real world example I can give is this. It's a room with two doors that has enough space for one person. There's a line out the front door for people waiting to get in. The front door only opens when the person inside the room has left through the back door. Inside the room is a timer - the back door unlocks only once the timer goes off and the person in the room restarts the timer. Regarding the main thread, I don't think WCF Cloud Services have a "main" thread - not one that's relevant anyway. Requests are handled via different threads on the thread pool. When waiting asynchronously, threads are returned to the thread pool so you don't need to worry about blocking other methods. This also shouldn't impact performance in any noticeable way.
|
# ? Jul 31, 2015 19:57 |
|
Sedro posted:That code ensures that at most one request happens every 250ms. That's quite aggressive--you really only need to throttle requests as you approach the rate limit. You mean the rate limit of one request every 200ms (5 per second)? I don't see how that's noticeably aggressive. EDIT: Should have edited this into the above post, oh well. Bognar fucked around with this message at 20:02 on Jul 31, 2015 |
# ? Jul 31, 2015 19:59 |
|
I mean, if you make 5 simultaneous requests then you don't need to throttle, only on the 6th.
|
# ? Jul 31, 2015 20:22 |
|
That's true, but it doesn't make much of a difference in the end if you're making enough requests to get you throttled. The main reason I didn't go with that way, though, is that the code isn't as simple to understand.
|
# ? Jul 31, 2015 20:29 |
|
Bognar posted:A semaphore is a synchronization primitive that only lets N things access it at once (where N here is one, aka a mutex). The C# SemaphoreSlim implementation allows us to wait on it asynchronously, so there shouldn't be any thread blocking. Got it, again thank you so much! Regarding the aggressiveness, if I'm understanding this right, I could probably drop that down to 100ms or even a bit less on the RateLimiter. The actual request to the api will always take minimum 100ms to return back, just due to latency etc. Therefore, if the RateLimiter gives me a 100ms delay and the api request takes 100ms I'm at most 5 per second. Yes this is adding a delay even when one may not be necessary, but given how simple this is to implement I'm not sure that really matters. VVVV I see, thanks! VVVV Essential fucked around with this message at 20:51 on Jul 31, 2015 |
# ? Jul 31, 2015 20:31 |
|
Essential posted:Got it, again thank you so much! Not exactly, this simple RateLimiter just throttles when you can start a request. If it's set to 100ms, then you'll start 10 requests per second. The end of a request isn't really taken into account. The aggressiveness discussion was more about the difference between these two throttling modes: 5 requests, wait 1 second, 5 requests, wait 1 second, etc... vs. 1 request, wait 200ms, 1 request, wait 200ms, etc...
|
# ? Jul 31, 2015 20:42 |
|
Bognar posted:Except that the result of that interpolated string would be "0, One" so the cast is definitely not redundant. Right, you're writing out an integer value (Foo.One explicitly cast as an integer) and then writing Foo.One.ToString("g") (the default for Enum.ToString() which displays the enum entry as a string value).
|
# ? Jul 31, 2015 21:00 |
|
Bognar posted:Just ran into a VS2015 code suggestions bug. Please file this as a bug on github "dotnet\roslyn". I filed two other bugs about wrong "redundant cast" suggestions a couple of months ago. Both got fixed but I guess we didn't check this case.
|
# ? Jul 31, 2015 21:11 |
|
ljw1004 posted:Please file this as a bug on github "dotnet\roslyn". I filed two other bugs about wrong "redundant cast" suggestions a couple of months ago. Both got fixed but I guess we didn't check this case. Just did, thanks for the suggestion.
|
# ? Jul 31, 2015 21:23 |
|
I am trying to use the MVC Entity scaffolding to create a some pretty standard views in VS2013 Update 5, but I keep getting: There was an error running the selected code generator 'Object reference not set to an instance of an object.' It seems to happen on all my classes. It is driving me batty, I have reinstalled Entity and reinstalled MVC in my projects and I repaired VS2013. I have WebTools installed. I even tried creating a new solution with a entity model and the mvc starter code but it still failed. The same thing also happens in VS2015. edit: I have tried it on a coworkers machines and I get the same issue, so I guess it must be something with my solution/project. Calidus fucked around with this message at 23:32 on Jul 31, 2015 |
# ? Jul 31, 2015 22:20 |
|
What is a good way to write out some files for debugging purposes from tests running in an UWP app? I am currently using ApplicationData.Current.LocalFolder but this seems to be deleted after the test runner process exits. I thought the Downloads folder might be a good place but nope, trying to create files via DownloadsFolder gives me some lovely "A parameter was incorrect" exception. I just want to save my debug output somewhere.
|
# ? Aug 1, 2015 17:54 |
|
In WinRT you can write to the Windows.ApplicationModel.Package.Current.InstalledLocation and it will leave them be. At least that is my experience. I don't know if it is different for UWP apps though. This the %appdata%\local\packages\guid\localstate location IIRC.
|
# ? Aug 1, 2015 18:50 |
|
What's where LocalFolder puts them but the files are cleaned up when it is done. Possibly the cleanup is specific to running tests? Whatever the case, the files disappear after the test run.
|
# ? Aug 1, 2015 20:09 |
|
EssOEss posted:What's where LocalFolder puts them but the files are cleaned up when it is done. Possibly the cleanup is specific to running tests? Whatever the case, the files disappear after the test run. Is this the behaviour that you are seeing? http://stackoverflow.com/questions/14245597/mstest-how-to-prevent-custom-log-file-from-being-deleted-and-prevent-trx-from
|
# ? Aug 1, 2015 22:47 |
|
Maybe I'm just not understanding exactly at what level of the compilation process the safe navigation operator (?.) is working at, but despite developing using the .NET 4.0 runtime, VS2015 is recommending I use it, and sure enough, it actually works. So what's going on here? Is the compiler just compiling it in a way that it still functions with the older runtimes?
|
# ? Aug 2, 2015 22:49 |
|
The King of Swag posted:Maybe I'm just not understanding exactly at what level of the compilation process the safe navigation operator (?.) is working at, but despite developing using the .NET 4.0 runtime, VS2015 is recommending I use it, and sure enough, it actually works. So what's going on here? Is the compiler just compiling it in a way that it still functions with the older runtimes? Language version and .NET Framework versions are two different things, yes. The framework mostly just changes the libraries you work with.
|
# ? Aug 2, 2015 23:03 |
|
The King of Swag posted:Maybe I'm just not understanding exactly at what level of the compilation process the safe navigation operator (?.) is working at, but despite developing using the .NET 4.0 runtime, VS2015 is recommending I use it, and sure enough, it actually works. So what's going on here? Is the compiler just compiling it in a way that it still functions with the older runtimes? The compiler translates var someVar = thing1?.Thing2 to this (more or less): C# code:
|
# ? Aug 2, 2015 23:18 |
|
|
# ? May 19, 2024 00:25 |
|
epalm posted:Back from several business trips, sorry for the delayed responses! I'm doing an internal move today to a team that has put me in the position of being able to talk to the Azure product teams more directly. I've sent a message, but this applies to anyone who has an issue. I can't guarantee anything but I can now yell at people louder.
|
# ? Aug 3, 2015 15:40 |