Nice video when using either of the RemObjects Elements (Oxygene or Hydrogene): for creating a UI UINavigationController – remobjects.
–jeroen
Posted by jpluimers on 2014/03/07
Nice video when using either of the RemObjects Elements (Oxygene or Hydrogene): for creating a UI UINavigationController – remobjects.
–jeroen
Posted in .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Oxygene, Pascal, RemObjects C#, Software Development | Leave a Comment »
Posted by jpluimers on 2014/03/07
Funny charts at andrewvos.com – Amount of profanity in git commit messages per programming language.
The source is online too: AndrewVos/github-statistics.
And it led me to this really nice way of choosing your chart type.
Click to enlarge… Read the rest of this entry »
Posted in .NET, C#, C++, Development, Java, JavaScript/ECMAScript, Perl, PHP, Ruby, Scripting, Software Development, Web Development | 2 Comments »
Posted by jpluimers on 2014/02/28
Wow, just wow for this teaser:
This page provides a few videos to help you get started with RemObjects C# for iOS development.
and this:
This page provides a few videos to help you get started with RemObjects C# for Android (and Java) development.
It is about Hydrogene, a.k.a. RemObjects C#, which – like Oxygene – also adds a few extensions to the C# language, just like Jolyon speculated december last year.
It wil be in beta tomorrow (:
Summary of tools used for iOS:
Summary of tools used for Android:
Summary of tools used for iOS and Android
I’m gussing here, as the URL is not yet live, but from March 1st (tomorrow!) you should be able to download a beta of Hydrogene/RemObjects C# from http://www.remobjects.com/elements/hydrogene (Just like Oxygene is available from http://www.remobjects.com/elements/oxygene/).
–jeroen
via:
Posted in .NET, C#, Development, Software Development, Visual Studio and tools | Tagged: android, Android SDK, iOS, iOS development, Oxygene | 1 Comment »
Posted by jpluimers on 2014/02/27
I’m more and more amazed (actually I’m not, this is how life on forum-like communities when moderatorss take over) about which StackOverflow questsions get closed, and which ones stay alive.
It seems the best way is to ask longer questions way beyond what most moderatorss can grasp.
Closed:
Still open:
A great point in the comments of the first question is that
you can technically can write .NET 4.0 / C# 4 applications on a .NET 4.5 / C#5 equiped machine and deploy them on machines that only have .NET 4.0 and C# support.
Don’t. I learned that in the .NET 3.0/3.5 and C# 3.0/2.0 era that combining is bad as the version matrix allows for subtle combinations that are hard to test.
.NET 3.0 with C# 2.0 applications written on a system that had .NET 3.5 and C# 3.0 installed would occasionally fail on systems that only had .NET 3.0 and C# 2.0 installed.
–jeroen
Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 4.0, C# 5.0, Development, Software Development | Tagged: stack overflow | Leave a Comment »
Posted by jpluimers on 2014/02/13
ForNeVeR now maintains ManagedSpy, see his answer on StackOverflow
BTW, I’ve cloned the original ManagedSpy source code and maintaining the code today (for example, ported it to .NET4).
See project on GitHub.
–jeroen
via: managed – What happened to ManagedSpy? – Stack Overflow.
Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2014/02/11
The DBNull type is a very special type in .NET. It represents null values in databases, which are slightly different than null values in .NET.
The biggest confusion that people have with it is that it won’t convert to anything. Which means that you see a lot of questions like “System.InvalidCastException: Conversion from type ‘DBNull’ to type” “is not valid”.
You’d think the full name would be System.Data.DBNull, it is actually named System.DBNull. The reason is that various other functionality of the System namespace depend on it, for instance the System.Convert class.
DBNull was already present in .NET 1.x, so it predates nullable types that were introduced in C# 2 / .NET 2.
A null value on the database side will result in a DBNull instance.
If you want to explicitly pass a null value to a database, you use a DBNull.Value, which is a singleton.
There is a very interestin question/answer series on StackOverflow about this: via .net – What is the point of DBNull? – Stack Overflow.
There are a few good arguments both for and against DBNull.
But the baseline is that DBNull predates the introduction in the .NET framework of genuine nullable types. Both their behaviour is slightly different, so DBNull had to stay.
Which means you have to deal with it every now and then.
A bit more background on the invalid casts.
It is thrown like this:
throw new InvalidCastException(Environment.GetResourceString("InvalidCast_DBNull"));
from
Convert.DefaultToType();
which is called from the DBNull method
object IConvertible.ToType(Type type, IFormatProvider provider);
All other IConvertible methods are implementated like
bool IConvertible.ToBoolean(IFormatProvider provider) { throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull")); }
So these all throw the same exception:
bool IConvertible.ToBoolean(IFormatProvider provider); byte IConvertible.ToByte(IFormatProvider provider); char IConvertible.ToChar(IFormatProvider provider); DateTime IConvertible.ToDateTime(IFormatProvider provider); decimal IConvertible.ToDecimal(IFormatProvider provider); double IConvertible.ToDouble(IFormatProvider provider); short IConvertible.ToInt16(IFormatProvider provider); int IConvertible.ToInt32(IFormatProvider provider); long IConvertible.ToInt64(IFormatProvider provider); sbyte IConvertible.ToSByte(IFormatProvider provider); float IConvertible.ToSingle(IFormatProvider provider); ushort IConvertible.ToUInt16(IFormatProvider provider); uint IConvertible.ToUInt32(IFormatProvider provider); ulong IConvertible.ToUInt64(IFormatProvider provider);
–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, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2014/02/06
A while ago, I had this error when running an application on a hardened server:
Unhandled Exception:System.InvalidOperationException: Unable to generate a temporary class (result=1). error CS2001: Source file 'C:\windows\TEMP\0hocq2nq.0.cs' could not be found error CS2008: No inputs specified at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence) at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies) at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace, String location, Evidence evidence) at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace, String location) at System.Xml.Serialization.XmlSerializer..ctor(Type type, Type[] extraTypes)
Usually I’m not the first with strange errors, but searching for “Unhandled Exception:System.InvalidOperationException: Unable to generate a temporary class” didn’t get many results.
This was a program running from SSIS under a non-system domain account with very little access.
My first guess was the right now: the XmlSerializer wants to generate a temporary C# file, then compile it into a temporary assembly. Since it cannot generate the C# file because the account does not have access to %windir\TEMP%, the compiler cannot find the (not generated) C# file.
After a few tries, I searched for XmlSerializer without GenerateAssembly, where the first hit ended at Changing where XmlSerializer Outputs Temporary Assemblies – Scott Hanselman.
That post indicated I should try looking for tempFilesLocation in the XmlSerializer context.
That got me these posts: Read the rest of this entry »
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, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2014/02/05
Looking for the pesky little differences between C# and VB.NET, I stumbled over this nice question by Micah Martin on default values for generics in VB.NET as compared to C#. Actually there were 3 questions, so I did a bit of post-editing:
How do I create the default for a generic in VB.NET? in C# I can call:
T variable = default(T);
- How do I do this in VB?
- If this just returns null (C#) or nothing (VB.NET) then what happens to value types?
- Is there a way to specify for a custom type what the default value is? For instance what if I want the default value to be the equivalent to calling a parameterless constructor on my class.
User Konrad Rudolph – Stack Overflow. promptly gave three answers:
Question 1:
Dim variable As T‘ or ‘Dim variable As T = Nothing‘ or ‘Dim variable As New T()Notice that the latter only works if you specifiy either theNewor theStructureconstraint for the generic type.Question 2:
For value types all members of the struct are “nulled” out, i.e. all reference type members are set to
null(Nothing) and all value types are in turn nulled out. And no, sincestringis a reference type, it does not result in""for strings as suggested in the other answer.Question 3:
No, there’s no way to specify this. There are some threads about this on Stack Overflow already, e.g. here. Jon has posted an excellent explanation why this is.
–jeroen
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, Development, Software Development, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 7.0, VB.NET 7.1, VB.NET 8.0, VB.NET 9.0 | Leave a Comment »
Posted by jpluimers on 2014/01/30
A while ago, I was refactoring some C# 1 code that uses HashTables as a poor mans property bag.
The problem was that I felt my code was convoluted, and should be denser, especially avoiding Convert.ChangeType. My code was already much simpler than casting tuples to a superclass.
So I asked this question on StackOverflow: c# – Is there a solution that feels less clumsy than Convert.ChangeType to get the value from a HashTable – Stack Overflow.
User dasblinkenlight showed it could be shortened and explained why (hyperlinks are mine):
Since System.String is sealed, the expression
genericType.IsSubclassOf(stringType)is the same as
genericType == stringTypeTherefore you do not need a call of Convert.ChangeType: you can cast to T by casting to object, like this:
object stringResult; // Note the change of type to "object" if (haveValue) stringResult = ((string)properties[propertyName]).Trim(); else stringResult = string.Empty; result = (T)stringResult; // It is allowed to cast object to generic T
The original .NET 1.1 code had loads of null checks wrapped if/then/else statements to assign default values for null values.
I wanted to get rid of that, and get code like this: Read the rest of this entry »
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, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2014/01/29
In the .NET/C#: fun with enums and aliases part 1 you saw that an enumerated type can specify an underlying type.
The underlying type is limited to a strict set of built-in C# types: , so you cannot use a CTS type for it.
So you might think that you can only define enumeration values by integer constant like this:
namespace BeSharp
{
enum TwoState
{
False = 0,
True = 1,
}
enum ThreeState
{
False = 0,
True = 1,
Unknown = -1,
}
}
Well, you can do it like this too, since Operations between different enum types are allowed in another enum declaration: Read the rest of this entry »
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, Development, Software Development | Leave a Comment »