Serialization error
Hi. I have a class A with an attribute of type B that has an attribute that
is a collection of type C. In B, the attribute that is a collection of C is
marked with the NonSerialized attribute and in A, the attribute that is of
type B is also marked with the NonSerialized attribute.
class A
{
[NonSerialized]
B b;
}
class B
{
[NonSerialized]
C c;
}
class C : IEnumerable
{
...
public void Add(object o) {}
}
I save an object of type A with the Configuration Application Block of
Enterprise Library, which tries to serialize the object. And there comes the
error. The message says that the collection of type C should have an method
Add because it inherits from IEnumerable.
The collection has the method Add and should not be serialized once it is
marked with NonSerialized attribute.
If anyone can understand the problem, can you help me? Tag: how to shutdown Tag: 102553
Compiler optimization question
just curiosity because I guess there isn't much I could do about it....
if I write
byte[] buf = ...;
int N = ...;
for(int i=0; i<N; i++)
do(buf[i]);
will the code do a bound checking on the array on every single access to
buf[i] or will it recognises that N, and buf.Length are constant and
optimize to only one bounds checking?
--
If you're in a war, instead of throwing a hand grenade at the enemy, throw
one of those small pumpkins. Maybe it'll make everyone think how stupid war
is, and while they are thinking, you can throw a real grenade at them.
Jack Handey. Tag: how to shutdown Tag: 102548
Complex DataGrid Binding
The question I have is how to -=> Effectively <=- and -=> Efficently <=-
bind a DataGrid to a 1 deep organizational chart, where "R" would be a
row of data and 1..N would be the columns of the row. I need to have the
data displayed and updated/added, so I will need 2 way binding.
+---+
| R | (View this in NotePad)
+---+
|
+-------+-------+-------+-------+
| | | | |
+---+ +---+ +---+ +---+ +---+
| 1 | | 2 | | 3 | |...| | N |
+---+ +---+ +---+ +---+ +---+
I am currently creating the columns of the DataGrid dynamically, which
works fine. The binding is where I am getting stuck. A -=> Very <=-
simplistic view of my data looks like this.
+-----------------------------+
| MyRowCollection |
+-----------------------------+
| Guid ID |
| MyRowCollection rows |
+-----------------------------+
| 1
| to
| N
+-----------------------------+
| MyRow |
+-----------------------------+
| Guid ID |
| MyColumnDataCollection data |
+-----------------------------+
| 1
| to
| N
+------------------+
| MyColumnData |
+------------------+
| Guid ID |
| object data |
+------------------+
Any thoughts would be appreciated.
Dave Tag: how to shutdown Tag: 102545
Portals anyone? SharePoint vs DNN?
I am at a current position to take an existing ASP system and bring it into
VS200? ASP.NET
Our new CIO wanted a comparison between SharePoint and DNN in a delivery
method for our new content.
My gut feeling is to go to DNN because it's Open Source. Flip side is to
not go with SharePoint because it's M$.
Anyone work with both who has a preference? Any great concepts that you
found fantastic in either product? Any deal killers that couldn't be
overcome in either?
TIA
__Stephen Tag: how to shutdown Tag: 102544
User defined Clipboard objects in other applications
Hi,
I am storing userdefined objects in the clipboard and I want them to be
available for external applications (Notepad, Excel, Word, ...) How does my
userdefined object have to look like to be usable in other applications? Do
I have to implement a special named method or something like that?
Best regards
Christian Tag: how to shutdown Tag: 102538
deserialization problem (xmlns=''> was not expected)
Hi,
I am getting error "<DECISION_REQIEST xmlns=''> was not expected.
excepiton: System.InvalidOperationException
any clue: why getting error:
input:
<DECISION_REQUEST xmlns:po="http://www.cqds.com/CQDSWebservice"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<CQAuthentication Type="String">
<AccountName>Greenlight</AccountName>
<UserName>greenlight1</UserName>
<UserPassword>greenlight1</UserPassword>
</CQAuthentication>
<Guideline Id="388" ProductID="89" VersionId="259"
RateSheetName=""/>
</DECISION_REQUEST>
class :
Imports System.Xml.Serialization
'<remarks/>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.cqds.com/CQDSWebservice"),
_
System.Xml.Serialization.XmlRootAttribute("DECISION_REQUEST",
[Namespace]:="http://www.cqds.com/CQDSWebservice", IsNullable:=False)>
_
Public Class DECISION_REQUESTType
'<remarks/>
'<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
_
Public Guideline As DECISION_REQUESTTypeGuideline
'<remarks/>
'<System.Xml.Serialization.XmlAttributeAttribute()> _
Public Version As String
End Class
'<remarks/>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.cqds.com/CQDSWebservice")>
_
Public Class DECISION_REQUESTTypeGuideline
Inherits GuidelineType
'<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public VersionId As Short
'<remarks/>
<System.Xml.Serialization.XmlIgnoreAttribute()> _
Public VersionIdSpecified As Boolean
'<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public RateSheetName As String
'<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public ProductID As String
'<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public ProductName As String
End Class
'<remarks/>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.cqds.com/CQDSWebservice")>
_
Public Class GuidelineType
'<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public Id As String
'<remarks/>
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public Name As String
End Class Tag: how to shutdown Tag: 102537
sending multiple files over the network
I want to send the multiple files over the network, i am having one window
services that services keep on listening the one port and accept the
request(multiple client can send the request) that request in the form of
requesting some image file
the requested files may be more than 2000 image files.
i want to know how to implement this concept
can we use multiple port to send the file or else one port?
If i send the files in multiple port
a) if the server send the multiple files over the multiple port how the
client system should be act?
b) if the server send the multiple files over the multiple port can we
implement the thread concept for sending the file in each port, if it is, how
to implement the thread concept in client system and how to retrieve the
each files and stored in client machine
Thanks in advance!
Renganathan Tag: how to shutdown Tag: 102536
tool to highlight redundant classes & methods...
I am currently working on a large code base that has several classes\methods
that are never used. Does anyone know of a tool that will generate a list of
classes & methods that are not used or referenced?
Cheers
Ollie Tag: how to shutdown Tag: 102535
.NET Intranet Zone Permission to Full Trust??
I build installs for our software CD. One of the application is a
vendor app and we don't have access to the code. They recently
implemented .Net platform. When we received their latest updates, we
are having problems with LAN/Network installs. One of the function is
to create a pdf document and gives you an option to print. I am
getting .NET security errors. One error box has WsPrint.exe as title
and throws in an exception. Another message is Microsoft .NET
framework error saying application has attempted to perform an
operation not allowed by security policy. If I go in
Control-Panel-Admin Settings -.NET Framework 1.1 Configuration -
Runtime Security Policies, and change the LocalIntranetZone from medium
trust to FULL trust, I resolve all of the my issues.
It only happens in Server installs, stand-alone PCs are fine.
Obviously this is not a good solution to change user's security. Is
there a work around? I am using install shield 5.1 to create our
installs.
Thank you,
Aamir. Tag: how to shutdown Tag: 102525
XML Serialization - Interface
I have a base class that inherits from CollectionBase that stores a
group of objects that inherit from an interface (let's call it
IEntity). The default item[] property and Add() method both handle
IEntity types, and I implement this interface on several objects. When
trying to serialize it I get a serialization error ("cannot serialize
interface IEntity") when I try to return a class that contains a
property that uses the collection type.
I tried shadowing the item[] member to return a class type rather than
an interface type, but no luck.
I'm starting to loose the rest of my hair ;-)
Thanks in advance,
Josselin Tag: how to shutdown Tag: 102522
How to keep memory usage and CPU as low as possible?
Hi,
How can I keep the memory usage and CPU usageas low as possible in a VB.NET
application? any special techniques, any things to consider?
Thanks a lot in advance,
Pieter Tag: how to shutdown Tag: 102521
.NET Framework 2. Beta: final version?
Hi,
I want to develop an application with Visual Studio 2005 Beta 2. But When
theo fficial release will happen in some months: will the 2.0 Framework be
changed, or does it stay the same as the current 2.0 Beta 2?
In cae it isn't the same: any harm for desisntalling it and installing the
new release at that moment,
thanks,
Pieter Tag: how to shutdown Tag: 102520
Encrypting a Web.Config value using Microsoft Enterprise Library-J
The Data EDRA is execellent in allowing Connection String to be encrypted,
but as yet I could not find any example of how to encrypt the following entry:
<appSettings>
<add key="SpecialPassword" value="aPasswordIwantEncrypted" />
</appSettings>
How could I do this? I already have
securitycryptographyconfiguration.config and the encryption .key file setup
(when I set up my Data EDRA to encrypt connection sting password). Tag: how to shutdown Tag: 102519
Finding DOT NET Framework Installed Path
Actually I have a 'windows service' as a part of the whole Visual Studio
solution (VS.NET 2003). I want to install this 'windows service' as a part of
the installation for the actual web-application. I used to do,
InstallUtil < service-exe-filename-with-path >
from the command prompt for Visual Studio 2003.
I wanted to include this in the installer itself.
Where to get the path for .NET framework
How to call the 'installutil < filename >' Tag: how to shutdown Tag: 102518
.NET controls running in Internet Explorer
Hi,
our system is running .NET controls hosted in Internet Explorer. Everything
was fine up to the moment when we started to get messages: "the publisher
could not be verified", browsing the pages having these ".NET applets"
inside. The message keeps repeating each time I enter the page, user needs
to press 'Run' on the messagebox prompting.
I went to lower the security setting for the browser and dotnet:
- adding the site to trusted sites
- enabling all dotnet/activex/java downloading/executing
- making checks in registry (e.g.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Download)
- i tried to sign controls giving them a strong name - no change
I'm running Windows XP professional version 2002 Service Pack 2. This is the
only version facing this problem (maybe this 'version 2002' causes this). On
other machines I'm using SP2 for XP pro for a year without any problems.
Our .NET controls of course do not have any certificate (they're not
approved by any VeriSign like agency)
- system i working in LAN only!
- we would like to avoid unneeded costs
- would this surely help anyway?
- could thi sthing be solved using test certificate (using cert2spc.exe?)
Any clue? Anybody facing this problem?
Igor Kramaric, dev.engineer
P.S. I found many articles addressing the security issues ragrding SP2 on
XP, none of them is focusing on .net controls in IE Tag: how to shutdown Tag: 102517
Image processing application
If i had to develop a windows forms based application , that would be used
for viewing a running video in one window, freezing an image from the video
into another window based on user's choice, and then change the resolution,
position, color intensity and zoom of the frozen image, what should i be
using ? C# and Win 32 ? Or Just C# ? Or VC++.NET ? (Or MFC / ATL ?).
Please advise , since i have only used C# for data driven application so
far, and would have to learn the other technologies for this application.
Regards,
Chak. Tag: how to shutdown Tag: 102516
Carriage Return in WinForms Label?
Is it possible to insert a carriage return in a WinForms Label's Text with
the VS.NET WinForms Designer?
(Including '\n' doesn't work -- that gets converted to '\\n'.) Tag: how to shutdown Tag: 102512
Is the Threadpool useless ?
I have a problem with the threadpool I can't seem to figure out.
If I use ThreadPool.QueueUserWorkItem to queue say 25 work items,
I would expect the Threadpool to give me the 25 free threads of the thread
pool i.e. execute my WaitCallback method 25 times instantly. However, there
seems to be about 0.5 sec. delay in pulling each thread of the queue.
Running the test code
public void WaitCallback( object state )
{
System.Diagnostics.Debug.WriteLine("Thread "+((int)state).ToString()+"
started");
Thread.Sleep(10000);
}
for( int i =0; i<50; i++)
ThreadPool.QueueUserWorkItem(new WaitCallback(WaitCallback),i);
I would expect the threadpool to instantly give me all available threads
thus executing the WaitCallback method 25 times. However, it takes at least
25 seconds for the pool to kick off 25 threads.
If you do not get the threads immediately, this in my book would make the
Threadpool completely useless for server purposes and any other for that
matter.
Is this as designed or am I doing something wrong ?
Regards
Per Millard
Systems Architect
Copenhagen
Denmark Tag: how to shutdown Tag: 102511
Problem with .Net app using 25% cpu
Hi!
I am developing a .Net app and I have got some problems with the program
suddenly using 25% cpu... The strange thing is that my program is not doing
anything(as far as I can tell), and the UI is just as responsive as ever,
even though it's single threaded (shouldn't it get a little sluggish??),
leading me to believe the problem must lie in a thread I don't controll
(GC????) . The program will keep using 25% cpu until shutdown, when restarted
it can work satisfactory (about 1-2% cpu) for anything between 10 minutes to
10 hours before the problem reappears.
Using a process viewer I have found the faulting thread to be spending time
in
mscorwks.dll!ReleaseFusionInterface, anyone know what this is???
Any help would be greatly appreciated
Sincerley
Rune Lanton
Transportnett AS Tag: how to shutdown Tag: 102507
OnGotFocus Problem
I am deriving a class from TextBox to implement a NumericBox. I am
overriding OnGotFocus and OnLostFocus methods but On GotFocus is causing
problems. Actually the commented lines are causing problems. These throw
Win32 exception that windows was unable to create handle. I dunno wats
wrong. Plz help
protected override void OnGotFocus(EventArgs e)
{
//this.TextAlign=HorizontalAlignment.Left;
//this.SelectionStart=base.Text.Length;
base.OnGotFocus(e);
}
protected override void OnLostFocus(EventArgs e)
{
this.TextAlign=HorizontalAlignment.Right;
base.OnLostFocus(e);
} Tag: how to shutdown Tag: 102506
Regular Expression required
RegEx heros,
I want to validate a certain field such that it shouldn't contain the
percentage character (%) or the asterisk character symbol (*). The
specification is that:
(1) The field must not contain the percentage symbol; AND
(2) The field must not contain the asterisk symbol.
It should contain neither of them. Can you please help me with the
RegEx for this? Tag: how to shutdown Tag: 102505
Using XmlSerializer
What do i need to add to my class so that the ArrayList the holds a
collection of my class will serialize properly.
heres my class
[System.Xml.Serialization.XmlInclude(typeof(Card))]
public struct Card
{
private int numbericvalue;
private CardDeck.Suits suit;
private CardDeck.Types type;
public CardDeck.Suits Suit
{
set
{
suit = value;
}
get
{
return suit;
}
}
public CardDeck.Types Type
{
set
{
type = value;
}
get
{
return type;
}
}
}
I create an ArrayList, add the class to the ArrayList and try to call
XmlSerializer.Serialiaze(myArrayList);
i recieve this error:
The type Card
was not expected.
Use the XmlInclude or SoapInclude
attribute to specify types that are not known statically
what else do i have to add to my Card class so that it will work Tag: how to shutdown Tag: 102504
Binding a datagrid to a System.Collections member
Ok, all I am doing is trying to bind a data grid to an IDictionary.
Here goes:
Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack() Then Call BindData()
End Sub
Public Sub BindData()
Dim Skl As New Hashtable
Skl.Add(1, "Visual C#")
skl.Add(2, "Visual Basic")
skl.Add(3, "Win32 API Programming")
dg.DataSource = skl
dg.DataBind()
End Sub
The error I get is:
System.Web.HttpException: DataGrid with id 'dg' could not automatically
generate any columns from the selected data source.
on the line:
dg.DataBind()
So, is there some special glue when you have to bind a datagrid to a
non-relational source such as IList or IDictionary or Hashtable? Tag: how to shutdown Tag: 102486
VPN in VB.NET
Hi all,
I'm trying to initiate a VPN connection programically from VB.NET. I know
you can Process.Start(the .lnk file), but then I would like to cleanly manage
vpn disconnections.
Has anybody found a way to do that from WMI/net.sockets?
Thanks,
Vince Tag: how to shutdown Tag: 102484
String stream in VB.NET 2003 (.NET 1.1)
I have some libraries that will write to a stream. I would like them to write
to a string, which I can then manipulate in memory, rather than to a file. I
cannot find documentation for how to get a stream that writes to or reads
from a string.
Is such functionality available?
Thanks!
~BenDilts( void ); Tag: how to shutdown Tag: 102433
Converting Tif to Jpeg problem
(Sorry for the double post I just saw the naming required for themanged
newsgroup and I need an answer!! Thanks)
Hi,
I'm writing an application that extract attachment from
Exchange, save it in an SQL DB and then display it over the web. Everything
works fine for JPG, GIF, etc. However for TIFF file I need to convert them.
However my code does not seem to work... I can convert from JPEG to GIF but
not from TIFF to GIF or JPEG.
For some reason the converted TIFF image appears to become corrupted during
the conversion... The resulting JPEG image shows an empty large image
holder. If I
"re-convert" (or if you prefer "re-save as a JPEG") a second time the image
again before displaying it, then it shows a portion of the image but then
seems to repeat a "pixel row" indefinetely till the bottom... Any idea has to
what I'm doing wrong?
Thanks a lot for your help.
Here is the code I use:
//Converts the bytes extracted from the exchange attachment
//Note: I tried using a file instead of memory stream with the same results
public byte[] ConvertTiffToJpeg(byte[] tiffImage)
{
//Creating memory stream with the raw image data
System.IO.MemoryStream memStrm = new
System.IO.MemoryStream(tiffImage, true);
memStrm.Write(tiffImage, 0, tiffImage.Length);
//Create an image from the memory stream
System.Drawing.Image img =
System.Drawing.Image.FromStream(memStrm, true, false);
//Get the list of available encoders
System.Drawing.Imaging.ImageCodecInfo[] codecs =
System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders();
//find the encoder with the image/jpeg mime-type
System.Drawing.Imaging.ImageCodecInfo ici = null;
foreach (System.Drawing.Imaging.ImageCodecInfo codec in
codecs)
{
if (codec.MimeType == "image/jpeg")
ici = codec;
}
//Create a collection of encoder parameters (we only need
one in the collection)
System.Drawing.Imaging.EncoderParameters ep = new
System.Drawing.Imaging.EncoderParameters();
//Create an encoder parameter for quality with an
appropriate level setting
ep.Param[0] = new
System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)100);
//Convert the tiff image to jpeg and save the result to a
new memory strem
System.IO.MemoryStream convertedMs = new
System.IO.MemoryStream();
img.Save(convertedMs, ici, ep);
//Convert the jpeg image back to byte
return convertedMs.ToArray();
}
--
Martin Rajotte
Incycle Software Tag: how to shutdown Tag: 102428
Problem converting TIFF to JPEG
Hi,
I'm writing an application that extract attachment from
Exchange, save it in an SQL DB and then display it over the web. Everything
works fine for JPG, GIF, etc. However for TIFF file I need to convert them.
However my code does not seem to work... I can convert from JPEG to GIF but
not from TIFF to GIF or JPEG.
For some reason the converted TIFF image appears to become corrupted during
the conversion... The resulting JPEG image shows an empty large image
holder. If I
"re-convert" (or if you prefer "re-save as a JPEG") a second time the image
again before displaying it, then it shows a portion of the image but then
seems to repeat a "pixel row" indefinetely till the bottom... Any idea has to
what I'm doing wrong?
Thanks a lot for your help.
Here is the code I use:
//Converts the bytes extracted from the exchange attachment
//Note: I tried using a file instead of memory stream with the same results
public byte[] ConvertTiffToJpeg(byte[] tiffImage)
{
//Creating memory stream with the raw image data
System.IO.MemoryStream memStrm = new
System.IO.MemoryStream(tiffImage, true);
memStrm.Write(tiffImage, 0, tiffImage.Length);
//Create an image from the memory stream
System.Drawing.Image img =
System.Drawing.Image.FromStream(memStrm, true, false);
//Get the list of available encoders
System.Drawing.Imaging.ImageCodecInfo[] codecs =
System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders();
//find the encoder with the image/jpeg mime-type
System.Drawing.Imaging.ImageCodecInfo ici = null;
foreach (System.Drawing.Imaging.ImageCodecInfo codec in
codecs)
{
if (codec.MimeType == "image/jpeg")
ici = codec;
}
//Create a collection of encoder parameters (we only need
one in the collection)
System.Drawing.Imaging.EncoderParameters ep = new
System.Drawing.Imaging.EncoderParameters();
//Create an encoder parameter for quality with an
appropriate level setting
ep.Param[0] = new
System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)100);
//Convert the tiff image to jpeg and save the result to a
new memory strem
System.IO.MemoryStream convertedMs = new
System.IO.MemoryStream();
img.Save(convertedMs, ici, ep);
//Convert the jpeg image back to byte
return convertedMs.ToArray();
} Tag: how to shutdown Tag: 102424
Bug in System.Timers.Timer class
The System.Timers.Timer class has a property Interval, which is a double
(timer interval in milliseconds)
If interval is set to a double value > Int32.MaxValue and the timer is
started, an ArgumentOutOfRangeException is thrown (Additional information:
Number must be either non-negative or -1).
It seems to me that internally, the double Interval is casted to an int...
Geert Depickere. Tag: how to shutdown Tag: 102417
Microsoft.Web.UI.WebControls not found
I downloaded a complete DataGrid example, "IssueTracker", for accessing an
Access DB with a DataGrid control. Sounded like a cakewalk. The first line
of the .aspx file referenced the "Microsoft.Web.UI.WebControls" namespace.
I got an error msg that the namespace could not be found.
Any ideas?
The gory details follow:
I expanded the compressed, downloaded app into "AppFolder", which had .aspx
and .vb files and a couple of sub-folders.
The first line of the .aspx file is:
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
I copied the AppFolder to the wwwroot folder a la Jeff Prosise's guidance
for testing his MyComicsRepeater example. I pointed IE to
http://localhost/AppFolder/IssueTracker.aspx
I got:
· Server Error in '/' Application.
· Parser Error Message: File or assembly name
Microsoft.Web.UI.WebControls, or one of its dependencies, was not found.
· Line 1: <%@ Register TagPrefix="iewc"
Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
The latter line was rendered in red.)
I searched the web and found
·
http://msdn.microsoft.com/library/default.asp?url=/workshop/webcontrols/assemblies/webcontrols_entry.asp
that claimed "Microsoft Internet Explorer WebControls are not currently
supported".
A few other pieces of possibly relevant data:
I'm running
· WinXP-Pro/SP2 with security upgrades from MicrosoftUpdate and .NET
1.1
· Visual Studio .NET (MSDE 2002 using .Net Framework 1.0) despite the
fact the I've got 1.1 installed Tag: how to shutdown Tag: 102403
What is the best way to implement this scenario?
We need to implement an application with following requirements.
This application needs to use a user defined component that plays movie
files. This application needs to run through web pages as well as a
stand-alone application through CD media.
Is has to be developed in VC.Net 1.1/2.0.
What is the best way to implement this application whereby maximum code
utilization can be done for both web and cd usage? Tag: how to shutdown Tag: 102399
Process - no window open
Hi,
I have a C# (form) program. I need it to run a 'command line program'. I
have it working fine using Process, but it (temporarily) opens a Command
Prompt window everytime it runs (and closes it when it finishes).
How do I get it to run in the background without opening a window each time
I call process.Start()? (FYI: I searched for this on the web but couldn't
find anything)
Thanks,
Hilton Tag: how to shutdown Tag: 102388
Detecting if SMTP server is running
Hi
I'm working on a project where some business process rely on several
external servers to perform processing. These are Sql Server x 2, Credit
Card processing and Mail Server.
Before entering the business process, I'd like to verify that each of these
are available, in particular the SMTP Server, which is the most volatile of
the above servers. What would be the best way to detect if the SMTP server
is up and running?
Ben Tag: how to shutdown Tag: 102386
select multiple xml fragments from xml file
Hi,
I have an xml file (see below). using C# I would like to pull out all
student names and write then to screen.
As there may be an unknown number of <studentName> tags in the file, what i
would like to do is "select" all <studentName>
nodes and for each one write out first name and last name.
can anybody point me in the direction (or show me how to do this.)
what I would like is something like the following foreach loop
foreach studentname element in the xmldocument
{
console.writeline(...student first name)
console.writeline(...student last name)
}
many thanks in advance.
cheers
martin.
============================================================================
=====================================================
<names>
<college>xml College</college>
<year>1995</year>
<class>orange</class>
<studentName>
<Firstname>John</Firstname>
<LastName>moses</LastName>
</studentName>
<studentName>
<Firstname>greg</Firstname>
<LastName>bennet</LastName>
</studentName>
<studentName>
<Firstname>lucus</Firstname>
<LastName>starsky</LastName>
</studentName>
<studentName>
<Firstname>chuck</Firstname>
<LastName>jennings</LastName>
</studentName>
<studentName>
<Firstname>nick</Firstname>
<LastName>edwards</LastName>
</studentName>
<studentName>
<Firstname>gordon</Firstname>
<LastName>bennet</LastName>
</studentName>
<studentName>
<Firstname>james</Firstname>
<LastName>galloway</LastName>
</studentName>
<studentName>
<Firstname>paul</Firstname>
<LastName>elley</LastName>
</studentName>
<studentName>
<Firstname>simon</Firstname>
<LastName>simone</LastName>
</studentName>
</names> Tag: how to shutdown Tag: 102385
Enterprise Library - Asynchronous Logging...
I have managed to get asycnhronous logging work for an asp.net application
and I wanted some clarification on the method.
Normally if the application is logging synchronously it has all the settings
for the logging application block in the app.config for the application. But
if you want to use asynchronous logging you have to specify asynchronous
logging for all logging types in the app.config of the application and then
define the extact logging sinks in the app.config of the msmqdistributor.exe
(windows service). Is this correct?
Seems rather confusing and rather messy - application specific logging
information have to be put into a generic widows service that could be used
by more than one application on the system.
cheers
Ollie Riches Tag: how to shutdown Tag: 102382
Help with HttpWebRequest.Method
Thanks in advance for any help offered.
I am trying to fill out a form on a web page and submit the form data to the
web server , all from within my vb program.
The html sorce ( reduced for this post is)
<FORM ACTION="a_valid_url.cfm" METHOD="POST">
<BR>
<P>Trend
<SELECT NAME="trend_id">
<OPTION VALUE="ALL;ALL">ALL
<OPTION VALUE="FIRST;abc">First
<OPTION VALUE="SECOND;abc">Second
</SELECT>
<P>
<TABLE WIDTH=400>
<TR ALIGN=CENTER><TD>Month
<SELECT NAME="month">
<OPTION VALUE="ALL" SELECTED>ALL
<OPTION VALUE="1">Jan
<OPTION VALUE="2">Feb
</SELECT>
</TD>
<TD>Day
<SELECT NAME="DAY">
<OPTION VALUE="ALL">ALL
<OPTION VALUE="1">1
<OPTION VALUE="2">2
</SELECT>
</TD>
</TR>
</TABLE>
<P><INPUT TYPE="submit" VALUE="Search">
</FORM>
In my vb program I set up a HttpWebRequest as follows.
I have no experience with HTML or Jscript. Limited experience with VB.
I want to submit a trend_id of "FIRST" with "ALL" months and "ALL" days from
my vb prog.
Dim STE As String = "http://www.a_valid_url"
Dim m_cred As New NetworkCredential("username", "password")
Dim m_Cache As New CredentialCache()
m_Cache.Add(New Uri(STE), "Basic", m_cred)
m_Cache.Add(New Uri(STE), "Digest", m_cred)
m_Cache.Add(New Uri(STE), "NTLM", m_cred)
m_Cache.Add(New Uri(STE), "Kerberos", m_cred)
Dim mm_req As HttpWebRequest = CType(WebRequest.Create(STE),
HttpWebRequest)
mm_req.Credentials = m_Cache
Dim srch As String
srch = "I'm not sure what goes here??"
Dim qq() As Byte = Encoding.ASCII.GetBytes(srch)
mm_req.Method = "POST"
mm_req.ContentLength = qq.Length
mm_req.Timeout = 60000
Dim req_stream As Stream = mm_req.GetRequestStream
req_stream.Write(qq, 0, qq.Length)
req_stream.Close()
Dim mm_resp As HttpWebResponse = CType(mm_req.GetResponse(),
HttpWebResponse)
Dim readStream As New StreamReader(mm_resp.GetResponseStream,
Encoding.ASCII)
Dim ch As String = readStream.ReadToEnd
...
...
readStream.Close()
mm_resp.Close()
I have tried various ways of constructing 'srch' but I keep getting back the
unfilled form. The server doesnt proceed to the url in the Action field of
the form.
--
Roger Tag: how to shutdown Tag: 102380
UI.WebControls TreeView
Hello.
I have trouble with the microsoft treeview. When I run my project local
everything seem to work. When I upload the project to the server I do the
following.
- Release project
- Copy Project. (Only files needed to run this application
- Upload the project to the server.
When I open the webpage with my project och open the page with the treeview
I only see text. Like this
Publika bilder Flags 121.gif 134.gif canada.gif china.gif flag.gif
flags_1142.gif flags_1143.gif flags_1144.gif flags_1145.gif france.gif
isril.gif mexico.gif
No nodes......
Regards... Tag: how to shutdown Tag: 102377
Sending email with attached files via WebDAV for Exchange
Hi all,
Anybody know how to send email message with attached files via WebDAV for
Exchange (MS Exchange 2003 Server).
Please, please, please! Need help! ASAP!!!!
Tnx,
Lev Tag: how to shutdown Tag: 102376
Security Appl. Block using AzMan
Hello All,
I have assigned a task to create a security application block using
Authorization Manager/ADAM. In abstract all roles and operation would
be saved in Authorization Manager (AzMan) and Main page would be shown
based on roles and operations user is assigned to using security
application block.
In this regard, if any one has any article/step-by-step guide or any
informative document, please share with me.
cheers!
iusfani Tag: how to shutdown Tag: 102373
Difference in XML serialization between Win 2000 and Win XP ?
Hi, I'm getting some very odd (to me atleast) results when writing a
serialized object to disk as an xml file.
It works correctly in WinXP but not in Win 2000.
This is the code:
XmlSerializer x = new XmlSerializer( typeof(OptionsHolder) );
TextWriter writer = new StreamWriter( "serversettings.xml" );
x.Serialize( writer, opt );
writer.Close();
and the object has the following class:
public class OptionsHolder
{
public int timeout;
public string lastrapportdate = "";
public string lastprintdate = "";
public bool deleteNonConfirmed = true;
public string defaultProject = "obevakad";
public string [] watchprinters; // = new string[256]; // Max 256 skrivare på
en server
public string [] dontwatchprinters; // = new string[256]; // Max 256 skrivare
på en server
public string [] ignoreips; // = new string[256]; // Max 256 klienter kan
ignoreras
public OptionsHolder()
{
}
}
On Win 2000 it just refuses to write whatever string is currently present in
lastrapportdate.
I have verified that there is content in the variable before serializing.
All other items get dumped to disk.
Result after serializing in WinXP Proffesional
<?xml version="1.0" encoding="utf-8" ?>
- <OptionsHolder xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<timeout>5</timeout>
<lastrapportdate>2005-09-04:21:23</lastrapportdate>
<lastprintdate />
<deleteNonConfirmed>true</deleteNonConfirmed>
<defaultProject>Obevakad</defaultProject>
<watchprinters />
- <dontwatchprinters>
<string>Microsoft Office Document Image Writer</string>
<string>Apple LaserWriter 12/640 PS</string>
</dontwatchprinters>
<ignoreips />
</OptionsHolder>
Result after serializing in Windows 2000 Pro
<?xml version="1.0" encoding="utf-8" ?>
- <OptionsHolder xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<timeout>5</timeout>
<lastrapportdate />
<temp />
<lastprintdate />
<deleteNonConfirmed>true</deleteNonConfirmed>
<defaultProject>Obevakad</defaultProject>
<watchprinters />
- <dontwatchprinters>
<string>Microsoft Office Document Image Writer</string>
<string>Apple LaserWriter 12/640 PS</string>
</dontwatchprinters>
<ignoreips />
</OptionsHolder>
Any ideas?
///. Tom Hellstrom
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =---- Tag: how to shutdown Tag: 102368
Thread.Start()
In the following example, could HasStarted() ever return false (meaning
that ThreadJob() would get called *after* Foo() returns)?
Basically I don't ever want Foo() to return until after the thread has
executed.
------
void Foo() {
Thread thread = new Thread(ThreadJob);
thread.Start();
if (HasStarted(thread)) {
thread.Join();
}
}
void HasStarted(Thread t) {
return
t.ThreadState & (ThreadState.Stopped | ThreadState.Unstarted)) == 0;
}
------
I ask because I don't know for sure what exactly happens when
Thread.Start() is called. Tag: how to shutdown Tag: 102363
problem with VB code on some machines (.net bug may be)
I have made my first visual basic .net 2003 application and I get the
following message on 1 of my computers (it works on 3 others).
Mailer4u.exe - Common Language Runtime Debuggin Session
Application has generated an exception that could not be handled.
Process id=0x6b4 (1716), Thread id=0xc70 (3184).
Click OK to terminate the application
Click CANCEL to debug the application
I searched on google and found 1000's of people with the same problem for a
range of applications. Every one had different reasons and not one had a
working solution / fix. If any body has an idea can you let me know. If you
could also email me at d a v i d @ j e m d a m . c o m that would also help
(remove all the spaces from the email address first).
If someone would like to try my code on their computer and see if they can
repeat the problem you can download it here:
http://www.mailer4u.com
Thanks in advance for any one who can figure it out.
David Tag: how to shutdown Tag: 102358
System.Net.HttpWebRequest - help
Thanks folks!
I'm new to this.
I'm trying to send a username , password to a website from my vb program
using httpWebRequest
I know how to set up the request and how to send a string via GetRequestStream
also how to to get the response.
Totally lost on how to send the username, password to the webpage for login.
Presently my request returns the html text for the login page.
Any help would be welcomed
--
Roger
--
Roger Tag: how to shutdown Tag: 102350
Hashtable thread safety?
It doesn't seem completely clear to me which operations I can perform while
continuing to be thread-safe on a Hashtable. Consider this scenario:
Hashtable 'table' contains the following:
table[1] = 1
table[2] = 2
table[...] = ...
table[Int32.MaxValue] = Int32.MaxValue
The following threads are now running against that same table
Thread 1:
for( int i = -1; i > Int32.MinValue; i-- )
{
table.Add( i, i );
}
Thread 2:
for( int i = 1; i < Int32.MaxValue; i++ )
{
table.Remove( i );
}
Thread 3:
while( true )
{
IList list = new ArrayList( table.Keys );
foreach( int number in list )
{
Console.WriteLine( number );
}
}
Obviously this is unusual, but it's something like what I actually have, and
I want to know whether or not this is thread-safe or if I need to provide
some synchronization. Thanks! Tag: how to shutdown Tag: 102348
Posting values between pages
That ASP.NET pages post to themselves, how do pages share information
amoung themselves? As in, if my index.aspx has to post data to
nextpage.aspx, how does it happen? Is it left to the developer to
persist relevant control values in a state dictionary such as Session
and read them back in the target/destination page nextpage.aspx? Tag: how to shutdown Tag: 102346
SocketException ???
Hi.
I have some quite unusual situation at which SocketException is thown while
connecting a socket. Generally the aim of application is processes data and
send results to a specified IPEndPoint. Since theres small amount of time
for processing and sending large amount of data it is logical to split whole
process in to few threads. One thread processes data and other sends it. The
problem occures when user sets too little time for doing that.
At first the thread works fine for about a minute or two, results are being
received on another machine event when the speed of whole process is
considered to be critical. And then just like that, exception
SocketException is thrown while connecting to an IpEndPoint with message
that might be translated as "It is usually allowed a single use of socket
address". As seen below socket is being shutdown and closed in the end. And
it seems like theres absolutely no reason for that exception to catch. Any
propositions? Thank you.
Error code of exception is 10048
private void Operate()
{
while (/*There is data to send*/)
{
Socket socket = null;
try
{
socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
socket.Connect(ipEndPoint);
<--------------------------------------------------------------------------Exception:
SocketException thrown here !!!!!!!!!!!!!
NetworkStream stream = new NetworkStream(socket);
BinaryWriter writer = new BinaryWriter(stream);
Scan[] scans = null;
lock (queue)
{
scans = queue.Dequeue() as Scan[];
}
for (int i = 0; i < scans.Length; i++)
{
writer.Write(scans[i].Azimuth);
socket.Send(scans[i].Data);
}
if (socket.Connected)
{
socket.Shutdown(SocketShutdown.Both);
}
}
catch (SocketException e)
{
msp.Engine.Paused = true;
if (MessageBox.Show(msp.Window,"Error occured:\n" + e.ToString()
+ "\n\nStop process?","Warning",MessageBoxButtons.YesNo) ==
DialogResult.Yes)
{
msp.Engine.Launched = false;
}
else
{
msp.Engine.Paused = false;
}
}
finally
{
if (socket != null)
{
socket.Close();
}
}
} Tag: how to shutdown Tag: 102345
System.Threading.Monitor and SendMessage
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C5B066.058A4E30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
We have an application written in c# that uses pinvoke to call =
SendMessage to send messages between threads. We also use Monitor class =
(via the c# lock keyword) for thread synchronization.=20
I have discovered the following behaviour, which surprised me:
0) Thread1 (T1) creates a NativeWindow, to be used as a SendMessage =
target, then calls Application.Run()
1) T1 enters an event handler
2) inside the event handler, T1 enters a lock region (calls =
Monitor.Enter), but blocks because another thread (call it T2) has =
entered
3) T3 calls SendMessage on the NativeWindow created by T1
4) The message handler for the message sent in 3) is run, while T1 is in =
the Monitor.Enter() call.
If I do the following experiment, I get different behaviour (code =
changes in bold)
0) Thread1 (T1) creates a System.Windows.Forms.Control, to be used as an =
Invoke target, then calls Application.Run()
1) T1 enters an event handler
2) inside the event handler, T1 enters a lock region (calls =
Monitor.Enter), but blocks because another thread (call it T2) has =
entered
3) T3 calls Invoke on the Control created by T1
4) T1 Monitor.Enter() returns (T2 called Monitor.Exit), and ultimately =
the event handler T1 is running returns
5) The delegate passed into Control.Invoke() in step 3) runs
The behaviour in the 2nd experiment is what I was expecting in the first =
experiments' case. It appears, in the first experiments case, that =
inside Monitor.Enter(), messages sent by SendMessage are being =
dispatched before it returns.
Does anyone have any idea what I can do, in the SendMessage case, to get =
the behaviour I am seeing using Control.Invoke()? I would rather not use =
Control.Invoke() because it has a couple limitations relative to using =
SendMessage() (but I may have to...)
Thanks for any insights any of you might have.
Craig Bryant
Senior Software Engineer
Tektronix, Inc
Beaverton, OR
------=_NextPart_000_0009_01C5B066.058A4E30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2627" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>We have an application written in c# =
that uses=20
pinvoke to call SendMessage to send messages between threads. We also =
use=20
Monitor class (via the c# lock keyword) for thread=20
synchronization. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I have discovered the following =
behaviour, which=20
surprised me:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>0) Thread1 (T1) creates a NativeWindow, =
to be used=20
as a SendMessage target, then calls Application.Run()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>1) T1 enters an event =
handler</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>2) inside the event handler, T1 enters =
a lock=20
region (calls Monitor.Enter), but blocks because another thread =
(call it=20
T2) has entered</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>3) T3 calls SendMessage on the =
NativeWindow=20
created by T1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>4) The message handler for the message =
sent in 3)=20
is run, <EM>while T1 is in the Monitor.Enter() call</EM>.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>If I do the following experiment, I get =
different=20
behaviour (code changes in bold)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>0) Thread1 (T1) creates a=20
<STRONG>System.Windows.Forms.Control</STRONG>, to be used as an Invoke =
target,=20
then calls Application.Run()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>1) T1 enters an event =
handler</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>2) inside the event handler, T1 enters =
a lock=20
region (calls Monitor.Enter), but blocks because another thread =
(call it=20
T2) has entered</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>3) T3 calls <STRONG>Invoke on the =
Control</STRONG>=20
created by T1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>4) T1 Monitor.Enter() returns (T2 =
called=20
Monitor.Exit), and ultimately the event handler T1 is running=20
returns</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>5) The delegate passed into =
Control.Invoke() in=20
step 3) runs</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The behaviour in the 2nd experiment is =
what I was=20
expecting in the first experiments' case. It appears, in the first =
experiments=20
case, that inside Monitor.Enter(), messages sent by SendMessage are =
being=20
dispatched before it returns.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Does anyone have any idea what I can =
do, in the=20
SendMessage case, to get the behaviour I am seeing using =
Control.Invoke()? I=20
would rather not use Control.Invoke() because it has a couple =
limitations=20
relative to using SendMessage() (but I may have to...)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for any insights any of you =
might=20
have.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Craig Bryant</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Senior Software Engineer</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Tektronix, Inc</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Beaverton, =
OR</FONT></DIV></BODY></HTML>
------=_NextPart_000_0009_01C5B066.058A4E30-- Tag: how to shutdown Tag: 102339
SqlException: Unknown Error
I have some code doing a very simple select "select bonusid from game where
gameid=@gameid" that works about 98% of the time, but somewhere around two
percent of the time it throws an exception. If I go through the sqlerror's
in the exception all it has is the following:
Index #0
Message: Unknown error.
LineNumber: 0
Source: .Net SqlClient Data Provider
Procedure:
Not very interesting is it. I've checked that the input is valid and I have
no problems running the same query manually. I also have yet to find a
consistent way to recreate this error but my clients are having no problems
doing it fairly frequently with no rhyme or reason that I can tell.
Although there are many clients simultaneously using the server they share
one database connection but I am very careful to only use the connection
through a wrapper class that Lock()'s the database connection. I'm really
lost on this one, has anyone else seen this? I could find next to nothing
on google/google groups.
Lloyd Christopher
SLOW30 Tag: how to shutdown Tag: 102325
Debugging Problem
Hi all,
I am trying to debug an application developed by another developer. if i run
it in Debug mode(locally), the application hangs and does nothing (basically
dies and makes me wanna kill myself),... "does not reach the break point....
nada....." but if I try to run the application from another machine while
the application is under debug mode, it hits the break point.
Please advice,
Stephen Noronha Tag: how to shutdown Tag: 102324
Enterprise Library really su#$%"#!"ks
Hello, long days these days than i had trying to setting up the Enterprise
Library Blocks in the production server.
Why? I will told you all my sad history, I had installed in my computer the
enterprise library of june with the ilussion than that will keep me away from
the database connections problems, scalability problems, and all that
things!, and I had tested that in my developer machine, and I dont had these
problems, but when I had started to setup the server, wow, what a
fu"#$%#$#$!"cking problem, the assemplies of the Enterprise Library doesn't
work. I had runned without results the installutil for each assembly, I had
compiled in command line the source code of these blocks in the server and i
dont had results, i had do everything possible (but not install the Visual
Studio 2003), and i dont have positive results.
Hey Microsoft guys, what is the problem with yours??, Keep it simple, why
the DAAB had worked so good, so easy, and with that enterprise library
everithing had changed, and you had send us a stupid problem.
For all you gouys, the problem than I got is that message error:
The type initializer for
"Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataConnectionFailedEvent" threw an exception. Tag: how to shutdown Tag: 102322
Hi to all.
I have a little problem. I need to shutdown, restart, or suspend the
system. How should I do?
Thanks a lot.
I think you'll need to find the right Windows API call and invoke it from
your application.
"am" <am_public@email.it> wrote in message
news:1126019438.250009.301730@g14g2000cwa.googlegroups.com...
> Hi to all.
> I have a little problem. I need to shutdown, restart, or suspend the
> system. How should I do?
> Thanks a lot.
>
"am" <am_public@email.it> wrote in message
news:1126019438.250009.301730@g14g2000cwa.googlegroups.com...
> Hi to all.
> I have a little problem. I need to shutdown, restart, or suspend the
> system. How should I do?
> Thanks a lot.
>