Inserting XML into a XmlDocument object
I have a XmlDocument object that has data in it already and I want to add 1 or more sections into the XmlDocument. Are there any c# (vb.net will work) examples or ideas anyone willing to share? Thanks...sonny Tag: How to decode PaskeLen? Tag: 76711
Regexp Validation
Oh great Regular Expression gurus - I summon thee...
I am using the regular expression validator...
I know this is probably about as trivial as it gets for someone with
regular expression experience, but I don't. I was wondering if
someone would be able to create a regular expression (for validating
user passwords) that matches the following:
All of the following must be true for a match:
6-12 length - Isn't it something like {6,12}
Must include 1 or more lowercase - [a-z]
Must include 1 or more uppercase - [A-Z]
Must include 1 or more numeric - [0-9]
That's it, from the little I know, those are the patterns that it
should use, but I have no idea how to create the full statement.
TIA!
JB Tag: How to decode PaskeLen? Tag: 76710
Sorting Problem
I need to sort an XML subtree using a value in a different matching subtree
in the same document.
The XSLT syntax I am using is (indented so that sort select and VAL
definition line up:
<xsl:for-each select='LABITEM0'>
<xsl:sort select='ancestor::TABLE/DATA/DIMN[@idx=current()/
@dimn_idx]/DIMN[@idx=$RANKCOL_IDX]/CELL/ITEM[contains($FIGTYPE,@class)][1]'
order='descending' data-type='number'/>
<xsl:variable name='VAL' select='/TABLE/DATA/DIMN[@idx=current()/
@dimn_idx]/DIMN[@idx=$RANKCOL_IDX]/CELL/ITEM[contains($FIGTYPE,@class)]
[1]'/>
<xsl:copy>
<xsl:copy-of select='@*'/>
<xsl:attribute name='ORD'><xsl:value-of select='position
()'/></xsl:attribute>
<xsl:attribute name='VAL'><xsl:value-of select='$VAL'/>
</xsl:attribute>
<xsl:copy-of select='*'/>
</xsl:copy>
</xsl:for-each>
This works fine using another XSLT processor (xsltproc)
BUT IS RETURNED UNSORTED (i.e. in original document order) using
XslTransform (and also msxml (4.0) from the command line).
The VAL attribute is correctly set - so I am pointing to the right values.
I've tried other sorts that do not use a path starting at the document root
and they seem to work OK.
Can anyone tell me why this isn't working - or suggest a sort select syntax
that would work? Tag: How to decode PaskeLen? Tag: 76703
Debug options
Does anyone know a way to NOT have the debugger debug javascript when going through ASP.Net code? I need to debug some code server side but I keep getting caught on some javascript error that never presents itself when running normally but seems to have some problem in the debugger. All I want to do is debug my VB and forget the javascript but it won't let me. I can't even step over the javascript block giving me hell. Tag: How to decode PaskeLen? Tag: 76699
serialization bug
Hi,
Could someone please confirm the following?
I think I have found a subtle .NET serialization bug. It occurs when object
has a list of items containing another object of the same type and both
objects have a non-static member reference to some other static object. In
this case, I get an InvalidArgument exception when I try to access the
non-static member of the child class. I've included a code sample to
clarify. This "bug" is causing a major problem for me. So, if anyone could
confirm it or let me know if I'm doing something wrong, I would be very
appreciative.
Thanks,
Aaron
Here is the sample
[Serializable]
public class A {
private ArrayList children;
private static Pen DPEN = Pens.Black;
private Pen pen = DPEN;
public A() {
children = new ArrayList();
children.Add(new D());
}
public void AddChild(A a) {
children.Add(a);
}
public A Child {
get { return (A)children[0]; }
}
public Pen Pen {
get { return pen; }
}
}
public class PenSurrogate : ISerializationSurrogate {
public void GetObjectData(Object obj, SerializationInfo info,
StreamingContext context) {
Pen pen = (Pen)obj;
info.AddValue("pencolor", pen.PenType == PenType.SolidColor ? pen.Color :
Color.Empty);
}
public Object SetObjectData(Object obj, SerializationInfo info,
StreamingContext context, ISurrogateSelector selector) {
return (Pen)info.GetValue("pencolor", typeof(Pen));
}
}
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
A a = new A();
A an = new A();
a.AddChild(an);
BinaryFormatter bFormatter = new BinaryFormatter();
SurrogateSelector s = new SurrogateSelector();
s.AddSurrogate(typeof(Pen), new
StreamingContext(StreamingContextStates.All), new PenSurrogate());
bFormatter.SurrogateSelector = s;
MemoryStream stream = new MemoryStream();
bFormatter.Serialize(stream, a);
stream.Seek(0, SeekOrigin.Begin);
A copy = (A)bFormatter.Deserialize(stream);
System.Console.WriteLine(copy.Pen.Color.ToString());
System.Console.WriteLine(copy.Child.Pen.Color.ToString()); //Causes an
InvalidArgument Exception
} Tag: How to decode PaskeLen? Tag: 76697
Problems with Compiling COM - newbie
HI,
I am having problems trying to compile a vb class, the code is below.
For some reason it doesn't recognise the namespaces, Data, or
Data.SqlClient.
In Visual Studio I have created a reference to System.Data, and
appears under references, but I can't seem to create one for
System.Data.SqlClient as it doesn't appear in the selection.
Another thing I should mention is that I am copying the vb class file
from our dev server onto my own machine and compiling it on my machine
using the VS.net compiler. I intend to copy and paste the dll into bin
on the dev server after.
What am I doing wrong??????
Thanks
Angela
-------------CODE-----------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class SQLTest
Public Shared Sub DeleteService(ByVal name As String, ByVal
strConnection As String)
Dim conPortal As New SqlConnection(strConnection)
Dim cmd As New SqlCommand("AdminDeleteService", conPortal)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@communityID", strConnection)
cmd.Parameters.Add("@name", name)
conPortal.Open()
cmd.ExecuteNonQuery()
conPortal.Close()
End Sub 'DeleteService
End Class Tag: How to decode PaskeLen? Tag: 76695
Best way to sent byte[] parameter to unmanaged code?
Using C#, I want to send a byte array to an unmanaged function with the
minimum amount of copies. The array is input only and won't be modified
(its copied on the unmanaged side).
I'm currently using fixed byte *. My question is: Should I be using In
byte[] parameter instead? Ref parameter?
fixed( byte *b = byte_array ) {
MyUnmangedFunc2( b, byte_array.Length );
}
[DllImport("foo.dll")] private static extern unsafe void MyUnmanagedFunc2(
byte *val, int count );
--OR--
MyUnmanagedFunc2( byte_array, byte_array.Length );
[DllImport("foo.dll")] private static extern unsafe void MyUnmanagedFunc2(
In byte[] val, int count );
I need a solution for both the compact framework and desktop framework.
(Don't have to be the same but closer the better)
Thanks,
Philippe Tag: How to decode PaskeLen? Tag: 76692
keybd_event in C#
How to use keybd_event api function in c# for combination keys
eg. ctrl+shift +s
I tried like
keybd_event(0x11,0x1D,0,0)
keybd_event(0x10,0xAA,0,0)
keybd_event(0x53,0x1F,0,0)
keybd_event(0x53,0x1F,0x0002,0)
keybd_event(0x10,0xAA,0x0002,0)
keybd_event(0x11,0x1D,0x0002,0)
but it doesn't work
-kannan Tag: How to decode PaskeLen? Tag: 76691
Stuck on problem using Serialization
This is what I have produced so far...
<?xml version="1.0" encoding="utf-8"?>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Tables>
<Table>
<NameOfTable>Table</NameOfTable>
<Columns>
<Column Name="Col_1">New_Col_1</Column>
<Column Name="Col_2">New_Col_2</Column>
<Column Name="Col_3">New_Col_3</Column>
<Column Name="Col_4">New_Col_4</Column>
<Column Name="Col_5">New_Col_5</Column>
</Columns>
</Table>
</Tables>
</Database>
I want
<NameOfTable>Table</NameOfTable>
in the form of
<NameOfTable Name="Table">NewTableName</NameOfTable>
and am having difficultly doing so.
I can get the form that I am looking for with the Columns because it is
an ArrayList. The NameOfTable is not. It is just a single Element.
Here is the code that produced the results above. I am attempting to
add in the TableName class to solve this problem but am not having
any luck in getting it to print out. It never hits the getter.
Any help is appreciated.
Dave
[XmlInclude(typeof(TableName))]
public class DatabaseTable
{
private TableName tableName;
private string name;
private string className;
private ArrayList columns = new ArrayList();
[XmlElement]
public string NameOfTable
{
get { return (name); }
set { name = value.Trim(); }
}
[XmlArray(ElementName = "Columns")]
[XmlArrayItem(ElementName = "Column", Type = typeof(DatabaseTableColumn))]
public ArrayList Columns
{
get {return (columns); }
}
[XmlElement(Type = typeof(TableName))]
public TableName MyTableName
{
get {return (tableName); }
}
}
public class TableName
{
private string dbName;
private string newName;
public TableName()
{
}
[XmlAttribute]
public string Name
{
get { return (newName); }
set { newName = value.Trim(); }
}
[XmlText(Type=typeof(string))]
public string NameOfDbColumn
{
get { return (dbName); }
set { dbName = value.Trim(); }
}
} Tag: How to decode PaskeLen? Tag: 76683
Remote Counter Monitoring using Perfmon
I don't know whether this is the right list....but we have configed our application to run on rpoduction environment and accoridng to KB Article ID 158438 - Enabling Non-Admin Users to remotely monitor with perfmon.. we have executed the required steps on production box...
Teh problem is we can access all system counters from remote machien but when we go thru .NET Counters or any custom counters those values don't get displayed. on remote machine...
Any special permission required for custom counters
Regards
Yogesh S Tag: How to decode PaskeLen? Tag: 76682
ANN: Reminder: Compact Framework chat today
Just a note that we'll be hosting an online chat this morning concerning
Smart
Device Programming with Visual Studio .NET 2003. We will be on hand ready
to
answer your questions, so bring 'em on!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Title: Smart Device Programming with Visual Studio .NET 2003
Chat Date: June 10th
10:00am - 11:00am Pacific Time
1:00pm - 2:00pm P.M. Eastern time
17:00 - 18:00 GMT/BST
Description: You know them from the newsgroups! You love them for their
immense knowledge! Please join these amazing Microsoft MVPs in this live
chat regarding the .NET Compact Framework and the Smart Device Programming
features of VS.NET. The .NET Compact Framework is a subset of the .NET
Framework designed to allow .NET developer to target smart devices. The
Smart Device Programming features of VS.NET allow embedded developers to
target devices running the Compact Framework.
To join this chat, please log on via the main MSDN chat page at:
http://msdn.microsoft.com/chats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
--
Thanks!
Michael Fosmire
Community PM/MVP Lead, Windows Embedded
This posting is provided AS IS with no warranties, and confers no rights. Tag: How to decode PaskeLen? Tag: 76681
calling a class defined in an ASP.NET project from windows application
Hi,
I'm working on a web project and i create classes to do business logic and
connect to DB.
i also need a windows application to do the same functionality as defined
in classes inside the ASP.NET project.
when i reference the web project DLL (inside the BIN directory) I
successfully make a call to a function and get return value.
but this is just a test and when trying to access the application
configuration information (defined in web.config) i get empty string in
return.
is there a way to share functionality between web and windows/service
projects?
TIA, zigi. Tag: How to decode PaskeLen? Tag: 76680
Refection/Serialization Problems
Hi,
I'm trying to build a gerenic routine which deals with versioning problems
between serailized objects. All my objects are Serialized into a SQL
server DB, but I need to make changes to the object tree and also make
future changes easier.
I'm using custom serialization and reflection and I think I'm getting there,
but I have a wierd problem. I've extracted all the properties from the
object in question and passed the info to the following VB routine. It's
working fine until it encounters an invalid member in the serializationinfo
(which is expected - it's a newly added property in my object), but after
that it never recovers - from that point on I'm getting a
serializationexeption (member <name> not found) for each subsequent property
even when the member definitely exists in the serializationinfo. This only
happens AFTER the expected error, until then it's fine.
Any clues?
Thanks,
Russ
Private Shared Function CopyObject(ByVal Info As SerializationInfo, ByVal
PI() As PropertyInfo, ByRef O As Object)
Dim P As PropertyInfo
For Each P In PI
Try
P.SetValue(O, Info.GetValue(P.Name, P.PropertyType), Nothing)
Catch ex As Exception
End Try
Next
Return O
End Function Tag: How to decode PaskeLen? Tag: 76673
rtd
hi
i have an excel sheet which is being populated with real time data using DDE links. i want to access this data in my C# program. How can i create a RTD client in C#? what is the other way out in C#? i have checked KB articles, but no reference is given on RTD clients, only RTD servers are given. plz help. Tag: How to decode PaskeLen? Tag: 76672
real time data client in c#
hi
i have an excel sheet which is being populated with real time data using DDE links. i want to access this data in my C# program. How can i create a RTD client in C#? what is the other way out in C#? i have checked KB articles, but no reference is given on RTD clients, only RTD servers are given. plz help. Tag: How to decode PaskeLen? Tag: 76671
Real time data
hi..
i have an excel sheet which is being filled with real time data using DDE links.
i want to access this data in my c# program. how can i make an RTD client? what is the other way out in C#? Tag: How to decode PaskeLen? Tag: 76670
EditorAttribute and ReadOnlyAttribute
Hi,
When I use BOTH ReadOnlyAttribute and EditorAttribute for a property it's for some reason NOT read only as I expected.
If I don't use the EditorAttribute it's read only.
Someone know more about why it's not read only when EditorAttribute used?
The object with the property is used in a PropertyGrid and it's when PropertyGrid is displayed the property unexpectedly is not read only. Tag: How to decode PaskeLen? Tag: 76669
.NET publish/subscribe support
Can anyone tell me if .NET directly supports the publish/subscribe messaging paradigm. If not directly, are there add-ons available that will provide this type of functionality?
Thanks in advance,
Russ
--------------------------------
From: Russ Goetz
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>hQf1RHAVfU2zhCQX5lyolg==</Id> Tag: How to decode PaskeLen? Tag: 76668
service timer event WaitHandleWaitOne
Hi there all, hope someone recognises this.
Problem summary:
I have a problem using a timer object within my service class. Whilst the timer triggers happily with delay of 30000 ms for some hours, it eventually comes to a point where no further work is done.
Background:
I have a service that (when started) I wish to check for work to do every 30 seconds. Therefore I have created a service class with a timer (system.Timers.Timer) and also an object of my service worker class.
In the OnStart method I create a new instance of my worker class and load it's configuration. I set the timer interval (held as part of worker's config) and set the timer delay.
On each timeout of the timer the timer_elapsed method runs. This stops the timer, does the work using the worker class, starts the timer and then sleeps again.
Repeat.
The service always appears to be running (in service manager shows as Started) and in task manager the exe process itself is running, but no CPU.
If I connect via Visual Studio to the process I cannot get it to hit a breakpoint anywhere. But if I "cheat" and connect to a second service (i.e. another custom process and stop the code in breakpoint relating to that service) then I can see that Visual Studio debugger believes that four threads are running that relate to my app:
1) At the final } statement of my service class.Main method and
2) In System.Threading.WaitHandle.WaitOne
3) & 4) have "no code associated"
This second thread leads me 'only' to some disassembly. But no further.
Deadlock?
As hinted at above: 3 further services run on the same machine and these share a similar format (triggered at time interval) and some code libraries between them.
Could anyone point me towards a possible solution or, perhaps more likely, a way to identify further actions towards a solution.
Many thanks
Matt
serviceworker = new CServiceWorker(intLogLevel);
System.Timers.Timer sleepTimer = new
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new ServiceClassName() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
private void InitializeComponent()
{
this.sleepTimer = new System.Timers.Timer();
((System.ComponentModel.ISupportInitialize)(this.sleepTimer)).BeginInit();
this.sleepTimer.Elapsed +=new System.Timers.ElapsedEventHandler(sleepTimer_Elapsed);
this.ServiceName = "ServiceClassName";
((System.ComponentModel.ISupportInitialize)(this.sleepTimer)).EndInit();
}
protected override void OnStart(string[] args)
{
// do some reading of args and load configuration
// create new instance of worker class
serviceworker = new CServiceWorker(intLogLevel);
long lngTimerIntervalSecs = serviceworker.getTimerIntervalSecs();
setTimerInterval(lngTimerIntervalSecs);
}
private void setTimerInterval(long lngTimerIntervalSecs)
{
long lngTimerSleepPeriodMilliSecs = 1000 * lngTimerIntervalSecs;
this.sleepTimer.Interval = lngTimerSleepPeriodMilliSecs;
// trigger first instance of timer
this.sleepTimer.Enabled = true;
sleepTimer.Start();
}
private void sleepTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
sleepTimer.Stop();
sleepTimer.Enabled = false;
// do all the stuff each time timer trigger
if(serviceworker.executeMainActivity())
{
// execute ok - try again in 30 seconds
sleepTimer.Start();
sleepTimer.Enabled = true;
}
else
{
// handling removed, but ...
// doesn't matter if execute failed - try again in 30 seconds
sleepTimer.Start();
sleepTimer.Enabled = true;
}
}
---
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching. Tag: How to decode PaskeLen? Tag: 76667
service timer event WaitHandleWaitOne
Hi there all, hope someone recognises this.
Problem summary:
I have a problem using a timer object within my service class. Whilst the timer triggers happily with delay of 30000 ms for some hours, it eventually comes to a point where no further work is done.
Background:
I have a service that (when started) I wish to check for work to do every 30 seconds. Therefore I have created a service class with a timer (system.Timers.Timer) and also an object of my service worker class.
In the OnStart method I create a new instance of my worker class and load it's configuration. I set the timer interval (held as part of worker's config) and set the timer delay.
On each timeout of the timer the timer_elapsed method runs. This stops the timer, does the work using the worker class, starts the timer and then sleeps again.
Repeat.
The service always appears to be running (in service manager shows as Started) and in task manager the exe process itself is running, but no CPU.
If I connect via Visual Studio to the process I cannot get it to hit a breakpoint anywhere. But if I "cheat" and connect to a second service (i.e. another custom process and stop the code in breakpoint relating to that service) then I can see that Visual Studio debugger believes that four threads are running that relate to my app:
1) At the final } statement of my service class.Main method and
2) In System.Threading.WaitHandle.WaitOne
3) & 4) have "no code associated"
This second thread leads me 'only' to some disassembly. But no further.
Deadlock?
As hinted at above: 3 further services run on the same machine and these share a similar format (triggered at time interval) and some code libraries between them.
Could anyone point me towards a possible solution or, perhaps more likely, a way to identify further actions towards a solution.
Many thanks
Matt
serviceworker = new CServiceWorker(intLogLevel);
System.Timers.Timer sleepTimer = new
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new ServiceClassName() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
private void InitializeComponent()
{
this.sleepTimer = new System.Timers.Timer();
((System.ComponentModel.ISupportInitialize)(this.sleepTimer)).BeginInit();
this.sleepTimer.Elapsed +=new System.Timers.ElapsedEventHandler(sleepTimer_Elapsed);
this.ServiceName = "ServiceClassName";
((System.ComponentModel.ISupportInitialize)(this.sleepTimer)).EndInit();
}
protected override void OnStart(string[] args)
{
// do some reading of args and load configuration
// create new instance of worker class
serviceworker = new CServiceWorker(intLogLevel);
long lngTimerIntervalSecs = serviceworker.getTimerIntervalSecs();
setTimerInterval(lngTimerIntervalSecs);
}
private void setTimerInterval(long lngTimerIntervalSecs)
{
long lngTimerSleepPeriodMilliSecs = 1000 * lngTimerIntervalSecs;
this.sleepTimer.Interval = lngTimerSleepPeriodMilliSecs;
// trigger first instance of timer
this.sleepTimer.Enabled = true;
sleepTimer.Start();
}
private void sleepTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
sleepTimer.Stop();
sleepTimer.Enabled = false;
// do all the stuff each time timer trigger
if(serviceworker.executeMainActivity())
{
// execute ok - try again in 30 seconds
sleepTimer.Start();
sleepTimer.Enabled = true;
}
else
{
// handling removed, but ...
// doesn't matter if execute failed - try again in 30 seconds
sleepTimer.Start();
sleepTimer.Enabled = true;
}
}
---
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching. Tag: How to decode PaskeLen? Tag: 76666
what's the prospect of MMC?
what's the prospect of MMC(Microsoft Management Console)?How will microsoft develop it in the future's plan and .NET solution? Tag: How to decode PaskeLen? Tag: 76663
what's the prospect of MMC?
what's the prospect of MMC(Microsoft Management Console)?How will microsoft develop it in the future's plan and .NET solution? Tag: How to decode PaskeLen? Tag: 76662
ANN: RemObjects Internet Pack for .NET public beta
Hello everyone,
RemObjects Software is pleased to announce that the public beta of the
Internet Pack for .NET is now available for download.
Internet Pack for .Net (IP) is the new lightweight and flexible network
development framework developed 100% using native C# code. IP supports the
Microsoft .NET Frameworks 1.1 and 2.0 (May Preview), the Compact Framework,
and Mono (Beta 2). Supported development IDEs include Visual Studio 2003,
2005 (May Preview), and Borland Delphi 8.
Internet Pack for .NET is free and includes full source code.
STATUS
IP is currently in "stable beta" status. This means that we consider the
current build to be stable enough to be used in production projects and
day-to-day development, but we're planning to incorporate more features and
possible fixes in the near future before releasing the "final" version.
FEATURES
IP is a work in progress, and our goal for version 1.0 was to provide a
high-quality framework rather than a large amount of different protocol
implementations.
Some of the features available in the first release of IP include:
- Lightweight and comfortable to use base framework
- Flexible and highly scalable architecture
- Extendable Connection class allows you to easily integrate
custom encryption or compression solutions
- Extendable HTTP Client and Server framework - build HTTP applications
with just a few lines of code, or easily expand the components to provide
complex custom solutions
- Extendable FTP Server framework and VirtualFTP sample implementation
- CommandBasedServer and Client based components allow you to easily
implement your own command based protocols (such as SMTP, FTP
Command Connection, etc.)
- SimpleHttpServer component provides an easy to implement file-based
HTTP Server
- SMPT and POP3 Client implementation, Mail Message encapsulation classes
- Integration with upcoming DebugServer 3 for easy debugging and tracing
DEVELOPMENT COMMUNITY
Over time, Internet Pack will become a community project, and we hope that
many of its users will contribute with their own extensions and components
to the project. Check the urls and newsgroup listed below for more
information.
ADDITIONAL INFORMATION & DOWNLOAD
Download your copy of Internet Pack now, or find more information about the
library at http://www.remobjects.com?ip.
Our news server is open for discussions about IP (both for users and
co-developers) at
news://news.remobjects.com/remobjects.public.internetpack.net.
Also check out the RemObjects Blogs at http://research.remobjects.com/blogs
for regular news and thoughts on the development and progress of IP.
We hope that you will enjoy using Internet Pack as much as we have enjoyed
creating it, and we look forward to your feedback and comments.
The RemObjects Team
http://www.remobjects.com Tag: How to decode PaskeLen? Tag: 76658
Newbie Namespace Question
Hi,
The following code snippet doesnâ??t compile with,
helloworld.cs(25,39): error CS0246: The type or namespace name 'Library' could not be found (are you missing a using directive or an assembly reference?)
Why canâ??t the â??Libraryâ?? namespace be found when its location â??Company.Applicationâ?? has been referenced in the Tester class.
using System;
namespace Company.Application.Library
{
class Math
{
public static int Add(int a, int b)
{
return(a + b);
}
}
}
namespace Test
{
using Company.Application;
class Tester
{
static void Main()
{
int iResult = Library.Math.Add(2, 2);
Console.WriteLine(iResult);
}
}
} Tag: How to decode PaskeLen? Tag: 76652
How to identify an error?
Hi,
I want my application do different actions depending on the exception it
gets.
For exemple: I have an SQL-table with a unique index. In case I try to
Insert a record that's alreaddy in it I get this exception: "Cannot insert
duplicate key row in object 'tblTelephones' with unique index
'UniqueValues'."
What I'm looking for is a way to identify the exception: in case I get this
exception I want to do this, in case of another I want to do that.
The most simple solution to me seems this:
Catch ex As Exception
If Left(ex.Message, 41) <> "Cannot insert duplicate key row in
object" Then
'do this action
End If
QAlthough, I'm not convinced this is the best way. Is there a way to
identify the exception with a unique number? Or I've seen once something
like a name for an error. Can anybody help me with this?
Thanks a lot in advance
Pieter Tag: How to decode PaskeLen? Tag: 76647
Web service doesn't run
When i open the .asmx file with IE the IIS server doesn't run the web
service but instead i am prompted by the web browser to open the .asmx file
(that is it is getting downloaded). The same happens with the default Hello
World web service. I am using VS 2003 and Windows XP SP1 (with its IIS
server).
Any ideas?
Regards,
Ioannis Vranos Tag: How to decode PaskeLen? Tag: 76646
Is MSWINSCK.ocx part of
the .NET framework? I keep getting an error that tells me "Component
MSWINSCK.OCX or one of its dependencies not correctly registered: a file is
missing or invalid" I have downloaded the .NET framework from windows update
and have since downloaded all available updates, including service pack 2.
Not sure if this makes a difference, but I reinstalled everything, installed
service pack 1, then 2, then did all the remaining updates and am getting
this error... Tag: How to decode PaskeLen? Tag: 76644
Is this possible to do with a script or CMD line
Hello frameworkers!
im trying to TrustAnAssembly when installing an application. Unfortunately
im a beginner in .NET Framework and Security.Config
I believe i should use CASPOL.EXE and SN.EXE or AL.EXE but i cant get i
working
My hope right now stand for the framework experts in this forum.
The steps i need to do with a script or CMD line
i run ConfigWizards.exe
choose "Trust an Assembly"
"Make Changes to this computer"
Enter the url for my app "//provisioprog/provisio/provisioadm.exe"
All Assemblies with the same assembly public key
Uncheck the "include version number
Choose full trust
Then this ends up in my security.config file and the application works fine.
CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="Provisio"
Description="">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000
100773D0F8D43BF49BE2CE450478AED753A1118FB32BF30A1E8E2387E75100E592690AADF566
5623F498158945C634A7613BC3E91F9003543CA22A161111CCB5D064647559D3B2D9FBFD2B63
ECD2CFA7BDB6BED88CB173B9B180EA4F4A6673D59A46B7BBF949DCF13E2116A8F64DB966955E
1E381BF3B688DDBF1690C4875CF8BBF"/>
</CodeGroup>
Regards / Lelle Tag: How to decode PaskeLen? Tag: 76642
How can I get the versions of all references items using Reflectio
OK so imaginer I have 10 single file assemblies I reference, all with their own version. I want to build a log string which shown the name and version so I can tell what a customer has installed at their site.
How can I do this? So it would say:
System.Data version: 1.0.5000.0
System.Drawing: 1.0.5000.0
InternalAss.DataAccess: 5.43.22
ThirdPartyVendor.Graphing: 2.3.3
Kind Regards,
D.W. Carr Tag: How to decode PaskeLen? Tag: 76636
EventLog problem
When I run the VB.NET program below, the entry below appears in the "Application" log. The "ServOneLog" log is created, but it is empty. I am trying to write to the "ServOneLog". Why doesn't this work??
Application log entry:
The description for Event ID ( 0 ) in Source ( ServOne ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: LogWorker succeeded in writing to ServOneLog..
Program:
Module Module1
Dim el As EventLog
Public Const LOG_NAME As String = "ServOneLog"
Public Const LOG_SOURCE As String = "ServOne"
Sub Main()
Dim appLog As New EventLog("Application")
appLog.Clear()
If (System.Diagnostics.EventLog.SourceExists(LOG_SOURCE)) Then
EventLog.DeleteEventSource(LOG_SOURCE)
End If
If System.Diagnostics.EventLog.Exists(LOG_NAME) Then
System.Diagnostics.EventLog.Delete(LOG_NAME)
End If
If (Not System.Diagnostics.EventLog.SourceExists(LOG_SOURCE)) Then
EventLog.CreateEventSource(LOG_SOURCE, LOG_NAME)
End If
el = New EventLog(LOG_NAME)
el.Log = LOG_NAME
el.Source = LOG_SOURCE
el.WriteEntry(LOG_SOURCE, "LogWorker succeeded in writing to ServOneLog.")
End Sub
End Module Tag: How to decode PaskeLen? Tag: 76635
EventLog problem
When I run the VB.NET program below, the entry below appears in the "Application" log. The "ServOneLog" log is created, but it is empty. I am trying to write to the "ServOneLog". Why doesn't this work??
Application log entry:
The description for Event ID ( 0 ) in Source ( ServOne ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: LogWorker succeeded in writing to ServOneLog..
Program:
Module Module1
Dim el As EventLog
Public Const LOG_NAME As String = "ServOneLog"
Public Const LOG_SOURCE As String = "ServOne"
Sub Main()
Dim appLog As New EventLog("Application")
appLog.Clear()
If (System.Diagnostics.EventLog.SourceExists(LOG_SOURCE)) Then
EventLog.DeleteEventSource(LOG_SOURCE)
End If
If System.Diagnostics.EventLog.Exists(LOG_NAME) Then
System.Diagnostics.EventLog.Delete(LOG_NAME)
End If
If (Not System.Diagnostics.EventLog.SourceExists(LOG_SOURCE)) Then
EventLog.CreateEventSource(LOG_SOURCE, LOG_NAME)
End If
el = New EventLog(LOG_NAME)
el.Log = LOG_NAME
el.Source = LOG_SOURCE
el.WriteEntry(LOG_SOURCE, "LogWorker succeeded in writing to ServOneLog.")
End Sub
End Module Tag: How to decode PaskeLen? Tag: 76634
EventLog problems
When I run the VB.NET program below, the following entry appears in the "Application" log.
The "ServOneLog" log is created, but it is empty. I am trying to write to the "ServOneLog".
Why doesn't this work??
Application log entry:
The description for Event ID ( 0 ) in Source ( ServOne ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: LogWorker succeeded in writing to ServOneLog..
Program:
Module Module1
Dim el As EventLog
Public Const LOG_NAME As String = "ServOneLog"
Public Const LOG_SOURCE As String = "ServOne"
Sub Main()
Dim appLog As New EventLog("Application")
appLog.Clear()
If (System.Diagnostics.EventLog.SourceExists(LOG_SOURCE)) Then
EventLog.DeleteEventSource(LOG_SOURCE)
End If
If System.Diagnostics.EventLog.Exists(LOG_NAME) Then
System.Diagnostics.EventLog.Delete(LOG_NAME)
End If
If (Not System.Diagnostics.EventLog.SourceExists(LOG_SOURCE)) Then
EventLog.CreateEventSource(LOG_SOURCE, LOG_NAME)
End If
el = New EventLog(LOG_NAME)
el.Log = LOG_NAME
el.Source = LOG_SOURCE
el.WriteEntry(LOG_SOURCE, "LogWorker succeeded in writing to ServOneLog.")
End Sub
End Module Tag: How to decode PaskeLen? Tag: 76633
Uxtheme skinning
Hello everybody...
I am trying to apply some parts of the WinXP skins in panel controls. I am
using the Uxtheme wrapper which you can download from www.codeproject.com
and it is good.
If I want to do what I explained, I have to pass a string to a function
which makes the drawing. The string refers to the part of the skin.
I have made this very well, but I can't find what string is the correct to
draw the StartButton and the task buttons of the Taskbar.
Please help me with this since I need it too much.
Thank you very much...
Martín Heras Tag: How to decode PaskeLen? Tag: 76632
How can the parent retrieve child mouse events?
I have a customized control inherited from panel (let's call it
panel). I use it as container and dynamically add some other
customized controls (let's call it ellipse). How can the panel
retrieve or know the mouse events on child controls (ellipses)? Any
idea are welcome. Thanks in advance. Tag: How to decode PaskeLen? Tag: 76623
Help with Object comparing with Strict On.
Hello,
Can anyone help me get this to work with Option Strict On in VB?
http://support.microsoft.com/?kbid=325684 (VB)
Can this only be done with C# or in VB with Option Strict Off?
http://support.microsoft.com/default.aspx?scid=kb;EN-US;326176 (C#)
Thanks,
Ross Tag: How to decode PaskeLen? Tag: 76619
Multithreading and DataSet, DataTable, DataRow
Hello,
if you have defined a DataSet in the HttpApplicationState which is
shared by all current users ...
what I have to do, to make the Dataset, DataTables and DataRows
thread-safe?
Following my assumptions:
1) If I change a Row:
lock (datarow)
{
datarow["xy"] = value;
}
2) If I add Rows
lock (datatable)
{
datatable.Rows.Add(..)
}
3) If I use the Fill method
lock (datatable)
{
adpt.Fill(datatable);
// what happens with changed or currently locked datarows?
// e.g: process 1 locks row X of datatable A
thread 2 wants to lock datatable A, is process 2 waiting for process 1
to unlock row A
}
4) If I make AcceptChanges to DataTable or DataRow
lock (datatable)
{
datatable.AcceptChanges();
}
5) For datatable.Remove (lock datatable)
6) For datarow.Delete() (lock datarow)
7) For dataset.Tables.Add() (lock dataset)
8) If I do a datatable.select(...) what a have to do to make it
thread-safe?
Is this correct or completly wrong?
in your applicatoin writes on rows can only be done by one user at the
same time, reading should be possible for all users "at the same
time".
Maybe yo have some answers...
Thank u!
Thomas Gasser Tag: How to decode PaskeLen? Tag: 76611
determining files to include in assemblies
Hello:
I am involved in the development of a NET application and was hoping for
some insight into the following question:
Outside of deployment considerations, what criteria should be used to
determine which classes to include in a given .NET project?
For example, if three class definitions, such as Customer, CustomerAccount,
and CustomerHistory are in the same namespace, are there any drawbacks to
associating each object with a separate project? Would it be preferable to
include these three definitions in the same project if they will be deployed
to the same machine?
Thanks,
Chris Tag: How to decode PaskeLen? Tag: 76610
Access denied problem for 5 mins after compiling
About 40 percent of the time I do a compile on my asp.net application I get Access Denied errors when trying to load the application in a web browser. The error is coming from the .Net framework and almost always affects the Interop.Scripting assembly (but not always). The error I get is as follows
---------------------------------------------------------------------------------------------------------------
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Access is denied: 'Interop.Scripting'
Source Error:
Line 196: <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/
Line 197: <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/
Line 198: <add assembly="*"/
Line 199: </assemblies
Line 200: </compilation
Source File: c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config Line: 198
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Interop.Scripting' could not be loaded
=== Pre-bind state information ==
LOG: DisplayName = Interop.Scriptin
(Partial
LOG: Appbase = file:///c:/inetpub/wwwroot/FDS_Reports/Report_Manage
LOG: Initial PrivatePath = bi
Calling assembly : (Unknown)
==
---------------------------------------------------------------------------------------------------------------
If i wait about 5 minutes and then try it again it works. This is really bugging me lol. Anyone have an idea of what the heck is going on? Tag: How to decode PaskeLen? Tag: 76609
Remoting and client connections
I am attempting to figure out a mechanism whereby I can have multiple
clients attached to the same server component, and have all clients made
aware of the changes made to a specific data object by one client. There are
several layers involved here, and I cannot figure out all of the pieces that
I need or how to implement then in C#/.Net. The following is the process as
I see it:
* I shall define an interface for a 'factory' that permits basic generic
operations to be remoted, and acts as a mechanism for requesting conceptual
data classes to be created. There shall be a server-side and a client-side
class defined for each conceptual data object (customers, orders, etc.) that
are supported by the application environment. The heart of each of these
classes shall be a DataSet that contains the DataTable and one DataRow that
contains the database record for that data object. It shall also be possible
to pass a list of data records, or even a set of related records using the
same DataSet approach.
* The client determines that it wants a reference to a conceptual data
object, say a customer, that is identified by a unique identifier, say a
CustomerId; the client code invokes the factory object to request that a
client side customer class instance be created.
* The factory body is remoted and implemented in the server component. The
factory holds a 'moniker dictionary' that holds references to all
server-side data objects that have been instantiated.
a) a search is made in the dictionary for a CustomerObject that has the
specified CustomerId
b) if found, then a reference to this object is used
c) if not found, then a check is made to determine whether the specified
customer exists in the database; if it does then a new CustomerServerObject
class instance is initialized with the database record, the instance is
added to the dictionary and a reference to this object is used
d) if a CustomerServerObject was found, then the associated DataSet
shall be returned to the client-side wrapper for the remoted interface,
which shall instantiate a CustomerClientObject using the same DataSet.
e) if no matching data object is found, then some form of
MyCustomNoSuchDataObject exception shall be raised and remoted back to the
client.
#### How do I define the CustomerClientObject class such that it contains a
remoted reference to the CustomerServerObject directly? I suspect that a
base class common to all such objects would simplify this, but I am not
certain how to establish this completely.
* Several other clients issues the same request to the factory for the same
customer record; all receive a unique CustomerClientObject, but all of them
are associated with the same CustomerServerObject.
#### How do I define the CustomerServerObject class such that it is aware of
all of the clients that have established a connection to that class?
* The client shall use methods in the CustomerClientObject class instance to
manipulate the contents of the class. Eventually the user shall elect to
save the changes or invoke a business action, and this request shall be
passed to the server. The request may include the DataSet that contains the
single record for this data object or not, depending on the business action
requested.
* The CustomerServerObject instance for this specific customer performs the
requested action, and any changes to the data for this object are
automatically saved to the database. For every client other than the
requestor, I would like to ensure that the associated CustomerClientObject
instance in that client is informed that a change was made (this request
does not have to send the change, just the fact that a change occurred, and
each client can elect to ask for the changed data or not; alternatively, the
change information could include the data itself); it may even be reasonable
for the requesting client to receive the changed data in a similar manner.
The remoted request then returns its result to the client.
* As each client releases its CustomerClientObject instance, the connection
with the CustomerServerObject is also released.
* When no more CustomerClientObject instances for that specific cusotmer
remain, the CustomerServerObject shall be removed from the dictonary and
released.
I just cannot get my head around the specific techniques required to define
the factory and base data object classes to permit this type of
connectivity.
I had though of using a single remoted class, the factory, as a wrapper (or
base class) and have everything go through it, but that makes remoted
business rules very complex to maintain and execute.
Can anyone aid me in this thinking or point me to specific references that
explain how to achieve this in C#/.Net? I am specifically interested in
understanding how much of this is built-in to the .Net architecture, as
opposed to requiring me to develop all of this capacbility myself on top of
the basic remoting facilities.
-ken Tag: How to decode PaskeLen? Tag: 76605
How to use MsgBox ?
Hi all,
C#.
I create form with single button.
On button push I want to get MsgBox("Hello world").
What I should do to make compiler understand "MsgBox" ?
regards
pronto Tag: How to decode PaskeLen? Tag: 76603
Question on installing the framework (Server or Client)
If the exe is sitting on the server and the client machines are accessing
the exe, does the client machine need the framework or just the server? Tag: How to decode PaskeLen? Tag: 76601
I want support both version 1.0 and 1.1??
hello:
I want support both version 1.0 and 1.1. I have V.S. 2003 7.1.3088 and .Net
Framework 1.1. I install a older .Net Framework version. 1.0a. I read this
article: http://builder.com.com/5100-6389-5055539.html I read this text:
----
If you're using VS.NET 2003, the IDE will add this information for you
automatically. Right-click on the project title in the Solution Explorer,
and then click Properties. In the window that follows, select the Build
option, and then click the Compatibility button. A dialog box will appear
asking you if you want to support 1.1 only, or both 1.0 and 1.1. If you
select the second option, the IDE will add a very long list of
<assemblyBinding> tags to your Web.config file. This ensures that your app
will try to run no matter what.
----
but I cant find this dialog box and neither button.
Please help me to support both version. and if I've must intalled .Net
Framework version. 1.0a and 1.1 in the same machine? Tag: How to decode PaskeLen? Tag: 76597
RegistryKey.SetValue throws System.IO.IOException: The handle is invalid.
I'm getting and setting a registry value and occasionally I get
System.IO.IOException: The handle is invalid
The stack trace shows
at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str
at Microsoft.Win32.RegistryKey.SetValue(String name, Object value
at Gargoyle.Middleware.Util.RegistryHelper.SetValue(String valueName, Object newValue
Any idea what could cause this? Tag: How to decode PaskeLen? Tag: 76592
.NETFramework 1.1. use question
I am an innocent in this area. I have XP Home and use Drive Image 2002 to clone my HD onto CD-R's. This is currently problematic (reasons not matter) and I contemplating upgrading to Drive Image Version 7, which is for XP. Symantec say I must install .NetFRamework 1.1. before I install Version 7. I have used Windows Update to downlaod and install 1.1, where I notice there is a wizard that allows you to add programs. I don't understand .NETFramework. My question is - for my purposes, do I just let it run, or do I in fact add Drive Image Version 7 to it using the wizard - indeed, is there anything else I should be aware of??? Tag: How to decode PaskeLen? Tag: 76585
What account to use with Visual Studio 2003?
I just moved from a Windows 2000 /VS 2002 development environment to XP / VS
2003. First I found that in the new environment you must be a member of the
Administrators group if the worker process (aspnet_wp.exe) runs under an
account other than your own, and by default the worker process runs under
the "ASPNET" account, which is specified as "Machine" in the machine.config
file. So I made myself part of the administrators group, but found that I
could now over-write read-only files, such as files under source control.
That seemed like a bad idea, so I took myself out of the administrators
group and modified machine.config so the process would run under my own
account. Now I find that my account lacks permissions to run aspnet_wp.exe.
At least I think that is the problem, even though I gave my account "full
control" over that file.
All this effort seems absurd. All I want to do is edit projects in Visual
Studio 2003. Isn't there a simple way to set up the accounts?
Much obliged.
Geoff. Tag: How to decode PaskeLen? Tag: 76584
Library in Same Directory Not Found
I've got a C# application which depends on another C# library, so I added a reference to the project. When compiled, the library .dll is copied into the directory, and so I would assume loading it would not be a problem
The application is a service application, and when I try to start the service I get a FileNotFoundException stating this library as the file not found. Is there some difference in how service applications look for .dll's
Thanks for any help. Tag: How to decode PaskeLen? Tag: 76583
Losing data sent through network socket
I have a server and client that I've written in .NET using the System.Net.Sockets objects, and I am having a bit of a problem. First let me describe what the programs do. The server takes an arbitrary message, encrypts it using a CryptoStream into a MemoryStream, gets an array of bytes from the MemoryStream, and then transmits then length of the encrypted data, followed by the encrypted data down the socket. The client does the exact opposite, reading a 4-byte integer to get the length of the encrypted data, then reading that much data off the socket
On the server, the messages that are being pumped out are put on a queue so that the code using the server will not block while waiting for the message to be sent. So I try filling up the queue with a few hundred messages, and the server starts firing them off as fast as it can. The client keeps up with this for a short duration but inevitably crashes at some point because of an IOException or serialization error.
The only way I have been able to keep a lid on things so far is to have the server wait for the client to send an acknowledgement byte back to the server once it has successfully read the message from the socket. If I do this I get every message flawlessly, but it seems like there is a better way to handle this, I just have not been able to find it
Any help would be GREATLY appreciated Tag: How to decode PaskeLen? Tag: 76581
UI Process Application Block (UIPAB) - has anyone really used it?
Hi, guys,
We're developing a Windows Forms application which includes managing
customers and their financial information, reporting, etc.
Just wondering if any of you have written a real Windows Forms
application (not a demo) using the UIPAB (whatever version).
If so, pls be as kind to tell me:
- how was the experience?
- what are the main advantages you felt? (not necessarily those
specified in the MS docs)
- was the cost in effort proportional to the gain (in
clarity/correctness/testability, whatever)
- any good starting points for info? (other than the UIPAB and its samples)
Thank you all very much and have a nice day Tag: How to decode PaskeLen? Tag: 76575
MetaData specification (ECMA-335) contain PackedLen values.
But PackedLen not described in specification.
How to decode it?