Home Home    Forum    Blog    Feed your aggregator (RSS 2.0)

The Johnnynine Weblog - .NET
A weblog by Johnny Hughes
 
 Tuesday, December 02, 2008

Wondering how the different .NET versions really fit together?  Scott Hanselman gives a good rundown in his How to set an IIS Application or AppPool to use ASP.NET 3.5 rather than 2.0 article.

Tuesday, December 02, 2008 4:34:44 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET | Technical  | 
 Wednesday, November 05, 2008

MSBUILD can give the following error message when compiling using a UNC path:

Error: Could not load file or assembly 'YOURASSEMBLYHERE' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)
              - Required permissions cannot be acquired.

C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1892,9): error MSB6006: "sgen.exe" exited with code 1.

This occurs when MSBUILD executes sgen.exe to build the optional XmlSerializers.dll assembly.

 

There are at least 3 ways to work around this error:

  1. Don't use a UNC path when compiling.
  2. In the project properties Build tab, Set 'Generate serialization assembly' to Off.
  3. Use caspol.exe to grant full trust to the UNC path. See Running a .Net application from a network share.
Wednesday, November 05, 2008 10:00:33 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET | Technical  | 
 Tuesday, October 21, 2008

To determine an Oracle database's character set:

select value from nls_database_parameters where parameter='NLS_CHARACTERSET'

 

UTF8 was the UTF-8 encoded character set in Oracle8 and 8i.

AL32UTF8 is the UTF-8 encoded character set introduced in Oracle9i.

 

VB6 reports UTF8 characters as 3 bytes, and AL32UTF8 characters as 4 bytes.

 

How "character-based" sizing in Oracle works

It requires setting an instance or session parameter (e.g., alter session set NLS_LENGTH_SEMANTICS = 'CHAR';).  This is available starting in 9i.  Then, subsequent column declarations such as VARCHAR2(10) really mean 10 characters and not 10 bytes.  You can also be explicit on the declaration by saying VARCHAR2(10 CHAR), but that is not as flexible obviously (because it will always mean CHAR even if the database is currently set to default to BYTE).

When doing a DESC command, the keyword "BYTE" or "CHAR" only shows up in the parentheses (as in your dump below) if the table is declared in the mode opposite what your current SQL*Plus session is set to.

 

Writing East Asian characters languages (such as Japanese)

In order for a VB6 or .Net application to write Japanese characters to an Oracle UTF8 database, the East Asian language files must be installed on the machine running the application that writes to the database.  This is done in XP and Windows 2003 from Start->Control Panel->Regional and Language Options->Language tab.  If they are not installed, no error will occur but the Japanese characters will be written as question marks.  It is unclear why this is the case however it has been confirmed with a UTF8 Oracle database, VB6 and .Net applications, and Japanese characters.  It is assumed that this applies to all East Asian languages as well as AL32UTF8 databases.

 

Snippet from an Oracle document describing these character sets' support and origin:

~~~~~~~~~~~~~~~ begin snip ~~~~~~~~~~~~~~~

UTF8

UTF8 was the UTF-8 encoded character set in Oracle8 and 8i. It followed the Unicode 2.1 standard between Oracle 8.0 and 8.1.6, and was upgraded to Unicode version 3.0 for versions 8.1.7, 9i and 10g. To maintain compatibility with existing installations this character set will remain at Unicode 3.0 in future Oracle releases. Although specific supplementary characters were not assigned to Unicode until version 3.1, the allocation for these characters were already defined in 3.0. So if supplementary characters are inserted in a UTF8 database, it will not corrupt the actual data inside the database. They will be treated as 2 separate undefined characters, occupying 6 bytes in storage. We recommend that customers switch to AL32UTF8 for full supplementary character support.

AL32UTF8

This is the UTF-8 encoded character set introduced in Oracle9i. AL32UTF8 is the database character set that supports the latest version (4.01 in Oracle 10.2) of the Unicode standard. It also provides support for the newly defined supplementary characters. All supplementary characters are stored as 4 bytes. AL32UTF8 was introduced because when UTF8 was designed (in the times of Oracle8) there was no concept of supplementary characters, therefore UTF8 has a maximum of 3 bytes per character. Changing the design of UTF8 would break backward compatibility, so a new character set was introduced. The introduction of surrogate pairs should mean that no significant architecture changes are needed in future versions of the Unicode standard, so currently the plan is to keep enhancing AL32UTF8 as necessary to support future version of the Unicode standard. For example in Oracle 10.1 this character set implemented the Unicode 3.2 standard, in Oracle 10.2 that has been updated to support the Unicode 4.01 standard.

~~~~~~~~~~~~~~~ end snip ~~~~~~~~~~~~~~~

Tuesday, October 21, 2008 11:14:47 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET | Database | Oracle | Technical  | 
 Thursday, September 27, 2007

Although there is a relative Reference HintPath in the .csproj file, when you move a solution to a different machine, the hint path may not be correct for that machine.  An easy way to get around this problem is to just ensure that your needed assembly is in the Public Assemblies folder: Program Files\Microsoft Visual Studio .NET\Common7\IDE\Public Assemblies.  Of course this should really only be done when you don't make any changes to the referenced assembly, such as a 3rd party dll.

 

A good summary: http://blogs.msdn.com/manishagarwal/archive/2005/09/28/474769.aspx

 

From: http://msdn2.microsoft.com/en-us/library/8y13ka7c(VS.80).aspx

When the project system finds an assembly reference, it resolves the reference by looking in the following locations, in the following order:

1. The project directory. The project directory files appear in Solution Explorer when Show All Files is not in effect.
2. Directories specified in this dialog box.
3. Directories displaying files in the Add Reference Dialog Box.
4. The project's obj directory. (Any assemblies created as a result of adding a COM reference to your project are added to the project's obj directory.)

From: http://msdn2.microsoft.com/en-us/library/wkze6zky(VS.80).aspx

To display an assembly in the Add Reference dialog box

* Move or copy the assembly to one of the following locations:

o The current project directory (you can find these assemblies using the Browse tab).
o Other project directories within the same solution (you can find these assemblies using the Projects tab).
o The Public Assemblies folder: Program Files\Microsoft Visual Studio .NET\Common7\IDE\Public Assemblies; (you can find these assemblies on the .NET tab).

* Set a reference path to the directory containing the assembly using the Reference Paths Dialog Box (Visual Basic) or the Reference Paths Page, Project Designer (C#, J#).
* Set a registry key that specifies the location of assemblies to display:

Add one of the following registry keys, where <AssemblyLocation> is the directory of the assemblies that you want to appear in the Add Reference dialog box, for example, C:\MyAssemblies\.

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\<version>\AssemblyFoldersEx\MyAssemblies]@="<AssemblyLocation>"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\<version>\AssemblyFoldersEx\MyAssemblies]@="<AssemblyLocation>"

Thursday, September 27, 2007 11:49:54 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET  | 
 Saturday, November 11, 2006
This is a Visual Studio 2003 error that i have received.

To fix this...

1. In the Internet Explorer, select the "Tools" Menu, then select "Internet Options".

2. Select the "Security" Tab in the new window.

3. Select the "Internet" globe icon.

4. Click the "Custom Level..." button at the bottom.

5. Locate the "User Authentication" section (it is at the bottom in IE7).

6. Select "Automatic logon with current username and password".

7. Click "Ok" twice to complete.

Saturday, November 11, 2006 3:03:17 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET  | 
 Monday, July 25, 2005

I always forget the lifecycle of custom server control classes with respect to web page, ie. aspx file.

The following results are based on a drop down list custom control:

customcontrol - Constructor
customcontrol - OnInit - Enter
customcontrol - OnInit - Exit
webpage - OnInit - Enter
webpage - OnInit - Exit
webpage - Page_Load - Enter
    customcontrol - could be altered here in page load, causing some event to fire
webpage - Page_Load - Exit
customcontrol - OnLoad - Enter
customcontrol - OnLoad - Exit

POSTBACK:

customcontrol - Constructor
customcontrol - OnInit - Enter
customcontrol - OnInit - Exit
webpage - OnInit - Enter
webpage - OnInit - Exit
customcontrol - LoadViewState - Enter
customcontrol - LoadViewState - Exit
webpage - Page_Load - Enter
webpage - Page_Load - Exit
customcontrol - OnLoad - Enter
customcontrol - OnLoad - Exit

customcontrol - OnSelectedIndexChanged - Enter
    webpage - xx_SelectedIndexChanged - Enter
        customcontrol - could be altered here in page load, causing some event to fire
    webpage - xx_SelectedIndexChanged - Exit
customcontrol - OnSelectedIndexChanged - Exit

Monday, July 25, 2005 10:39:23 PM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET  | 
 Tuesday, July 12, 2005

Here is the lifecycle of a Windows Service from .Net

--Clicked Start from gui
Main()
Service1() Constructor
InitializeComponent()
OnStart()
--END Clicked Start from gui


--Clicked Restart from gui (looks just like clicking stop and then start)
OnStop()
Dispose()
Main()
Service1() Constructor
InitializeComponent()
OnStart()
--ENDClicked Restart from gui (looks just like clicking stop and then start)


--Clicked Stop from gui
OnStop()
Dispose()
--END Clicked Stop from gui


--Ran from VS.NET by hitting "Play" button and only calling "(new Service1()).OnStart(args);" from Main().
Main()
Service1() Constructor
InitializeComponent()
OnStart()
Dispose()
--END Ran from VS.NET by hitting "Play" button and only calling "(new Service1()).OnStart(args);" from Main().

Tuesday, July 12, 2005 9:47:35 AM (US Mountain Standard Time, UTC-07:00)  #    Comments [0]   .NET  | 
Copyright © 2010 Johnny Hughes. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.