|
Thank you. The program at the moment uses a simple animated scene (a continuously rotating model) in the background and the current frame rate is displayed. When web methods are called, the rotation of the model stops for the duration of the call and the frame rate is not updated. Then it resumes and the frame rate briefly is displayed as 0, indicating that the rendering thread indeed stood still during that time. No such delays happen when the webservice calls are commented out.
Edit: Just to be precise: I had started it in debug mode, but there were no breakpoints. It was the mere presence of the debugger which caused this behavior. When I come home I will take a look how well the current version fares.
I have an older version of the project here and just compiled it with 'Release' settings and started the program from Windows Explorer, so that the debugger was not present in any way. It worked as expected: The UI thread waited when calling the webservice, briefly freezing the UI. Meanwhile the animated 3D rendering in the background continued without any visible delay or drop in the frame rate, even when slower web methods were called.
I'm glad that the debugger was the culprit and that there is no hidden bug which may come back and cause even more trouble.
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
modified 15-Nov-11 11:01am.
|
|
|
|
|
Hi
I have the regex below to split words and not split a string ".. .." instead take the whole string as on item to a List.
Example:
text="all "1 dl""
after split
all[0]="all"
all[1]="1 dl"
I found it in Google and it works, but I don't understand how it works.
string regexSpliter = @"(?<=^(?:[^""]*""[^""]*"")*[^""]*) ";
List<string> all =new List<string>_ (System.Text.RegularExpressions.Regex.Split(text, regexSpliter));
And if I remove the space before the last " in the string it doesn't work as I want. It seems like it splits all the characters written in the string text.
Can anybody please explain the string regexSplitter and why it has to be a space last in the string.
Many thanks
Fia
|
|
|
|
|
|
I truly appreciate the "deep art" of RegEx expressions, although I'd never spend time trying to reverse-engineer what any complex one, like this, does. My understanding is they are expanded internally into lots of code, but, when compiled, give excellent performance.
Meanwhile, have you considered an alternative like:
char[] c = new char[] {'\"'};
string s = "all \"1 dl\"";
List<string> sList = (s.Split(c)).Where(str => str != "").ToList<string>(); Disclaimer: the above code was created very quickly, and tested only on your input string, making the assumption that you would have to escape the internal quote delimiters.
On your input it does work to create a two element List<string>, whose elements match the results of your RegEx.
Whether the above code is appropriate/robust, etc., for your parsing needs, I have no idea; it's meant only to show the possibility of an alternative.
good luck, Bill
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
It's basically saying 'split on space or on this big group which matches a quoted string'. I guess the fact it's a parenthesised group is how it ends up being returned even though it was the split expression. I don't fully understand it but that's the basic idea.
This isn't how I would parse a command string, I have some code for that in my Lobby Server article:
using System.Text.RegularExpressions;
namespace RedCorona.Util {
public class Command {
public static string[] Parse(string text){
if(text.IndexOf('"') < 0) return text.Split(' ');
else{
MatchCollection mc = Regex.Matches(text, "\"(?<word>[^\"]*)\" *|(?<word>\\w+)");
int len = mc.Count;
string[] res = new string[len];
for(int i = 0; i < len; i++) res[i] = mc[i].Groups["word"].Value;
return res;
}
}
}
}
I'm not sure if MatchCollection implements IEnumerable<string> and therefore whether you could do a one-liner as you have done there; this code comes from pre-generic days (which is why it returns an array not a List<string>). My simple brain can only think in terms of the matched groups not the delimiters so this regex matches a quoted (first part) or unquoted (second part) 'word'.
|
|
|
|
|
our laptops are 32 bit while the servers are 64bit (we work mainly with web services).
This was no problem while we used OleDb, but with the new server OleDb wasn't installed and we had to switch to Odp.Net. Here we had to compile against x64 to get it working. It all 'works', however now we need to switch between 32bit when hitting F5 and 64bit when deploying on our server.
Up until know it ended up in a nightmare as we need to reference some dll's and those also need to be recompiled etc...
Is there an easy way in switching between platforms easily?
I might be confused with the different options in the configuration manager and the project properties for one thing. I did some googling, but it seems everybody has the same problem, but I haven't seen a good solution yet.
thanks !
V.
|
|
|
|
|
Does it still work if you compile to "Any CPU"?
|
|
|
|
|
No, but that could be because I'm messing with all different settings in the different projects.
You have the
- Configuration manager
- The platform in the build tab in the project properties
- The platform target in the build tab in the project properties
I don't really see the link between them.
I mostly use 'batch build' and let it build both versions, but somehow this isn't working 100% either. I just end up with dll hell and try several settings until it works again (which is not very good).
V.
|
|
|
|
|
Do you really need to use the 64 bit version of ODP.NET on the server?
|
|
|
|
|
Unfortunately yes, sysadmin installs these items and it will take some time to change.
Besides, I would prefer a 64bit development machine instead
V.
|
|
|
|
|
VS is bit weird with these - changing it in one place sometimes updates the other places, sometimes not. Specifically, changing the "active solution platform" changes everything else, but changes made in other places do not propagate (I suppose it can sometimes be useful to set the target differently for different projects in a solution, but usually it's a Bad Thing)
Were ALL of those settings set to "Any CPU", and if not, does it work if you make it so?
|
|
|
|
|
Hello,
Thanks for your reply. Any CPU was were it was on originally, but that's where the ODP.Net component started to mess things up when installed on the (x64) server. It was solved when compiling specifically against 64 bit, but that resulted in our local development to be messed up.
V.
|
|
|
|
|
Strange. I don't think I can be of much help them then. Maybe you can convert the dev machines to 64bit?
modified 15-Nov-11 6:39am.
|
|
|
|
|
harold aptroot wrote: I don't think I can be of much help them
No worries, you tried.
harold aptroot wrote: Maybe you can convert the dev machines to 64bit?
Long story, don't get me started .
anyway, I appreciate the help.
V.
|
|
|
|
|
I have the following code after this execution i have to navigate to other Page can any one help me out..
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Export.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
HtmlForm frm = new HtmlForm();
gv.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(gv);
frm.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
Response.Redirect()// Not working
Server.Transfer()// Not working
Please any one help me to navigate to other page here ??
Thanks in Advance.
|
|
|
|
|
you are terminating response at this line
pravin_mun wrote: Response.End(); comment out this line,
Response.Redirect("URL") should work then.
Regards
modified 15-Nov-11 1:37am.
|
|
|
|
|
No Luck..!! Tried with the same.. Getting this exception..!("Cannot redirect after HTTP headers have been sent.")
|
|
|
|
|
First of all, I don't understand why you want to redirect after sending anything to browser. Didn't check that in VS, but believe the problem is that you are modifying response, and then doing Response.Redirect. Try removing lines:
<br />
Response.ContentType = "application/pdf"; <br />
Response.AddHeader("content-disposition", "attachment;filename=Export.pdf");<br />
Response.Cache.SetCacheability(HttpCacheability.NoCache);<br />
<br />
Response.Write(pdfDoc);<br />
Response.End();<br />
And check if Response.Redirect works.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
I have enclosed a short snippet of code of my attempt to pass a Generic list to a new form. I can't get it done. Any help would be great:
Code from Main form
public List<iattachmentlist> iattachmentagents = new List<iattachmentlist>();
public class iattachmentlist
{
private string _title;
private stream _attachment;
public string TITLE { get { return _title; } set { _title = value; } }
public stream ATTACHMENT { get { return _attachment; } set { _attachment = value; } }
public iattachmentlist(string xtitle, object xattachment)
{
_title = xtitle;
_attachment = xattachment;
}
}
private void attachmentsbutton_Click(object sender, EventArgs e)
{
emailattachment attachform = new emailattachment();
attachform.pgsource = pgsource;
attachform.id = id;
attachform.iattachmentagents = ?????????;
attachform.ShowDialog();
attachform.Close();
}
How do I set up attachform?
Kendall
|
|
|
|
|
I can't provide specific help as you didn't include the relevant code snippet, where iattachmentagents gets defined. It is also unclear whether you are using nested classes, or in what type the first line is actually defined.
What I can tell you is this:
1. there is nothing special about passing generic lists; in a statement such as a = b; a and b could both be an int, or a string, or a list of some type, it doesn't matter, as long as both sides agree.
2. if a class property needs to have a specific type, just set it, as in:
class SomeClass {
private List<string> myListOfStrings;
public List<string> MyListOfStrings {
get { return myListOfStrings; }
set { myListOfStrings = value; }
}
}
3. I suggest you switch to standard formatting, clearer identifier names, and standard casing. At first glance your code does not even look like C#. If you're new to C#, maybe an introductory book could get you started on the right track.
|
|
|
|
|
Sorry for the format and casing. I hope the code snippet below will help define my problem.
Main form:
namespace Vetnet
{
public partial class emailform : Form
{
public string pgsource;
public string cpass
{ set { pgsource = value; } }
public string id;
public string passid
{
set {id=value;}
get {return id;}
}
public List<iattachmentlist> iattachmentagents = new List<iattachmentlist>();
public emailform()
{
InitializeComponent();
}
public class iattachmentlist
{
private string _title;
private stream _attachment;
public string TITLE { get { return _title; } set { _title = value; } }
public stream ATTACHMENT { get { return _attachment; } set { _attachment = value; } }
public iattachmentlist(string xtitle, object xattachment)
{
_title = xtitle;
_attachment = xattachment;
}
}
private void attachmentsbutton_Click(object sender, EventArgs e)
{
emailattachment attachform = new emailattachment();
attachform.pgsource = pgsource;
attachform.id = id;
attachform.iattachmentagents = iattachmentagents;
attachform.ShowDialog();
attachform.Close();
}
public class emailattachment : Form
{
public string pgsource;
public string cpass
{ set { pgsource = value; } }
public string id;
public string passid
{
set { id = value; }
get { return id; }
}
public string displaymode;
public List<iattachmentlist> iattachmentagents = new List<iattachmentlist>();
public List<iattachmentlist> pass
{
public set { iattachmentagents = value; }
public get { return iattachmentagents; }
}
public emailattachment()
{
InitializeComponent();
}
Please don't get hung up on my poor formating and casing.
Kendall
|
|
|
|
|
This is horrible code simply by (A) your extremely poor choice of identifier names and (B) you making everything public. This causes total confusion to you and everyone else.
Examples:
1. class iattachmentlist does not represent a list, it seems to represent an attachment, which later on might or might not go into a list. Do you call your house a homecity just because it is your home and part of the city you live in, I think not.
The right name would be: class Attachment , notice an existing word, explaining exactly what it is, starting with an uppercase as it is public, and absolutely not beginning with "I" as it isn't an interface.
2. class emailattachment : Form is equally bad, the class does not represent an attachment, it probably is a Form going to be used to do something to an attachment. So maybe it should be class EditAttachmentForm .
3. inside class emailattachment you have both a public member iattachmentagents and a public property pass using said member; that does not make sense at all.
I am not going to spend more time here, it is up to you to untangle this mess. Sorry.
|
|
|
|
|
As has been mentioned, the naming and casing makes it very hard to figure out what you are doing.
where yuo say 'it screws up here I think' it is just trying to instantiate the generic list - not pass it over to another form - so I cant see why you think it is screwing up - what is / isn't happening?
I quickly copy/pasted your code into a new solution and got compilation errors, and about gave up there.
I would firstly suggest you remove the public class iattachmentlist into its own source file.
then I would rename things as has been suggested, get a clean compilation and try again - and post again if its not working still.
|
|
|
|
|
What version of .NET are you compiling to ?
Assuming you can compile this without error:
1. set a break-point on the first line in 'attachmentsbutton_Click
2. F11 single-step through the code until you encounter an error, and then report the specific error here
3. if it breaks before even reaching 'attachmentsbutton_Click, then set a break-point in the 'InitializeComponent(); if the 'eMailForm constructor, and single-step from there
If this doesn't compile: what's the error report(s) from the compiler.
And, as _Maxxx_ commented on, if you are passing a generic List in to this new Form you are creating why do you need to instantiate it in the new 'emailAtttachment instance ?
good luck, Bill
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." Bjarne Stroustrop circa 1990
|
|
|
|
|
I would like to thank _Maxxx_ and Bill for taking the time to look at the code. AS _Maxxx_ recommended I eliminated the instance of 'emailAttachemnt' in the second form. Still will not compile.
private void attachmentsbutton_Click(object sender, EventArgs e)
{
emailattachment attachform = new emailattachment();
attachform.pgsource = pgsource;
attachform.id = id;
attachform.iattachmentagents = iattachmentagents;
attachform.ShowDialog();
attachform.Close();
}
Does this help?
also-> Net 3.5, Visual studio 8
Kendall
|
|
|
|