.net-4.0

JSON - is there any XML CDATA equivalent?

非 Y 不嫁゛ 提交于 2019-12-03 22:07:55
I'm looking for a way that json parsing will take information as is (as if it was CDATA) - and not to try to serialize that. We use both .net and java (client and server) - so the answer should be about JSON structure Is there any way to achieve this structure? Thanks. almalki There is no XML CDATA equivalent in JSON. But you can encode your message in a string literal using something like base64. See this question for more details. http://www.json.org/ describes JSON format in details. According to it JSON doesn't support "something like CDATA" value type. To achieve CDATA structure you can

What features are people looking forward to in .Net 4.0 - 4.1

巧了我就是萌 提交于 2019-12-03 22:04:20
问题 I am very interested in learning what features people are interested in in the forthcoming .net framework(s)? Whether these be new classes or new controls I am curious to know people views. 回答1: Code Contracts and Parallel Extensions. Neither are language features (which is mostly what I get interested in usually) but both have the potential to significantly change how we write code. The DLR does sound cool and interesting, but I'm not sure I'd end up using it much, at least in terms of

InvalidOperationException in my Lazy<> value factory

倾然丶 夕夏残阳落幕 提交于 2019-12-03 22:03:17
I have a class containing something like the following: public static class Config { private static Lazy<ConfigSource> _cfgSrc = new Lazy<ConfigSource>( () => { /* "ValueFactory" here... */ }, true); public static ConfigSource ConfigSource { get { return _cfgSrc.Value; } } } In accessing the ConfigSource property, I encountered this InvalidOperationException : ValueFactory attempted to access the Value property of this instance. I don't see anything in my "value factory" method that accesses the Value property. Is there anything else that could be triggering this exception? This problem only

Many to Many mapping not working - EF 4.1 RC

妖精的绣舞 提交于 2019-12-03 21:45:54
UPDATE: After a bit more research it seems a number of my many-to-many mappings aren't working. Hmmm... I'm upgrading a data access project from EF 4.1 CTP4 to EF 4.1 RC and I'm having trouble with the new EntityTypeConfiguration<T> setup. Specifically I'm having an issue with a Many-to-Many relationship. I'm getting a Sequence contains no elements exception when I'm trying to get the .First() item. The particular exception isn't really that interesting. All it's saying is that there are no items BUT I know there should be items in the collection - so there must be an issue with my new

WebBrowser Control and Adobe Flash content

Deadly 提交于 2019-12-03 21:09:28
I have a standard WebBrowser Control that has been modified to use IE11 in Edge Mode ( see here for details for how I did that ). I am unable to play Flash content on some websites, a notable one being BBC iPlayer and other media requiring Flash served on the BBC website, for which I receive the following error: There was a problem initialising the player. Script access is denied in your browser. I am able to view this content using Internet Explorer, and script access is enabled within IE. Errors are suppressed in the WebBrowser control by setting ScriptErrorsSuppressed property to true, even

Force Task<T> to different core ?

烂漫一生 提交于 2019-12-03 20:56:08
Tpl and Plinq automatically assign work to threads (at core/s... { well ,if #threads> #cores then , >1 thread will run on the same core. }). However , Let's say I have MyMethod1(){..} and MyMethod2(){..} and I need to make sure (!) that each will run on a different core! (e.g. intensive computing) The nearest solution I found is Plinq's .WithExecutionMode (ParallelExecutionMode.ForceParallelism) But this is for a different situation where Plinq might think that it is better to do it sequentially rather then parallel.Also ,I dont use Plinq. I only have 2 methods which needs to run on a

TPL - How can I force TPL to use fixed # of threads? not less

我与影子孤独终老i 提交于 2019-12-03 20:56:08
问题 How can I force TPL to use a fixed number of threads? I know MaxDegreeOfParallelism can be used to set the upper limit, but I want the upper limit to equal the lower limit. Is this possible? How? Because I know someone will ask =) yes, I'm sure I want to do this and yes its optimal for my scneario. =) EDIT The solution requires a custom Partitioner as well as the custom TaskScheduler http://social.msdn.microsoft.com/Forums/en-US/parallelextensions/thread/002ff888-6e13-4d7e-a234-1632e8a1f551

DataTable.Load, One or more rows contain values violating non-null, unique, or foreign-key constraints

 ̄綄美尐妖づ 提交于 2019-12-03 20:24:48
I searched a lot, but could not find the solution. I get the error: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. I run DataTable.GetErrors() and see that some columns are set to Not NULL in SQL Compact Edition Database. And these columns are used in LEFT OUTER JOIN query so they are null when the query is run. (I can get the results when i run the query in Server Explorer in VS). The error occurs when trying to load the data in Datatable: using (SqlCeCommand Cmd = new SqlCeCommand("Query HERE", "Connection HERE")) { C

Playing ohLibSpotify pcm data stream in C# with NAudio

心已入冬 提交于 2019-12-03 20:24:22
I'm trying to play raw pcm data delivered from ohLibSpotify c# library ( https://github.com/openhome/ohLibSpotify ). I get the data in the following callback: public void MusicDeliveryCallback(SpotifySession session, AudioFormat format, IntPtr frames, int num_frames) { //EXAMPLE DATA //format.channels = 2, format.samplerate = 44100, format.sample_type = Int16NativeEndian //frames = ? //num_frames = 2048 } Now i want to directly play the received data with NAudio ( http://naudio.codeplex.com/ ). With the following code snippet i can play a mp3 file from disk. Is it possible to directly pass the

Managed Windows Service starts up slowly after digital signing

南笙酒味 提交于 2019-12-03 20:04:57
问题 We recently tried out digitally signing our .NET binaries. We have a Windows Service which typically starts up within 10 seconds. However after we started digitally signing it, the time increased to around 20-30 seconds. Googling led to me this: http://support.microsoft.com/kb/936707 which basically says that I have to set generatePublisherEvidence to false. But the description of generatePublisherEvidence on MSDN points to the fact that this is not applicable for .NET 4. Still I tried out