Strip seconds from datetime

You can create a new instance of date with the seconds set to 0. DateTime a = DateTime.UtcNow; DateTime b = new DateTime(a.Year, a.Month, a.Day, a.Hour, a.Minute, 0, a.Kind); Console.WriteLine(a); Console.WriteLine(b);

Getting the Last Insert ID with SQLite.NET in C#

Using C# (.net 4.0) with SQLite, the SQLiteConnection class has a property LastInsertRowId that equals the Primary Integer Key of the most recently inserted (or updated) element. The rowID is returned if the table doesn’t have a primary integer key (in this case the rowID is column is automatically created). See https://www.sqlite.org/c3ref/last_insert_rowid.html for more. As … Read more

ASP.Net Core 1 Logging Error – The description for Event ID xxxx from source Application cannot be found

I have not been able to use the loggerFactory.AddEventLog() in .Net Core 2.0. As the Microsoft.Extensions.Logger.EventLog only lives in .net 4.5.1 although the Nuget package is available for 2.0.0 here , so looks like it needs to be ported to Core. but maybe this will work for you. Add your CustomEventIds public static class CustomEventIds … Read more

UWP Windows 10 App memory increasing on navigation

Every time you navigate to a Page, you create a new instance of Page, but the previous Page is not disposed (even if the Page is already in the navigation stack). To prevent multiple allocation of same page, set NavigationCacheMode=”Enabled” attribute to the Page. Also, to minimize the memory allocation, you must override method OnNavigatedTo … Read more

Removing PDF invisible objects with iTextSharp

If the PDF which you are trying is a template/predefined/fixed then you can remove that object by calling RemoveField. PdfReader pdfReader = new PdfReader(../Template_Path.pdf”)); PdfStamper pdfStamperToPopulate = new PdfStamper(pdfReader, new FileStream(outputPath, FileMode.Create)); AcroFields pdfFormFields = pdfStamperToPopulate.AcroFields; pdfFormFields.RemoveField(“fieldNameToBeRemoved”);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)