Programming

Crack C# namespaces in 30 seconds

The namespaces conception in C# seems to be exhaustive and insufficient at the same time compared with a strong module notation in Oberon-2 and even with a modular programming approaches in Free Pascal/Delphi.

Why insufficient? You cannot declare constants and functions within namespaces but you should add a class with constant field or static method for it.

Why exhaustive? The using directive with such introduced classes is the source of unexpected errors. Here is an example below.

Fast inserting a file into a table

How to insert fast a file (i.e. binary one) from disk to a SQL Server table?

Certainly the SQL Server account should have a corresponding permissions to access the file on the disk. For example I take the file C:\WINDOWS\system32\oembios.bin having the size about 12 MB. For really big files you'd better switch to the FILESTREAM approach.

SQL: generate date/time series

There are many examples of user defined table functions generating the series of dates(times) between two specified values. Usually, in OLAP you can see a table filled by the date/time series, too. Such table avoid to generate the values "on the fly".

However, in some cases you may be unable to use an UDF or a table. Fortunately, "pure SQL" method still works.

Suppose, the start and finish dates are specified as entry parameters. The transact SQL code below generates the series "moth by month".

Pages

Subscribe to RSS - Programming