The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,861 other subscribers

Archive for the ‘C’ Category

2 More Old Micro Cornucopia issues on BitSavers from 1986 « The Wiert Corner – irregular stream of stuff

Posted by jpluimers on 2015/06/18

Almost two years ago, I wrote “the only issues missing are #28, #30 and #31.”. As of mid May any more:

All of them are from the 5th anniversary year.

–jeroen

via 2 More Old Micro Cornucopia issues on BitSavers from 1986 « The Wiert Corner – irregular stream of stuff.

Posted in 6502 Assembly, Assembly Language, BitSavers.org, C, C++, Development, History, Pascal, Software Development, Turbo Pascal | Leave a Comment »

RosettaCode: cool way to improve your coding skills

Posted by jpluimers on 2015/01/22

Wow: I feel like having lived under a stone for 8 years, as RosettaCode has been alive since it was founded in 2007 by Mike Mol.

The idea is that you solve a task and learn from that, or learn by seeing how others have solved tasks or draft tasks.

So in a sense it is similar to the Rosetta stone: it has different languages phrasing the same tasks.

There are already a whole bunch of languages on RosettaCode (of which a few are in the categories below), and you can even suggest or add your own languages.

When you want to solve tasks, be sure to look at the list unimplemented tasks by language that leads to automatic reports by language (for instance two of the languages I use most often: C# and Delphi).

I’m sure there are lots of programming chrestomathy sites, even beyond the ones, and it feels very similar to programming kata sites.

–jeroen

Posted in .NET, APL, Awk, bash, Batch-Files, C, C#, C++, COBOL, CommandLine, Delphi, Development, Fortran, FreePascal, Java, JavaScript/ECMAScript, Lazarus, Object Pascal, Office VBA, Pascal, Perl, PHP, PowerShell, PowerShell, Prism, Scripting, sed script, Sh Shell, Software Development, Turbo Prolog, VB.NET, VBS, VBScript, Visual Studio and tools, Web Development | Leave a Comment »

The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs

Posted by jpluimers on 2014/04/09

Interesting read:

The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs.

In other words: any language that merges null behaviour in the underlying storage will have a problem somwehere.

So if you want to have true nullable types, your null flag should be stored outside the underlying storage.

The .NET framework 2 and up, most database management systems and many other environment support that.

But most languages don’t support it for pointer types. So there will be portions of address spaces either inaccessible, or only accessible when skipping the null pointer checks.

Note that the thread above contains some very interesting bits, for instance this one:

Matt 28 Mar 2013 5:58 PM #

@MarkY “Dereferencing null is undefined?  Cool!  I thought it was guaranteed to crash, just like a false assertion or something.  So crashing is the OS guarantee, not the language guarantee apparently.”

Nope. It’s not an OS guarantee either. The OS won’t ever normally allocate memory at address zero, but there’s nothing to stop you telling it to. Try doing “VirtualAlloc(1, 4096, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)” on your pre-Windows8 machine.

In fact, this is the reason why null-dereferences in kernel mode are often exploitable as elevation of privilege attacks. The null-page is mappable and within the user-addressable region of memory, so if the kernel dereferences a null pointer, it reads attacker controllable data.

And btw, this is the reason why on Linux and Windows8+ you can’t map the null-page.

–jeroen

via: The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs.

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Borland C++, Borland Pascal, C, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, C++ Builder, Database Development, Delphi, Development, Pascal, Quick Pascal, Software Development, Turbo Pascal, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 8.0, VB.NET 9.0 | Leave a Comment »

Faking num lock, caps lock and scroll lock leds – About My Code

Posted by jpluimers on 2014/01/21

I remember doing this in DOS ages ago (in the Turbo Pascal 5 era) for exactly the same reason: flash the keyboard LEDs to indicate some event was happening, but I’ve yet to find back the source code.

Here is how to do it in Windows using either C# or C: Faking num lock, caps lock and scroll lock leds – About My Code.

–jeroen

via: c# – Way to turn on keyboard’s caps-lock light without actually turning on caps-lock? – Stack Overflow.

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Development, Pascal, Software Development, Turbo Pascal | Leave a Comment »

Cyber-Dojo: practice unit-tested programming in pairs/groups using Katas

Posted by jpluimers on 2013/11/07

Wow, I’ve been living under a stone (:

Just discovered the online Cyber-Dojo by Jon Jagger. It is an online manifestation of a Coding Dojo. Both have been there for years, and I think both are brilliant.

They take the concept of a Dojo as being a place to practice sports like martial arts in a pair or group setting with a series of Katas or practices.

Katas in a Dojo are a means for performing deliberate practice in order to learn new things. For instance, acquire new movement techniques, learn about your balance, gain strength, all in both a physical and mental way.

The aim of both is do more deliberate practice.

When performing Coding and Cyber Dojo, you should use Test Driven Development using pair programming and BabySteps. Those help you to slow down, as one of the Dojo Principles is for Katas to slow down. It reminds me of the “if you are in a hurry, sit down” mantra and is a key part of the Coding/Cyber Dojo Principles too.

The aim is to learn, and part of that is to first un-learn and open you to new thoughts. That’s why it is so cool that the Cyber-Dojo provides you with:

  • a bunch of pre configured programming languages*,
  • preformulated practices** (including a few cyber-dojo refactorings),
  • a small boilter plate to get started.

You’d think they speed you up, but that is not their aim. Like a regular Dojo it gives you an pre-set environment and gives you piece of mind to get started.

The Cyber Dojo does without a Sensei, whose purpose in a Coding Dojo is to ask questions in order to guide the participants.

That’s why it is good to use the Cyber Dojo as part of a Coding Dojo: basically the Cyber Dojo provides a standardizes set of tools to quickly setup a Coding Dojo.

Cyber Dojo languages

(a prime number, so the table is a bit distorted)

C Go PHP
C# Haskell Perl
C++ Java-Approval Python
Clojure Java-Cucumber Ruby
CoffeeScript Java-JUnit Ruby-Rspec
Erlang Javascript

Cyber Dojo practices

Many of the practices come from rosettacode.org.

100 doors Harry Potter Print Diamond
Anagrams LCD Digits Recently Used List
Bowling Game Leap Years Reversi
Calc Stats Mine Field Roman Numerals
Count Coins Monty Hall Tennis
Diversion Number Names Unsplice
Fizz Buzz Phone Numbers Verbal
Game of Life Poker Hands Yahtzee
Gray Code Prime Factors Zeckendorf Number

–jeroen

via:

Posted in .NET, Agile, C, C#, C++, Development, Java, JavaScript/ECMAScript, Perl, PHP, Scripting, Software Development, Unit Testing | 3 Comments »

Interesting SO question: What are the experiences with using unicode in identifiers?

Posted by jpluimers on 2013/10/29

Toon Krijthe posted an interesting question to SO.

Though 5 years old, I think it stilll is very valid one:

At my work, we have decided to stay with the ANSI characters for identifiers. Is there anybody out there using unicode identifiers and what are the experiences?

For all projects I work on (in various Languages like  English, German, Dutch or other), I stick to ASCII characters (not even ANSI) for:

  • file names
  • identifiers

I also try to abstract the non-ASCII strings into places where I am sure that the encoding is preserved (for text files, I prefer UTF-8), or where these characters are properly escaped.

What is your take on this?

–jeroen

via: uniqueidentifier – What are the experiences with using unicode in identifiers – Stack Overflow.

Posted in .NET, Agile, AS/400 / iSeries / System i, C, C#, C++, COBOL, Continuous Integration, Delphi, Development, F#, Prism, Scripting, Software Development, VB.NET, Visual Studio and tools | 4 Comments »

.NET/C#: Igor Ostrovsky wrote a few great MSDN magazine articles helping you write better threading code

Posted by jpluimers on 2013/09/17

Igor Ostrovsky wrote a few very nice MSDN magazine articles. Not all of them have ended up in the list at MSDN magazine, so here is a more complete list:

Though the articles show the majority of sample code in C#, the actual topics are of great interest to any developer writing .NET code or interfacing to it.

Some keywords in his articles: 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, .NET CF, C, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Delphi, Development, F#, LINQ, PLINQ, Prism, 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 »

2 More Old Micro Cornucopia issues on BitSavers from 1986

Posted by jpluimers on 2013/07/17

2 more issues got on-line both close to a 100 pages each:

So the only issues missing are #28, #30 and #31.

–jeroen

via: More Old Micro Cornucopia issues on BitSavers from 1987 and 1988 « The Wiert Corner – irregular stream of stuff.

Posted in Assembly Language, BitSavers.org, C, C++, Development, History, Pascal, Software Development, Turbo Pascal, Turbo Prolog, x86 | Tagged: , | 1 Comment »

Crap: the outsourcing party of the client wrote C-code like this in 2005, and nobody scrutinized it

Posted by jpluimers on 2013/06/12

I was involved in a big project migrating a complex stack from Windows XP to Windows 7 x86, and got scared this !@#$ out of me.

The stack communicated to WebSphere MQ on AS/400 from Windows, and on the Windows side of things consisted of a UI developed in in Cool:Gen, a C interface to a Delphi DLL, which takes care of the communication to WebSphere MQ.

Digression:

This all was histerically grown. In the beginning (early to mid 90s last century) it was a big Borland Pascal/Turbo Pascal application – running on DOS, Windows 3.1x, Windows 95 and OS/2 2.x/3.0 – that talked over a propriatary layer over SNA to AS/400.
The vendor of that layer didn’t respond to a request for Windows NT 4.x compatibility, and meanwhile some client applications were about to be developed in Delphi.

So in 1997/1998 – together with a great AS/400 software developer – I wrote a SNA based APPC/CPI-C communication layer in Delphi 3 that could be accessed from both Turbo Pascal (using a file based interface) and Delphi (using an object interface).
The DOS interface was an executable around the Delphi interface, which was a set of classes.

Delphi part

The Delphi part of the DOS interface was centered around FindFirstChangeNotification/CreateProcess combined with MsgWaitForMultipleObjects/WaitForSingleObject to make the waiting as efficient as possible.

DOS part

DOS part

The DOS part of the Delphi interface was centered around this piece to make waiting efficient:

asm
  int $28
  mov ax, $1000
  int $15 { DESQview/TopView give up time slice }
  mov ax, $1680
  int $2F
end;

Thanks to the RBIL: Ralf Brown’s Interrupt List (there are now multiple HTML versions of it), it makes use of these tricks so DOS applications can efficiently wait : Read the rest of this entry »

Posted in C, CVS, Delphi, Delphi 2006, Delphi 3, Delphi 5, Delphi XE2, Development, Dimensions CM by Serena, MKS Integrity, Software Development, Source Code Management | 3 Comments »

More Old Micro Cornucopia issues on BitSavers from 1987 and 1988

Posted by jpluimers on 2013/04/08

Last quarter, 11 issues of Micro Cornucopia appeared on BitSavers including the final May 1990 issue.

This month, another 7 issues appeared, most of which cover a form of Pascal in one or more of the articles and advertisements:

A fun thing to notice are the advertisements for Modula-2. Logitech Modula-2. Yes though the Logitech Wikipedia page does not mention it at all, Logitech didn’t only sell mice, keyboards and web-cams. They had more products. Being Swiss, they were big in Modula-2. And Bitsavers has a PDF of that too: Logitech_Modula-2_86_1.0_Feb84.pdf

The only issues still to be scanned are #28 till .

–jeroen

via: New Micro Cornucopia issues on BitSavers including the Final May 1990 issue « The Wiert Corner – irregular stream of stuff.

Posted in Assembly Language, BitSavers.org, C, C++, Delphi, Development, History, Pascal, Software Development, Turbo Assembler, Turbo Pascal, x86 | Tagged: , , , , | 2 Comments »