|
|
Check the MIME Type in IIS Root WebSite Property.
May be downloaded..
.application --> application/x-ms-application
.manifest --> application/x-ms-application
.deploy --> application/octet stream
.msp --> application/microsoftpatch
.msu --> application/microsoftupdate
email:php4u@paran.cm
msn:php4u@chol.net
name: Lee SeungGu / REDSOFT / KOREA
|
|
|
|
|
Hi,
I've got some C++ code to convert to C# and I'd prefer the C# to be as similar in design to the legacy code as possible (not my original design).
Currently, I'm not having much luck finding an equivalent to WSAWaitForMultipleEvents() that lives in the managed world. Also, the current architecture doesn't allow for a higher-level repackaging with a C++/CLI.
Could anyone point me towards it if I'm just not seeing it in MSDN after staring at the screen for too long, or alternatively put me out my misery so I know I've just got to go with a rethink and rework and new time estimate.
Thanks v. much in advance,
Kev
|
|
|
|
|
How about something like Socket.Select()[^]?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
You gave me a brief glimmer of hope there that I hadn't read the docs properly and that it was something that obvious, but no. Socket.Select() does only work with sockets.
I've given up now to be honest. I'll go with Socket.Select() with an internal control socket that, when data is read from it, is the signal to close down the main socket.
Not ideal, but it's a close enough workaround that it's still clear what's happening in the ported code even though the events have been swapped for sockets. As being close and preserving the overall code structure is what I've been asked to do, it's good enough.
Thanks very much for the response anyway!
Kev
|
|
|
|
|
In fact I don't know where this idea to look at Socket.Select() comes from.
When I read your post and the documentation again, nothing mention socket!?!
Anyway, how about: Semaphore[^], or multiple call to ThreadPool.RegisterWaitForSingleObject[^]?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
You're closer with Socket.Select rather than the others which work on WaitHandles. I'll look into getting a WaitHandle-based object associated with a socket so I could use the regular WaitForMultipleObjects but the client's happy with the socket-workaround I told in last mail.
Thanks again.
K
|
|
|
|
|
lemur wrote: an equivalent to WSAWaitForMultipleEvents() that lives in the managed world
On Windows, WSAWaitForMultipleEvents is the same as WaitForMultipleObjectsEx().
WaitForMultipleObjectsEx() in .NET is WaitHandle.WaitAny().
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have xml with with lots of nested node.
when I loaded this xml file into dataset each node becomes tables with primary/foreign key relation.
I want to find out in dataset which is the master key between certain multiple tables those are dependend each other.
with regards
tarak
|
|
|
|
|
I'm almost there.
The problem: Using smo, I'm having trouble re-creating a DefaultConstraint on a column after dropping it.
Where this stems from: I need to change a column from nvarchar(x) to nvarchar(max).
(The ms help is useless, showing no examples for working with default constraints. No searches show people using smo to solve this.)
The conceptual problem is that you can't change a column's size if a "DefaultConstraint" exists on the column. You must drop the DefaultConstraint, then change the size of the column, and then re-create the DefaultConstraint.
Variables not shown: The variable "AColumn" below has been populated with a smo column object (Name:"SsGradeString"), and the variable "Size" is the desired size to change the column to.
The error occurs on AColumn.AddDefaultConstraint(DName) , error message:"Column SsGradeString already has a default."
I tried doing Table.Alter, Column.Alter, DefaultConstraint.Alter (after the .Drop), but I get: "Cannot access properties or methods for the Microsoft.SqlServer.Management.Smo.DefaultConstraint '[DF_ADVSessions_SsGradeString]', because it has been dropped."
'preserve existing values for re-creation of DefaultConstraint
'NOTE: AColumn is the column we are working with and Size is the new size to set.
Dim DName As String = ""
Dim DText As String = ""
Dim DefaultConstraintWasThere As Boolean = False
'remove DefaultConstraint if it exists
If AColumn.DefaultConstraint IsNot Nothing Then
DefaultConstraintWasThere = True
DName = AColumn.DefaultConstraint.Name
DText = AColumn.DefaultConstraint.Text
AColumn.DefaultConstraint.Drop()
'tried doing various "Alter"s here but none work,
'citing that the DefaultConstraint's properties cannot be accessed.
End If
'make the desired change to the column property
AColumn.DataType.MaximumLength = Size
'recreate the DefaultConstraint if there was one
If DefaultConstraintWasThere Then
Try
'error is occurring here
AColumn.AddDefaultConstraint(DName)
AColumn.DefaultConstraint.Text = DText
Catch ex As Exception
Stop
End Try
End If
|
|
|
|
|
I had the same problem and I found a solution to this.
Our codes are exactly same.
Steps should be like this.
1) Drop constraint
2) Refresh Column
3) Change column data type
4) Alter column
5) Recreate default constraint
As you can see you are missing step 4.
This is why you are getting an error.
|
|
|
|
|
|
I've been hacking at this problem for a few month off and on and I can't seem to find a solution.
For parallel computing reasons it is necessary to open up and manage multiple instances of an application (CATIA) get be able to get them through the COM. The problem exists that you can only obtain the first register object in the running objects table with the standard GetObject methods.
My plan was to build a windows service that would be available to my applications through COM and manage the multiple instances of the CATIA application. This way any application started by any user should be able to get the windows service and then the CATIA applications from it. Right?
I first tried this in VB.NET but found out that my VB.NET applications couldn't use the VB.NET dll through the com (or I couldn't get it to work). So I'm now working in C# but I am still having troubles accessing the dll through the COM. I know the dll is being initialized and is running but when i try to test it using VBA in excel using the GetObject method. I can not get the Active X object. I've tried registering the dll in the ROT when initialized but it does not help. Am I missing something or am I wasting my time trying to get this to work.
I've had something similar working before, VB.NET executable with a VB6 wrapper (ActiveX executable). It worked fine alone on the machine but when trying to get the wrapper from a executable started by a cueing system (condor) it would fail to get the Active X object. I was hoping that if the dll was started by the system (windows service) any user could access it. Is this thinking correct?
Thanks,
SC
|
|
|
|
|
Hi
I am quite new in protecting code against hackers. I know that much to obfuscate the the .NET assemblies, but my questions are:
Which is harder for hacker: Reverse engineering the optimized x86 code or obfuscated .NET assembly?
How much extra protection does the standard anti-hacking approaches(checking the correct serial code in different places in code, adding dummy code to serial validation methods, using unmeaningful method names...) add to the obfuscated code.
Thank you for your time.
Uros
|
|
|
|
|
1 - It would be Reverse engineering the optimized x86 code.
2 - I am not a proponent of obfuscation. IMO, obfuscators will just rename classes,methods and variables to some hard to read names.
Here[^] is a good article in which Jon Skeet shares his views on obfuscation. Its worth reading.
|
|
|
|
|
Hi all,
I have this .NET 2.0 application. At several points during the application it asks the user to load a picture from their computer. Basically the code uses an open file dialog box to get the path and then copies that picture from that path into a section in my program's folder. Works great on my XP Pro development machine and on Vista. And it works great if the user is selecting a picture from their desktop.
However, if the user goes to My Computer and then clicks on My Pictures the program bombs and "locks up" (according to the user). I can't recreate the error here but I've managed to capture the sequence. I'm pretty sure both of these errors hit when the system "locks up". This also happens if they go to any other folder's subfolder.
I have no idea how to overcome this or what is even causing it or what to even search on. Help?
Exception Message: External component has thrown an exception.
Stack Trace: at System.Windows.Forms.UnsafeNativeMethods.GetOpenFileName(OPENFILENAME_I ofn)
at System.Windows.Forms.OpenFileDialog.RunFileDialog(OPENFILENAME_I ofn)
at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
at System.Windows.Forms.CommonDialog.ShowDialog()
at FirstTimeUser.frmGatherPersInfo.btnLoad_Click(Object sender, EventArgs e)
Exception Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Stack Trace: at System.Windows.Forms.UnsafeNativeMethods.IntDestroyWindow(HandleRef hWnd)
at System.Windows.Forms.UnsafeNativeMethods.DestroyWindow(HandleRef hWnd)
at System.Windows.Forms.NativeWindow.DestroyHandle()
at System.Windows.Forms.Control.DestroyHandle()
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at MyHealtheFile.modMain.main()
Denise "Hypermommy" Duggan
|
|
|
|
|
Not that it helps you, but one of my dev boxes runs XP Home and I have no problems with this.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I'm wondering if it has something to do with the specific service pack installed. Would you mind telling me what SP you're running?
Denise "Hypermommy" Duggan
|
|
|
|
|
Currently SP3, but I've upgraded as the SPs have been released and also any HotFixes as I'm notified by Automatic Updates.
My box is not on a network, I don't know if that makes any difference.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I don't think so as this box is not on a network either. But I'll have to check what the SPs and hotfixes fixed as that may be part of it.
Denise "Hypermommy" Duggan
|
|
|
|
|
I'm posting this in this forum cause I want to do this in .NET.
What I want to do is install a software-based microphone (or other voice input device), to which I can redirect voice coming from an actual hardware-based mic after performing some transforms on the voice input. This way I can make voice-enabled applications (like gTalk) listen on the software mic for voice input.
Can someone please point me in the right direction? Is there any other way to achieve this?
Basically what I'm trying to do is create an application that encrypts/decrypts all voice communication b/w two computers.
|
|
|
|
|
I have a backgroundworker on my form, I start it from the UI thread.
Then it would start a worker thread to do network-consuming task.
private void btnOK_Click(object sender, EventArgs e)
{
DisableForm();
Object obj = GetObjFromUI();
BackgroundWorker saveAsWorker = new BackgroundWorker();
saveAsWorker.DoWork += new DoWorkEventHandler(saveAsWorker_DoWork);
saveAsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(saveAsWorker_RunWorkerCompleted);
saveAsWorker.RunWorkerAsync(obj);
}
After the task completed, it would return to the UI thread and modify related UI, in the Complete event, it worked very well before.
But now I found some times, the method saveAsWorker_RunWorkerCompleted will return to other thread, which is nor the UI thread, neither the worker thread which run the network-consuming task. So the cross-thread exception will be thrown, when the system try to modify related UI in the method saveAsWorker_RunWorkerCompleted.
I have to write code below, to avoid the cross-thread exception.
void saveAsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (InvokeRequired)
{
Invoke(new MyEventHandler(MyObject_MyEvent), new object[] { sender, e });
}
else{
}
}
But I do not want to call the "if (InvokeRequired)", as before, this method "saveAsWorker_RunWorkerCompleted" was indeed excuted in the UI thread, and I am sure the thread which constructed the Backgroundworker and called RunWorkerAsync() was indeed UI thread. Why does the complete method return to "the 3rd thread" now?
Who knows why? Is any system configuration, for windows and .NET framework?
modified on Monday, August 24, 2009 9:48 PM
|
|
|
|
|
Hi,
You have saveAsWorker declared as a local variable making it eligible for garbage collection as soon as btnOK_OnClick returns. Without knowing the internals of the object it's not possible to predict what would happen after GC if the worker thread was still running.
Declaring saveAsWorker as a class level field will probably solve the problem.
Alan.
|
|
|
|
|
Please use PRE tags to show code, it is part of the forum guidelines. I'm not reading your post as is.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
Assuming the two snippets belong inside a single Form-derived class, your code looks fine to me. Here[^] is a little article I wrote as a summary on the cross-threading issue.
IMO the only way to get into trouble with the code shown would be by creating some new Control(s) in another thread which you shouldn't do ever (e.g. inside the DoWork handler), and then touching them again in the Completed handler.
You may want to add some log("Inside XXX thread ID = "+Thread.GetCurrentThread().ManagedThreadID); lines to the different pieces of your code to better see which thread is doing what.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|