Archive for the ‘C#’ Category
Posted by jpluimers on 2018/01/10
Some links via xs:choice element to C# – Google Search.
I need them one day to better understand xsd:choice mapping to C# for both XSD and WSDL usage.
I have the feeling that the WSDL and XSD importer are trying to be smart, so for instance when you have multiple choices that come down to a common basic type like a derivation from xsd:string, it makes to two properties: a C# enumeration to select the type and a C# string value for the content referencing the enumeration through a XmlChoiceIdentifierAttribute.
–jeroen
Posted in .NET, C#, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/12/28
Interesting new .NET feature already available for .NET 4.5, but much faster in future .NET versions: [WayBack] C# – All About Span: Exploring a New .NET Mainstay
Documentation (only quoted first paragraph):
Span<T> is a new type we are adding to the platform to represent contiguous regions of arbitrary memory, with performance characteristics on par with T[]. Its APIs are similar to the array, but unlike arrays, it can point to either managed or native memory, or to memory allocated on the stack.
Further on in that document are the Design specifications.
Via:
–jeroen
Posted in .NET, C#, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/12/27
From my SO Question Archive:
Just curious: Why is the syntax for try catch in C# (Java also?) hard coded for multiple statements? Why doesn’t the language allow:
int i;
string s = DateTime.Now.Seconds % 2 == 1 ? "1" : "not 1";
try
i = int.Parse(s);
catch
i = 0;
The example is for trivial purposes only. I know there’s int.TryParse.
[WayBack] c# – Why does Try-Catch require curly braces – Stack Overflow.
I asked this question partially because of my Delphi background where there are two try statements (one for finally and one for except a.k.a. catch) neither having the braces problem as try/finally/except all are block boundaries.
The most interesting bit was the [WayBack] answer by [WayBack] Eric Lippert (ex C# compiler team, now at Facebook after an intermediate position at Coverty) referring to his [WayBack] Why are braces required in try-catch-finally? | Fabulous adventures in coding blog entry.
The answer and blog entry come down to preventing ambiguity.
His answer reveals that a compound try/catch/finally statement is converted by two try statements like this:
try
{
try
{
XYZ();
}
catch(whatever)
{
DEF();
}
}
finally
{
ABC();
}
This emphasises that catch and finally are conceptually indeed two different things which statistics show.
I need to dig up the numbers (I remember researching this for Java and Delphi code a very long time ago – think Delphi 7 era – and C# code a long time ago – think C# 2 era), but this comment should still hold:
–
–jeroen
Posted in C#, Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/12/26
Ever introduced an extra parameter on a method, tracked all its usages and made the compiler happy by providing a corresponding extra argument in all the calls of that method? Sure you have…
Things like that need a reminder: the joy of reflection and lambdas…
Very good train of thought (and solving!) at [WayBack] Head scratching with a TargetParameterCountException | Software on a String
By [WayBack] Marjan Venema – Google+
–jeroen
Posted in .NET, C#, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/12/13
A nice article [Archive.is] What is thread safety anyway? with a kind reference to the Deadlock Empire translation from C# to Delphi that I made.
In any language, multi-threading is hard, so I really love the quote below:
[WayBack] Multithreading can be hard to do right. The most common point of failure is assuming some code is thread safe when it actually is not... – Dalija Prasnikar – Google+
It reminded me of an old one:
A programmer had a problem. He thought to himself, “I know, I’ll solve it with threads!”. has Now problems. two he
–jeroen
Posted in .NET, C#, Delphi, Development, Fun, Multi-Threading / Concurrency, Quotes, Software Development, T-Shirt quotes | Leave a Comment »
Posted by jpluimers on 2017/12/13
Mads Torgersen shares future thinking of a fast-moving major programming language, C#. Torgersen discusses pattern matching, type classes, discriminated unions and much more.
A cool outlook of things that hopefully make it into the next upcoming major C# release: [WayBack] Herding Nulls and Other C# Stories From the Future
Via:
Slides (of which a few screenshots are below): [WayBack] herding_nulls.pptx
–jeroen
Read the rest of this entry »
Posted in .NET, C#, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2017/12/07
Ah, C. The best lingua franca we have… because we have no other lingua francas. Linguae franca. Surgeons general? C is fairly old — 44 years, now! — and comes from a time when there were possibly more architectures than programming languages. It works well for what it is, and what it is is a relatively simple layer of indirection atop assembly. Alas, the popularity of C has led to a number of programming languages’ taking significant cues from its design, and parts of its design are… slightly questionable. I’ve gone through some common features that probably should’ve stayed in C and my justification for saying so. The features are listed in rough order from (I hope) least to most controversial. The idea is that C fans will give up when I call it “weakly typed” and not even get to the part where I rag on braces. Wait, crap, I gave it away.
Great re-read towards the end of the year: [WayBack] Let’s stop copying C / fuzzy notepad
Via: [WayBack] Old and busted: emacs vs vi. New and hot: Language war, everybody against everybody else. – Kristian Köhntopp – Google+
–jeroen
Posted in .NET, APL, Awk, bash, BASIC, C, C#, C++, COBOL, CoffeeScript, CommandLine, D, Delphi, Development, F#, Fortran, Go (golang), Java, Java Platform, JavaScript/ECMAScript, Pascal, Perl, PHP, PowerShell, PowerShell, Python, Ruby, Scala, Scripting, Software Development, TypeScript, VB.NET, VBScript | 3 Comments »
Posted by jpluimers on 2017/11/02
Quoted in full because even 2.5 years later, it’s just too funny:
- Python: What if everything was a dict?
- Java: What if everything was an object?
- JavaScript: What if everything was a dict *and* an object?
- C: What if everything was a pointer?
- APL: What if everything was an array?
- Tcl: What if everything was a string?
- Prolog: What if everything was a term?
- LISP: What if everything was a pair?
- Scheme: What if everything was a function?
- Haskell: What if everything was a monad?
- Assembly: What if everything was a register?
- Coq: What if everything was a type/proposition?
- COBOL: WHAT IF EVERYTHING WAS UPPERCASE?
- C#: What if everything was like Java, but different?
- Ruby: What if everything was monkey patched?
- Pascal: BEGIN What if everything was structured? END
- C++: What if we added everything to the language?
- C++11: What if we forgot to stop adding stuff?
- Rust: What if garbage collection didn’t exist?
- Go: What if we tried designing C a second time?
- Perl: What if shell, sed, and awk were one language?
- Perl6: What if we took the joke too far?
- PHP: What if we wanted to make SQL injection easier?
- VB: What if we wanted to allow anyone to program?
- VB.NET: What if we wanted to stop them again?
- Forth: What if everything was a stack?
- ColorForth: What if the stack was green?
- PostScript: What if everything was printed at 600dpi?
- XSLT: What if everything was an XML element?
- Make: What if everything was a dependency?
- m4: What if everything was incomprehensibly quoted?
- Scala: What if Haskell ran on the JVM?
- Clojure: What if LISP ran on the JVM?
- Lua: What if game developers got tired of C++?
- Mathematica: What if Stephen Wolfram invented everything?
- Malbolge: What if there is no god?
–jeroen
Read the rest of this entry »
Posted in .NET, APL, Assembly Language, BASIC, C, C#, C++, COBOL, Development, EPS/PostScript, Fun, Go (golang), Java, Java Platform, JavaScript/ECMAScript, LISP, Makefile, Pascal, Perl, PHP, Python, Quotes, Ruby, Rust, Scala, Scripting, Smalltalk, Software Development, T-Shirt quotes, TCL, Turbo Prolog, VB.NET, Visual BASIC, XML/XSD, XSLT | Leave a Comment »
Posted by jpluimers on 2017/10/12
I mentioned Asbjørn Heid on wiert.me before. While prepping for the Deadlock Empire workshop at EKON20, I needed a Delphi equivalent for the .NET [Way: Barrier Class (System.Threading)
The game uses that in level deadlockempire.github.io/#H4-Barrier [WayBack].
Edwin van der Kraan found the ThreadBarrier/ThreadBarrier.pas at master · lordcrc/ThreadBarrier implementation via [WayBack] Is there a way to create memory barriers in Delphi? Something like .NET’s System.Threading.Barrier class, java.util.concurrent.CyclicBarrier… – Horácio Filho – Google+
It’s from Asbjoørn who is known as lordcrc on GitHub. Cool stuff!
So yes, there is a Delphi version of If you thought you could do multi-threading, then play “The Deadlock Empire” games. You can find it at https://deadlockempire.4delphi.com/ There are two deadlockempire implementations there:
The workshop was great fun!
This is about a web game focussing on the concurrency issues in multi-threading environments. By the conference there will be a Delphi version of it. At the workshop we will play each round interactively: all attendees play the round followed by a short discussion. This is about collective learning, so the speakers will probably learn… Read More
Source: [Archive.is] If you thought you could do multi-threading, then play “The Deadlock Empire” games – Entwickler Konferenz
–jeroen
Posted in .NET, C#, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »