Archive for the ‘.NET’ Category
Posted by jpluimers on 2016/10/04
Slay dragons, learn concurrency! Play the cunning Scheduler, exploit flawed programs and defeat the armies of the Parallel Wizard.
Source: The Deadlock Empire
Via: Face the dragon. Learn the ropes of concurrent programming. – Lars Fosdal – Google+
Source code is available and focuses on C#; maybe one day I’ll make a Delphi version: deadlockempire/deadlockempire.github.io: The Deadlock Empire: Slay dragons, learn concurrency!
BTW: a great book (with nice illustrations at both github and kernel.org) is Source: Is Parallel Programming Hard, And, If So, What Can You Do About It? [WayBack]
–jeroen
Posted in .NET, C#, Delphi, Development, Multi-Threading / Concurrency, Software Development | Leave a Comment »
Posted by jpluimers on 2016/09/21
It’s been in the System.Array class forever, but remarkably few people do know that it can throw you a NotSupportedException (for instance when calling Add, Insert, Remove, etc).
It does because it implements IList, but not all methods implemented from IList are valid.
And it also indicates that, as the IList Properties allows for IsFixedSize to return false.
A similar case is there for IsReadOnly: then you cannot even modify the values.
Ever since I started teaching .NET/C# classes almost 15 years ago, I warned:
beware when you use IList as not everybody implements all methods.
–jeroen
via:
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/09/06
I’ve published the Delphi version info table as a Gist: https://gist.github.com/jpluimers/b5891600b73642788b492393710c6070.
Note I need help with these:
The updated script that forms the base of this table is here: https://bitbucket.org/jeroenp/wiert.me/src/tip/Native/Delphi/Scripts/List-Delphi-Installed-Packages.ps1
You can pass any of these args to get information
- Individual columns:
- CompanyNames, Versions, ProductNames, ProductVersions, BetaNames. ReleaseDates, Architectures, CharacterSets, Defines, CompilerVersions, RTLVersions, DllSuffixes, ProjectVersions, Frameworks, ProductVersions, ProductFullNames, BaseKeyPaths, HKCU-BaseKeyPaths, HKLM-BaseKeyPaths
- Base of the below table:
- Installed info (installation status obtained through the registry):
- InstalledProductVersions, InstalledProductFullNames, InstalledProductSummaries, InstalledPackages
An elaborate wrapper around the Define column is jedi.inc which is used in many projects (both open source and closed source) to distinguish between various Delphi versions, libraries and platforms at compile time (URL: github.com/project-jedi/jedi/blob/master/jedi.inc)
Read the rest of this entry »
Posted in .NET, C#, C# Builder, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »
Posted by jpluimers on 2016/09/02
By default the changeset command in tf.exe shows a dialog showing a list of all files in that changeset.
I wanted that list to be dumped on the console for further processing.
Luckily there is a /noprompt option for that:
call "%~dp0tf.bat" changeset /noprompt %*
The above tf-show-changeset-details-on-console.bat batch file uses tf.bat that hunts for the location of tf.exe.
–jeroen
Posted in .NET, Development, Software Development, Source Code Management, TFS (Team Foundation System) | Leave a Comment »
Posted by jpluimers on 2016/08/18
Empty arrays are not used often as arrays usually are about the presence data, not about the absence.
Here are two ways based on the int data type in C# (the original [WayBack] examples [WayBack] are using string, but since string itself is also a kind of array…):
Specify a size of zero:
int[] a = new int[0];
Specify an empty initialisation:
int[] a = new int[] { };
Though many people think arrays are a thing of the past, I think it is one of the first generic types and have their place. For one, enumerating over arrays using foreach is a lot faster in many environments than enumerating over other data types. Another thing is that the fixed nature of arrays can be very beneficial in setting constraints.
That’s why I like the balanced view from Eric Lippert [WayBack] in Arrays considered somewhat harmful – Fabulous Adventures In Coding – Site Home – MSDN Blogs [WayBack]
–jeroen
via:
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/08/09
Maintaining a suite of project that use CamelCase on the one hand and underscore_separators on the other (partially mapped by code generators) an on-line conversion comes in handy: CCConverter abedo.pl.
–jeroen
Posted in .NET, Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/07/27
Just what I needed: Push a new local branch to a remote Git repository and track it too – Stack Overflow But watch the comments to this answer:
Answer:
In recent versions of Git (1.7.0 and later), you can checkout a new branch:
git checkout -b <branch>
Edit files, add and commit. Then push with the -u option:
git push -u origin <branch>
Git will set up the tracking information during the push.
Daniel Ruoso / Dan
Comments:
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management, Visual Studio 2013, Visual Studio 2014, Visual Studio 2015, Visual Studio and tools | Leave a Comment »
Posted by jpluimers on 2016/07/27
It comes down to these cases for XML elements having maxOccurs="1" (which the default for maxOccurs):
- adding
nillable="true" will convert from a regular type to a nullable type.
- adding
minOccurs="0" will add boolean …Specified properties in the generated C# for each element.
- you can have both
nillable="true" and minOccurs="0" in an element which gets you a nullable type and a …Specified property.
Note I’m not considering fixed or default here, nor attributes (that have use instead of minOccurs/maxOccurs, but do not allow for nillable) nor larger values of maxOccurs (which both xsd.exe and xsd2code regard as unbounded).
From the above, XML has a richer type system than C#, so in XML there are subtle a differences between:
- an explicit
nil in the XML element
- the XML element being absent
- the XML element being empty.
Hopefully later more text and examples to show how to actually work with this.
Delphi related to minOccurs:
Note that xsd2code.codeplex.com (unlike XmlGen#) has at least two forks at github:
From the specs:
–jeroen
Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Conference Topics, Conferences, Development, Event, Software Development, XML, XML/XSD, XSD | Leave a Comment »
Posted by jpluimers on 2016/07/19
A while ago I bumped into this interesting bit: LLLPG (Loyc LL(k) Parser Generator) is a new recursive-decent parser generator for C#, with a feature set better than ANTLR version 2.
–jeroen
via:
Posted in .NET, C#, Development, Software Development | Leave a Comment »
git push -uwas introduced in Git 1.7.0 (2010-02-12). – Chris Johnsen Jun 4 ’11 at 4:16-uis short for--set-upstream—for what it does and why it’s needed I wouldn’t mind some explanation, too. :) – Anton Strogonoff Mar 9 ’14 at 6:07push.defaultis set toupstream, this will not do what you think it will do. It will try to push over the existing tracking branch. Use:git push -u origin mynewfeature:mynewfeatureor dogit branch --unset-upstreamfirst. – void.pointer May 19 ’14 at 18:07