|
AJAX means I'd have stuck with the ASP.NET forum ( where you've also posted this )
Perhaps your code is making too many AJAX callbacks and that is slowing it down ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I was maybe thinking that the ajax may have been slowing down the Dictionary of search parameters, the search inputs first try and get any previous parameters when the page is initialized.
Sorry for cross posting, I was just trying to cover my bases.
Thanks for the response, I'll look into it.
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
How do you build up the rows in your grid? Do you create an array of rows and add them all at the end, or do you add one at a time?
I've seen codes adding items to DataGridView one at a time and I think the grid does some 'OnAddedItem' handling like trying to refresh etc because when I changed it to adding arrays of data instead, the processing time was cut down to 1/3d.
-Larantz
|
|
|
|
|
Larantz wrote: How do you build up the rows in your grid?
I retrieve a Data Set from a database table via NetTiers.
How did you handle populating the GridView? Using the DataBound to create array, then ItemCreated?
Thanks for the insight though.
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
Could be viewstate "bloat". Are you using firefox with firebug? If so you can check out the http requests and responses in the console window and see what's being passed back and forth.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I have all the AJAX extensions set to disable ViewState already, but thanks.
Steve Echols wrote: If so you can check out the http requests and responses in the console window
Is there a way to do this in IE?
Cheers
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
There's a tool called Fiddler[^], but I can't get it to work on my machine. You might have better luck though!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Chris McGlothen wrote: I retrieve a Data Set from a database table via NetTiers.
Ok.With DataSet I don't think the row generation is an issue.
Chris McGlothen wrote:
How did you handle populating the GridView? Using the DataBound to create array, then ItemCreated?
Well in a normal case I'd use BindingList to handle the populating of the grid. The example I was refering to before was initially just building up string[] arrays with column values and then adding them to the grid. As a quickfix I just changed that into creating arrays of finished DataGridViewCells and adding the entire array to the grid. If I had the time, I'd go for a BindingList though.
Best regards!
-Larantz
|
|
|
|
|
Nice!
Thanks for the tip. I've not had the opportunity to try using a BindingList yet, I'll have to give it a go.
Cheers
An American football fan -
Go Seahawks!
Lil Turtle
|
|
|
|
|
I have a text box & a property window.
The text box is read-only and displays C code. As the users change properties the C-code changes respectively. I've implemented this using Regex's replace function. However it is really really slow. Here's what I have
private void updateCCodeTextBoxWorker(int address, string name)
{
cCodeTextBox.SuspendLayout();
string pattern = name + @", 0x..";
string replace = String.Format("{0}, 0x{1:X2}", name, regData[address]);
Regex rgx = new Regex(pattern);
cCodeTextBox.Text = rgx.Replace(cCodeTextBox.Text, replace);
cCodeTextBox.ResumeLayout();
}
The string "name" is basically what I'm searching for and "regData[address]" is the value that's changing.
Is there a better way to do this? How can I make it faster?
Thanks,
--RB
|
|
|
|
|
Have you tried the RegexOptions.Compiled flag? It may help, since the search pattern will be compiled into the assembly, which yields in faster execution time
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
So for every property change, the code executes, creates a new Regex and
makes it Replace something. Regex is an expensive class by itself,
it has to either interpret your intentions, or, optionally generate compiled
code for it (more cost effective only when required over and over, not your case).
If the user types 5 characters for a property, it changes five times.
I would look for a way to run the code less frequently. Some ideas:
- let the user trigger the code by clicking a button or so (less comfortable);
- let a timer trigger the code; maybe have a scheme where the worker runs
say 3 seconds after the last change (i.e. every change starts/restarts a timer,
and only when the 3 seconds elapse is the code executed).
Hope this helps
|
|
|
|
|
Hi,
Am writing an .net windows application in which i have to connect to IBM MQ on remote machine running unix to post messages. This is a tool kinda thing for an enterprise application.
this is the code am using to connect to the MQ.
Code: ( text )
MQEnvironment.Hostname = hostName;
MQEnvironment.Port = port;
MQEnvironment.Channel = "SYSTEM.DEF.SVRCONN";
MQQueueManager qm=new MQQueueManager(queueMgr);
When i try to run the application it throws an exception in
MQQueueManager qm=new MQQueueManager(queueMgr);
Exception details :- CompCode 2 Reason 2035 ..from error code lookup i learnt that its MQRC_NOT_AUTHORIZED.
read somewhere that the user's credentials under whom application is run will be supplied for authorization automatically..if thats the case how is cross platform connectivity is possible...in my case mq client is on windows and
mq server is on unix.
Do i have to specify the userid,password for unix system to override this?
If so, how? MQQueueManager Class doesnt have a constructor that accepts userid/password as a parameter and MQEnvironment doesnt have a property for userid/password..
Am using Websphere Mq 5.3 ? Is the option to specify userid/password available in the latest version 6.0?
seems MQ classes for java have options to specify userid/password but .NET classes didnt.
am pulling my hair over this for the past 3 days...please help..
|
|
|
|
|
I have a variable
string input
How do i detect if variable has digit in it or an alphabet.
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
t4urean wrote: How do i detect if variable has digit in it or an alphabet.
In terms of an exclusive or?
To check, if the string is a number:
int i = int.TryParse(input)
If it's just one digit:
int i = int.TryParse(input) and then i =< 9 && i >= 0
If it contains one or more alphabets:
bool b = Regex.IsMatch(input, "[a-zA-Z]")
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
you can walk the individual characters of the string:
for (int i=0; i<input.Length; i++) {
char c=input[i];
... do something with c
}
or equivalently (unless you want to change c, wouldnt work here):
foreach (char c in input) {
... do something with c
}
and you can use one of many many methods available in String class,
such as IndexOf() and Contains()
May I suggest you at least read the MSDN documentation on String class;
or better yet work your way through a introductory C# book.
|
|
|
|
|
You can use regex, or iterate over the chars and use things like char.IsDigit.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
For some reason my IOException is not being caught... if my Frame (SettingsPane) tries to go to a non-existent XAML page in my resources (in a folder), it gives me this exception but I tell it to handle it and it totally ignores it for some reason. My catch statement is there but when I attempt to load a non-existent page, I see the exception. Why isn't it being caught by my catch statement?
Another question if this can't be answered... how do I check if a resource exists in my application? If I can test the existence of the resource my app is trying to find, I wouldn't have to deal with this exception in the first place.
Here is a screenshot of what I'm dealing with here...
Screenshot
|
|
|
|
|
Hi,
my best guess is you have nested exceptions, and the IOException shown is at
a lower level.
suggestion for verification: temporarily change your catch to catch Exception exc
and print exc.ToString(), it should reveal everything.
|
|
|
|
|
void PropertyTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)<br />
{<br />
if (((XmlElement)PropertyTree.SelectedItem).Name == "Panel")<br />
{<br />
try<br />
{<br />
SettingsPane.Source = new Uri(((XmlElement)PropertyTree.SelectedItem).GetAttribute("Uri"), UriKind.Relative);<br />
}<br />
catch (Exception exc)<br />
{<br />
MessageBox.Show(exc.ToString());<br />
}<br />
}<br />
<br />
}
... is what I have now. I reproduced the exception and it shows the same IOException again (depending on which TreeViewItem I click on (change selection) and I never did get a MessageBox shown within my catch statement...
Thanks for the quick reply!
|
|
|
|
|
The IOException window you get has a "copy to clipboard" facility;
could you please use it and show all the lines preferarbly formatted
line by line, not just as a wrapping stream).
That should tell us something...
|
|
|
|
|
Hope this is how you wanted it.
System.IO.IOException was unhandled
Message="Cannot locate resource 'pages/customtrackinfo.xaml'."
Source="PresentationFramework"
StackTrace:
at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream()
at System.IO.Packaging.PackWebResponse.GetResponseStream()
at System.IO.Packaging.PackWebResponse.get_ContentType()
at System.Windows.Navigation.BaseUriHelper.GetContentType(WebResponse response)
at System.Windows.Navigation.NavigationService.GetObjectFromResponse(WebRequest request, WebResponse response, Uri destinationUri, Object navState)
at System.Windows.Navigation.NavigationService.DoNavigate(Uri source, NavigationMode f, Object navState)
at System.Windows.Navigation.NavigateQueueItem.Dispatch(Object obj)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AveSkin.App.Main() in C:\Documents and Settings\DocMARs\My Documents\Visual Studio 2005\Projects\AveSkin2\AveSkin2\obj\Debug\App.g.cs:line 0
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
|
|
|
|
|
Gee, that is a terrible trace.
I noticed Threading.ExceptionWrapper.TryCatchWhen at two distinct locations,
and a Threading.Dispatcher.WndProcHook in between.
Are you just clicking some control ???
Can I assume the following ?
your .NET is 2.0 or better
you never set Control.CheckForIllegalCrossThreadCalls false
your app doesnt have other anomalies
I dont understand, but I would suggest three things:
1.
keep the try-catch(Exception exc) for now
2.
you split the suspicious line in smaller parts, e.g. URI=new URI...
3.
you add the following at the start of the offending method:
Console.WriteLine(Environment.StackTrace);
so that should tell us how you get there.
Good luck.
|
|
|
|
|
Sorry, I should have provided more information...
I'm using .NET Framework 3.0 coding a WPF application.
And I don't know if this has anything to do with it but it might...
In the same if-statement, I had the same try-catch statement with a NullReferenceException in the catch statement but I changed it to IOException when I was getting IOExceptions because I had to change my code in the try block and if the Frame control couldn't find the XAML page it was looking for in the try block, it throws the IOException.
Does this help you?
|
|
|
|
|
Andy Spier wrote: Does this help you?
Not really.
I dont quite understand it; you first were prepared to handle NullRefs, then
decided not to handle them anymore ?
Anyhow, I stand by my recommendation to split the difficult line, and keep
the catch (Exception) for now.
Have been looking at Visual itself; you have some say in which exceptions
get intercepted by Visual, rather than passed on to your app. Have a look
at menu Tools/Options/Debugging/General, first two checkboxes.
I dont pretend to understand it all, first is unchecked (cross appdomain,
I dont use extra appdomains so does not matter), second is checked (enable
assistant). You may want to try different settings and/or read up on what
they mean, then decide what you want.
You also may want to try and run your app outside Visual...
|
|
|
|
|