|
|
There is basically two solutions:
1. Get the data without reloading the page (e.g. using AJAX) from a session-less page. This of course means that the data that you get can't rely on any session variables.
2. Send some data along when you refresh the page, so that you can differentiate between the automatic refreshes and user activity. This means that you can't rely on the session timeout for the timeout. You have to handle it all yourself, keeping record of the last (non-automatic) request from the user.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
textbox.length propriety
There´s no need to create a new control, just validade with code.
If you know how to connect to a database what is your problem there?
Float, Int, Datetime i work them almost the same way, no special atention.
Do you already have done the connection to your database?
What do you have done so far?
nelsonpaixao@yahoo.com.br
|
|
|
|
|
The database connections are created using DataSets that are bound to controls to those tables and tableadapters within the dataset. Generally using a binding navigator to cycle through the records where needed.
|
|
|
|
|
I have a base form type which contains my delegate type definitions as well as standard routines that maybe used througout the application. On initialization of the base form I wire up an Update event which is triggered after I receive return data from a webservice call. The idea is to trigger the event within each running instance of the base form. I am accomplishing this now by iterating a foreach loop and firing the event seperately each time. Execution of this process can be greater than 40 seconds depending on how many forms are currently open. Is there a way of incorporating a multicast delegate to assist in triggering the events rather than the bloated foreach loop?
|
|
|
|
|
danielgmx wrote: this process can be greater than 40 seconds depending on how many forms are currently open.
danielgmx wrote: rather than the bloated foreach loop?
If I understand what you said, the root problem might be the number of forms. How many are there?
led mike
|
|
|
|
|
The form count is unknown, the forms are dynamically created from the base form via webservice response data. Here is an example of my code.
<pre>//the base form..
public delegate void SummaryDataChanged(object sender, SummaryDataChangedEventArgs e);</pre>
<pre>public virtual event SummaryDataChanged SummaryDataChangedEvent;</pre>
<pre>[STAThread()]
public ClassSpf.DataManager.ActivityReturn AnalyzeWebRequest(ClassSpf.DataManager.ActivityReturn.ActivityFlag flagType, ClassSpf.WebTargets.ProcessActivityDelegate webRequest, ClassSpf.DataManager.SpfGenericParameter genericParameter)
{
IAsyncResult iAsyncResult = webRequest.BeginInvoke(genericParameter, AnalyzeWebRequestCallBack, null);
ClassSpf.ActivityReturn activityReturn = webRequest.EndInvoke(iAsyncResult);
if (activityReturn.OutPut.Reqstatustx != string.Empty)
{
IssueMessage(activityReturn.Output);
}
if (activityReturn.ActivityException != null)
{
ClassAppTrace.HandleSystemException(activityReturn.ActivityException);
}
if (flagType == ActivityReturn.ActivityFlag.IssueUpdate)
{
if (ClassSpf.GlobalMemorySlots.Order != null && ClassSpf.GlobalMemorySlots.Operation != null)
{
this.QueueLoadSummary();
}
}
return activityReturn;
}
</pre>
<pre>
internal void QueueLoadSummary()
{
System.Threading.WaitCallback waitCallBack = new WaitCallback(LoadSummaryInformation);
System.Threading.ThreadPool.QueueUserWorkItem(waitCallBack);
}
</pre>
<pre>protected void LoadSummaryInformation(object stateInfo)
{
try
{
if (ClassSpf.GlobalMemorySlots.Input == null)
{
//well we can not load the summary data with out input now can we.
return;
}
else
{
ActivityReturn activityReturn =
WebServiceCall(ClassSpf.GlobalMemorySlots.Input, ref dataManager);
if (activityReturn.ActivityException == null)
{
if (dataManager.CurrentOrder != null & dataManager.CurrentOperation != null)
{
if (SummaryDataChangedEvent != null)
{
SummaryDataChangedEvent(this, new SummaryDataChangedEventArgs(dataManager));
}
SummaryDataChangedEventArgs summDataChanged = new SummaryDataChangedEventArgs(dataManager);
SummaryDataChangedEvent += new SummaryDataChanged(FormBase_SummaryDataChangedEvent);
SummaryDataChangedEvent(this, summDataChanged);
}
}
}
}
catch (InvalidOperationException iOx)
{
ClassAppTrace.HandleSystemException(iOx);
}
}</pre>
<pre>
FormBase_Load()
{
this.UpdateOccurredEvent += new SummaryDataChanged(FormBase_UpdateOccurredEvent);
}</pre>
//the mdiparent (inherited from base form)
<pre>private void MdiParent_SummaryDataChanged(object sender, SummaryDataChangedEventArgs e)
{
try
{
this.Invoke((MethodInvoker)delegate
{
//Some grid code goes here unimportant to the question
});
}
catch (Exception eX)
{
ClassAppTrace.HandleSystemException(eX);
}
finally
{
try
{
//Hook the event in to each child window that needs to accept it
foreach (FormBase child in this.MdiChildren)
{
(child as FormBase).OnUpdateOccurred(sender, e);
}
}
catch (Exception eX)
{
ClassAppTrace.HandleSystemException(eX);
}
}
}
</pre>
I am trying to change the foreach (FormBase child) loop to something more robust, I just don't know what now I imagine the issue is when the update is fired it is triggered by a child form thus only triggering the event for that form. I would like something like this.
Delegate UpdateType(Data Arguments);
Event UpdateType UpdateEvent;
FormBase_Load()
{
this.UpdateEvent += new UpdateEvent();
}
FormBase_TriggerChildUpdate(DataArgs e)
{
//this is where I would like to see all of the instantiated forms events fired.
//I am just not familiar enough with delegates to find a way to do so without the loop
if(UpdateEvent != null)
UpdateEvent(e);
}
|
|
|
|
|
danielgmx wrote: The form count is unknown
When it takes 40 seconds you don't know what the count is? Can't you do some debugging to find out?
led mike
|
|
|
|
|
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++
|
|
|
|