Picon
Favicon

Expiration of your subscription to the ADVANCED-DOTNET list


Wed, 9 Jun 2010 06:07:58

Your subscription  to the ADVANCED-DOTNET  list has expired and  you have
failed to  confirm it  in the 20  day period that  you had  been granted.
Therefore, you have been automatically removed from the list. If you want
to  re-subscribe  to  the  list,  then  send  the  following  command  to
LISTSERV <at> PEACH.EASE.LSOFT.COM:

                        SUBscribe ADVANCED-DOTNET

You can also re-subscribe at:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ADVANCED-DOTNET.

Olemis Lang | 26 May 21:28
Picon

Unable to debug in VS 2008 after updating Assembly version using Hg shortrev

Hello !

I am using MS Visual Studio 2008. Recently I developed a custom
workflow for a MOSS 2007 WSS 3.0 site. Everything works OK (so this is
just background information ;o) , and I can deploy and debug the
workflow . I manage the source code using Mercurial SCM , hence I also
use VS Mercurial plugin . Then I installed «MSBuild Mercurial Tasks
Class Library» as well as «MSBuild Community Tasks» because I want to
increment the Assembly Version Number automatically and consistently
so that it will match the local revision number in Hg repos .

In order to do that I added an HgVersion.targets (similar to the
example) file that includes something like this :

{{{
#!xml

 <Target Name="GenerateAssemblyInfo"
         Condition=" '$(MSBuildCommunityTasksAvailable)' == 'true' "
         DependsOnTargets="ExtractRevision">
   <PropertyGroup Condition=" '$(AssemblyVersionRevision)' == '' ">
     <AssemblyVersionRevision>0</AssemblyVersionRevision>
   </PropertyGroup>
   <CreateProperty Value="$(AssemblyVersionBase).$(AssemblyVersionRevision)">
     <Output TaskParameter="Value" PropertyName="AssemblyVersion" />
   </CreateProperty>
   <AssemblyInfo CodeLanguage="CS"

OutputFile="$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs"
                 AssemblyDescription=""
(Continue reading)

David Nicholson | 20 May 12:32
Picon
Favicon

Key compare in Dictionary

I am using a class as a key to a Dictionary, and the key comparisons are not working as I expect. The example
below illustrates:

// This is the key of the dictionary
namespace DictionaryTest
{
    using System;
    public class KeyData : IEquatable<KeyData>
    {
        public string F1 { get; set; }
        public int F2 { get; set; }

        public KeyData(string f1, int f2)
        {
            F1 = f1;
            F2 = f2;
        }

        bool IEquatable<KeyData>.Equals(KeyData other)
        {
            if (String.Compare(F1, other.F1, true) != 0)
                return false;

            if (F2 != other.F2)
                return false;

            return true;
        }
    }
}
(Continue reading)

David Nicholson | 19 May 16:20
Picon
Favicon

Extract method refactor (C# in VS 2010)

I have a function like this:

        private void DoSomething(List<string> slist)
        {
            foreach (string s in slist)
            {
                if (s == "b")
                    return;
            }

            string x = "Hello";
        }

and I select all of the foreach loop. If I refactor/extract method I get a message saying that all paths must
be terminated by a return statement if any are.

If I remove the assignment to x at the end (outside the part I want to refactor), it works.

I don't understand why the assignment stops it doing something like this:

        private void DoSomething(List<string> slist)
        {
            f(slist);

            string x = "World";
        }

        private static void f(List<string> slist)
        {
            foreach (string s in slist)
(Continue reading)

Eddie Lascu | 18 May 16:54
Favicon

Getting a byte array from a generic class

Hi there,

I need to pick your brains with regard to a more elegant solution to a problem I'm dealing with right now. I
have a generic class that wraps any type of numeric values (short, int, decimal, double or float).
Removing the parts that are not interesting, this class is something like this:

    public abstract class NumericNtcipObject<T> where T : struct, IComparable<T>
    {
        protected NumericNtcipObject(T value)
        {
            double val;
            Debugging.Assert(typeof(T).IsValueType && typeof(T).IsPrimitive);
            Debugging.Assert(double.TryParse(value.ToString(), out val));

Value = value;
        }

        public T Value
        {
            set
            {
                _value = value;
            }
        }

        public byte[] ValueAsByteStream
        {
            get
            {
                  // Need help here
(Continue reading)

David Nicholson | 2 Dec 22:08
Picon
Favicon

VS formatting of "file:" string value

Just curious, but why in VS 2008 if I have a line

string str = "file:";

are the characters inside the quotes underlined. I couldn't find a font setting like that, and things like
http: aren't underlined. Take out the colon, or a use word other than file, there's no underline.

David.

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

Dean Cleaver | 22 Nov 22:46
Favicon

Problems with ServerCertificateValidationCallback

I'm using the below code (trimmed a bit of unimportant stuff out) to check a given page on a site, and validate
the server certificates. However, it seems to not call the callback at all for some sites, despite the url
being https, and manual checking of the site indicates a valid certificate.

I'm using an instance level function and a mutex so I can ensure that I'm checking one at a time. I've even
stepped through the code, and the callback just doesn't get called for some sites.

Any ideas why?

Dino

        private bool checkedCertificate;
        public void RunTest(object url)
        {
            Mutex mutex = new Mutex(false, "WebsiteLock");
            mutex.WaitOne();

            try
            {
                HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create(url.ToString());
                ServicePointManager.ServerCertificateValidationCallback = this.ValidateServerCertificate;

                checkedCertificate = false;

                HttpWebResponse httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse();
            }
            finally
            {
                mutex.ReleaseMutex();
            }
(Continue reading)

Phil Sayers | 19 Nov 19:42

Process.Start() on Terminal Server.

We have a line of business, Winforms client/server application.

.Net 3.5 SP1.

One of our customers is a heavy terminal services user.  We've found that as
soon as 1 person has started our application on the terminal server, no one
else can start it up.

I think the same problem is described here (not my ee post):

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_24726101.htm
l

But the "accepted solution" isn't really a solution.

Our application is launched with  small stub on the end user machine
(installed via elevated MSI per-machine into "program files"), and we use
file copy &  process.start() fairly liberally so that the stub will download
any updates to itself, and restart itself with the most current version
before continuing to download the real application and then finally launch
that with process.Start.

I'm wondering if our liberal usage of process.start() is killing us.

Our code for Process.Start usage is..

'copy stub to a user specific temp folder and restart.

Dim Mydir As New DirectoryInfo(My.Application.Info.DirectoryPath)

(Continue reading)

Mike Andrews | 11 Nov 20:04
Picon

unmanaged structure layout error

I'm having a problem with an unmanaged structure.

I'm getting this error message when the system tries to load the type:

*Could not load type '_S' from assembly '...' because it contains an object
field at offset 134 that is incorrectly aligned or overlapped by a
non-object field.*

For the life of me I cannot figure this out why this is failing.
I've set the byte packing to 1 which means that there is no padding between
bytes.  I've also explicitly specified each field offset.

Below is the structure that I have declared.  It's only a partial structure
and I removed all the properties for brevity.  Also there's more members but
the last field is where the error is occurring.  Also, if I remove the last
field it works.  When I add it back it fails.

Any suggestions?

Thanks,
Mike

[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 1)]
private struct _S {
    [FieldOffset(0)]
    private System.Double _height;
    [FieldOffset(8)]
    private System.Double _width;
    [FieldOffset(16)]
    private System.Double _depth;
(Continue reading)

Eddie Lascu | 4 Nov 17:56
Favicon

Running solaris or linux executables on windows

Hi everybody,

This question is not related to .NET in anyway. However, given the high expertise of the folks that are
answering questions here, I figured that this is the best place where I can turn for advice. For a project I
am working on, we have to deal with a temporary solution to access some data. Normally, a T1 connection to a
web service should be provided and my client would access said web service. Unfortunately, there is a long
delay in making that T1 connection available and we have to come up with a different approach to access the
data until the T1 link is put in place.

The client has provided two sets of executables compiled for Linux and Solaris platforms (their
environment is Unix). Since we have developed our system in .NET and deployed it on Windows machines, I
need now to install some kind of Unix emulator and run said executables. The executables will dump the XML
data into a MySql database from where I can get it and do make use of it.

My question for you is whether you could recommend a good Unix virtual machine for Windows that could host
the two executables I need to run.

Thanks and sorry if this question is somehow off-topic.

Regards,
Eddie

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

Chris Anderson | 11 Oct 17:18

Re: Online activity

Instead of using a basic bit flag, use the userid as the flag. i.e. :

UPDATE table SET lockedByUser = <userId> WHERE rowId = <editRow> AND
(lockedByUser IS NULL OR lockedByUser=<userId>)

Then either read the row data to see if you have the lock, or check how
many rows were affected (0 or 1)

The above technique allows only a single user to pass the check and is
resilient to browser windows closing, session timeouts, etc

The flag will remain indefinitely unless you separately clear flags
(perhaps also include a lockTime so you know which are old and stale),
but will always allow the user that created the lock to re-apply for the
edit mode, and to clear the flag in the usual way (i.e. after hitting
save or cancel)

> -----Original Message-----
> From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> DOTNET <at> PEACH.EASE.LSOFT.COM] On Behalf Of Paul Cowan
> Sent: 11 October 2009 09:01
> To: ADVANCED-DOTNET <at> PEACH.EASE.LSOFT.COM
> Subject: [ADVANCED-DOTNET] Online activity
> 
> Hi,
> 
> I am working on an application where different users will process
> different
> database records off a web page.
> 
(Continue reading)


Gmane