• Нет пользователя
Войти Зарегистрироваться

Навигация

Итоги года

Другие ссылки


Реклама

Счётчики


<- Предыдущие записи

TypeScript vs. C#: LINQ

19.04.2018 Четверг 22:41

Nice summary of Typescript equivalents of C#'s LINQ functions:

https://decembersoft.com/posts/typescript-vs-csharp-linq/

Доктор, меня все игнорируют (нет комментариев)

PowerShell and latest .NET

20.01.2015 Вторник 00:04

To force PowerShell use latest .NET Framework:

reg add hklm\software\microsoft\.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1
reg add hklm\software\wow6432node\microsoft\.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1

To find out what .NET version PowerShell is currently using, type this:

$PSVersionTable

Доктор, меня все игнорируют (нет комментариев)

SQL Server instances list

20.01.2015 Вторник 00:02

To see the list of SQL Server instances installed on the machine, use registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

If you are looking for 32 bit instances on a 64 bit OS, you will need to look here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL

via blogs.msdn.com

Комментариев: 7

Implicit dependencies

13.06.2013 Четверг 18:36

When you work on a C# solution, sometimes it's quite easy to find dependencies between parts of the solution. For example, to find all uses of a class, in Visual Studio you just have to right-click on its name and select "Find all references". But sometimes dependencies and relationships are not that easy to find. Here i decided to list cases which may require special attention when you are refactoring your code and don't want to introduce breaking changes. This is based on my personal work experience.

1.Unity framework may introduce implicit dependencies. Once I was investigating a class and was trying to locate the place in the code where constructor of the class was being called. However, the Find all references feature did not yield ANY results. Which puzzled me much, because I knew the class WAS working and therefore its constructor had to be called somewhere. It turned out eventually that the constructor, even though it wasn't parameterless, was being called implicitly by the Unity framework. This was made possible by registering all types used as parameters of the constructor with Unity prior to use of the class.

So, if you use Unity (or may be some other IoCC), check if types of all parameters of the constructor are registered with Unity. If this is the case, the constructor might be called implicitly from inside the Unity framework.

2.Consider the scenario where you are refactoring your code by simply renaming classes, methods or properties. You are pretty sure you have accounted for all places where those names are used. Otherwise the project would simply not build, right? Wrong. A class may be used in a serialization/deserialization procedures when communicating with external parties, e.g. in WCF or RESTful service scenarios. In this case, the solution WILL compile, but at runtime you will get an error (or even worse, silent bug) when your code tries to deserialize a message received from an external party where they did not do the matching renamings.

So, when you rename anything, make sure it is not used in serialization/deserialization. If it's not, you are free to rename. If it is, you'll have to coordinate your refactoring with the party or perties that send you or receive from you serialized messages.

I will be adding more things like these here as soon as I discover or get to know about them.

Доктор, меня все игнорируют (нет комментариев)

How to identify version of SQL Server

15.11.2010 Понедельник 15:03

How to identify version of SQL Server:

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
via http://support.microsoft.com/kb/321185

Доктор, меня все игнорируют (нет комментариев)

OPENROWSET fails to import some data from Excel file

15.04.2010 Четверг 16:09

Context: SQL Server 2008, Excel 2007

When importing Excel data into SQL Server using OPENROWSET, if a column has 'mixed' data, i.e. it contains both numeric AND text values, not of all of that data may make it to the SQL Server. The reason lies in how the database driver works. It uses first several rows of the Excel file to determine type of values in columns. It then uses the infered type to import all values. BUT. If while importing it encounters a value that can be resolved to a different type, the driver just returns NULL for that value! Which gets inserted into the table in SQL Server.

To remedy this there are two things that need to be done:

1.Put "IMEX=1" into the provider string. This option tell to handle columns with mixed content (numeric and text) always as text.

The query should look like this:

SELECT * FROM OPENROWSET
('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Fee_matrix.xls;IMEX=1;',
'SELECT * FROM [tProduct$]')
2.Set the following value in the system registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel\TypeGuessRows = 0

This setting determines exactly how many rows at the beginning of the Excel file does the driver consider to determine the type of the values in the column. Zero means "use ALL rows". Be aware that this may affect performance if your Excel file is big.

P.S. Also, the OPENROWSET queries may not work right away. The following may help:

- Open SQL Server Mgmt Studio
- Right-click the server
- Facets
- Facet: Surface Area Configuration
- AdHocRemoteQueriesEnabled: True
- Ok your way out of the dialogs

Доктор, меня все игнорируют (нет комментариев)

SQL 2008 Management Studio -> SQL 2005 instance issue

30.12.2009 Среда 13:00

When you connect to to a SQL Server 2005 instance using SQL Server 2008 Management Studio you may get an error about some permissions being lacked for a database when you're trying to enumerate databases. Here's a workaround:

1. Navigate to 'Databases' in OE and open OED in that context
2. Right click on the column header and unselect 'Collation'
3. Refresh the server in OE and enumerate the databases

(C)opied from here.

Glossary:
OE — Object Explorer
OED - Object Explorer Details (invoked View -> Object Explorer Details or just by F7)

Доктор, меня все игнорируют (нет комментариев)

SecurityAction

12.10.2009 Понедельник 19:05

Context: .Net Framework 2.0

Meaning of the members of the System.Security.Permissions.Security.Action enumeration:

RequestMinimum

Means "I need this permission". Application does not start if the assembly does not have the specified permission.

RequestOptional

Means"I don't need any permissions other than this one". Application starts and runs, but whenever a permission other than the specified one is requsted, an exception is thrown.

RequestRefuse

Means "I don't need this permission". Application starts and runs, but whenever the specified permission is requested, an exception is thrown.

Доктор, меня все игнорируют (нет комментариев)

ChangeConflictException in UPDATE

25.08.2009 Вторник 17:21

Context: LINQ-to-SQL

Symptoms:

ChangeConflictException while doing UPDATE:

Row not found or changed
OR
1 of 2 updated failed

If you look into the SQL Server profiler you see a weird UPDATE statement ending with "WHERE 0 = 1".

Cause:

Most often these errors are caused by a mismatch between the database and the LINQ-to-SQL data model representation of the database.

Доктор, меня все игнорируют (нет комментариев)
<- Предыдущие записи