|
Whoa! I feel like I've just gone to the hospital to ask a surgeon why I keep getting headaches whenever I hit my head with a hammer. There should be a facepalm emoticon.
Thanks guys. I'll apply your suggestion to the code tonight and see what happens.
Clive Pottinger
Victoria, BC
modified 15-Nov-11 12:38pm.
|
|
|
|
|
Yup - that was it.
embarassing... that's all I have to say... embarassing
oh, and thanks.
BTW: I find it interesting that the question from one C.D.P was answered by another C.D.P.
Clive Pottinger
Victoria, BC
|
|
|
|
|
Don't worry.
And you're welcome.
BTW: you shouldn't reply to self, as nobody gets mail notification when you do.
|
|
|
|
|
Clive D. Pottinger wrote: BTW: I find it interesting that the question from one C.D.P was answered by
another C.D.P
In my case the 'CDP' has nothing to do with my name or initials. A CDP1802 or RCA1802[^] was the CPU in my first computer. Look closely at the assembly code sample. One of the instructions, the one to designate the stack pointer, still does not fail to bring a wide grin to programming.
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.
|
|
|
|
|
An instruction any man would love to comply with I think
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Yes, who does not like to set the stack pointer
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.
|
|
|
|
|
Good catch. I read right over that.
|
|
|
|
|
Hi,
I have an Web Application developed in .NET Framework 4.0 and created an deployment setup for the same. The client requirement is to create an custom Apppool and assign it to the virtual directory which is currently installing. To address this issue i created an custom actions project as described in following article.
http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx[^]
I wrote the following code to create an apppool and assign it to the virtual directory.
private void CreateAppPoolIIS7()
{
using (ServerManager serverManager = new ServerManager())
{
string appPoolName = this.Context.Parameters["APPPOOL"];
ApplicationPool newPool;
newPool = serverManager.ApplicationPools.FirstOrDefault(x => x.Name == appPoolName);
if (newPool == null)
newPool = serverManager.ApplicationPools.Add(appPoolName);
newPool.ManagedRuntimeVersion = "v4.0";
newPool.ManagedPipelineMode = ManagedPipelineMode.Classic;
serverManager.CommitChanges();
}
}
private void AssignIIS7AppPoolToVirDir()
{
using (ServerManager serverManager = new ServerManager())
{
Microsoft.Web.Administration.Application newApp = null;
string appPoolName = this.Context.Parameters["APPPOOL"];
Site site = serverManager.Sites.First(s => s.Id == 1);
string installpath = this.Context.Parameters["INSTALLDIR"];
installpath = installpath.TrimEnd('\\');
string virdirname = "/" + installpath.Substring(installpath.LastIndexOf('\\') + 1);
newApp = site.Applications.FirstOrDefault(x => x.Path == virdirname);
if (newApp != null)
{
newApp.ApplicationPoolName = appPoolName;
serverManager.CommitChanges();
}
else
{
MessageBox.Show("Website not found");
}
}
}
I call these methods in the Install event of the installer as follows..
public override void Install(IDictionary stateSaver)
{
.......
CreateAppPoolIIS7();
AssignIIS7AppPoolToVirDir();
The assigned app pool is reflected in the IIS as long as the control is in the custom action project. The apppool resets back to the default selected at the start of the installer once the setup exits the custom action project.
It would be grateful if some one could help.
When you fail to plan, you are planning to fail.
|
|
|
|
|
Hi All,
I am using the WPF ribbon Library in my application for getting a ribbon control attached in my application.
I need the functionality where I can trap the minimize event in ribbon and do some additional stuff of code in there.
But, to my surprise I could not find any property named Minimized in ribbon .. I could found out collapsed and Expanded but they were of no use.
Can some body tell me what does IsMinimize property correspond to. As,if I know for which property the minimize functionality is attached,I can then easily solve my problem statement.
-Kushagra
I believe in Me !!!
|
|
|
|
|
|
I have an XNA application which runs in several threads. One thread takes care of the 3D rendering, the other one is a GUI with the application logic. The controls of the GUI are also drawn by the rendering thread, therefore some thread synchronization between the UI thread and the rendering thread exists. Basically this is neeeded only when a control's properties are changed so that the control must be redrawn. Locks are only needed while those properties are changed, so that a control is not accidentally drawn with only half of the changes, causing ugly rendering glitches. This synchronization is only brief and does not cause any visible delay in rendering or in the performance of the UI thread.
The UI thread makes use of a webservice to fetch or write data from and to the server. With synchronous webservice calls I would expect the UI thread to freeze up while waiting for the response. This should have no bearing on the rendering thread, as the UI thread is waiting and not making any changes to controls. Against this expectation, the rendering thread also briefly freezes when a web method is called.
Using asynchronous webservice calls solves the problem and will be the way to go, but I also would like to understand what is going on. I use a quad I7 proceesor at 4 GHz, so calling a web method in a multithreaded application should (and does not) generate a CPU load of 100%. Also it cannot be because of thread synchronization.
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 7:58am.
|
|
|
|
|
How are you determining that the rendering thread freezes? Obviously anything it tries to display will get delayed, and if you have any event handlers which call Invoke onto the UI thread, those will also cause a synchronisation point. The debugger is primarily attached to the UI thread and so if you're looking at it in there it might also show a freeze, which could be an artifact of the debugging environment.
|
|
|
|
|
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.
|
|
|
|