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 ‘.NET’ Category

Elfproef as T-SQL UDF

Posted by jpluimers on 2012/10/09

As a follow-up on my earlier number validation posts (Elf proef in C# and Other number verifications), I found a nice T-SQL version of the Elfproef for Dutch bank account numbers.

It works at least from SQL Server 2000 and up, most likely also in the (unsupported) SQL Server 7.

–jeroen

via: Elfproef als T-SQL UDF.

Posted in .NET, C#, Database Development, Development, Software Development, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7 | Leave a Comment »

Some notes on multi-touch and Windows

Posted by jpluimers on 2012/10/06

While fooling around with Microsoft Surface, you are astonished with the number of fingers it supports: 10 is no problem on the Samsung SUR40 which can also do full HD resolution (more specs here).

Not so with the standard Windows 7 touch support: that has only 2.

As I want to increase that to better mimic the development environment to the actual environment a few notes:

–jeroen

Posted in .NET, Development, Microsoft Surface, Microsoft Surface on Windows 7, Software Development, Windows 7, Windows 8 | Tagged: , , , , , , , , , , , , | 1 Comment »

asp.net – Should the WebInfo file be excluded from SVN – Stack Overflow

Posted by jpluimers on 2012/10/03

When moving a truckload of stuff from Visual Source Crash, I came a long many .webinfo files.

I wasn’t sure they should be in TFS, and indeed they should not:

.webinfo should be excluded. (Some info about webinfo: How to copy and configure ASP.NET projects between different local computers)

–jeroen

via: asp.net – Should the WebInfo file be excluded from SVN – Stack Overflow.

Posted in .NET, ASP.NET, Development, Software Development, Source Code Management, TFS (Team Foundation System) | Leave a Comment »

Portable Library Tools extension: hopefully a Visual Studio 11 studio comes soon

Posted by jpluimers on 2012/10/02

Portable Library Tools extension is a great tool for creating assemblies that run on a variety of .NET platforms without recompilation.

I hope a Visual Studio 11 version of it comes soon.

–jeroen

Posted in .NET, Development, Software Development | Leave a Comment »

Make Selection Uppercase or Lowercase – The Ultimate Visual Studio Tips and Tricks Blog – Site Home – MSDN Blogs

Posted by jpluimers on 2012/09/28

How Upper Lower Comment
Keyboard CTRL + SHIFT + U CTRL + U
Menu Edit -> Advanced -> Make Uppercase Edit -> Advanced -> Make Lowercase
Command Edit.MakeUppercase Edit.MakeLowercase
Versions 2008, 2010, 11

–jeroen

via: Make Selection Uppercase or Lowercase – The Ultimate Visual Studio Tips and Tricks Blog – Site Home – MSDN Blogs.

Posted in .NET, Development, Keyboards and Keyboard Shortcuts, Power User, Software Development, Visual Studio 11, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools | Leave a Comment »

Other number verifications (via: Things I tripped over when implementing the “Elf proef”: digit check for Dutch bank account numbers and social security numbers (bankrekeningnummer, BSN/Sofinummer)

Posted by jpluimers on 2012/09/27

EAN (GLN,GTIN, EAN numbers administered by GS1)

Related:


/**
* This is a data provider for the above Unit-test.
*/
public function provider()
{
  return array(
    array('', null), // Empty
    array('0', null), // Empty
    array(' ', null), // Empty
    array('NOT-NUMERIC', null),
    array('77676656', null), // Invalid EAN8 - we do not validated EAN8 at this time.
    array('123456789999', '0123456789999'), // Upc valid, translated to EAN
    array('5031366016409', '5031366016409'),
    array('99802618537', '0099802618537'),
    array('99802469443', '0099802469443'),
    array('58231298109', '0058231298109'), // Too short but valid ean, needs zeros padding.
  );
}

via Ean13.php – yinyang – YinYang Zend Framework Supplement Library – Google Project Hosting.

Edit 20210402: this library has since moved without commit history from Google Code to GitHub with new source code file at [Wayback/Archive.is] yinyang/Ean13.php at master · henryhayes/yinyang.

YinYang Zend Framework Supplement Library

YinYang is a library of classes. Generally anything that is created in addition to Zend Framework and can be reused will be included in this library. YinYang requires Zend Framework as most of the classes extend ZF.

To use, simply checkout a copy, add the library/YinYang folder to your library folder and add YinYang to your list of autoloader namespaces.

Old:

New:

–jeroen

via: Things I tripped over when implementing the “Elf proef”: digit check for Dutch bank account numbers and social security numbers (bankrekeningnummer, BSN/Sofinummer) « The Wiert Corner – irregular stream of Wiert stuff.

Posted in .NET, Barcode, C#, C# 3.0, C# 4.0, C# 5.0, Development, EAN, Software Development | 1 Comment »

Generating a WordPress posting categories page – part 3

Posted by jpluimers on 2012/09/26

Notes:

Log, Ln, Lg, Log10, LogE, Ld

Common logarithm – Wikipedia, the free encyclopedia.

Exponential_and_logarithmic_functions ISO 31-11 – Wikipedia, the free encyclopedia.

Binary logarithm – Wikipedia, the free encyclopedia.

What is logarithm(log, lg, ln).

Common Logarithms.

Why Use a Logarithmic Scale to Display Data Math Forum – Ask Dr. Math.

STRAIGHT LINE ON ARITHMETIC GRAPH PAPER (LINEAR FUNCTION)

http://www.humboldt.edu/geology/courses/geology531/531_handouts/equations_of_graphs.pdf

Font sizes

CSS font-size property.

Five simple steps to better typography – Part 4 | Mark Boulton.

A List Apart: Articles: How to Size Text in CSS.

–jeroen

Via: Generating a WordPress posting categories page – part 2 « The Wiert Corner – irregular stream of Wiert stuff.

Posted in .NET, C#, C# 4.0, C# 5.0, Development, Software Development, Web Development, WordPress | Leave a Comment »

Please fellow programmers, name variables more properly.

Posted by jpluimers on 2012/09/25

The code I had a hard time understanding

The below code didn’t compile during a .NET 1.1 to 4 migration.

Downstream code:

Word.Document document = app.Documents.Add(ref FileName, ref missing, ref missing, ref missing);

Upstream code (6 layers up!):

string filename = Path.Combine(ConfigurationSettings.AppSettings["MSWordTemplateDirectory"], (string)status["CoverLetter"]);

And somewhere in the middle:

public bool GenerateLetter(Word.Application app, DataRow row, object FileName, object FilePathAndName)

Afterwards the code is this

Downstream code:

Word.Document document = app.Documents.Add(ref templateFileName, ref missing);

Upstream code (6 layers up!):

templateFileName = Path.Combine(ConfigurationSettings.AppSettings["MSWordTemplateDirectory"], (string)status["CoverLetter"]);

And somewhere in the middle:

public bool GenerateLetter(Word.Application app, DataRow row, object templateFileName, object documentFileName)

Coincidentally, parameters are now all lowercase.

–jeroen

Posted in .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

“tfpt treeclean /exclude:*.suo,*.user” is what I use most (and recommend this thread: Does any tool exist to help Sync a directory with TFS? – Stack Overflow)

Posted by jpluimers on 2012/09/20

This post describes the TFS workspace cleanup features Treeclean and Scorch.

Both are not in the Visual Studio UI nor TFS tool, but are available form the ftpt command from the optional Team Foundation Power Tools package.

The main reason you need these two features is that TFS does not always clean up after it self when you perform get latest. For instance renamed directories, as well as bin and obj directories are not automatically removed.

The tfpt command I most often use this this one:

tfpt treeclean /exclude:*.suo,*.user

This deletes files from your local TFS workspace directory tree that are not in the source control system, but skips the *.suo and *.user files.

Tfpt also allows you to scorch files from your TFS.

So my second most used tfpt command is scorch in either of the two below forms:

tfpt scorch /recursive /diff
tfpt scorch /recursive /diff /exclude:*.suo,*.user

The first form is for the automatic build environment, the second for my normal development workspace.

Below is the explanation of treeclean and scorch.

First some other great commands from this StackOverflow answer by Martin Woodward:

Not quite, however you might want to download the TFS Power Tools and check out the command line utility tfpt.exe.

The “tfpt online” and “tfpt treeclean” might be most useful to you when working outside of an integrated TFS client. tfpt online will look for files in your local directory that are not under version control, treeclean will show you files in your local directory that are not under version control so that you can remove then if they are not required.

Scorch versus Treeclean

Scorch does more than Treeclean.

I use Treeclean for 90% of my normal workspace work, Scorch (with exclude) for about 10% of the time in my regular workspace.
For my CCnet build integration workspace, I only use Scorch (without exclude).

Treeclean just cleans the tree of stuff that is not in TFS:

B:\MasterWorkingDir>tfpt treeclean /?
tfpt treeclean - Delete files and folders not under version control

Usage: tfpt treeclean [/exclude:filespec1,filespec2,...] [filespec...]
[/recursive] [/batchsize:num] [/noprompt [/preview]]

Scorch does more work: at the end, both source control and the local disk situation are identical.

B:\MasterWorkingDir>tfpt scorch /?
tfpt scorch - Ensure source control and the local disk are identical

Your local disk will be scanned for:
 (1) items that are not in source control
 (2) items which are different on disk from the workspace version
 (3) items which are in the workspace but are missing on disk
Items not in source control will be deleted from disk, just as with the
 tfpt treeclean command. Items determined to be different on disk from the
 workspace version will be redownloaded from the server. Items missing on
 disk will also be redownloaded. Items with pending changes are exempted.

By default, items deleted from your local disk (#3 above) will not be
scanned for, and local items are determined to be identical/different from
the workspace version *solely by examining the read-only bit on the file*.

To redownload items deleted from your local disk (#3 above), supply the
/deletes option. To detect items which are different from the workspace
version but still have their read-only bit set (+R), supply the /diff option.
When using either or both of these options, tfpt scorch runs more slowly.

Usage: tfpt scorch [/exclude:filespec1,filespec2,...] [filespec...]
[/recursive] [/batchsize:num] [/noprompt [/preview]]
[/deletes] [/diff]

The commandline options are also different.

Scorch has these extra when compared to Treeclean:

/batchsize:num Set the batch size for server calls (default 500)
/deletes Detect and replace items missing from the local disk
/diff Use MD5 hashes to compare items with source control

Treeclean can have these options:

/noprompt Operate in command-line mode only
/exclude:filespec[,..] Files and directories matching a filespec in this list
are excluded from processing
/preview Do not make changes; only list the potential actions
/recursive Switch from one level of recursion to full recursion
/batchsize:num Set the batch size for server calls (default 500)
filespec... Only files and directories matching these filespecs
are processed

Scorch can have these options:

/noprompt Operate in command-line mode only
/exclude:filespec[,..] Files and directories matching a filespec in this list
are excluded from processing
/preview Do not make changes; only list the potential actions
/recursive Switch from one level of recursion to full recursion
/batchsize:num Set the batch size for server calls (default 500)
filespec... Only files and directories matching these filespecs
are processed

–jeroen

via:

Posted in CodePlex, Development, Software Development, Source Code Management, TFS (Team Foundation System), Visual Studio 11, Visual Studio 2002, Visual Studio 2003, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools | 4 Comments »

On my research list: AsyncBridge (adds C#5 async features for .NET 4 projects)

Posted by jpluimers on 2012/09/18

Having a done a lot of Async stuff in the .NET 2, 3.x and 4 era with multimedia applications (oh, the days of SynchronizationContext), this project seems very interesting:

AsyncBridge

Adds the new C#5 async features for .NET 4 projects

Download this project as a .zip file
Download this project as a tar.gz file

What does it do?

AsyncBridge lets you use the VS 11 C#5 compiler to write code that uses the async and await keywords, but to target .NET 4.0. It was published by Daniel Grunwald (from SharpDevelop) here.

As an extra, I’ve thrown in the new C#5 caller info attributes, which lets you automatically add the method name, line number or file path to your code.

Authors and Contributors

Daniel Grunwald (@dgrunwald) – Original code.

Omer Mor (@OmerMor) – Turned it into a full blown github repo with the complimentary nuget.

Alex Davies (@alexdavies74) – Wrote the blog post that inspired this, and is actively improving the code.

–jeroen

via: AsyncBridge.

Posted in .NET, .NET 4.5, C#, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »