Posted by jpluimers on 2017/03/15
Sometime you might want to protect your data in memory – the greatest example is when dealing with anything related to passwords. It is simply not smart to keep that data around in a plain-text. In .NET there are multiple methods you can use for this purpose, starting with SecureString, ProtectedMemory, and my favorite ProtectedData.…
Source: How to secure memory? – Medo’s Home Page
via: Found this via +Ilya S a post from +Josip Medved – Stuff like this should be way built into an OS, and RTL’s should have a secureMalloc()… – Joe C. Hecht – Google+
Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/02/22
A while ago, I bitched that Microsoft moved away the Windows Update out of the Control panel into a language depended place (in Windows 10 1511 update broke the Hyper-V networking – Fix network connection issues).
Since then I had to maintain too many locales running Windows 10. So here is the batch file:
for /f "delims=" %%A in ('PowerShell -Command "(Get-Culture).Name"') do explorer "%LocalAppData%\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\%%A\AAA_SystemSettings_MusUpdate_UpdateActionButton.settingcontent-ms"
It uses these tricks:
- Set output of a command as a variable (in this case a for loop variable)
- Execute PowerShell script in a .bat file
- PowerShell Get-Culture (which gets a .NET CultureInfo instance)
- CultureInfo.Name property (which has the nl-NL, en-US, etc codes in it)
It replaced this simple batch-file which has worked for like 10 years:
%windir%\System32\rundll32.exe url.dll,FileProtocolHandler wuapp.exe
via: Windows Update Shortcut – Create in Windows 10 – Windows 10 Forums
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Batch-Files, CommandLine, Development, Power User, PowerShell, Scripting, Software Development, Windows, Windows 10 | Leave a Comment »
Posted by jpluimers on 2017/02/21
… there’s no need to use WaitForMultipleObjects in Step 2. It’s fairly easy to keep a counter of active threads in the pool (interlocked-incremented when a thread starts, interlocked-decremented when a thread is finished). When the counter reaches zero (no more active threads), signal an event. With only one event to wait for, you can use WaitForSingleObject…
So no more 64-thread (MAXIMUM_WAIT_OBJECTS) limits for pools…
Source: Delphi and stuff: The strange limitation of 64 threads
Posted in .NET, Delphi, Development, Power User, Software Development, Windows | Leave a Comment »
Posted by jpluimers on 2017/02/09
Brilliant Date format converter from dates in Text (almost any format) or timestamp numbers in Unix, Mac, Filetime or Microsoft (which is the same as Delphi TDateTime) format to any of these formats:
Date in human-readable text
|Wednesday, March 23, 2016 4:05:39pm
RFC 822 formatted date
|Wed, 23 Mar 2016 16:05:39 +0000
ISO 8601 formatted date
seconds since Jan 1 1970
seconds since Jan 1 1904
days since Dec 31 1899
100-nanoseconds since Jan 1 1601
Source: Date format converter
Posted in *nix, .NET, Apple, Delphi, Development, Mac, OS X, Power User, Software Development | 1 Comment »
Posted by jpluimers on 2017/01/17
I will probably need this again somewhere in the future: An exponential back-off implementation I used somewhere; probably room for improvement, but it works good enough.
It’s Delphi, but I’ve not seen practical implementations in C# either.
(the updated version thanks to Anders Melander).
Posted in .NET, C#, Delphi, Development, Software Development | 5 Comments »