Thread Synchronisation
Hey everyone, just converted a class from .net 1.1 to .net 2.0 and the
compiler has warned me of some deprecated usage of functions :(. Namely
thread.suspend and thread.resume.
My class was quite clean and the logic was sound (ie it worked). Now I was
considering writing the main loop to grab a semaphore whilst executing and
then play a file, however, I wish to have no limit on the number of sounds
that can be queued up by the player, so I can't use a semaphore as I cannot
know how many sounds can enqueue at any one time, and I CANNOT have the main
thread block in its call to "playsound" as would happen if I attempted to
"release" whilst the semaphore was already held.
I was considering using a monitor but then I run into the double check
problem, I need to check the monitor is released at just the right time and
all sorts of issues happen.
I suppose if someone could point me in the right direction for a good
technique to use. Essentially the class needs to return from playsound
immediately after enqueuing the file name. The main thread should wake up
any time that a sound is added to the queue, dequeue the sound and then play
it. Order and Timing are important (ie sounds must be played in the order
they are received, and all sounds in the queue MUST be played without a
delay (ie, Attention, "name", "Message" would be a common usage of the
function). I just can't think of a construct that would work efficiently.
And I'm certainly not asking people to write code for me, but if you can
point in the right direction I'd really appreciate it.
My CURRENT class is listed below.
Public Class AsyncSounds
Implements IDisposable
Private PlayQueue As System.Collections.Queue
Private SoundThread As System.Threading.Thread
Private Exiting As Boolean = False
Public Sub New()
PlayQueue = New System.Collections.Queue
SoundThread = New System.Threading.Thread(AddressOf PlayThread)
SoundThread.Name = "Sound Playing Thread"
SoundThread.Start()
Console.WriteLine("Sound Thread: Starting the Sound Play Thread")
End Sub
Public Sub PlaySound(ByVal SoundFile As String)
SyncLock (PlayQueue)
PlayQueue.Enqueue(SoundFile)
End SyncLock
Console.WriteLine("Main Thread: Added sound to queue.")
If SoundThread.ThreadState = Threading.ThreadState.Suspended Then
SoundThread.Resume() ''If the player is asleep, wake it up.
End If
End Sub
Private Sub PlayThread()
Dim Count As Integer = 0
Dim SoundFile As String = String.Empty
Do
If Exiting Then
Console.WriteLine("Sound Thread: Terminating")
Exit Sub
End If
SyncLock (PlayQueue)
Count = PlayQueue.Count
End SyncLock
If Count > 0 Then
SyncLock (PlayQueue)
SoundFile = CType(PlayQueue.Dequeue, String)
End SyncLock
Console.WriteLine("Sound Thread: Playing Sound. Count = " &
Count.ToString)
SoundClass.PlaySoundFile(SoundFile, True)
Else
Console.WriteLine("Sound Thread: Suspending")
System.Threading.Thread.CurrentThread.Suspend()
End If
Loop
End Sub
Public Sub Dispose() Implements System.IDisposable.Dispose
If Not Exiting Then
Exiting = True
If SoundThread.ThreadState <> Threading.ThreadState.Running Then
SoundThread.Resume()
SoundThread.Join()
GC.SuppressFinalize(Me)
End If
End Sub
End Class Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127205
Cannot find the System.Windows.Forms assembly
I am trying to build a WinForms application, and I'm using the Visual
Studio C# 2005 Express edition. Doesn't it bind to .NET 2.0 by
default, and shouldn't it be able to find the dll without any settings
being tweaked ? I'm sure the answer is simple, but I couldn't find
anything after a brief trawl of the net.
nr0mx. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127204
Anyone knows the C# Equivalent
Hello,
I am trying to convert a program from Microsoft VB.NET team:
http://blogs.msdn.com/vbteam/archive/2005/04/14/TableAdaptersAndObjects.aspx
I am having a hard time converting the following two sections. Anyone knows
the C# equivalent?
- oringial VB.NET code from VB Team:
Public Sub AcceptChanges()
For Each item As T In Me.Items
item.ObjectState = ObjectState.Unchanged
Next
DeletedRows.Clear()
End Sub
- my approach:
public void AcceptChanges()
{
foreach (T item in this.Items)
{
item.ObjectState = ObjectState.Unchanged;
}
DeletedRows.Clear();
}
- Visusal Studio error: 'T' does not contain a definition for 'ObjectState'
2. Original code from VB team:
Dim txScope As New System.Transactions.TransactionScope
Using txScope
...
end using
- my approach:
using txScope
{
...
}
- Visual Studio:
Syntax error, '(' expected
Best regards,
Alan L.
--
Message posted via http://www.dotnetmonster.com Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127198
SMTP sink on win2003
Hi,
I have a sink class which is registered on the server correctly. I know this
because in my class I put in some ex handling that writes to the event log
and I do get entries. Wat I want to do is get my class to see the content of
the message. Once I get this far I will be able to handle the rest. The COM
exception I am getting in event viewer is:
ExchangeSinks: Unable to cast COM object of type
'Microsoft.Exchange.Transport.EventInterop.MailMsgClass' to class type
'Microsoft.Exchange.Transport.EventWrappers.Message'. Instances of types that
represent COM components cannot be cast to types that do not represent COM
components; however they can be cast to interfaces as long as the underlying
COM component supports QueryInterface calls for the IID of the interface.
Class Code is:
Imports System
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports Microsoft.Exchange.Transport.EventInterop
Imports Microsoft.Exchange.Transport.EventWrappers
Namespace SampleManagedSink
<Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")> Public Class
ExchSinkClass
Implements IMailTransportSubmission, IEventIsCacheable
Public Sub IsCacheable() _
Implements IEventIsCacheable.IsCacheable
End Sub
Public Sub OnMessageSubmission(ByVal pIMailMsg As
Microsoft.Exchange.Transport.EventInterop.MailMsg, ByVal pINotify As
Microsoft.Exchange.Transport.EventInterop.IMailTransportNotify, ByVal
pvNotifyContext As System.IntPtr) _
Implements IMailTransportSubmission.OnMessageSubmission
Try
Dim buffer As Byte() = CopyContentToStream(pIMailMsg)
Dim oFileStream As System.IO.FileStream
Dim nw As DateTime = Now
oFileStream = New System.IO.FileStream("C:\Logs\" &
nw.ToShortTimeString & " email.txt", System.IO.FileMode.OpenOrCreate)
oFileStream.Write(buffer, 0, buffer.Length - 1)
oFileStream.Close()
Catch cex As COMException
Dim sSource As String = "Exchange Sink Library"
Dim sLog As String = "Application"
Dim sEvent As String = cex.Source & ": " & cex.Message
If (Not EventLog.SourceExists(sSource)) Then
EventLog.CreateEventSource(sSource, sLog)
EventLog.WriteEntry(sSource, sEvent)
Catch ex As Exception
Dim sSource As String = "Exchange Sink Library"
Dim sLog As String = "Application"
Dim sEvent As String = ex.Source & ": " & ex.Message
If (Not EventLog.SourceExists(sSource)) Then
EventLog.CreateEventSource(sSource, sLog)
EventLog.WriteEntry(sSource, sEvent)
End Try
End Sub
Function CopyContentToStream(ByVal msg As Message)
Dim buffer As Byte()
Dim Offset As Integer = 0
Try
Const BYTES_TO_READ As Integer = 2048
buffer = msg.ReadContent(Offset, BYTES_TO_READ)
Catch cex As COMException
Dim sSource As String = "Exchange Sink Library"
Dim sLog As String = "Application"
Dim sEvent As String = "In Function, " & cex.Source & ": " &
cex.Message
If (Not EventLog.SourceExists(sSource)) Then
EventLog.CreateEventSource(sSource, sLog)
EventLog.WriteEntry(sSource, sEvent)
Catch ex As Exception
Dim sSource As String = "Exchange Sink Library"
Dim sLog As String = "Application"
Dim sEvent As String = "In Function, " & ex.Source & ": " &
ex.Message
If (Not EventLog.SourceExists(sSource)) Then
EventLog.CreateEventSource(sSource, sLog)
EventLog.WriteEntry(sSource, sEvent)
End Try
If buffer.Length > 0 Then
Return buffer
Else
Return Nothing
End If
End Function
End Class
End Namespace
if I edit this code to simply create an entry in event log every time the
sink class is run, it does and I get no errors.
I don't know how to pass the same interface to my function. Please help. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127195
Bypassing Disk Caching
Anyone know a way to bypass disk caching in Windows XP?
I am working on a C# program that needs to verify the integrity of
data that was copied to a removable drive. My approach is to read the
data back and compare it to the original data source. Problem is,
this process is happening way too quickly to be possible.
I used filemon to see what the file system is doing when I attempt to
copy back the file I just wrote to the removable drive, and although
there are tons of FASTIO_WRITE requests directing chucks of the data
to a local file (a file that holds a "copy" of the removable drive's
data), there is not a single request for any information from the
external drive.
My best guess is that the entire file is still in the local disk's
cache; this would explain the super speeds I am seeing.
So my question(s): Is there a way to force windows to not use the
disk cache? If not, is there a way to flush the disk cache? Is there
another workaround someone can suggest?
I am going to start trying to hack something together to fool it
(maybe renaming the file on the external drive will be enough to fool
it), but thanks in advance to anyone who knows a proper way to handle
this problem.
--
lucas Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127192
Strange exception with ReportViewer control
We're the ReportViewer Control in a .NET 2.0 winforms app.
Here's the call I'm making:
byte[] reportBytes = this.reportViewerInstallRpt.LocalReport.Render("PDF",
null, out mimeType, out encoding, out extension, out streamids, out warnings);
Here's the exception:
A call to PInvoke function
'Microsoft.ReportViewer.Common!Microsoft.ReportingServices.Rendering.ImageRenderer.CompositionPDF+WindowsGDIWrapper::GetGlyphIndicesW'
has unbalanced the stack. This is likely because the managed PInvoke
signature does not match the unmanaged target signature. Check that the
calling convention and parameters of the PInvoke signature match the target
unmanaged signature.
The exception only happens intermittently on some machines, but always on
some other machines. This makes me think there is some kind of configuration
problem, perhaps. However, we are all using Visual Studio 2005 SP1 -- exact
same version of .NET framework and VS.
Any thoughts on why this is happening? Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127190
.NET service running as user (HKEY_CURRENT_USER?)
Greetings,
I trust that I am writing to the correct newsgroup or that at least I
can find direction here.
We have an issue with a custom-developed service which we would like
to run as a specified set of user credentials. This is on account of a
DLL resource which utilizes HKEY_CURRENT_USER registry settings in
order to operate. We are operating under the assumption that if the
service runs as a specified user, then that process utilizes the
settings specified under HKEY_CURRENT_USER.
If that isn't feasible, then we need to start looking at HKEY_USERS,
which gets somewhat ugly. How do we glean the key(s) from user
Security Identities (SID)?
Regardless, it would seem that we're faced with utilizing 32-bit API
from within our C# .NET code.
Thanks in advance...
Michael Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127175
CSS and MasterPage
I can't apply a CSS file to a web site with a masterpage.
In design mode I see it's applied but at runtime no.
--
Sorin Sandu
Romania Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127167
Saving updated binding source
I created an object using BindingList<T> for GetObjects() and assigned that
to a objectBindingSource in a WinForm application. The ObjectBindingSource
then
assigned to a DataGridView. There was a objectBindingNavigation also on the
form. Everything worked as expected when I run the application. However,
after inserting
some new rows, deleting a few rows, and updating yet couple rows, the program
could not save the resulting datasource. I had a hard time converting the
result of the objectBindingSource to a typed DataSet Object table. Everytime
I tried to save, the system returned a message stating that the operation
created duplicated keys in the table and stopped. It appeared that after
converting the ObjectBindingSource to a typed dataset, all unchaged rows were
updated to the dataset as new rows.
I tried to solve the problem with a typed dataset table, it worked fine. But,
I can't rewrite all our business objects to use datatables and datarows
instead of BindingList<object> and objects.
Any suggestions or comments will be greatly appreciated. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127164
UdpClient Question
Hi
I am new to network programming.
I had a question about UdpClients.
Is the following possible:
I have a UdpClient bound to say port 5000.
The UdpClient also joins a multicast group which has some
IP Address like 224.x.x.x and the same port number 5000.
I start a new thread and call the UdpClient.Receive method.
Would this instance of the client recieve both multicast messages posted
to 224.x.x.x as well as other packets directed only to me at my IPAddress at
port 5000.
Thanks and regards
Vikas Manghani Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127162
could'n read memory
Hi,
I'm using Text Control comercial component (comprehensive text editor writen
as ActiveX). It's placed on form. If I paste image from clipboard into text
control and close main window I receive exception "could'n read memory ..."
(it comes from wnd proc of text control obejct while processing WM_DESTROY
msg)
I now that it's hard to say what's is going on based on above informations
but could somebode tell me which tools can be used to investige such
problems, does MS.NET studio have any interal utylity to do this (I'm using
ver. 2005).
In c++ there is BoundChecker what can be used in my scenario?
Shark Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127160
dotNet Class for Printer ACL
Hi there,
Knowing that .Net 2.0 has new System.Security.AccessControl namespace. I
read through the documentation but I cannot find a class that can manipulate
printer's ACL, e.g. Print, ManageDocument, ManagePrinters...
Basically, I've written a Windows Service that need to check a particular
printer's ACL and see if a document can be printed. Right now, I'm using
ADSI's ADsSecurityUtility, IADsAccessControlList and IADsAccessControlEntry
to read a printer's ACL.
What I would like to do is to see if "Everyone" have the "Print" permission
on that printer.
Can this be done solely in .NET Framework 2.0?
Thanks in advance.
Steve Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127155
User from not behaving as expected
I am using Visual Studion 2005 SP1 and C#.
I have a User Control that has a single label docked at the top of the
control. This control is to be the basis for a number of inherited controls.
Many of the inherited controls will have a split container docked as fill
for the first control to be added. This was working fine and in the controls
already developed it continues to behave as I expect. New controls however
when I dock the split container, the container fills the whole control and
ignores the label on the parent control.
Does anybody know what is happening.
Thanks. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127152
1.1 Framework hangs during install on aspnet.mof on Windows 2000
I've seen others with this same issue, but no replies. I did see someone with
a similar issue on XP in this newsgroup, and they got it to work by deleting
files, rebooting, and installing .NET FW 1.1 SP1. I cannot (feasibly) do this
in our automated environment.
We have hundreds of systems that need .NET FW 1.1 installed (during or after
unattended install), and we cannot have them all hanging during installation.
--
Bill Baker Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127151
Fields in Interfaces, Indexer
SITUATION:
I have a class "MainClass" that has an indexer "SubClass1Indexer".
This indexer returns an instance that implements a particular
interface "ISubClass1". This interface defines another indexer
"SubClass2Indexer". Bellow is some code with comments. It should
compile.
PROBLEM:
I would like to write something like this:
MainClass cm = new MainClass();
cm.SubClass1Values[0].SubClass2Values[0].ToString();
Note that "SubClass2Indexer" needs access to an internal field of
"SubClass1". This only seems to be possible if a field is allowed in
an interface, i.e. ISubClass1. That is not the case, though.
NONE IDEAL SOLUTIONS:
1) Make "this[]" in SubClass2Indexer aware of all the current and
future implementations of "ISubClass1".
2) Do a casting after "cm.SubClass1Values[0]" but then I have to write
separate indexers "SubClass2Indexer" for each implementation of
"ISubClass1".
QUESTION:
How can I solve the shortcomings in the above solutions? Or in general
how is this best handled?
CODE:
using System;
using System.Collections.Generic;
using System.Text;
namespace testProj
{
class Program
{
static void Main(string[] args)
{
MainClass cm = new MainClass();
cm.SubClass1Values[0].SubClass2Values[0].ToString();
}
}
//CLASSES
public class MainClass
{
private SubClass1Indexer m_subClass1Indexer;
protected internal List<ISubClass1> m_subClass1List; //
SubClass1Indexer needs access to this.
public SubClass1Indexer SubClass1Values
{
get { return m_subClass1Indexer; }
}
}
public class SubClass1 : ISubClass1
{
private SubClass2Indexer m_subClass2Indexer;
protected internal List<ISubClass2> m_subClass2List; //
SubClass2Indexer needs access to this.
public SubClass2Indexer SubClass2Values
{
get { return m_subClass2Indexer; }
}
}
//INTERFACES
public interface ISubClass1
{
//!!! If the following would be possible then in
SubClass2Indexer
// I would not have to make the function 'this[]' be aware of
all
// the ISubClass1 implementations.
//protected internal List<ISubClass> m_subClass2List;
SubClass2Indexer SubClass2Values { get; }
}
public interface ISubClass2
{
}
//INDEXERS
public class SubClass1Indexer
{
private readonly MainClass m_subClass1Owner;
public SubClass1Indexer(MainClass seriesOwner)
{
m_subClass1Owner = seriesOwner;
}
public ISubClass1 this[Int32 index]
{
get {
return m_subClass1Owner.m_subClass1List[index];
}
}
}
public class SubClass2Indexer
{
private readonly ISubClass1 m_subClass2Owner;
public SubClass2Indexer(ISubClass1 subClass2Owner)
{
m_subClass2Owner = subClass2Owner;
}
public ISubClass2 this[Int32 index]
{
//The command commented out would be possible if one could
// define a field in an interface. Now I'll need a switch
// to handle all the IClass1 implementations. So I can't
just
// add a new implementation without adjusting this
function.
//get { return m_subClass2Owner.m_subClass2List[index]; }
get { return
((SubClass1)m_subClass2Owner).m_subClass2List[index]; }
}
}
} Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127139
Does calling GC.Collect() only work from the main thread?
To take advantage of the hardware power on my companyâ??s application server,
which has 4 CPUs and 8Gs of memory, I have created a multi-threaded
application that would simultaneously process multiple requests to generate
reports.
The main thread of the application would spawn several worker threads to
process requests and generate reports, and, at the same time, the main thread
would monitor the processing statuses of all worker threads.
To conserve memory, at the end of the class/method, which is associated with
the worker thread, GC.Collect() would be called after calling all the heavy
objectsâ?? Dispose methods and setting them to null.
Strangely enough, just one request to generate a series of big reports could
raise OUT OF MEMORY errors.
So I converted the application to be single-threaded and process requests
one at a time. The application works fine and, at any given time, only 300 MB
of memory, at most, are used to process the very same request.
I could not help but conclude that when GC.Collect() is called from a worker
thread, no disposed memory would be re-claimed right away, unless it is
called from the main thread.
Is my conclusion correct? Or there is something else I do not know about GC
in .NET?
Thanks in advance for any help or advice.
Don Lin Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127138
Could not find a part of the path
Environment: Windows 2003 Server R2
Application type: ASP.NET application
sample code:
string filePath variable = "c:\xyz\abc";
FileStream clientFilew = new FileStream(filePath, FileMode.Create); //blows
here
Error message:
Could not find a part of the path.
Now, the filePath variable = "c:\xyz\abc" MOST CERTAINLY EXISTS on the web
server.
"Everyone" user has FULL ACCESS to the C: drive.
"Everyone" user has FULL ACCESS to the C:\xyz folder.
"Everyone" user has FULL ACCESS to the C:\xyz\abc folder.
I already tried just having "NETWORK USER" have access to the same
things...no dice.
This is incredibly frustrating as this works with no issue on my development
machine. Based upon the "Everyone" settings, I can't imagine this is STILL
an authorization issue of the .net environment not being able to create a
file in the specified folder ???
Could the error message be any more ambiguous or incorrect?
Thanks in advance for any insight into this most enlightening error message.
Larry Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127136
SOS Command not working
I am trying to use sos extension but almost half of the sos command do
not work, for example
0:027> !findtable
No export findtable found
0:027> !bpmd
No export bpmd found
0:027> !GCHandleLeaks
No export GCHandleLeaks found
0:027> !GCHandles
No export GCHandles found
0:027> !GetWorkItems
No export GetWorkItems found
0:027> !LoadCache
No export LoadCache found
0:027> !SaveAllModules
No export SaveAllModules found
0:027> !TraverseHeap
No export TraverseHeap found
0:027> !SaveCache
No export SaveCache found
0:027> !SaveModule
No export SaveModule found
0:027> !SearchStack
No export SearchStack found
0:027> !SyncBlk
0:027> !VerifyHeap
No export VerifyHeap found
0:027> !X
No export X found
0:027> !Analysis
No export Analysis found
0:027> !Bp
No export Bp found
0:027> !CheckCurrentException
No export CheckCurrentException found
0:027> !ConvertTicksToDate
No export ConvertTicksToDate found
0:027> !ConvertVTDateToDate
No export ConvertVTDateToDate found
0:027> !CurrentExceptionName
No export CurrentExceptionName found
0:027> !DumpAllExceptions
No export DumpAllExceptions found
0:027> !DumpBuckets
No export DumpBuckets found
0:027> !DumpCollection
No export DumpCollection found
0:027> !DumpConfig
No export DumpConfig found
0:027> !DumpLargeObjectSegments
No export DumpLargeObjectSegments found
0:027> !DumpLog
No export DumpLog found
Also, after I set a breakpoint (bring up the source code ) a managed
code, the program just does not break.
Any ideas?
Thanks in avance.
John
0:027> .chain
Extension DLL search Path:
C:\Program Files\Debugging Tools for Windows\winext;C:\Program
Files\Debugging Tools for Windows\winext\arcade;
C:\Program Files\Debugging Tools for Windows\WINXP;C:\Program Files
\Debugging Tools for Windows\pri;
C:\Program Files\Debugging Tools for Windows;C:\Program Files
\Debugging Tools for Windows\winext\arcade;
C:\Program Files\Debugging Tools for Windows
Extension DLL chain:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\sos: API 1.0.0, built
Wed Jul 14 23:46:07 2004
[path: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\sos.dll]
dbghelp: image 6.6.0007.5, API 6.0.6, built Sat Jul 08 13:11:32
2006
[path: C:\Program Files\Debugging Tools for Windows
\dbghelp.dll]
ext: image 6.6.0007.5, API 1.0.0, built Sat Jul 08 13:10:52 2006
[path: C:\Program Files\Debugging Tools for Windows\winext
\ext.dll]
exts: image 6.6.0007.5, API 1.0.0, built Sat Jul 08 13:10:48 2006
[path: C:\Program Files\Debugging Tools for Windows\WINXP
\exts.dll]
uext: image 6.6.0007.5, API 1.0.0, built Sat Jul 08 13:11:02 2006
[path: C:\Program Files\Debugging Tools for Windows\winext
\uext.dll]
ntsdexts: image 6.0.5457.0, API 1.0.0, built Sat Jul 08 13:29:38
2006
[path: C:\Program Files\Debugging Tools for Windows\WINXP
\ntsdexts.dll] Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127132
Deadlock in XmlSerializer when using RedirectStandardInput
I have encountered a situation where a thread (say, thread-1) blocks for 10
minutes in an XmlSerializer constructor. This occurs when another thread
(say, thread-2) is blocked in a call to Console.ReadLine and the process was
created using System.Diagnostics.Process with RedirectStandardInput = true.
In this situation not only does thread-1 block for 10 min in the
XmlSerializer constructor, but will hang indefinitely when creating a COM
object.
The problem started occuring after migrating our application to .NET v2.0.
I found a forum post where some other developers have run into the exact
same problem. Please see this link:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=188895&SiteID=1 (it
also includes a reproducible testcase)
Is anyone aware of a decent workaround to this issue (or a fix available
.NET 2.0)? I seems that this problem greatly limits the usefulness of stdin
redirection.
BACKGROUND INFO
We need to run multiple instances of an console application (it runs until
told to stop). Since we need to run more than one process on a single machine
it did not make sense to make the application a windows service. Instead, we
developed a windows services that spawns these (child) application processes.
Using the System.Diagnostics.Process class we can not only spawn the process,
but also interact with it via stdin and stdout.
OTHER NOTES (not-so-nice workarounds)
It appears that the XmlSerializer hangs in the call to csc.exe (you can see
this child process using ProcessExplorer). I can get around this problem by
sgen'ing the assembly which eliminates the need for spawning csc.exe at
runtime. However, this doesn't fix the problem with creating COM objects.
Another workaround i've seen (see forum post mentioned above) is to not call
Console.ReadLine() in the child process. However, I need this call in order
to process interactive commandline input. Also note the call to ReadLine is
on an MTA thread to avoid STA "pumping" issues, so the deadlock/contention is
occuring on some other resource. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127125
Writing to an external config file.
Hi:
I am having trouble writing to an external .config file (a .config file
from another application, not the running application)
Below I have included the code I am using, but although no exception or
error is thrown, noting is written to the file! All the sections and
elements exist in the .config file and the debugger passes through each
scenario.
Can anyone please help me?
TIA,
Martin.
Code
****
private void saveToExternalConfigFile()
{
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = @"MovilGesNet.exe.config";
Configuration config =
ConfigurationManager.OpenMappedExeConfiguration(fileMap,
ConfigurationUserLevel.None);
ConfigurationSectionGroup seccion =
config.GetSectionGroup("applicationSettings");
if(seccion != null)
{
ClientSettingsSection secPropertiesSettings =
seccion.Sections["MovilGesNet.Properties.Settings"] as
ClientSettingsSection;
if(secPropertiesSettings != null)
{
foreach(SettingElement element in secPropertiesSettings.Settings)
{
switch(element.Name)
{
case "Host":
element.Value.ValueXml.InnerText = "MyNewAppText";
break;
}
}
}
}
seccion = config.GetSectionGroup("userSettings");
if(seccion != null)
{
ClientSettingsSection secPropertiesSettings =
seccion.Sections["MovilGesNet.Properties.Settings"] as
ClientSettingsSection;
if(secPropertiesSettings != null)
{
foreach(SettingElement element in secPropertiesSettings.Settings)
{
switch(element.Name)
{
case "PathPdaImport":
element.Value.ValueXml.InnerText = "MyNewUserText";
break;
}
}
}
}
config.Save(ConfigurationSaveMode.Full); // Not doing anything!
} Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127119
Double.MaxValue Casting Problems
I have some code that takes Double.MaxValue and converts it to a string, but
when I try to convert it back to a double, it fails. Shouldn't the value be
able to be converted back to a double without error?
Here is a simple code sample that demonstrates the problem:
try
{
Double dbl = double.MinValue;
//String sdbl = dbl.ToString(); // This errors as well
String str = dbl.ToString("N");
// This throws "Value was either too large or too small
for a Double."
Double dbl2 = Convert.ToDouble(str);
}
catch (Exception ex)
{
System.Diagnostics.Debug.Write(ex.Message);
} Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127114
Generic BindingList.SumItems.MyProperty: howto?
Hi,
I use a customized Generic List (VB.NET 2.0) inherited from BindingList(Of
T).
I made some methods in this BindingList, to allow me to do some standard
functions on the BindingList-Items.
One of them is for instance SumItems, which returns me the sum of a given
Property of all the Items in the List.
e.g.: MyBindingList.SumItems("Price") returns me the sum of all the prices
of my articles in the list.
But I would like to be able to access directly the Property's of the T-class
of my BindingList. It woudl be much much nicer if I could directly type in
the code editor MyBindingList.SumItems.Price, and that I can, while coding,
see al the proeprty's of my T-class after typing
"MyBindingList.SumItems."...
Because I use Generics I somehow think this should be possible, although I
don't find how...
Anybody has any ideas? Any help would be really appreciated!
Thanks a lot in advance,
Pieter
PS: My current SumItems-method:
Public Function SumItems(ByVal ColumnName As String) As Decimal
Dim properties As PropertyDescriptorCollection
Dim myProperty As PropertyDescriptor
Dim decSum As Decimal = 0
Try
' Specify search columns
If (ColumnName Is Nothing) Then
Return Nothing
End If
' Get list to search
Dim lItems As List(Of T) = Me.Items
If Me.Count > 0 Then
properties =
TypeDescriptor.GetProperties(Me.Items(0).GetType)
myProperty = properties.Find(ColumnName, True)
If myProperty Is Nothing Then
Throw New ArgumentException("Invalid Property Name.",
ColumnName)
Return 0
Exit Function
End If
' Traverse list for value
For Each it As T In lItems
'Dim value As String = CStr(myProperty.GetValue(item))
decSum += CSng(myProperty.GetValue(it))
Next it
End If
Catch ex As Exception
Throw ex
End Try
Return decSum
End Function Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127102
PDF exporting using reportviewer control for Visual Web Developer
I just want to share some aspects that might help novice developers
out there like me... Since Visual Web Developer doesn't have a
reportviewer control built-in ( unlike with visual studio 2005 ) so it
seems to be very impossible for us ( developers ) to make a pdf export
report. Fortunately, Microsoft has provided us some alternatives, the
<a href="www.youdel.com/
SQLServer2005_ReportAddin.msi">SQLServer2005_ReportAddin.msi</a> that
will automatically install a reportviewer to your Visual Web Developer
Editor...
Reportviewer control is the fastest and easiest control I've used so
far that provides me access to PDF exportation or Excel format..
have fun programming,
http://tambayan.isgreat.org Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127095
FileIOPermission usage
I read in an old response to a question about the FileIOPermission (from May
5, 2006) that you could use the security imperatively using something like:
FileIOPermission perm = new FileIOPermission(FileIOPermissionAccess.Read,
path);
perm.Demand();
However, code analysis barks at this method with the following:
CA2103
A method uses imperative security and might be constructing the permission
using state information or return values that can change while the demand is
active.
So, how exactly should we employ demands when the path changes as the method
is called? Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127092
Process redirectStandardOutput into a textBox?
Hi,
Is it possible to bind the output from process to a textBox?
Thanks,
Ole Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127091
.Net 2.0 memory usage
I ported a .Net service from 1.1 to 2.0. In .Net 1.1, the total private
bytes for this service ran around 40MB. In .Net 2.0, the same service has
total private bytes of around 140MB. I then ran our service under a memory
debugger, and we have a total of 34 MB allocated on the heap.
Anyone have any ideas as to where the extra 100MB is going in .Net 2.0?
Joe Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127088
What framework ???
Hi:
We have visual studio 2005 and framework 2 running on window XP, we are
planning to switch to window vista in 3 months. We are going to develop new
web application that will take about 6-8 month to develop. We want to make
sure that when move to window vista the transition will go smooth. What is
your suggest to handle this?
Thank you. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127079
XmlSerializer and Custom Attribute Inclusion?
I have a CustomAttribute class that decorates properties and methods
in a class that is serialized with the .NET 2.0 XmlSerializer. I would
like to have these attributes interpreted as XML Comments and embedded
inline or at least at the top of the result document when it is
serialized.
How can I do this?
Thanks. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127078
custom attributes
I have a class with methods that I am applying custom attributes to. Right
now, I'm using reflection within each method to check for the attribute and
do something if it exists and depending on it's settings. I'd like to
automate that so the class will call a helper method by itself that doees
this check so that no code has to be written within each method (otherwise
what's the point if the developer has to write the code to check for the
attribute and it's values).
Example:
<EmailAttribute("sendurgent")> _
Public Sub UpdatePersonnelRecord(ByVal personnelID as Integer)
(do operations to perform data operation on personnel)
Dim oAttr As EmailAttribute = GetEmailAttribute()
'perform operation depending on the values set in the attribute
End Sub
Protected Function GetEmailAttribute() As EmailAttribute
Dim oAttr() As CustomAttributes.EmailAttribute
Dim oCAttr As CustomAttributes.EmailAttribute
Dim method As MethodBase = New StackFrame(1, False).GetMethod()
oAttr = method.GetCustomAttributes(GetType(EmailAttribute), True)
If UBound(oAttr) = -1 Then
'do nothing, attribute does not exist
Return Nothing
Else
oCAttr = oAttr(0)
Return oCAttr
End If
End Function
-----
What I'd like to do is to be able to get rid of the lines in the
UpdatePersonnelRecord method...
Dim oAttr As EmailAttribute = GetEmailAttribute()
'perform operation depending on the values set in the attribute
...so they will be done automatically Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127075
Uninstalling older versions of .net framework.
Hi
I've got VS2005 and .NET framework 3.0 installed.
Can I uninstall older .Net frameworks 2.0, 1.1 (and 1.0).
Does .NET framework 3.0 cover all previous .net framework versions
nowadays?
Cheers
Alex Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127074
Enterprise Library Deployment
I am looking into the Microsoft Enterprise Library 2005 for my
organization. My question is:
What machines would the Enterprise Library need to be installed on to
take advantage of it?
I would think that because it is a code library, installation would
only be required on the developer workstations, and that the
Enterprise Library would not need to be installed on any of the
production servers. All of the Enterprise Library code should be
included with any distributable package in dll form. That would
certainly make it an easier sell for my organization, but before I
start pitching that as an advantage, I'd like to make sure that a
server install is not necessary.
Can anyone confirm this? Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127071
Cardspace is something to do with Framework 3.0 but what?
I have had an icon for Windows Cardspace (supposedly something to do with
Framework 3.0) in my XP Control Panel (SP2 and fully updated including the
February Cardspace update) since installing Framework 3.0. Whenever I click
on the icon, Windows Cardspace tries to open and then irretrievably crashes
my PC. I have therefore never experienced what it actually does. Having
searched on the Microsoft website there is almost nothing about it. I am
bound to ask if I actually need it at all. Has anyone else been able to open
it and if so, what does it do?
Mike Bernstein Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127066
updating document.xml example?
Hi,
I am able to build a package in code as there are plenty of examples
but I haven't seen one about updating. Can someone point me in the
right direction?
I have a docx that will be used as a template and I simply need to
open the package, get the document.xml. load it, modify it, then save
the part back and save the whole thing as a new document.
I can open the document and create a modified document.xml fine but
seem unable to save that back to a new copy of the document.
Any hints/snippets appreciated.
Chandy Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127064
How to find out the OS is Real or VPS?
Dear All,
Can anyone tell me that How can I figure out that the OS system running on
some system is Real OS or it is running on VPS?
--
Regards,
Muhammad Nasir Waqar Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127052
Disabling chunking in HTTP 1.1
Hi,
I'm not sure if this is the right place to post this but when
searching for the exception I got this group came up the most.
I'm making a HttpWebRequest to get data from a web page but am getting
the following error
System.Net.WebException: The server committed a protocol violation.
Section=ResponseBody Detail=Response chunk format is invalid
at System.Net.HttpWebRequest.GetResponse()
I've looked in the groups and the recomended fix for this error is to
set
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
in the App.config but this isnt working for me, playing around I find
that if I set the version in the HttpWebRequest to 1.0 like so
HttpWebRequest hwr = (HttpWebRequest)
HttpWebRequest.Create(url.Text);
hwr.ProtocolVersion = new System.Version(1,0);
then everything runs fine, running a packet sniffer I see this is
becuase I'm not recieving the data chunked, is there a header I can
set so I can carry on using 1.1 but not get chunked data as this is
obviously whats causing the problem and I dont really want to use http
1.0.
Failing that does anyone know what is causing this problem? Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127048
ListBox not updating when datasource changes
Hi all,
I bind a list to a ListBox. Binding works but when I change the list
the data is not updated in the listbox.
Someone knows how to signal the listbox to update when the datasource
changes?
Thanks
Stijn Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127046
how to fight a password cracker
Dear All,
Using pdflib library in C# I have created a pdf file which is
protected using owner password .Different options are disallowed like
print, copy contents etc. Things were working very fine untill i came
to know about some password crackers which could easily crack the
file , eliminating the password , thus making it possible for
operations like printing, copy etc .
The study showed that using user password as well will make the file
strong enough to be decrypted ,but "user password" is not a solution
in my case .
The code which actually creates a pdf file using pdflib is as under :
PDFLib obj = new PDFLib();
obj.begin_document(FileName, "masterpassword=23wdlm3ldjwld4w
permission={noprint}");
Now i wonder even that the file is encrypted using 128-bit
encryption , how a password cracker can retrieve that stored password
form the encrypted file .What operation is performed by the cracker to
remove the password and making the file accessible for all options .
Can any one please help me in this ....
Regards,
Madni Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127044
ClickOnce deployment over the internet
Hi
I'm using ClickOnce to deploy a small application over the internet.
On some machines this works and on others (in a different
organisation) I get the stack trace below. It mentions "Too many
automatic redirections were attempted". Is this caused by proxy
servers? Any help would be appreciated.
- Stack trace:
at
System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem
next)
at
System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at
System.Deployment.Application.FileDownloader.Download(SubscriptionState
subState)
at
System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri&
sourceUri, String targetPath, IDownloadNotification notification,
DownloadOptions options, ServerInformation& serverInformation)
at
System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore
subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState&
subState, IDownloadNotification notification, DownloadOptions options,
ServerInformation& serverInformation)
at
System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore
subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState&
subState, IDownloadNotification notification, DownloadOptions options)
at
System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri
activationUri, Boolean isShortcut)
at
System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object
state)
--- Inner Exception ---
System.Net.WebException
- Too many automatic redirections were attempted.
- Source: System
- Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at
System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem
next)
TIA Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127042
Free .Net Framework quiz site @ http://www.quiznetonline.com
Hi
I am in the progress of developing a web site whereby developers can
do free online tests on various programming languages. I would just
like some advice or feedback on ways to improve the site or other
comments of the site
The site is http://www.quiznetonline.com
Thanks in advance
Mark Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127039
Framework 2.0 still used after 3.0 install
Hi,
In updated to .NET Framework 3.0 but projects, even new, still reference the
2.0 framework.
If I go to my ASP .Net tab in web site properties, my only options are
framework versions 1 and 2.
A reinstall of 3 tells me that it is already installed.
This is running on Windows XP Prof.
Anyone know what the problem is with this?
TIA,
Chris Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127035
BitmapDecoder not releasing file lock
I am using System.Windows.Media.Imaging.BitmapDecoder as part of some code
that extracts metadata, but my problem can be reduced to the following simple
example:
using System;
using System.Windows.Media.Imaging;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string filepath = @"C:\mypic.jpg";
BitmapDecoder fileBitmapDecoder = BitmapDecoder.Create(new
System.Uri(filepath, UriKind.Absolute), BitmapCreateOptions.None,
BitmapCacheOption.Default);
fileBitmapDecoder = null;
// Lock is not released unless I perform a garbage collection.
//GC.Collect();
}
}
}
Unless I call GC.Collect(), the BitmapDecoder class holds a lock on
mypic.jpg until the application exits. I have stepped through the code with
Process Monitor running to prove it. For performance reasons I do not want to
use GC.Collect().
I need the lock released as soon as I am done with the BitmapDecoder class.
It does not implement IDisposable so that is not an option.
Thanks for any help,
Roger Martin
Tech Info Systems
www.techinfosystems.com Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127027
Indexed Properties
I wonder about the pros and cons of a setter for an index property. As
an example let's look at the Dataset
DataSet ds;
....
ds.Tables[0] = new Table(); //Assume Tables[0] exists already
The above will generate a compile error. Why is this allowed? Tables
basically looks like an array/list to the user and arrays and lists
allow this assignment. What is the logic behind this limitation? What
are the pros/cons in general, i.e. not just for the above example but
any custom class that has an indexed property?
Thanks Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127022
Exception trying to retrieve from My.Resources
In a Property Set statement, I'm trying to retrieve a value from My.Resources
like this:
Public Property TimeEnd() As DateTime
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Get
Return _timeEnd.Date
End Get
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Set(ByVal value As DateTime)
CanWriteProperty(True)
If Not _timeEnd.Equals(value) Then
_timeEnd.Date = DateAdd(DateInterval.Year,
CInt(My.Resources.SqlMinYear), value.TimeOfDay)
End If
End Set
The purpose of SqlMinYear is to allow the UI to receive a time only and to
store it by appending SQL Server's min date. However, when I try to retrieve
this Resources string, I get this error:
"'My.Resources.SqlMinYear' is not declared or the module containing it is
not loaded in the debugging session."
I get the same thing if I try to get the value in the immediate window.
Any ideas? Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127015
Exception trying to retrieve from My.Resources
In a Property Set statement, I'm trying to retrieve a value from My.Resources
like this:
Public Property TimeEnd() As DateTime
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Get
Return _timeEnd.Date
End Get
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Set(ByVal value As DateTime)
CanWriteProperty(True)
If Not _timeEnd.Equals(value) Then
_timeEnd.Date = DateAdd(DateInterval.Year,
CInt(My.Resources.SqlMinYear), value.TimeOfDay)
End If
End Set
The purpose of SqlMinYear is to allow the UI to receive a time only and to
store it by appending SQL Server's min date. However, when I try to retrieve
this Resources string, I get this error:
"'My.Resources.SqlMinYear' is not declared or the module containing it is
not loaded in the debugging session."
I get the same thing if I try to get the value in the immediate window.
Any ideas? Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127014
Exception trying to retrieve from My.Resources
In a Property Set statement, I'm trying to retrieve a value from My.Resources
like this:
Public Property TimeEnd() As DateTime
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Get
Return _timeEnd.Date
End Get
<System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.NoInlining)> _
Set(ByVal value As DateTime)
CanWriteProperty(True)
If Not _timeEnd.Equals(value) Then
_timeEnd.Date = DateAdd(DateInterval.Year,
CInt(My.Resources.SqlMinYear), value.TimeOfDay)
End If
End Set
The purpose of SqlMinYear is to allow the UI to receive a time only and to
store it by appending SQL Server's min date. However, when I try to retrieve
this Resources string, I get this error:
"'My.Resources.SqlMinYear' is not declared or the module containing it is
not loaded in the debugging session."
I get the same thing if I try to get the value in the immediate window.
Any ideas? Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127013
Can't install Framework 2.0 - help help help
Hi,
I've have tried to install .Net Framework 2.0 on my windows 2000 machine
with plenty of disc space and ram, over and over again without any luck.
After unpacking the files and the installation starts it stops after about 1
minute saying:
Property: DD_IE501FOUND_X86.3643236F_FC70_11D3_A536_0090278A1BB8
Signature: SearchForIE501_ENU_X86,3643236F_FC70_11D3_A536_0090278A1BB8
I have tried to update and reinstall msi installer 3.1
I have tried to update and reinstall Internet Explorer 6 with service packs
etc.
I have tried to download Framework via redistributable and via windows
updatestart
...and soon I start to cry....
Thanks
Ole Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127012
Unique Identifier for a computer.
I need to come up with a way to uniquely identify computers that can't be
hacked easily. Something like the system id or info from the CPU that is
then sent over the internet to a central database.
What we are trying to do is have a unique identifier that is machine based
that can't be changed.
Anybody have any thoughts?
TIA - Jeff. Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127008
Download free ebook MCTS Exam : 70-431 ebook
Download free ebook MCTS Exam : 70-431 ebook
Go to http://free-tech-ebooks.blogspot.com/2007/02/download-free-ebook-mcts-exam-70-431.html Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127005
BitConverter.ToInt32 - weird optimization?
Now, if we take a look at the reflected BitConverter.ToInt32 method it looks
something like this:
public static unsafe int ToInt32(byte[] value, int startIndex)
{
if (value == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
}
if (((ulong) startIndex) >= value.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex,
ExceptionResource.ArgumentOutOfRange_Index);
}
if (startIndex > (value.Length - 4))
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
}
fixed (byte* numRef1 = &(value[startIndex]))
{
if ((startIndex % 4) == 0)
{
return *(((int*) numRef1));
}
if (BitConverter.IsLittleEndian)
{
return (((numRef1[0] | (numRef1[1] << 8)) | (numRef1[2] <<
0x10)) | (numRef1[3] << 0x18));
}
return ((((numRef1[0] << 0x18) | (numRef1[1] << 0x10)) |
(numRef1[2] << 8)) | numRef1[3]);
}
}
What I don't understand is this:
if ((startIndex % 4) == 0)
{
return *(((int*) numRef1));
}
What prevents me from using this method when the remaining product isn't 0?
We already checked if there is 4 bytes to read so I should be able to.
Cheers
Morten Tag: how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to recenter the form on the screen at some point other then startup. Tag: 127001
how to get the System.Drawing.Point of FormStartPosition, e.g. if i want to
recenter the form on the screen at some point other then startup.