c#

How to set the 'PRAGMA foreign_keys = ON' statement with SQLitePCL

↘锁芯ラ 提交于 2021-02-20 04:37:51
问题 I have been using SQLitePCL (currently ver 3.8.7.2), and now decided to experiment with Delete and Update Cascade by turning on the Foreign Key constraint. I understand this feature is disabled by default and according to SQLite documentation, the constraint must be enabled separately for each database connection . The connection string only takes a database path (for SQLitePCL anyway) and doesn't allow more flexible composite connection string of the form data source=d:\foo\bar\mySqlite.db

Mediafoundation cant decode video on certain NVIDIA cards

时光总嘲笑我的痴心妄想 提交于 2021-02-20 04:36:26
问题 We are using the SharpDX .NET wrapper to make Mediafoundation decode an MP4 Video into a DirectX9 texture. This works fine, except that it crashes on certain NVIDIA cards for example the 940MX . For example the same machine with an Intel HD graphics card decodes the video stream fine. Unfortunately we cant get any other details than a E_FAIL/Unspecified error from SharpDX . Even with the debug layer enabled. Any ideas how to find out why it crashes? VideoMediaType outputVideoFormat;

Xamarin C# Android Call Logs

徘徊边缘 提交于 2021-02-20 04:34:42
问题 Im having trouble with this call logs of the device. The code is not returning the logs at all, It's giving false data. Code: public void ReadCalls() { try { Android.Content.Context myContext = Android.App.Application.Context; string myDateToCheck = myServiceRef.myTimeToCheck("CallLog"); if (myDateToCheck==null || myDateToCheck=="") {myDateToCheck = "0";} ICursor cursor = myContext.ContentResolver.Query( Android.Net.Uri.Parse ("content://call_log/calls"), null, "Date > ?", new string[]

C# WCF Service Reference - can not create UserNameToken

本小妞迷上赌 提交于 2021-02-20 04:34:25
问题 In my desktop application (C#, WPF, WCF, .NET4.0) I addes a service reference. This is Web Service (SOAP) using certificate and UserNameToken in Soap Envelope Header. I add service reference (Solution -> Service Reference -> Add Service Reference) using WSDL of this web service. In my app.config I have got: <customBinding> <binding name="tmsIntegrationServiceSOAP"> <!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'urn:CDM/tmsIntegrationService/': --> <!--

Xamarin C# Android Call Logs

邮差的信 提交于 2021-02-20 04:34:13
问题 Im having trouble with this call logs of the device. The code is not returning the logs at all, It's giving false data. Code: public void ReadCalls() { try { Android.Content.Context myContext = Android.App.Application.Context; string myDateToCheck = myServiceRef.myTimeToCheck("CallLog"); if (myDateToCheck==null || myDateToCheck=="") {myDateToCheck = "0";} ICursor cursor = myContext.ContentResolver.Query( Android.Net.Uri.Parse ("content://call_log/calls"), null, "Date > ?", new string[]

“timer + Task.Run” vs “while loop + Task.Delay” in asp.net core hosted service

不羁岁月 提交于 2021-02-20 04:30:07
问题 I have a requirement that background service should run Process method every day at 0:00 a.m. So, one of my team member wrote the following code: public class MyBackgroundService : IHostedService, IDisposable { private readonly ILogger _logger; private Timer _timer; public MyBackgroundService(ILogger<MyBackgroundService> logger) { _logger = logger; } public void Dispose() { _timer?.Dispose(); } public Task StartAsync(CancellationToken cancellationToken) { TimeSpan interval = TimeSpan

C# graphics drawlines draws broken lines

只愿长相守 提交于 2021-02-20 04:28:09
问题 I am drawing ECG graphs using C# Graphics. I draw the curve using drawlines method. however line joints look broken. I tried all available options of smoothing mode and capstyle, none helps. here is sample graph1 and sample graph2 code is below: private void DrawCurve(Graphics g, cPoint[] data) { List<Point> ps = new List<Point>(); for (int i = 0; i < data.Length - 1; i++) { int x = data[i].x; int y = data[i].y; if (x > 0 && x < (Width)) { ps.Add(new Point(x, y)); } else if (x > Width) {

try-catch block used while smtp exception need to display an error message in the local server

给你一囗甜甜゛ 提交于 2021-02-20 04:25:48
问题 Catch block used whenever there is an exception while using smtp port,but it will throw exception thats fine, it will take a very long time and also the exception message will be directly shown in the code itself,requirement is to display an error message while executing in the localserver and shouldnot come to the code. It should throw exception whenever the server is down or invalid email Id or change in smtp port ,Conclusion is the error message should not come directly to the code.It

Entity Framework bulk insert with transaction management - Performance

£可爱£侵袭症+ 提交于 2021-02-20 04:24:29
问题 I followed the answer in the following link for improving the performance of entity framework for bulk inserts and updates. Improving bulk insert performance in Entity framework Made save changes in batch of 1000 regeneration of the DbContext object after every save changes I got the performance boost as expected. But I have a requirement of rolling back the transaction while exception condition while performing bulk insert. This becomes issue when we re initialize the DbContext object. Is

File Upload in Asp.net core 2.0 issue creating 0 byte Image

不想你离开。 提交于 2021-02-20 04:23:45
问题 I, am using angular 5, with asp.net core 2.0. I, am trying to upload the file to the server. The code update the file to the server. But with 0 kb of data and sometime it upload the file. The file size is not large. Its in KB. Here is the Angular code public QuestionPostHttpCall(_questionPhotoVM: QuestionPhotoViewModel): Observable<GenericResponseObject<QuestionPhotoViewModel[]>> { const formData: FormData = new FormData(); formData.append('FileUpload', _questionPhotoVM.FileUpload); formData