Ropes I Know

September 13, 2009

.NET – Discoveries

Filed under: .NET, Computer, Programming Languages — Tags: , — Yeti @ 8:45

ApplicationContext Class (System.Windows.Forms)

.NET Framework Class Library
ApplicationContext Class

Specifies the contextual information about an application thread.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Even after several years of heavy C# / .NET – programming, I occasionally stumble upon something I have long since implemented a replacement method, only to discover that there is a class and and a standard method to do this. This standard method often proves to be a one-to-three – liner whereas I have hacked together a class hierarchy of several hundred lines-of-code.

And hey, sometimes it even works and if not, I have always learned quite a lot.

I know, sometimes people consider this trial and error method “Cargo Cult Programming”, but if I afterwards discover how it should be done, and realize that I’ve hacked in the right direction and have learned the “standard” method.

Does any of that make any sense to anyone?

P/Invoke the easy way

Filed under: .NET, Computer, Programming Languages — Tags: — Yeti @ 8:30

pinvoke.net: the interop wiki!

A wiki for .NET developers

PInvoke.net is primarily a wiki, allowing developers to find, edit and add PInvoke* signatures, user-defined types, and any other information related to calling Win32 and other unmanaged APIs from managed code (written in languages such as C# or VB.NET).

.NET developers worldwide can easily contribute to the community, sharing their valuable knowledge, whenever they have time to do so.

August 10, 2008

C# (or .NET) Really Helps

Filed under: .NET, Computer, Programming Languages — Tags: , , , — Yeti @ 7:25

Some time ago, I realized why I really like C# (or .NET, for that matter), now I decided to try and put it into words.

I program a lot. I mean, an awful lot, really. Just as a brick-layer layers an awful lot bricks, because that’s what he does all day. Modularity has always been one of my concerns, but it never really worked up to the point of really reusing code. I mean reuse as in: just use it again. Full-stop. And not, “oh, I did something similar some time ago, I’ll just copy ‘n paste this stuff into this project and adapt it to my current needs”.

Curiously enough, since I started to rely heavily on managed code and, more specifically, on C# instead of good-ole C++, ever more pieces have started to fall into ever more places where they seem to fit … (more…)

July 21, 2008

That pile of shit again …

Filed under: Computer, Programming Languages — Tags: , , — Yeti @ 23:54

This post is in reference to the “Visual C++ Team Blog

Just a short quote as a teaser:

At first glance it does appear that the user is correct – but looks can be deceiving. Just because the string class has a converting-constructor from a string-literal doesn’t mean that the compiler has to use it. For the first argument to the function call, the conversion is straight forward – both of the candidate functions expect a string and so the compiler will use the provided converting constructor to convert the string-literal to an instance of the string class. The second argument is not so straight forward. For the first function the compiler can again use the converting-constructor, but for the second function it can use the standard pointer-to-bool conversion to convert the string-literal (which the compiler will consider as type “const char*”) to bool. As this is a standard conversion, the C++ Standard considers this conversion to be cheaper than calling the converting-constructor (which is a user-defined conversion) and hence the second function is a better match than the first function and the compiler, correctly, calls that function.

No need for me to comment on this. ’nuff said.

April 5, 2008

Why C Is a Pile of Shit

(edited for code-readability)

Consider this:

#include
int main()
{
unsigned int u1 = 1;
unsigned int u2 = 1;
int k;
for (k=-u1; k

Create a free website or blog at WordPress.com.