Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

Guinness4Strength

@Guinness4Strength
About
Posts
233
Topics
83
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Tab Order in Ajax ModalPopupExtender
    G Guinness4Strength

    Thanks.....any luck ?

    ASP.NET help question

  • Tab Order in Ajax ModalPopupExtender
    G Guinness4Strength

    Did you ever find a solution to this ?

    ASP.NET help question

  • Import Schema problems in XSD
    G Guinness4Strength

    I'm implementing the XmlSchemaProvider attribute and am having some issues defining my XSD. I've created a XSD file which will be an embedded resource in an assembly. I'm attempting to import the MS WSDL types schema so that I can provide a defintion for char datatype, but every way I try and add the namespace and import the schema I get resolution errors. I'm VERY new to XSDs and have some working knowledge of XML so I'm not 100% positive I can do what I want to here, but this is the basic pattern I have seen in many WSDLs for adding support for char datatypes. Any answers or shoves in the right direction would be appreciated. Below is a sample format for my XSD:

    <xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xs0="http://microsoft.com/wsdl/types/">
    <xs:import namespace="http://microsoft.com/wsdl/types/"/>
    <!--cannot resolve "http://microsoft.com/wsdl/types/" error here-->
    <xs:complexType name="MyComplexType">
    xs:sequence
    <xs:element name="Value" nillable="true">
    xs:complexType
    xs:choice
    <xs:element name="boolean" type="xs:boolean" />
    <xs:element name="byte" type="xs:byte" />
    <xs:element name="unsignedByte" type="xs:unsignedByte" />
    <xs:element name="short" type="xs:short" />
    <xs:element name="unsignedShort" type="xs:unsignedShort" />
    <xs:element name="int" type="xs:int" />
    <xs:element name="unsignedInt" type="xs:unsignedInt" />
    <xs:element name="long" type="xs:long" />
    <xs:element name="unsignedLong" type="xs:unsignedLong" />
    <xs:element name="float" type="xs:float" />
    <xs:element name="double" type="xs:double" />
    <xs:element name="decimal" type="xs:decimal" />
    <xs:element name="dateTime" type="xs:dateTime" />
    <xs:element name="string" type="xs:string" />
    <xs:element name="char" type="xs0:char" />
    <!--Type http:=//microsoft.com/wasdl/types/:char is not declared error here -->
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>

    XML / XSL xml database wcf com hardware

  • XmlSchemaProvider XSD import problem
    G Guinness4Strength

    I'm implementing the XmlSchemaProvider attribute and am having some issues defining my XSD. I've created a XSD file which will be an embedded resource in an assembly. I'm attempting to import the MS WSDL types schema so that I can provide a defintion for char datatype, but every way I try and add the namespace and import the schema I get resolution errors. I'm VERY new to XSDs and have some working knowledge of XML so I'm not 100% positive I can do what I want to here, but this is the basic pattern I have seen in many WSDLs for adding support for char datatypes. I posted this question in the XML message board as well, but was hoping some C#ers out there have come across this same issue while implementing the XmlSchemaProvider attribute. Any answers or shoves in the right direction would be appreciated. Below is a sample format for my XSD:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/XMLSchema.xsd"
    xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xs0="http://microsoft.com/wsdl/types/"

    <xs:import namespace="http://microsoft.com/wsdl/types/"/> <!--cannot resolve "http://microsoft.com/wsdl/types/" error here-->
    <xs:complexType name="MyComplexType">
    	<xs:sequence>
    		<xs:element name="Value" nillable="true">
    			<xs:complexType>
    				<xs:choice>
    					<xs:element name="boolean" type="xs:boolean" />
    					<xs:element name="byte" type="xs:byte" />
    					<xs:element name="unsignedByte" type="xs:unsignedByte" />
    					<xs:element name="short" type="xs:short" />
    					<xs:element name="unsignedShort" type="xs:unsignedShort" />
    					<xs:element name="int" type="xs:int" />
    					<xs:element name="unsignedInt" type="xs:unsignedInt" />
    					<xs:element name="long" type="xs:long" />
    					<xs:element name="unsignedLong" type="xs:unsignedLong" />
    					<xs:element name="float" type="xs:float" />
    					<xs:element name="double" type="xs:double" />
    					<xs:element name="decimal" type="xs:decimal" />
    					<xs:element name="dateTime" type="xs:dateTime" />
    					<xs:element name="string" type="xs:string" />
    					<xs:element name="char" type="xs0:char" /> <!--Type http:=//microsoft.com/wasdl/types/:char is not declared error here -->
    				</xs:choice>
    
    C# help xml question csharp database

  • <xs:import namespace="http://microsoft.com/wsdl/types/" xmlns:xs="#unknown" />
    G Guinness4Strength

    I'm createing an XSD file which will be an embedded resource in an assembly. I'm attempting to import the MS WSDL types schema so that I can provide a defintion for char datatype, but every way I try and add the namespace and import the schema I get resolution errors. I'm VERY new to XSDs and have some working knowledge of XML so I'm not 100% positive I can do what I want to here, but this is the basic pattern I have seen in many WSDLs for adding support for char datatypes. Any answers or shoves in the right direction would be appreciated. Below is a sample format for my XSD:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/XMLSchema.xsd"
    xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xs0="http://microsoft.com/wsdl/types/"

    <xs:import namespace="http://microsoft.com/wsdl/types/"/> <!--cannot resolve "http://microsoft.com/wsdl/types/" error here-->
    <xs:complexType name="MyComplexType">
    	<xs:sequence>
    		<xs:element name="Value" nillable="true">
    			<xs:complexType>
    				<xs:choice>
    					<xs:element name="boolean" type="xs:boolean" />
    					<xs:element name="byte" type="xs:byte" />
    					<xs:element name="unsignedByte" type="xs:unsignedByte" />
    					<xs:element name="short" type="xs:short" />
    					<xs:element name="unsignedShort" type="xs:unsignedShort" />
    					<xs:element name="int" type="xs:int" />
    					<xs:element name="unsignedInt" type="xs:unsignedInt" />
    					<xs:element name="long" type="xs:long" />
    					<xs:element name="unsignedLong" type="xs:unsignedLong" />
    					<xs:element name="float" type="xs:float" />
    					<xs:element name="double" type="xs:double" />
    					<xs:element name="decimal" type="xs:decimal" />
    					<xs:element name="dateTime" type="xs:dateTime" />
    					<xs:element name="string" type="xs:string" />
    					<xs:element name="char" type="xs0:char" /> <!--Type http://microsoft.com/wasdl/types/:char is not declared error here -->
    				</xs:choice>
    			</xs:complexType>
    		</xs:element>
    	</xs:sequence>
    </xs:complexType>
    

    </xs:schema>

    XML / XSL xml database wcf com hardware

  • XML Deserialization problem
    G Guinness4Strength

    Hey Leppie, thanks for the response. I tried your suggestion but, unfortunately the following Xml deserialied with the same error:

    <?xml version="1.0" encoding="utf-8"?>
    <!--CodeCulture Culture File-->
    <!--Created: 6/27/2008 8:27:23 AM-->
    <!--Version: 1.0.0.0, Culture=neutral, PublicKeyToken=null-->
    <!--Server: ISI-MBLDEV111-->
    <CodeCulture xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Name>Sample</Name>
    <Version>1.0</Version>
    <GlobalExtensions>
    <CultureItemOfIOExtension ID="" Type="IOExtension, Component, Version=2.0.0.0, Culture=neutral, PublicKeyToken=03604d72884e7711">
    <IOExtension>
    <Name>GlobalExtensions</Name>
    <StringValue>GlobalValue</StringValue>
    <Value xsi:type="xsd:string">GlobalValue</Value>
    </IOExtension>
    </CultureItemOfIOExtension>
    </GlobalExtensions>
    </CodeCulture>

    C# help testing beta-testing xml json

  • XML Deserialization problem
    G Guinness4Strength

    My code is serializing a generic list of objects of class IOExtension. The IOExtension has two properties : string Name object Value The serialization occurs without issue and provides the following XML:

    <Culture>
    <CodeCulture xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <GlobalExtensions>
    <CultureItemOfIOExtension ID="" Type="MyNamespace.MyClass.IOExtension, MyNamespace.MyClass, Version=2.0.0.0, Culture=neutral, PublicKeyToken=03604d72884e7711">
    <IOExtension>
    <Name>GlobalExtensions</Name>
    <Value xsi:type="xsd:string">GlobalValue</Value>
    </IOExtension>
    </CultureItemOfIOExtension>
    </GlobalExtensions>
    </CodeCulture>
    </Culture>

    This is all great, except when I go to deserialize the XML I get an exception on the Value property:

    Namespace prefix 'xsd' is not defined.

    Now I've done some testing and it appears that this does not occur when I serialize a single instance of the IOExtension object. This would appear to be an issue with serializing the generic list of objects but I'm not sure. I've thought about implementing System.Xml.Serialization.IXmlSerializable but I'm not sure how to go about serializing the object itself. Any suggestions or thoughts out there ? I'm hoping that I can define the namespace manually somehow but obviously my knowledge of Xml Serialization is limited.

    C# help testing beta-testing xml json

  • Problems in .net socket
    G Guinness4Strength

    Broadcasts are a "best efforts" communication method, you should plan on messages NOT making it to a client if your using UDP broadcast messages.

    C# csharp sysadmin question

  • User located controls
    G Guinness4Strength

    This is probably not a rookie task ;) Just as a starting point I would begin by monitoring the Mouse Button Click events as follows: In the Mouse Button Down event I would record the coordinates of the mouse pointer and the control being clicked. Then in the button Up event I would check the coordinates of the mouse again. If the delta between the starting and new locations are greater than, say, the size of the control oringall clicked (or some other specific value) then set the Location property of the control to the new coordinates. This approach will not create the dragging effect visually but it should move the controls for you. Good Luck.

    C# csharp tutorial

  • Multithreaded windows service
    G Guinness4Strength

    I would be surprised if anyone would be able to post code for this type of request. I have written a few multithreaded services and can give you some pointers. 1. I usually put all of the code used by the thread in its own DLL, that way you can basically insantiate an instance of you class for each thread and limit the race conditions which can occur between threads. 2. Create a single public method in your class which can be the starting point for your thread, populate class properties with initial values in the Service code then use the ThreadStart or ParameterizedThreadStart methods to start the thread. Once the Thread has started (you can use ManualResetEvents to monitor this) add the Thread instance to an array in the Service code so all of the running threads canbe managed from the service. Doing so will allow you to stop the threads in the event that the service must stop. 3. I've found that .NET remoting is especiall handy with M-threaded Windows Services for sending control / command requests to the threads. Here is an example of starting a thread:

    try
    {
    m_ThreadStarted.Reset();
    //ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessADTThread), DR);
    Thread ADTThread = new Thread(new ParameterizedThreadStart(ProcessADTThread));
    ADTThread.IsBackground = true;
    m_MasterThreadList.Add(ADTThread);
    ADTThread.Start(DR);
    m_ThreadStarted.WaitOne(-1, false);
    Lines.Append(DR["ClientName"].ToString() + " Started\r\n");
    }
    catch (Exception Err)
    {
    m_ServiceLog.WriteEntry("Start Service WaitEvent Exception: " + Err.Message, EventLogEntryType.Error);
    }

    C# database help

  • DataProtectionScope.CurrentUser & NT Domains
    G Guinness4Strength

    I know most of you will cringe as you read this but my office has not moved to AD and still uses an NT domain. I've noticed an issue and am not sure if it is related to NT domains or just basic encryption "gottcha". I'm using ProtectedData.Protect() method to encrypt data with the CurrentUser scope. When I change my domain password according to our domain policy I can no longer decrypt data that has been encrypted with the previous password (Exception = {"Key not valid for use in specified state.\r\n"}). Is this an issue inherent with using the CurrentUser scope ? I've seen a previous post where the CurrentUser scope was a viable solution and did not cause issues with password changes, but that person was using an AD domain. Anyone have any experience with this issue or a work around ?

    C# security help question

  • ListView OwnerDraw Question
    G Guinness4Strength

    Thanks for the response, unfortunately the drawing problem still persists even after overriding the OnPaint as you suggested as well as the Draw Events....see below:

    class GradientListView:System.Windows.Forms.ListView
    {
    
        public GradientListView()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
              ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
        }
        protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e)
        {
            base.OnDrawColumnHeader(e);
        }
        protected override void OnDrawItem(DrawListViewItemEventArgs e)
        {
            base.OnDrawItem(e);
        }
        protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
        {
            base.OnDrawSubItem(e);
        }
        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
        {
            PaintRectangle(this.ClientRectangle, this.BackColor, Color.Black, pevent.Graphics);
        }
        protected void PaintRectangle(Rectangle Rect, Color RectColor, Color RectBorderColor, Graphics g)
        {
            LinearGradientBrush brush;
            Rectangle BottomRect;
            BottomRect = new Rectangle(Rect.X, Rect.Height-((int)(Rect.Height / 2)), Rect.Width, Rect.Height / 2);
            brush = new LinearGradientBrush(
                Rect,
                RectColor,
                Color.White,
                45);
            g.FillRectangle(brush, Rect);
            brush.Dispose();
        }
    }
    

    Any other thoughts ? -- modified at 11:43 Monday 23rd October, 2006

    C# question wpf graphics

  • ListView OwnerDraw Question
    G Guinness4Strength

    I've derived my own GradientListView class from the ListView control to try and draw a gradient background. I'm able to draw the gradient background just fine by overriding the OnPaintBackground event, but the ListView items no longer appear in the ListView. Is it an all or nothing deal?....Do I need to handle all the painting events if I override one of them? If I comment out the SetStyle command in the constructor the ListView shows the items correctly, but obviously without the gradient background.

        public GradientListView()
        {
            //set styles
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
                ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
        }
       
        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
        {
            PaintRectangle(this.ClientRectangle, this.BackColor, Color.Black, pevent.Graphics);
        }
        protected void PaintRectangle(Rectangle Rect, Color RectColor, Color RectBorderColor, Graphics g)
        {
            //draw rectangle
            Pen LinePen = new Pen(RectBorderColor, 10);
            g.DrawRectangle(LinePen, new Rectangle(Rect.X, Rect.Y, Rect.Width - 1, Rect.Height - 1));
            LinePen.Dispose();
            Rect = new Rectangle(Rect.X + 1, Rect.Y + 1, Rect.Width - 2, Rect.Height - 2);
            SolidBrush bgBrush = new SolidBrush(RectColor);
            g.FillRectangle(bgBrush, Rect);
            bgBrush.Dispose();
            LinearGradientBrush brush;
            Rectangle BottomRect;
            BottomRect = new Rectangle(Rect.X, Rect.Height-((int)(Rect.Height / 3)), Rect.Width, Rect.Height / 3);
            brush = new LinearGradientBrush(
                new Point(BottomRect.Width / 2, BottomRect.Top - 1),
                new Point(BottomRect.Width / 2, BottomRect.Bottom),
                RectColor,
                ControlPaint.Dark(RectColor));
            g.FillRectangle(brush, BottomRect);
            brush.Dispose();
        }
    
    C# question wpf graphics

  • Column Length
    G Guinness4Strength

    Yes, the length limit can be seen in the "Design Table" dialog of the SQL Server Enterprise Manager for the table in question. Its a VARCHAR(50) column, but after I query this tabkle the DataTable's DataColumn has a MaxLength value of -1 Here is the code i use to Query the Table if that helps...

    DataTable DT = new DataTable();
    if(m_DB is SqlConnection)
    {
    m_DA = new SqlDataAdapter(Query,(SqlConnection)m_DB);
    m_CB = new SqlCommandBuilder((SqlDataAdapter)m_DA);
    ((SqlCommandBuilder)m_CB).QuotePrefix="[";
    ((SqlCommandBuilder)m_CB).QuoteSuffix="]";
    ((SqlDataAdapter)m_DA).Fill(DT);
    }

    Database database csharp sql-server sysadmin question

  • Column Length
    G Guinness4Strength

    I'm using ADO.NET and I'm attempting to get the column length for VARCHAR columns using the MaxLength property of the DataTable class, but it always returns -1, any secrets to finding this info from a returned MS SQL Server Query ?

    Database database csharp sql-server sysadmin question

  • Too many MachineKeys ?
    G Guinness4Strength

    I've written a Web Service which encrypts files via the RSACryptoServiceProvider. Everything is going great with the code except that I am experiencing a build up of key files in my Crypto\RSA\MachineKeys directory. I have verified that it is because every call to the WebService creates a new instance of RSACryptoServiceProvider which creates a new Key. I am using the FromXmlString method to restore a previously used Key Pair which I persist to a file between calls to the Web Service. This only occurs after I have created the new instance of RSACryptoServiceProvider though so the new key is already created. Is this something I need to worry about? Will Windows clean this directory from time to time or am I doing somthing wrong ?

    C# cryptography question

  • Public Key Encrytpion with Web Services
    G Guinness4Strength

    I'm working on a web service which uses public key encryption to transfer files to and from a web server. I've run into an issue that I'm hoping someone can help with. I can download files just fine since I can specify the public key as one of the parameters of the Web method and then decrypt the returned byte array. However I'm not sure how to upload an encrypted file. Since I need the public key of the server to encrypt the file on the client side, I created a web methiod which just returns the server's public key. But when I then encrypt the file on the client side and call another web method to send the byte array, the server's instance of the encryption class has changed and the previously used public key is no longer valid. Any thoughts on a possible solution ?

    C# help wcf sysadmin data-structures security

  • Command Line Arguments for an existing process
    G Guinness4Strength

    Does anyone know how to retreive the command line arguments for an existing external process ? StartInfo.Arguments does not contain it.

    C# tutorial question

  • Get the command line parameters of an external process.
    G Guinness4Strength

    Did you ever figure this out ?

    C# csharp c++ help tutorial

  • Multi-threading & Listening Sockets
    G Guinness4Strength

    I have written a Windows Service which creates multiple threads. Each thread listens on a seperate port, writes received messages to disk and acknowledges the receipt of each message. It works perfectly with a single thread so I started load testing multiple threads with disapointing results. I've noticed erratic behavior and am pretty sure its due to the multi-threading. This is my first true multithreaded app and wanted to get some pointers. My Windows Service basically just creates (with ThreadPool.QueueUserWorkItem) and stops the threads as necessary. The rest of the code (Listening and responding, storing port numbers and directory paths, writing messages to disk) is contained in a DLL shared by each thread. So first question is: 1. Is what I'm attempting to accomplish possible, or is it going to be a locking nightmare ? The reason I ask is that it appears I need to lock the listening loop since it is contained in a DLL used by each thread. But won't this effectively stop the rest of the the threads from listening to their ports since it is blocking? Do I need to ditch the idea of listening on multiple ports within threads and just have multiple instances of the same app on a server ? Any help would be appreciated.

    C# question sysadmin testing beta-testing json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups