I'm writing a windows service in .net 2.0.
What should I do within the OnStart method if for some reason I don't want it to start? Can I simply call the Stop() method of the base class (ServiceBase)? I've tried that and am getting some funny memory access exceptions. Is it required to start a separate thread to call the Stop() method?
...
Hi guys.
I'm building a tiny webapplication in which our customers can update some details about their company. The customers currently don't have a login/password and we don't want to validate their registration, so we want to give them a automaticly generated password/key to login to the website.
Our plan to encrypt their customerId ...
I need help in my code. I would like to write only numbers/integer in my textbox and would like to display that in my listbox.
Could someone please check my code below. This seems to give an error.
int yourInteger;
string newItem;
newItem = textBox1.Text.Trim();
if ( newItem == Convert.ToInt32(textBox1.Text))
{
...
Hi,
I am creating a quite complex digital filter in Simulink. For testing I generate a .txt file i .NET application and use this file as a source in Simulink model.
Does anyone know whether it is possible to generate a Simulink model, define input and output and then connect it with .NET application?
...
Hi,
I have to calculate the relative time which is
TimeSpan relativeTime = currentTime.Subtract(startTime);
Next I would like to convert relativeTime to double value which should be consisted of seconds and milliseconds (seconds.milliseconds).
Does anyone know what is the best way to generate such double value from time difference?
...
Hi folks,
Andrew Arnott has a post here about how to extract the attribute exchange extension data, from an OpenId proivder. Here's a snippet of the code :-
var fetch = openid.Response.GetExtension<FetchResponse>();
if (fetch != null)
{
IList<string> emailAddresses = fetch.GetAttribute
(Well...
I am using the .NET 2.0/3.5 framework for my application. I need to run several SQL commands across multiple connections and each connection is on a different server (Oracle, SQL Server). I need to make sure these commands are transactional.
For example: I need to perform an INSERT in a table on both Oracle and SQL Server databases, t...
I'm calling some VB.NET code in one assembly from C# code in another assembly. The code builds fine, but I'm getting MissingMethodException when I make the call.
Usually, according to the Stack Overflow and Google search results for MethodMissingException I've read, it's due to a mismatch between the DLLs you're building against and th...
Consider this class:
public class Column<T>
{
public string Header { get; set; }
public Func<T, string> ValueExpression { get; set; }
}
used like this:
var columns = new List<Column<Employee>>
{
new Column<Employee> {Header = "Employee Id", ValueExpression = e => e.EmployeeID.ToString()},
...
For example:
BitmapImage bitmap = new BitmapImage();
byte[] buffer = GetHugeByteArray(); // from some external source
using (MemoryStream stream = new MemoryStream(buffer, false))
{
bitmap.BeginInit();
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.StreamSource = stream;
bitmap.EndInit();
bitmap.Freeze();
}
...
Is there a control to enter the time (i.e. 9:00am) in .NET?
...
I build a xpath string based on all filled-out fields in a form submitted by a user. In my xml document, not all form fields necessarily exist as nodes. When I try to do
doc.SelectNodes(xpath);
I get an exception System.Xml.XPath.XPathException that my xpath has an invalid token.
How can I modify the xpath string to only include tho...
I have moved a web application with Atlas implementation from IIS6 to IIS7. There are sections in this application that have Ajax implementation. Due to constraints the Atlas was not converted to Ajax.
The parts were Ajax is implemented, the application works fine, but client side events fired using Atlas throw an 'UnKnown error'.
I ch...
Within a Web Service CarService,
- I have a class called Car.
- Car has a bunch of properties i.e. Car.Color.
- CarService has a method called GetCars().
- Within GetCar, I have a loop that appends a List of, you guessed it.. Cars.
Dim carList As New List(Of Car)
Do While rdr.Read()
If rdr.GetValue(1).ToString().Length > 0...
I have what I think are some satellite assemblies in an application produced by a company that no-longer exists. I'd like to confirm that they are what I think (the naming is correct but...) and see what is inside them.
...
I am trying to convince my web server admins to upgrade our version of the .NET framework from 2.0 to 3.5. I was wondering what are the best reasons to upgrade, from a server admin prospective. Obviously, there are the over arching ideas of keeping up to date, security, and so forth. I am looking for some hard and fast reasons that will...
I have to write a service to monitor a complex system. I searched Google for some articles, but didn't find exactly what I was looking for. Does anyone have any good resources for writing a service to monitor a complex system?
...
Hi folks,
I have some code i'm revewing, which is used to convert some text into an MD5 Hash. Works great. It's used to create an MD5Hhash for a gravatar avatar. Here it is :-
static MD5CryptoServiceProvider md5CryptoServiceProvider = null;
public static string ToMD5Hash(this string value)
{
//creating only when needed
if (md5...
I'm running Visual Studio 2008 on a Vista Ultimate box. When I create a brand new console application and run the following code via the debugger, I get an expected result -- an UnauthorizedAccessException is thrown and the directory is not created.
Sub Main()
Dim path = "C:\Windows\zzzz"
Try
IO.Directory.CreateDirect...
I built a quick program that needed to loop through an enormous log file (a couple of million records) and find various bits and pieces from inside. Because the volume of data was so huge, I have been curious to watch my Windows Task Manager performance tab and see how much CPU and memory is being used.
After the program successfully ge...