.net-4.0

Can I design any lock-free solution for this scenario

柔情痞子 提交于 2019-12-10 12:26:42
问题 I have a simple Employee class as follows public class Employee { public int ID { get; set; } public string LastName { get; set; } public string FirstName { get; set; } } I then have a ProcessEmployees class which do concurrent processing of these employees in method called ProcessThisEmployee. Within this method, I have to call a third party library method. So far its all simple. Problem is sometime when user choose to cancel this operation when its in progress, I need to do some clean up on

Targeting .NET 4.0 in VS 2012 on Windows 8

不打扰是莪最后的温柔 提交于 2019-12-10 12:18:45
问题 I just installed VS 2012 Ultimate RTM on Windows 8 Pro RTM and tried to open a solution containing several projects (class libraries and WinForms) targeting .NET 4.0. When the solution is loaded, VS prompts that .NET 4.0 isn't supported. It gives me the chance to update my projects to 4.5 (and promises that I could change the target later) or install a "Multi targeting pack" for 4.0 from this page. I decided to update my projects to 4.5 because I had no luck installing the offered Multi

Checking a structure's default value

烂漫一生 提交于 2019-12-10 11:49:49
问题 There is something wrong in my DefaultValue() function. It ALWAYS returns false , representing that the the structure is NOT the default value. Why would this not work? [StructLayout(LayoutKind.Sequential)] private struct ArrayItem { public long SrcSize; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 250)] public string SrcFile; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 250)] public string DestFile; } [StructLayout(LayoutKind.Sequential)] private struct MyInfo { public int Count;

Install GitExtensions on a machine with .NET 4.0 only

瘦欲@ 提交于 2019-12-10 11:49:38
问题 .NET 4.0 / Visual Studio 2010 is installed on my machine. When I execute the current installer (GitExtensions224SetupComplete.msi) it tells me that I need to install .NET 3.5. Can one use GitExtensions with .NET 4.0 or do you have to install .NET 3.5? If yes, how do I force the installer to use .NET 4.0? Is there a general approach to this, which also works with other programs and installers? Thanks 回答1: As far as I can see from GitExtensions224SetupComplete.msi, it has an explicit launch

IronPython import performance with compiled code

ぐ巨炮叔叔 提交于 2019-12-10 11:35:45
问题 I am doing some experiments with IronPython 2.6.1 and the clr.CompileModules function to compile my large scripts into assemblies. Testing has shown good cold start performance performance improvements but in some cases importing the compiled module is actually slower than executing a large string that represents my code in some cases. My question is, if i use something like scope.Engine.Execute(string.Format("from {0} import {0}", theModule), scope); or the ImportModule function, even though

Connect to Oracle with odp.net and the OCI from C#

狂风中的少年 提交于 2019-12-10 11:25:31
问题 I have been reading about how to connect to my oracle database from my C# win application, but I keep “hitting the wall”. I have decided to use odp.net and OCI, such that the client computer not needs to install a client, but I can’t get it to work. I have a small test application, the code I shown below and in my solution I have added the following dll’s from oracle OCI: oci.dll, orannzsbb11.dll and oraociicus11.dll. They are all placed together with the final .exe file. Test Code: private

MVC3 publishing and IIS 6

家住魔仙堡 提交于 2019-12-10 11:21:37
问题 I've been fighting with this for several hours with no headway. I am trying to publish a web app (MVC3, .net4, made in Visual Studio 2010) to a server. All googles eventually lead to this article, which has not been helpful. According to it, MVC3 running on IIS 6 (MVC and .net4 are installed, it is a 2k3 server) should just work. Different set ups give me different issues, but nothing that works. With default settings, I get "Directory Listing Denied This Virtual Directory does not allow

How to make reading this instance primitive thread-safe without locking?

坚强是说给别人听的谎言 提交于 2019-12-10 11:08:47
问题 The problem with the below class is when reading myThreadSafe.Value it may not return the most up-to-date value. public class ThreadSafe { private int value; public int Value { get { return value; } } public void Update() { Interlocked.Add(ref value, 47); // UPDATE: use interlocked to not distract from the question being asked. } } I realise I could lock when reading it and writing it: public int Value { get { lock(locker) return value; } } public void Update() { lock(locker) { value += 47; }

Visual Studio 2010 not recognizing .NET Framework 4.0

落爺英雄遲暮 提交于 2019-12-10 10:54:20
问题 I've recently had to uninstall/re-install my .NET Framework 4 after finding my current installation was corrupt. I found this when attempting to upgrade my Telerik Controls. I manually uninstalled my .NET Framework using the command line and then re-installed the newest version of the framework from MSDN. Now when I open previous projects in VS2010 (which are coded in .NET 4), it prompts me to Install .NET Framework 4.0 or retarget the Project to a another Framework or Profile. Is there a way

Triggered Content Template

柔情痞子 提交于 2019-12-10 10:27:06
问题 I'm trying to set up a ContentTemplate that changes based on a DataTrigger. Syntatically, I feel like this should work, but it results in a stack overflow when trying to render the page: <ItemsControl ItemsSource="{Binding Path=ExtendedFieldCollection}" ItemTemplate="{StaticResource RequiredFieldsTemplate}" /> <!--Where--> <DataTemplate x:Key="RequiredFieldsTemplate"> <ContentPresenter> <ContentPresenter.Style> <Style TargetType="ContentPresenter"> <Setter Property="ContentTemplate" Value="{x