|
The test case was 4 forms. I don't mean to be ignorant, but I suppose I am missing your reasoning? I will not always have 4 forms, I could have many. So delivering a count is irrelevant again unless there is something your not telling me.. Is there a limit to eventhandlers that I am not aware of?
|
|
|
|
|
danielgmx wrote: The test case was 4 forms.
Well that wasn't what I expected. I don't understand how 4 forms can take 40 seconds, that seems unreasonable, unless perhaps each form has a 1000 controls to update or something that is sucking the life out of the process. I must be missing something here because this just doesn't make sense.
led mike
|
|
|
|
|
Sounds to me like the problem is processing time within the delegate handlers, not the foreach loop which would be very quick. You could try calling each delegate asynchronously, but a better solution would probably to change how the delegate code is handled.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
You make a valid point, I appreciate your insight.
|
|
|
|
|
Hi,
I had written a webservice..which is working fine. This webservice will reside in server.
Now if I have make this webservice work for multiple servers.
Right now Iam adding a webrefernce to my application which is consuming webservice.
if this webservice has to be utilised globally..then what I have to do?
If I have to host the same webservice on different servers that leads to waste memory..since in all web methods in all the webservices have same logic and same datatype.
1.To make the same webservcie work on mutiple servers....
2. How add web refernce globally through programatically
3. If to make the webservcie work globally what are the paarameters I have to pass for them?.
4. what is best mechanism to check whether server running or down?
Kindly help me in achieving above
So kindly tell me wat is the best way..
|
|
|
|
|
you have put the same question in asp.net forum also and that was the right place .
cheers,
Abhijit
|
|
|
|
|
Below pasted is the piece of code where I want to display records based on the date range.
Let's say I have a startDate(01/15/2007) and an endDate(01/15/2008):
Can anyone give me some inputs as how to handle date validation in this code. I mean the place where I'm concatenating those 4 columns and getting a single date column row by row, I want to have this date validation. If it falls within this range, it shud add to the DataSet as a new row or else no.
DataSet newPDS = new DataSet();
DataRow row = new DataRow();
<code>
<code>
if (newPDS.Tables[0].Columns["ADM_DATE"]== null)
{
DataColumn dCol = new DataColumn(newPDS.Tables[0].Columns.Add("ADM_DATE", typeof(DateTime), "").ToString());
}
for(Int32 i = 0; i < newPDS.Tables[0].Rows.Count; i++)
{
row = newPDS.Tables[0].Rows[i];
<code>
row["ADM_DATE"] = row["CADMMM"] + "/" + row["CADMDD"] + "/" + row["CADMHH"] + row["CADMYY"];
}
Any help would be appreciated. Thanking you in anticipation.
modified on Wednesday, August 6, 2008 3:34 PM
|
|
|
|
|
Why do you have the date stored in four columns in the first place? That makes it mostly useless...
You are putting a string in the column, and as the format is not based on ISO 8601 it's not comparable. Create a DateTime value instead:
row["ADM_DATE"] = new DateTime((int)row["CADMHH"] * 100 + (int)row["CADMYY"], (int)row["CADMMM"], (int)row["CADMDD"]);
...or, if the values are not even numerical (which makes them even more useless...):
row["ADM_DATE"] = new DateTime(int.Parse((string)row["CADMHH"]) * 100 + int.Parse((string)row["CADMYY"]), int.Parse((string)row["CADMMM"]), int.Parse((string)row["CADMDD"]));
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: Why do you have the date stored in four columns in the first place? That makes it mostly useless...
that's infact a million $$$ question...........the dates stored in AS400 (mainframes) systems are in this format only...........and moreover, they dont have a date field as such.......... (i said wtf???? wen i first saw this format, thn i learned its Mainframes)..........
anyway, with couple of changes in the code i've done the date validation.........but its showing all records in the report............i don't want it that way............date validation is working fine, but its working only on the "ADM_DATE" column.........
hold on, i'll explain.........suppose a row of record falls within the given date range, then in the report as expected its displaying the entire row............but when its not falling within the date range, still its displaying the row of record, but keeping the date field as empty............
did i explained the situation clearly..........pls see the code below:
for(Int32 i = 0; i < newPDS.Tables[0].Rows.Count; i++)
{
row = newPDS.Tables[0].Rows[i];
string stringConCatDate;
DateTime startDate = DateTime.Parse("07/28/1960");
DateTime endDate = DateTime.Parse("02/14/1982");
stringConCatDate = row["CADMMM"] + "/" + row["CADMDD"] + "/" + row["CADMHH"] + row["CADMYY"];
DateTime dtConCatDate = DateTime.Parse(stringConCatDate);
if (dtConCatDate > startDate && dtConCatDate < endDate)
{
row["ADM_DATE"] = stringConCatDate;
}
}
myReport.SetDataSource(newPDS.Tables["TABLE_1"]);
|
|
|
|
|
Verghese wrote: did i explained the situation clearly..........pls see the code below:
Not sure
Seems like you want to display only the rows witch have a non-empty date field.
Try
myReport.SetDataSource(newPDS.Tables["TABLE_1"].Select("ADM_DATE IS NOT NULL"));
I'm not sure if this works with the SetDataSource method, but try it.
Kjetil
|
|
|
|
|
I am using Office XP and VS 2005. KB908002[^] has been installed.
When I run my spreadsheet as a "restricted" user, I get a very helpful VB error saying
Run-time error '-2146233036 (80131534)
Automation error I think this is a permission issue, because when I run it as a "standard" or admin user, everything works fine.
How do I ensure my DLL works even with restricted rights? Any help would be greatly appreciated.
Cheers,
Vıkram.
"if abusing me makes you a credible then i better give u the chance which didnt get in real" - Adnan Siddiqi.
|
|
|
|
|
do ur dll write something to disk?
In restricted mode the user dont have all the rights
Vikas Amin
UNITED STATES STEEL CORPORATION
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
I have a few System.Windows.Shapes object.
In order to display them on screen, I use a Canvas.
canvas1.Childern.Add(myShape);
Now what I want exactly is a bitmap data of this whatever has been
added to this canvas. Like I want this in pixel Array. How can I achieve this.
|
|
|
|
|
|
I tried this
Line l = new Line();
l.X1 = 0;
l.Y1 = 0;
l.X2 = 100;
l.Y2 = 100;
l.Stroke = Brushes.Black;
canvas1.Children.Add(l);
canvas1.UpdateLayout();
RenderTargetBitmap rmi = new RenderTargetBitmap(
(int)canvas1.ActualWidth, (int)canvas1.ActualHeight,
1 / 96, 1 / 96, PixelFormats.Pbgra32);
rmi.Render(canvas1);
Can you tell me what to do next in order to get array of pixels.
|
|
|
|
|
Here's an example (you can use a different encoder and/or output to a different stream type if necessary) :
Saving you canvas to image[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks the link helped.
But the article doesnt explain how to get the pixel values in an array.
I want the pixel values in a 1-D or 2-D array.
|
|
|
|
|
AmitDey wrote: I want the pixel values in a 1-D or 2-D array.
Maybe RenderTargetBitmap.CopyPixels() ?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Just another day at the CodeProject Documentation Proxy Office eh?
Where do you want to go today?
What documentation don't you want to read today?
led mike
|
|
|
|
|
Hello, I'm receiving the following error message. I know I'm missing something simple, but I can't figure out what it is.
Possibly a local DLL security issue? I have been able to reference winmm.dll 's other methods without a problem though.
The only thing I can think of is I'm sending invalid Types.
Tested in VS 2005 (.NET 2.0), and C# Express 2008 (.NET 3.5)
Thanks for any help anyone can provide.
Microsoft's Documentation of mciGetErrorString...
http://msdn.microsoft.com/en-us/library/ms709479(VS.85).aspx[^]
Error Message...
AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Code...
class Program
{
[System.Runtime.InteropServices.DllImport("winmm.dll")]
private static extern bool mciGetErrorString(long errorCode, string buffer, int iReturnLength);
static void Main(string[] args)
{
long error = 19703256959680778;
string text = "";
mciGetErrorString(error, text, 128);
}
}
modified on Wednesday, August 6, 2008 11:28 AM
|
|
|
|
|
Now that I have been looking at it, it seems the line "long error = 19703256959680778;" value may have been invalid.
What I have been trying to do is simply get the string value of the error code returned by mciSendString in winmm.dll
I have been trying out the MP3 Player at
http://www.codeproject.com/KB/audio-video/MP3Example.aspx[^]
and I wanted to add some more descriptive error reporting to the mciSendString return value calls.
I haven't been able to find any clear C# documentation of using the mciSendString error in mciGetErrorString.
I hope this helps to explain a little more.
|
|
|
|
|
I'm not an expert at making native calls but there are a few things that don't look right to me.
1) C# long is not necessarily the same as C/C++ long .
2) In mciGetErrorString param #3 represents the length of the buffer that param #2 points to, but you're passing in an empty string which is length zero and telling mciGetErrorString that it's 128 chars long. I think to return a string from native code to managed code you need to create a StringBuilder of the appropriate length and use that. In the article you linked to see how he used a StringBuilder for the variable strReturn in the declaration of mciSendString even though when he calls that function he passes null for the string pointer and zero for the length.
Hope that helps.
|
|
|
|
|
Yep, you guys were right on. The C++ to C# conventions types threw me a bit off. TY TY.
Now... You wouldn't have any idea why I can make winmm.dll MCI device calls from a windows forms app but not a console app? I believe a windows forms app uses the default sound device, but the console app attempts to use it (the default one windows is probably holding onto) and windows tells it...
"Unknown problem while loading the specified device driver."
This error shows up regardless if the audio file path is valid or not.
I would think the windows console process would have access to the windows audio devices.
I used the final code below to generate the error. Works in a form app, not in a console app.
VS 2005, and C# 2008.
Any ideas?
Code is as follows...
class Program
{
[System.Runtime.InteropServices.DllImport("winmm.dll", EntryPoint = "mciGetErrorString")]
public static extern bool mciGetErrorString(int dwError, StringBuilder lpstrBuffer, int uLength);
[System.Runtime.InteropServices.DllImport("winmm.dll")]
private static extern int mciSendString(string strCommand, string strReturn, int iReturnLength, IntPtr hwndCallback);
static void Main(string[] args)
{
string Pcommand = "open \"" + "C:\\SomeNonExistantFile.mp3" + "\" type mpegvideo alias MediaFile";
int err = mciSendString(Pcommand, null, 0, IntPtr.Zero);
StringBuilder text = new StringBuilder(128, 128);
mciGetErrorString(err, text, int.MaxValue);
Console.WriteLine(text);
Console.WriteLine();
Console.WriteLine("Press Any Key");
Console.ReadKey();
}
}
|
|
|
|
|
audio yes, but video no. the type in your Pcommand is mpegvideo , but should a console app be able to play movies? the command succeeded when i tried it with a type waveaudio ..
Also, if you pass a value into mciGetErrorString that is larger than the space that you have allocated for the buffer, then it will be able to write to invalid memory. Since the SB has a capacity of 128 it makes sense to pass in 128 instead of int.MaxValue
good luck
|
|
|
|