Jesse Hallam

1

votes
2

answer
58

views

Why does OAuth fail when using ASP.NET Identity Core?

I have an ASP.NET Core 2.x project with the following configuration: services .AddAuthentication(options => options.DefaultScheme = CookieAuthenticaitonDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme) .AddFacebook(ConfigureFacebook); Predictably, when I ca...
Jesse Hallam
1

votes
3

answer
1.3k

views

How do I use WaitHandles safely to prevent deadlocks?

Observe the following pseudo: ManualResetEvent[] resetEvents = new ManualResetEvent[operations.Count]; for( int i = 0; i < operations.Count; i++ ) { resetEvents[i] = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem(new WaitCallback(timeConsumingOpHandler), resetEvents[i]); } WaitHandle.Wait...
Jesse Hallam
1

votes
3

answer
195

views

Why does this ComboBox render differently on other PCs?

I'm troubleshooting an issue with the positioning of the PART_Popup section of a ComboBox in a WPF application. It aligns differently depending on what system you run it on. I don't have enough PCs available to determine the pattern behind it. edit Sorry for the poor images. I've requested some larg...
Jesse Hallam
1

votes
1

answer
93

views

What is the use of the Nuget .package directory in my solution root

My solution's .package folder increases the size of the solution by several orders of magnitude - not including my Mvc app's build folders, of course. The bin folder isn't getting commited to source control and I'm wondering if I can skip out on the nuget folder too without having negative side effe...
Jesse Hallam
1

votes
1

answer
407

views

Initializing a class instance globally in a static library

I'm implementing the Qt framework's QTextCodec in a static library. In order for my implementation of the codec to become registered with QTextCodec::codecForMib(int) and QTextCodec::codecForName(const char *), a few things must happen: An instance of the codec must be initialized (but not necessari...
Jesse Hallam
1

votes
1

answer
1.3k

views

Castle Windsor PerWebRequest Lifestyle is not being honored

I'm working on a 3-tier MVC application. The data layer contains an EF4 code-first DbContext: public class MyDataContext : DbContext { // DbSets... } There's also an interface and an implementation for DI: public interface IContextFactory { MyDataContext GetContext(); } public class ContextFactory :...
Jesse Hallam
1

votes
1

answer
71

views

Rewriting git commit history

Assuming we have a git commit history which looks like: ZZ [origin/master] A -> B -> C -> D -> E [master] We want to: Rewind the history back to before A. Keep the working directory of E. Bundle all the changesets of A..E in to a single commit. Push the outcome to remote. The result should look like...
Jesse Hallam
2

votes
1

answer
772

views

WPF Docking to Top on a VerticalAlign Stretch with MaxHeight

I'm seeking a behaviour which combines that of VerticalAlign='Stretch' and VerticalAlign='Top'. Please observe the following markup: ... This acts as I intend it to until the container of Border becomes greater than 200 tall. At this point, Border becomes 200 tall and centers itself in its container...
Jesse Hallam
5

votes
1

answer
723

views

GetExternalLoginInfo returns 'null' on Google OWIN provider

I've got a nearly stock ASP.NET MVC template application from Visual Studio 2013. It was created using the following settings: Create > Project > Web > ASP.NET Web Application > OK > MVC, Individual User Accounts > OK I'm attempting to log in using the OWIN Google provider and having issues. OWINs C...
Jesse Hallam
5

votes
3

answer
1.6k

views

How can I split a string by whitespace unless inside of a single quoted string?

I'm seeking a solution to splitting a string which contains text in the following format: 'abcd efgh 'ijklm no pqrs' tuv' which will produce the following results: ['abcd', 'efgh', 'ijklm no pqrs', 'tuv'] In other words, it splits by whitespace unless inside of a single quoted string. I think it co...
Jesse Hallam
2

votes
1

answer
1.2k

views

Castle Windsor does not work under Medium Trust

When attempting to run an ASP.NET MVC application which uses Castle Windsor, the following error occurs. Server Error in '/' Application. Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overrid...
Jesse Hallam
21

votes
5

answer
22.1k

views

How do I return an empty result set from a procedure using T-SQL?

I'm interested in returning an empty result set from SQL Server stored procedures in certain events. The intended behaviour is that a L2SQL DataContext.SPName().SingleOrDefault() will result in CLR null value. I'm presently using the following solution, but I'm unsure whether it would be considered...
Jesse Hallam
3

votes
2

answer
6.6k

views

Cannot convert parameter - Conversion loses qualifiers

I'm frequently troubled by const correctness, and this seems to be no exception. Please advise me why the following code wont compile: class string_token_stream { public: typedef wchar_t* string_type; string_token_stream(const string_type input_string) : _input_string(input_string) { } private: cons...
Jesse Hallam
6

votes
3

answer
1k

views

Modifying .ui files requires a `make clean`

The Problem: When a QMainWindow or QDialog's corresponding .ui file has been altered in Qt Designer, the entire project must be cleaned and rebuilt in order for those changes to take effect: make clean then make. If the project isn't cleaned first, the changes will not reflect in the executable. The...
Jesse Hallam
2

votes
1

answer
466

views
2

votes
1

answer
913

views

Enumerate a PSCustomObject as key/value pairs

I'm calling Invoke-RestMethod on a URI which returns JSON like this: { '01': {'ID':1, 'Name':'Foo'}, '02': {...}, '03': {...} } I end up with a PSCustomObject whose property names are the numbers in the keys, and values are the object graphs, but I want to treat the object as a list of key/value pai...
Jesse Hallam
3

votes
1

answer
643

views

Passing values to DataTemplates with attached properties

I'm utilizing a data grid which has three columns of type DataGridTemplateColumn. These columns share almost identical behaviors and, as a consequence, utilize almost identical templates. The templates are copy-paste with a few resources changed out. I would like to refactor the templates in to a ge...
Jesse Hallam
3

votes
3

answer
2.5k

views

Is System.Drawing too slow for what we wish to do?

I'm currently working on the user interface of a win forms application. The primary window is a borderless form whose surface area is almost entirely rendered in the Form.Paint event. A back buffer is created and it's drawn fairly conventionally: private void form_Paint(object sender, PaintEventArgs...
Jesse Hallam
35

votes
4

answer
63.6k

views

WPF Image Control with Click Event

I wish to use an in my WPF Application which responds to mouse clicks. Only the 'Mouse Up' and 'Moue Down' events are available out of the box. I find this rather particular. Is there a way to extend the control or a way to use another control to give the same effect?
Jesse Hallam
7

votes
0

answer
1.1k

views

OWIN Configuration: What's the difference between CookieAuthenticationDefaults.AuthenticationType and DefaultAuthenticationTypes.ApplicationCookie

I'm revisiting some code in my OwinStartup class and have this definition: app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString('/login') }); The constant DefaultAuthenticationTypes.ApplicationCook...
Jesse Hallam
4

votes
2

answer
1.3k

views

How do you interrupt/intercept MVC Actions using ActionFilters?

Feel free to close this one if it s a duplicate. I couldn't find an answer. I wish to be able to place a System.Web.ActionFilterAttribute on an Action Method and override the OnActionExecuting method to insert business logic which determines if the Action should be fulfilled. Can the ActionExecutin...
Jesse Hallam
3

votes
4

answer
20.1k

views

How do I resolve “Type or namespace could not be found” compilation error?

I'm concerned that the web hosting that I'm paying for is not configured correctly. ASP.NET Web Sites which compile and run correctly on my local machine don't work once they're deployed. The issue I'm dealing with is a compilation error: CS0246, 'Type or namespace could not be found (Are you missi...
Jesse Hallam
38

votes
8

answer
50.2k

views

Wait for pooled threads to complete

I'm sorry for a redundant question. However, I've found many solutions to my problem but none of them are very well explained. I'm hoping that it will be made clear, here. My C# application's main thread spawns 1..n background workers using the ThreadPool. I wish for the original thread to lock u...
Jesse Hallam
3

votes
2

answer
9.7k

views

Configuring IIS 7 & ASP.NET App for URL Routing

This is not an MVC topic. I have an ASP.NET Application which performs URL Routing in the Application_Start method. The routing looks like: RouteTable.Routes.Add(new Route( 'Profile/{query}', new RouteValueDictionary() { {'query',string.Empty} }, new GenericRouteHandler('~/ProfileHttpHandler.ashx')...
Jesse Hallam
3

votes
2

answer
696

views

Possible race condition with WPF ItemsCollection.ItemContainerGenerator

In my application, I have a need to acquire the content of an ItemsCollection immediately after the ItemsSource has been changed. Or, at the very least, before the possibility of the content being visually drawn. I tested something close to the following: void UserControl_Loaded(object sender, Event...
Jesse Hallam
1

votes
3

answer
596

views

What to do when data becomes too large for web.config

Consider an ASP.NET MVC application which is dependent on configuration data which is not ideal for storage inside web.config. This data is mostly freetext, such as document templates and markup which is loaded when the web application starts. It is considered unideal for web.config storage because...
Jesse Hallam
3

votes
1

answer
753

views

Can host ASP.NET Core site through console but not through IIS

Solution and server configuration: I have developed a fairly simple ASP.NET Core application. It consists of a core project file, created and built in Visual Studio 2017. The target framework is .NETCoreApp 1.1 and Platform target is x64. It also contains two class library projects with target frame...
Jesse Hallam
25

votes
2

answer
18k

views

Why am I causing a Clustered Index Update?

I'm executing the following statement: UPDATE TOP(1) dbo.userAccountInfo SET Flags = Flags | @AddValue WHERE ID = @ID; The column 'ID' is an INT PRIMARY KEY with IDENTITY constraints. Flags is a BIGINT NOT NULL. The execution path indicates that a Clustered Index Update is occurrin...
Jesse Hallam
3

votes
3

answer
163

views

Are primary keys available in nonclustered indices?

In an attempt to make the best index choices for my database, I've noticed some particular behaviour which I'd like to address. Observe the following table and corresponding index (SQL Server 2005): CREATE TABLE demo ( id INT PRIMARY KEY IDENTITY, name NVARCHAR(50) NOT NULL, password BINARY(20) NOT...
Jesse Hallam
3

votes
1

answer
88

views

Why does this RegExp query return all results?

I have a MongoDB 3.2 server. My collection contains documents like the following: { 'name': 'string', 'explicitMods': [ '+48 to Blah', '-13% to Blah', '12 to 18 to Blah' ] } If I write this: myCollection.find({ 'explicitMods': /bad string/ }) I get zero results, as expected. However if I write this:...
Jesse Hallam
2

votes
1

answer
495

views
15

votes
3

answer
14.1k

views

Rewind remote to a prior commit

As a junior git user, I got overwhelmed by a tough merge and must have done something wrong. I ended up committing my conflict resolutions with a whole mess of garbage inside my source files. The commit shows additions of many lines which look like > a7b4de79431c2e73d28621c72c8d14820df1a24b. The com...
Jesse Hallam
2

votes
1

answer
91

views

Which Data Annotation attribute creates this validation attribute?

Presuming we have a model like so: public class TheViewModel { public string DateTime? Image_Date { get; set; } } And it is added to a Razor view like so: Html.TextBoxFor(model => model.Image_Date) Then the following is rendered in the browser: The attribute data-val-date is what I'm interested in....
Jesse Hallam
3

votes
1

answer
2k

views

ANTLR 3.x - How to format rewrite rules

I'm finding myself challenged on how to properly format rewrite rules when certain conditions occur in the original rule. What is the appropriate way to rewrite this: unaryExpression: op=('!' | '-') t=term -> ^(UNARY_EXPR $op $t) Antlr doesn't seem to like me branding anything in parenthesis with a...
Jesse Hallam
8

votes
4

answer
3.2k

views

Remove handlers on disposing object

I can think of a few messy ways to solve this, but it strikes me that there should be a far more elegant solution than those which I've already come up with. What's the most appropriate way for an object to cleanse itself of all of its event handlers prior to being disposed. It's a shame the event...
Jesse Hallam
2

votes
2

answer
164

views

Why are parameters being incorrectly interpreted in this PowerShell ampersand command?

I have a PowerShell script which is as follows: [CmdletBinding()] param( # Other parameters removed for brevity [string] $MSBuildParameters = '' ) # Other syntax removed for brevity & $MSBuild $Solution /p:Configuration=$Configuration /p:Platform='$BuildPlatform' /nologo /m /v:m /nr:false $MSBuildPa...
Jesse Hallam
4

votes
4

answer
1.8k

views

What's the matter with this Grammar?

grammar Test; IDHEAD: ('a'..'z' | 'A'..'Z' | '_'); IDTAIL: (IDHEAD | '0'..'9'); ID: (IDHEAD IDTAIL*); fragment TYPE: ('text' | 'number' | 'bool'); define: 'define' ID 'as' TYPE; The problem is that the define rule matches the tokens define, ID, as, but wont match TYPE. I'm yielding a MissingT...
Jesse Hallam
0

votes
0

answer
755

views

Razor Helpers are inaccessible from an MVC project “does not exist in the current context”

I'm unable to call Razor helper functions from across cshtml file boundaries. The intellisense does not detect a class with the name of the cshtml file and typing it anyways produces the compile-time error: The name 'helper name' does not exist in the current context. I've tried placing these helper...
Jesse Hallam