I think I understand strong typing , but every time I look for examples for what is weak typing I end up finding examples of programming languages that simply coerce/convert types automatically.
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Monday, June 11, 2012
Seeking clarification on apparent contradictions regarding weakly typed languages
Does inverting the "if' improve performance?
I've been using ReSharper for a while now and sometimes it suggests that I invert the if . I guess an example would be a better explanation of my situation:
Proper use of the IDisposable interface
I know from reading the MSDN documentation that the "primary" use of the IDisposable interface is to clean up unmanaged resources.
What is the proper way to check for null values?
I love the null-coalescing operator because it makes it easy to assign a default value for nullable types.
What is the correct way to create a single instance application?
Using C# and WPF under .net (rather than WindowsForms or console), what is the correct way to create an application that can only be run as a single instance? I know it has something to do with some mythical thing called a mutex, rarely can I find someone that bothers to stop and explain what one of these are.
WPF image resources
I come from a mostly web and a little bit Windows Forms background. For a new project, we will be using WPF. The WPF application will need 10 - 20 small icons and images for illustrative purposes. I am thinking about storing these in the assembly as embedded resources. Is that the right way to go ?
Sunday, June 10, 2012
Access to Modified Closure
string [] files = new string[2];
files[0] = "ThinkFarAhead.Example.Settings.Configuration_Local.xml";
files[1] = "ThinkFarAhead.Example.Settings.Configuration_Global.xml";
//Resharper complains this is an "access to modified closure"
for (int i = 0; i < files.Length; i++ )
{
// Resharper disable AccessToModifiedClosure
if(Array.Exists(Assembly.GetExecutingAssembly().GetManifestResourceNames(),
delegate(string name) { return name.Equals(files[i]); }))
return Assembly.GetExecutingAssembly().GetManifestResourceStream(files[i]);
// ReSharper restore AccessToModifiedClosure
}
What are the true benefits of ExpandoObject?
The ExpandoObject class being added to .NET 4 allows you to arbitrarily set properties onto an object at runtime.
Why do enum permissions often have 0, 1, 2, 4 values
Why are people always using enum values like 0, 1, 2, 4, 8 and not 0,1,2,3,4 ?
Why huge performance hit 2048x2048 array versus 2047x2047?
I am making some matrix multiplication benchmarking, as previously mentioned in Why is matlab so fast in matrix multiplication?
File Upload Asp.net Mvc3.0
I want to upload an excel file in asp.net mvc3.0. How can I upload the file using html input file control.
How do I code a Mono Daemon
I'm trying to write a Mono C# daemon for linux.
I'd like to do a starts and stops of it when its done processing instead of just killing the process.
Can"t get ScriptManager.RegisterStartupScript in WebControl nested in UpdatePanel to work
I am having what I believe should be a fairly simple problem, but for the life of me I cannot see my problem. The problem is related to ScriptManager.RegisterStartupScript, something I have used many times before.
Friday, June 8, 2012
Overengineering - How to avoid it
Sometimes I find myself designing my classes for a certain project. I start with some entities, some interfaces, but after some time I think:
Joins are for lazy people?
I recently had a discussion with another developer who claimed to me that JOINs (SQL) are useless. This is technically true but he added that using joins is less efficient than making several requests and link tables in the code (C# or Java).
Why does C# forbid generic attribute types?
This causes a compile-time exception:
public sealed class ValidatesAttribute<T> : Attribute
{
}
[Validates<string>]
public static class StringValidation
{
}
Are there any suggestions for developing a C# coding standards / best practices document?
I'm a recent AI graduate (circa 2 years) working for a modest operation. It has fallen to me (primarily as I'm the first 'adopter' in the department) to create a basic (read useful?) C# coding standards document.
Simple 2 way encryption for C#
I'm looking for very simple encrypt and decrypt functionality for some data. It's not mission critical. I need something to keep honest people honest, but something a little stronger than ROT13 or Base64.
Tuesday, June 5, 2012
Protect .NET code from reverse engineering?
Obfuscation is one way, but it can't protect from breaking the piracy protection security of the application. How to make sure that the application is not tampered with, and how to make sure that the registration mechanism can't be reverse engineered. Also it is possible to make to convert C# app in native code, Xenocode is too costly.
Best practices to parse xml files?
The default methods for dealing with xml in c# seem incredibly crude to me, leading me to suspect that I must be missing something in my searches. What is considered the standard best practices to parse xml files in c#?