Good article with some videos that show you how to get started with Silverlight 2.0 in Visual Studio 2008: http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2644
Well.. here it is... my BLOG! Started out being mostly used for dropping bookmarks - links to good sites relating to my current interests. Now even with some code samples and comments about interesting pages.
2009-03-25
Microsoft Patterns and Practices: Application Architecture Guide 2.0a
I came across this excellent book while surfing yesterday: Application Architecture Guide 2.0a. It seems to be very good, taking into consideration most of the aspects of an application Architecture. It has a "Fast Track" chapter that summarises different patterns and practices, and when to use what. This chapter has references to the other chapters if one needs to go deeper in.
Best of all: the book is free! The book can be downloaded as PDF from CodePlex: http://www.codeplex.com/AppArchGuide/Release/ProjectReleases.aspx?ReleaseId=20586
I just discovered that there is a presentation available that summarises much of the book: http://apparch.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=17700
The book may be a little outdated with regards to the latest developments in O/RM (Entity Framework / NHibernate etc.) and maybe some other places as well, but it gives an excellent overview, and tries to be technology-agnostic.
2009-03-24
Entity Framework episodes on DNRTV!
Intro/getting started:
http://www.dnrtv.com/default.aspx?showNum=117
Using EF with applications:
http://www.dnrtv.com/default.aspx?showNum=118
2009-03-21
Linq Flavors
I am reading up on Linq, and see that there are a few types of Linq implementations. like for instance LinqToSharePoint or Linq ToFlickr. Reading this makes me think of a few other that could be useful:
- LinqToWikipedia - for querying for information in an application
- LinqToLiveSearch (…or Google?)
- LinqToFacebook
- LinqToLiveEarth (... or Google Maps) - for finding places
2009-01-16
Mapping Cargos to Objects returned from a Web Service using Reflection
Background:
When working with webservices, we wanted to use a common library of cargo objects that would be used for sending data between the tiers of the application. The Middleware tier has all the web references, and also has methods that encapsulate the web references objects, essentially wrapping them to common cargo objects. After all, we would not like to have dependencies to types that are defined in the auto-generated web service proxies.
One way:
One way of creating the cargo objects is to copy the code for the classes from the Reference.cs file into the common cargo objects assembly. Then you could wrap the objects from the web service dependent object to the common cargo objects which would then be passed to the application tier.
Problem:
It's a lot of work to type all the code for wrapping the objects...
Solution:
Since the cargo objects have the same properties as the web service proxy objects with the same names, it is possible to do the wrapping by using reflection, for instance using a method like this:
private void wrapToCargo<T,U>(T source, U cargo)
{
//Gets all properties from the source object...
PropertyInfo[] props = source.GetType().GetProperties();
//Loops the properties...
for(int i = 0; i < props.Length; i++)
{
//Checks if a property with the same name is present on both the source and the cargo,
// and if the property is writeable.
string name = props[i].Name;
if (source.GetType().GetProperty(name) != null && cargo.GetType().GetProperty(name) != null && cargo.GetType().GetProperty(name).CanWrite)
{
//If so, set value of the cargo property to the value of the source property.
cargo.GetType().GetProperty(props[i].Name).SetValue(cargo, source.GetType().GetProperty(props[i].Name).GetValue(source, null), null);
}
}
}
Alas, this generic way of wrapping cargos comes at a cost. I would suggest that one should wrap from the target (loop through properties of the target, then match with properties belonging to the source object) in stead of the source as shown above, because you will have more control of what fields should be mapped.
2009-01-13
Lots of cool stuff at SourceForge!
I just discovered that SourceForge has a softwaremap at http://sourceforge.net/softwaremap with lots and lots of cool downloads.
2009-01-12
xp_ReadErrorLog (SQL 2005)
The xp_ReadErrorLog extended stored procedure allows you to display the logs for SQL Server 2005 amnd also (as it turns out) the logs for SQl Server Agent.
Usage:
xp_ReadErrorLog - shows the default log for SQL Server.
xp_ReadErrorLog 0,2 - shows the error log for SQL Server Agent (the second parameter means "Agent")
Parameters:
1 (int): Log Number
2 (int): 1 = SQL Server, 2 = SQL Server Agent
3 (string): Search string for searching for a log entry.
4 (string): Another search string.
Source: SQLTeam.com
2008-07-21
Update 'GDR 3068 for SQL Server Database Services 2005 ENU (KB948109)' could not be installed. Error code 1603.
I noticed that my local SQL Server (2005, Standard Edition) was not started every day when I came to work, so I checked the event log, and found the error message from the title of this posting. Seems that there is a bug somewhere that prevents an update from being installed. There is a workaround at this address: http://support.microsoft.com/kb/925976 .
2008-07-16
SandcastleGUI
I started using Sandcastle just a few days ago, and it was not very userfriendly, since it is a collection of command line utilities. Hence, I started looking for a GUI for Sandcastle, and found one at: http://www.inchl.nl/SandcastleGUI .
It's quite easy to use, and I was quite happy with it. I then started to create a web with documentation for one of my projects, and ran into some problems. It seems Sandcastle has problems with some long names, resulting in linebreaks in a file called "filetitles.js". This results in a javascript error saying something about unterminated string constants.
Thats why I created a small utility for fixing that file: FixFiletitlesJs.exe. Here's the code for my little utility (Console application):
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace FixFileTitlesJs
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0 || (args.Length > 0 && args[0] == "?"))
{
Console.WriteLine("USAGE: fixfiletitlesjs filename [Y | N]");
return;
}
string filename = args[0];
//creates a new filname by replacing ".js" at the end of the filename with ".bak"
string backupFilename = Regex.Replace(filename, @"\.js$", ".bak");
try
{
//create a backup file
FileInfo fi = new FileInfo(filename);
fi.MoveTo(backupFilename);
}
catch (FileNotFoundException)
{
Console.WriteLine("File not found.");
Console.ReadLine();
return;
}
catch (Exception ex)
{
Console.WriteLine(string.Format("An exception was thrown while accessing the file: {0}", ex.Message));
Console.ReadLine();
return;
}
StreamWriter sw = null;
try
{
sw = File.CreateText(filename);
}
catch (Exception ex)
{
Console.WriteLine(string.Format("An exception was thrown while accessing the file: {0}", ex.Message));
Console.ReadLine();
return;
}
StreamReader sr = null;
try
{
sr = File.OpenText(backupFilename);
}
catch (Exception ex)
{
Console.WriteLine(string.Format("An exception was thrown while accessing the file: {0}", ex.Message));
Console.ReadLine();
return;
}
int i = 0,j = 0, k = 0;
while (!sr.EndOfStream)
{
string line = sr.ReadLine();
j++;
Regex rx = new Regex("\",$");
while (!sr.EndOfStream && !rx.IsMatch(line) && i > 0)
{
line += sr.ReadLine();
j++;
k++;
}
sw.WriteLine(line);
i++;
}
sw.Close();
sr.Close();
//write result
Console.WriteLine(string.Format("Original file renamed to: {0}", backupFilename));
Console.WriteLine(string.Format("New file created with original name: {0}", filename));
Console.WriteLine(string.Format("Number of lines read from source: {0}", j));
Console.WriteLine(string.Format("Number of lines written to destination: {0}", i));
Console.WriteLine(string.Format("Number of concatenations of lines done: {0}", k));
Console.WriteLine();
string reply = string.Empty;
if (args.Length >= 2 && !string.IsNullOrEmpty(args[1]))
{
reply = args[1];
}
while (reply.ToLower() != "y" && reply.ToLower() != "n")
{
if (reply != string.Empty) Console.WriteLine("You must answer Y or N.");
Console.Write("Would you like to delete the backup of the original file (y/n)?");
reply = Console.ReadLine();
}
if (reply.ToLower() == "y") File.Delete(backupFilename);
}
}
}
2008-07-01
Using MARS with SQL Native Client
I tried using the example code from this article http://blogs.msdn.com/sqlnativeclient/archive/2006/09/27/774290.aspx but I hade some trouble. Seems that you cannot use the System.Data.SqlClient to access MARS because it does not support using a Provider or the keyword "MARS Connection" in the connection string. This means you have to use an ADODB Connection.
2008-06-10
Javascript error in EPiServer admin mode ('Invalid argument')
In this posting, Mark Bagnall describes a problem with javascript in EPiServer Edit Mode. I had the same problem. It was not possible to expand any branches in the EditTree, and the web browser reported a javascript error. Turned out I had set up my website in IIS with Windows Authentication only, to enable debugging/stepping in Visual Studio. The problem was fixed by allowing "Anonymous" access.
2008-05-20
T-SQL CONVERT datetime to varchar
This script gets current date, and converts it using all existing predefined formats between 1 and 255:
DECLARE @format int;
CREATE TABLE #temp (format int NULL, string varchar(20) NULL, date datetime NULL)
SET @format = 1;
WHILE @format < 256
BEGIN
BEGIN TRY
INSERT INTO #temp (format, string, date) VALUES(@format, CONVERT(varchar(20),getdate(),@format), getdate());
END TRY
BEGIN CATCH
END CATCH
SET @format = @format + 1;
END
SELECT * FROM #temp;
DROP TABLE #temp;
2008-05-15
SQL Server 2005 XML - Msg 9402 (unable to switch the encoding)
Had a problem converting XML from a column of type text to type xml. Someone else luckily has had the same problem:
http://devio.wordpress.com/2008/03/04/retrieving-xml-data-in-sql-server-2005/.
The solution was to convert the column from type TEXT to NVARCHAR(max), and get rid of the "encoding" part of the root tag, something like this (slightly altered from the example mentioned above):
SELECT ID, CAST(
REPLACE(CAST(XmlTextColumn AS NVARCHAR(MAX)), 'encoding="UTF-16"', '')
AS XML).query('xpath to nodes') AS Node
FROM TableName
Another way to solve this problem is by adding a computed XML column:
ALTER TABLE [MyTable]
ADD MyXMLColumn AS CAST(REPLACE(CAST(MyXMLStoredAsText AS NVARCHAR(MAX)), 'encoding="UTF-16"', '') AS XML)
PERSISTED
If you add the persisted option, the value will be persisted with the table data, which will give better performance for read operations (slightly worse performance for insert/update operations).
2008-05-07
TFS Workspace Mapping
I was getting this error: The Path <local path> is already mapped in workspace <machine name [old tfs server]>
Turns out workspaces are cached locally and settings are found in: <DRIVE>:\Documents and Settings\<USER ID>\Local Settings\Application Data\Microsoft\Team Foundation\1.0\Cache.
To fix my problem I opened the VS 2005 Command Prompt and entered: "tf workspaces /remove:*" which removed all my cached workspaces (refer to http://msdn.microsoft.com/en-us/library/54dkh0y3.aspx for full description of the Workspaces Command). This also cleared most of the content from the earlier mentioned file in the users Documents and Settings.
Then, of course, I had to create a new workspace using VS 2005.
Source: http://geekswithblogs.net/aaronsblog/archive/2006/09/11/90878.aspx
2008-04-25
.NET 2.0 transaction model
How to handle transactions using ASP.NET 2.0 and SqlClient. Nice article here.
2008-04-07
Serialization of IDictionary objects
By design, objects that implement IDictionary (Hashtable, SortedList, ListDictionary, or HybridDictionary) cannot be serialized. This Q&A describes a way of making these objects serializable by using (a "hidden hook"), and implementing IXmlSerializable: http://msdn2.microsoft.com/en-us/magazine/cc164135.aspx
2008-04-03
Using SQL Server 2005 XML and CROSS APPLY
In my last blog entry, I used the UNPIVOT operator to get a table with products from an XML type column which were displayed as columns, to display the columns as rows. As fun as that was, it was not really a practical approach, more a way of showing how the UNPIVOT operator works.
To get a similar result, without using UNPIVOT, using in stead the values() function with the CROSS APPLY operator, we could use this query:
SELECT
ContractNumber,
col.value('Name[1]', 'nvarchar(50)') AS ProductName
FROM Contract
CROSS APPLY contractXML.nodes('Contract/Order/OrderItem') AS x(col)
This could give a table like this if there were only one contract in the table with ContractNumber = 1:
| ContractNumber | ProductName |
| 1 | Product 1 |
| 1 | Product 1 |
| 1 | Product 2 |
The nodes() function returns a table "x" with one column "col".
The CROSS APPLY operator joins the result from a table-valued function with the result of an "ordinary" query. This is like a LEFT JOIN, only against a table returned by a function in stead of another table.
2008-03-10
Using SQL Server 2005 XML And Unpivot
I have a table with contracts stored as XML. Using the XML query possibilities in SQL Server 2005 together with the UNPIVOT keyword I can get statistics on different types of contracts.
My table has these columns:
ContractNumber int (Primary Key)
contractXML xml
My XML looks something like like this, and is stored in a column of type XML:
<Contract>
<Customer>
...
</Customer>
<Order>
<OrderItem>
<Name>Product1</Name>
<Price>123.00</Price>
</OrderItem>
<OrderItem>
<Name>Product1</Name>
<Price>123.00</Price>
</OrderItem>
<OrderItem>
<Name>Product3</Name>
<Price>13.00</Price>
</OrderItem>
<OrderItem>
<Name>Product2</Name>
<Price>23.00</Price>
</OrderItem>
<OrderItem>
<Name>Product1</Name>
<Price>123.00</Price>
</OrderItem>
</Order>
</Contract>
To get a table with a max of 5 OrderItems as columns, I can use this query:
SELECT
ContractNumber,
contractXML.value('(/Contract/Order/OrderItem/Name)[1]','varchar(50)') AS Product1,
contractXML.value('(/Contract/Order/OrderItem/Name)[2]','varchar(50)') AS Product2,
contractXML.value('(/Contract/Order/OrderItem/Name)[3]','varchar(50)') AS Product3,
contractXML.value('(/Contract/Order/OrderItem/Name)[4]','varchar(50)') AS Product4,
contractXML.value('(/Contract/Order/OrderItem/Name)[5]','varchar(50)') AS Product5
FROM Contract
This is nice, but what if I want to get the number of each product sold? The answer is that I can use the UNPIVOT operator!
Something like this will do it:
SELECT Name, COUNT(*) AS [Count] FROM
(
SELECT
ContractNumber, col, Name
FROM
(SELECT
ContractNumber,
[col1] = contractXML.value('(/Contract/Order/OrderItem/Name)[1]','varchar(50)'),
[col2] = contractXML.value('(/Contract/Order/OrderItem/Name)[2]','varchar(50)'),
[col3] = contractXML.value('(/Contract/Order/OrderItem/Name)[3]','varchar(50)'),
[col4] = contractXML.value('(/Contract/Order/OrderItem/Name)[4]','varchar(50)'),
[col5] = contractXML.value('(/Contract/Order/OrderItem/Name)[5]','varchar(50)')
FROM Contract) col
UNPIVOT(
Name
FOR col
IN ([col1],[col2],[col3],[col4],[col5])
) AS unpvt
) AS T
GROUP BY PackageName
The UNPIVOT operator gives the values in the 5 columns as 1 column.
If I had only the 1 row in my Contract table from the example above, the result would be:
| Name | Count |
| Product1 | 3 |
| Product2 | 1 |
| Product3 | 1 |
This is a simple example, and it has a max number of ordered products per contract of 5. Could maybe be extended.
If you want a table with the counts for the different products as columns, then something like this would do the job:
SELECT
SUM(contractXML.value('count(/Contract/Order/OrderItem[Name="Product1"])','int')) AS Product1,
SUM(contractXML.value('count(/Contract/Order/OrderItem[Name="Product2"])','int')) AS Product2,
SUM(contractXML.value('count(/Contract/Order/OrderItem[Name="Product3"])','int')) AS Product3
FROM Contract
This would give this result:
| Product1 | Product2 | Product3 |
| 3 | 1 | 1 |
And we could of course UNPIVOT this result too:
SELECT
ProcuctCount
FROM
(SELECT
SUM(contractXML.value('count(/Contract/Order/OrderItem[Name="Product1"])','int')) AS Product1,
SUM(contractXML.value('count(/Contract/Order/OrderItem[Name="Product2"])','int')) AS Product2,
SUM(contractXML.value('count(/Contract/Order/OrderItem[Name="Product3"])','int')) AS Product3
FROM Contract) cols
UNPIVOT(
ProductCount
FOR cols IN (Product1, Product2, Product3)
) AS unpvt
This should give a table like this:
| ProductCount |
| 3 |
| 1 |
| 1 |
2008-03-03
Apache Leap Year Bug
Seems Apache (Web Server) has some rather embarrassing problems with leap years: http://blogs.lodgon.com/johan/Leap_year_issues_in_apache_commonsnet
https://issues.apache.org/jira/browse/NET-188
2008-02-12
Gøran's blog
I see that this guy, who was a presenter at MSDN Live in Oslo yesterday, has some good links and stuff relating to WPF and hopefully soon something on MVC (Model-View-Controller): http://blog.goeran.no/CategoryView,category,Presentation.aspx
2008-02-07
Understanding "login failed" (Error 18456) error messages in SQL Server 2005
This blog entry explains how to read the "login failed" error message for SQL Server 2005. The messages can be very cryptic, like for instance "Error: 18456, Severity: 14, State: 8. It is the "State" part that tells you the reason the login failed.
2007-12-14
Windows Workflow Foundation Links
This article by Don Box and Dharma Shukla should be good: Simplify Development With The Declarative Model Of Windows Workflow Foundation
The most trivial and useless WF application, to get newcomers started: http://www.codeproject.com/KB/WF/HelloWF.aspx
Jump start WF: http://www.codeproject.com/KB/WF/JumpStartWF.aspx
2007-12-13
Windows Live Writer
Blogging just became easier. Using the Windows Live Writer it's pretty easy to make blog entries.
2007-10-11
https://www.microsoftelearning.com/eLearning/offerDetail.aspx?offerPriceId=117972
This should be interesting:
http://blogs.msdn.com/buckh/archive/2007/08/14/tfs-2008-a-basic-guide-to-team-build-2008.aspx
2007-09-27
Needed to know if SQL Server Express Edition supports indexed views, and found an article on the Microsoft Web Site. Uh-oh... computer says NO!
2007-07-27
This article describes how to validate 2 or more controls to see if at least 1 of them has content.
2007-05-09
This error sometimes occurs when consuming webservices through a proxy.
2007-05-04
Just putting in a few links so I won't loose them:
How to configure a Windows Server 2003 Load Balancing cluster:
Web Farming with the Network Load Balancing Service in Windows Server 2003
EPiServer:
Configuring the Cache in Multi-Server Scenarios
Configuring EPiServer Enterprise Edition
2007-04-12
I got an error message on my aspx web page after one of the latest Windows updates:
Unable to find script library '/aspnet_client/system_web/1_1_4322/WebUIValidation.js'. Try placing this file manually, or reinstall by running 'aspnet_regiis -c'.
After trying to reinstall the script library, and reinstalling aspnet on my web application, I found a solution by simply adding the following code to my aspx file:
<script language="javascript" type="text/javascript" src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>
Update:
After I put in the script-tag above in my "master page", I got an other error on pages not having any validation controls, so I had to put in a hidden dummy validator.
2006-12-04
I have a server that has been installed using default language/locale "en-US".
This becomes a problem with the date format, which is "MM/dd/yyyy" in en-US, while in Norway where I live we use (nb-NO) "dd.MM.yyyy".
There is also a problem with which character to use as a decimal point and which to use as a thousand marker/separator:
Norwegian (nb-NO): decimal point is comma (",") , thousand marker is space. Ex: 2 345,67
US English (en-US): decimal point is dot ("."), thousand marker is comma. Ex: 2,345.67
So I need a way to set the locale that the ASPNET account is using.
There are several ways. You can set this in the web.config file:
<system.web>
<globalization
culture="nb-NO"
uiCulture="nb-NO" />
</system.web>
You can also set it in the users session, by using the Session_Start event handler:
protected void Session_Start(object sender, EventArgs e)
{
this.Session.LCID = 1044;
}
If you want to change the default settings of the ASPNET account (and you have the guts), you could go in and change the settings in the registry.
NB! It may be risky to change settings in the registry. The author of this blog is not responsible for any damage that may be caused by doing so.
Anyway here it is, change the settings under the following key:
HKEY_USERS\S-1-5-20\Control Panel\International
Here you can see settings for number formats, date formats languages etc for the user. I have as of now NOT TESTED THIS, but the key for the ASPNET user should according to a news group be S-1-5-20.
Good luck!
2006-09-27
Found a simple but cool way to serialize an ADODB Recordset without converting to DataSet on CodeProject.
2006-08-14
Not sure if I have bookmarked this before. Well, better safe than sorry...
2006-06-22
Good article that explains quite a bit about how cryptography works.
2006-06-15
Nice to know info on how to get information about windows and other stuff.
2006-05-30
How to get a quick status of the server while on-site.
2006-05-23
Description of how to sysprep a VPC. Useful stuff.
2006-04-04
This article describes how to encrypt cookies in .NET 2.0.
2006-04-03
This is a nice page with lots of free software links. Among others, web browsers and antivirus programs.
Some big players as Microsoft and IBM built a group that dealed with the security problem (of Web Services), finally offering several specifications. The most important, and foundation of the others, is Web Service-Security (WS-Security or WSS).
2006-03-29
Site with a lot of information on cryptography, and different algorithms.
This is very cool! Nice and free collection of code snippets from Microsoft, ready for pasting into your application source.
2006-03-28
This article describes how to make asychronous calls to a web service. This is useful when the web service has to perform some task that takes a while to complete before returning the result to the client. By making an asynchronous call, the thread of the calling process can go back into the pool and be useful for other purposes while waiting for the response.
2006-03-27
This article in Norwegian gives a few tips on starting out with Ajax (Asyncronous Javascript and XML).
2006-03-24
Quote from a newsgroup (slightly modified):
"If a website (or a webservice) calls a webservice on the same server, then there is no limit on outgoing connections on the Framework. Due to this, the number of outgoing connections to the ASMX page will be huge, and for each connect that takes place, one wildcard TCP port gets used. Since there is a limit of 5000 wildcard TCP ports on the OS, pretty soon, after 5000 or so socket.Connects(), they will start failing with "unable to connect exceptions".
If the authentication is set to NTLM, then you will run into this problem sooner. This is because NTLM uses one extra connection, and after each successful request, that connection is torn down. If you are running into this, try setting "UnsafeAuthenticatedConnectionSharing=true" on the underlying HttpWebRequest
of the client."
A web service client has in .NET by default a limit of 2 connections. You can adjust this limit by putting the following into the web.config file of the client web (not sure about winforms clients, but probably you can put the same into the config file here as well):
<system.net>
<connectionmanagement>
<add maxconnection="40" address="*">
</connectionmanagement>
</system.net>
Jan Thielen (MVP) gives a solution to the problem of sporadic errors of type "The underlying connection was closed".
In essence, you need to add the following code to your Webreference's Reference.cs file:
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.HttpWebRequest webRequest =
(System.Net.HttpWebRequest) base.GetWebRequest(uri);
webRequest.KeepAlive = false; return webRequest;
}
2006-03-20
This article explains why introverts are the way they are, so that maybe extroverts can understand them better.
2006-03-06
Codesmith is an excellent tool for generating general code, like for instance cargos. You don't always have to type all the boring code. Codesmith can do some of the tedious work!
Visual Sourcesafe or as it is now known Team System is not so stable it seems. This to a degree that makes Same Gentile refer to it under the name "Unsafe" (as opposed to its real name "SourceSafe"). His team is now going for the open-source freeware Subversion source code versioning system.
2006-03-03
Very useful list of new features in .NET 2.0 and C" 2.0.
Ajax is a hot buzzword these days (Asynchronous Javascript And Xml). It is a technique for making web GUIs that look more like windows forms applications (less flicker, less postback) because more operations are performed client-side.
An alternate to storing business objects in a database. Now that 64 bit CPU's are coming more and more, and they can handle much more RAM, this is probably something for now and the future. 3000 times faster than mySQL!
This is how it works:
1) All business objects are stored in RAM. 2) Once in a while a snapshot of all business objects is serialised to disk. 3) All operations on objects are stored in a log.
So what if the server crashes?
1) Restore the last snapshot.
2) Replay all actions from log.
A lot like the MS SQL Server backup / Transaction Log bacup.
2006-02-16
I've got to read this some time soon.
Why you can't rely on just biometrics for authentication. Your fingerprint tells who you are (your ID). So what if someone chopped off your finger?
2006-02-15
NIS by default blocks the header "HTTP_REFERER" to be sent from the browser to the server. If your web application is depending on this servervariable, and your clients are using NIS, then do the following:
NIS:
- Privacy control - configure
- Advanced button
- Global settings tab
- "Information about visited sites"
If blocked (this appears to be the default) then HTTP-REFERER is wiped out. Change this option to allow the header to be sent.
2006-02-10
You cannot expect to build a first-class application unless you use the best available tools. Besides well-known tools such as Visual Studio® .NET, there are a multitude of small, lesser-known tools available from the .NET community. In this article, James Avery describes some of the best free tools available today that target .NET development.
2006-02-06
This function takes an Enum type and a text representing the value of the enum, and if the Enum has a field with a name contained in the text (enumText), then it returns that value.
For use when for instance the database field to parse from has been extended somewhat... Modify to suit your needs!
private object FuzzyEnumParse(System.Type type, string enumText)
{
System.Reflection.FieldInfo[] fis = type.GetFields();
foreach(System.Reflection.FieldInfo fi in fis)
{
if(fi.Name!="value__")
{
object obj=fi.GetValue(null);
if(enumText.IndexOf(obj.ToString())>-1)
{
return obj;
}
}
}
return null;
}
2006-02-01
I have been puzzled by the behavior of my webservice. I have a couple of properties in an object that is sent as a parameter to the webservice. Since these properties are not assigned directly by any code, I didn't implement a "set" method for the properies. (As it turns out: Bad mistake!)
What happened was that the values were set in the client to "true", but when the object arrived inside the webservice, the values were suddenly "false".
It turns out, if you don't implement both "get" and "set" for a property, it will not be serialised.
2006-01-19
Operation not allowed"
I got this error at a customer's after they upgraded their web servers to Windows Server 2003. The error appears when trying to upload files through the web. Turns out there is a setting in the metabase.xml file (located in the Windows\System32\inetsrv directory) called AspMaxRequestEntityAllowed, that sets the maximum filesize allowed to be uploaded. This is set very low as a default, to only 204 Kb. In Windows 2000 Server you could upload files much larger (well at or above 1 Meg anyway, I believe).
2006-01-18
Describes different reasons why a query can not be executed on the server.
2006-01-13
A page with lots of cool quotes from the Discworld series (Terry Prattchett).
My favorite (from "Thief of Time):
If you put a large switch in some cave somewhere, with a sign on it saying 'End-Of-The-World Switch. PLEASE DO NOT TOUCH', the paint wouldn't even have time to dry.
Another good one:
"I'll tell you, the day someone pulls the plug out of the bottom of the universe, the chain will lead all the way to Ankh-Morpork and some bugger saying, 'I just wanted to see what would happen.'"
Got this message when I was trying to connect to Analysis Services:
Exception: System.Data.OleDb.OleDbException
Message: No error information available: E_FAIL(0x80004005).
Looks like the most common explanation is that one of the field names in the query is a SQL reserved word, like for instance "Name", "Size" or "Read". If you use bracketed field names this should not be a problem.
A little comparation of the subst command and the LinkD tool. From Craig Andera's blog. Craig also published the now legendary "The last config section handler I'll ever need".
2006-01-02
Don Box and Chris Anderson show how to build real applications that leverage the major components in WinFX. With rich UI, robust communication, and workflow control, they build an application that integrates with various devices laying around Don's home to demonstrate how to use WinFX together.
2005-12-15
This post says:
"Because, for example, if your query return less then 1000 members by dimension in your query, all the data is retrieve to the client and the calculated members are calculated on the client side."
So actually the calculated members are by default calculated by the client. This explains why so much CPU is used on the client when there are a lot of calculated members.
To set the location for calculating the members to the server, you can use this parameter in the query string:
Execution Location=3
The AutoAccept Sink for Exchange is a tool for Exchange 2000 that allows resource mailboxes to automatically accept/decline meeting requests based on a combination of factors. These factors include the free/busy status of the resource, whether the requestor is authorized, and many other configurable settings.
2005-12-05
A very annoing part of VS is debugging. Debugging always hangs after some steps... The article answers some of the questions around debugging. Except my solution still hangs after 3-5 steps...
2005-11-23
This article describes a way of connection to a web service asynchronously that is 8 times faster than the usual synchronous method.
2005-11-21
Shows how to run a manual mail session to test connectivity to a mail server.
2005-11-15
OLAP Performance
Microsoft OLAP Technical Info (articles, whitepapers etc)
As you may have guessed, I am struggling with OLAP performance at the time being. These links provide some information on the subject.
2005-11-10
Today I'm meeting Rick LaPlante, who is responsible for the development of Microsofts new Team System (VSTS). Looking forward to it... Hope I can come up with some good questions.
2005-11-07
Microsoft has changed the certifications. This is a quote from the FAQ:
The new Microsoft certification program is designed to emphasize both the primary technology skill set and the job role of the individual. By focusing on core technical or professional skills, individuals can work toward a certification that meets their needs.
This article describes the changes more in-debth.
2005-10-26
Not really one of my areas of competence, but sometimes one have to try to do one's best. The article describes what one might do to improve performance for a data warehouse using MS OLAP / MS Analysis Services.
2005-10-24
In a Service Oriented Architecture (SOA), having some webservice methods that consume more than a minutes time, timeout can be a problem.
In this scenario there is also a web site acting as the webservice client. The webservice is getting its data from a database.
We know there is a timeout, but where?
a) Could be the connection to the database from the webservice.
b) Could be the connection between the webservice and the webservice client.
c) Could be a browser timeout.
d) Could be a .NET Framework/ASP.NET timeout.
a. The connection to the database
The timeout of a query can be set by a propery on the ADO.NET Command object. The default is 30 seconds.
OleDbCommand dbcmd = new OleDbCommand();
dbcmd.CommandTimeout = 600; //10 minutes should be enough?
b. The connection to the webservice
The timeout of the http connection of a synchronous call to a web service has a default timeout of 100 seconds. This can be set by a property on the web service proxy. You can set it in the constructor of the webservice proxy (remember that this may me overwritten when you update your webservice reference):
public WSMyWebservice() {
this.Credentials = System.Net.CredentialCache.DefaultCredentials;
this.Url = "http://localhost/webservice/WSMyWebservice.asmx";
this.Timeout = 450000; //wait for 7.5 minutes
}
c. The browser timeout
Not covered in this topic.
d. .Net Framework / ASP.NET timeout
There are a few places the timeout can be set in machine.config.
The executionTimeout in the httpRuntime section can be increased. In the .NET Framework versions 1.0 and 1.1, the default is 90:
<httpruntime
maxrequestlength="4096"
usefullyqualifiedredirecturl="false"
minfreethreads="8"
minlocalrequestfreethreads="4"
apprequestqueuelimit="100"
enableversionheader="true"
executiontimeout="90">
In the processModel section there are several timeouts that can be set:
<processmodel
username="machine"
password="AutoGenerate"
timeout="Infinite"
enable="true"
idletimeout="Infinite"
shutdowntimeout="0:00:05"
requestlimit="Infinite"
requestqueuelimit="5000"
restartqueuelimit="10"
memorylimit="60"
webgarden="false"
cpumask="0xffffffff"
loglevel="Errors"
clientconnectedcheck="0:00:05"
comauthenticationlevel="Connect"
comimpersonationlevel="Impersonate"
responsedeadlockinterval="0:03:00"
maxworkerthreads="20"
maxiothreads="20">
The above should show the default settings, although I can't guaratee it. The setting that may be changed to avoid timeout is the responseDeadlockInterval. MSDN states the following about the setting: Specifies the time interval, in standard process model format (hr:min:sec), after which the process is restarted, if the following conditions are met: 1) There are queued requests, and 2) There has not been a response during this interval.
2005-10-19
A collegue of mine just discovered this problem. The problem was that logging using log4net stops whenever the aspnet_wp process is recycled. The problem is caused by the way log4net and ASP.NET works.
First, whenever the aspnet_wp process has been idle for a while or has used more memory than it should (over 60% default), the process is recycled. This is done in a clever way so users should not be affected. A new aspnet_wp process is started in parallell with the old one, gradually taking over the workload by serving all new requests.
Second, log4net stops logging, even stops trying to log, as soon as it finds out that it can't write to the logfile. Essentially logging is then disabled.
These two facts together is causing logging to stop. When the second aspnet_wp process is started, it will try to log to the same file that the old aspnet_wp process is already logging to. The file will be locked by the old process, so log4net in the new process will detect that the file is not writeable, and disable logging.
2005-10-12
WELCOME TO WEALTHQ.COM!
"Visual Studio is over 43 million lines of code, there are over 30 teams working on different pieces, with roughly 700 developers checking-in code to 11 different virtual build labs that are then integrated on a rotating schedule producing over 100 different builds of the product daily."
Mike Stall's .NET Debugging Blog : Size of Visual Studio
2005-09-30
Explains why there sometimes comes a 401 error and the "could not get files from the server" error, and how to fix the problem by simply deleting the VSWebCache folder.
2005-09-23
Tusenvis drept av spillvirus Spillsonen (norwegian)
Story in English:
http://www.1up.com/do/newsStory?cId=3143959
2005-06-14
PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET Application Tries to Write New EventSource in the EventLog
2005-05-03
FreeTextBox
Il-Dan Test
2005-04-14
2005-04-11
2005-04-06
2005-03-17
2005-02-16
2005-02-15
2005-02-09
2005-02-08
Active Directory Client (dsclient) for Win98/NT