|
Is any Linked Open data projects in C#, ASP.Net available for learning RDF/XML?
|
|
|
|
|
Don't just post the same question in Q&A and the forums - pick one and stick to it.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I need to change the location of where a database file is located in a C#.net 2008 desktop application, but I am hacing problems. When stepping through the code, I find that I need to change a 'settings.settings' file. Bascially I need to be able to access the properties in some kind of a designer and I jhave not be able to do that. Would you have an idea of where I can obtain the directions to access the settings.settings file?
|
|
|
|
|
Assuming that you are using Visual Studio then use your mouse to right-click on the project name and select Properties. This will open a project properties tab and the settings selector is half way down on the left. Select the relevant item and edit as required.
Alternatively check the Properties folder in your project directory and you will find the file there. It's an XML file that you can edit with your favourite editor.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I have written the following
List<Project> UserProjects = ...
string domain = cbxDomain.SelectedValue.ToString();
HashSet<string> itemsToShow = new HashSet<string>();
And I was wondering which of the two snippets below people prefer
A) Use a Predicate
foreach (Project p in UserProjects.FindAll(delegate(Project x){return x.DomainName.Equals(domain);}))
{
itemsToShow.Add(p.ProjectName);
}
Or
B) Nested if
foreach (Project p in UserProjects)
{
if (p.DomainName.Equals(domain))
{
itemsToShow.Add(p.ProjectName);
}
}
0If you haven't used HashSet before, it is basically a List that sort of behaves like a Dictionary in that doesn't allow duplicates, but doesn't throw an exception if you try and add a duplicate. (I know that's an over simplification, - see MSDN[^] for full description)
|
|
|
|
|
Given the choices, the second. FindAll with an old-style anonymous function is a bit ugly in my opinion. Do you have the option of replacing that with a LINQ query?
|
|
|
|
|
I personally would go with the second choice for the sake of readability.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
The latter. But why are you usnig .Equals ?
|
|
|
|
|
I'll join the crowd and prefer the latter for its readability; the former isn't bringing anything IMO.
|
|
|
|
|
why not just use:
if (!itemsToShow.Contains(p.ProjectName))
itemsToShow.Add(p.ProjectName);
gets rid of the foreach and the ugly LINQ statement.
Please stop using LINQ for every little thing... the performance hit you take is big . People who use LINQ all over there code often find themselves re-writting slow chunks down the road.
|
|
|
|
|
While the second part is true,
SledgeHammer01 wrote: why not just use: [something]
Because it does something entirely different.
|
|
|
|
|
Er, you're right... I just glossed over the example .
|
|
|
|
|
Option A should really be
foreach (Project p in UserProjects.FindAll(x => x.DomainName.Equals(domain)))
{
itemsToShow.Add(p.ProjectName);
}
But I still think B is clearer. Also, why are you using .Equals instead of ==? For almost every class they are equivalent (even if I override Equals for value semantics I also override ==/!= because it's just too confusing otherwise) and == is prettier.
|
|
|
|
|
Thanks for your comments - this was more a general style point rather than the actual semantics of the sample code - I am putting together some new coding standards for a client and wanted to garner your views.
|
|
|
|
|
Hello Developers:
I am new in programming C#, i have a question about handling Usercontrol in win forms. i have started new project, in it i added a menu strip.
Menu have following List of Item:
<b>
New Member
Modify Member
Delete Member</b>
i have add three usercontrol for each of menu items and named them:
<b>
NewMember_UserControl
ModifyMember_UserControl
DeleteMember_UserControl</b>
Now what i want to do is: when i click on the <b>New Member</b> Menu Item, Usercontrol "<b>NewMember_UserControl</b>" display on the Main form's area below the menustrip. and similarly for two others
Please help me in writing menu even handler for UserControl.
|
|
|
|
|
There are a few options. I'm not sure what will bring the best performance:
Note: I assume your usercontrols are more or less the same size?
1.
Add the three usercontrols when the form loads, but make them invisible (or make a default visible and hide the others) In the event handler of the menu item you can then switch visibility accordingly.
I think this will have a good performance, but with higher memory usage.
2.
Add/Remove the controls dynamically from the form. The most easy way is to add a panel that will contain the usercontrol.
You can then do something like mypanel.Controls[0].Add(new ..._UserControl) (and a similar call for remove)
Note that you probably need instantiate an object of the usercontrol and set some properties before adding.
This will be a little slower, but less Memory consuming.
Hope this helps.
V.
|
|
|
|
|
Are you sure you don't want TabPages? Or dialogs?
|
|
|
|
|
anything else on sale today?
PS: you're right to ask, it just sounded a bit mercantile...
|
|
|
|
|
I have a MainMenu on clearance, but I don't think that'll do what he wants.
|
|
|
|
|
This is a repost of [^] on QA Sept. 22. The question was upvoted, and several detailed suggestions presented.
"Last year I went fishing with Salvador Dali. He was using a dotted
line. He caught every other fish." Steven Wright
|
|
|
|
|
I don't know how to Insert image on ricktextbox. Can you help me?
|
|
|
|
|
I needed that functionality not so long ago, and was able to get it up and running, with a lot of help from Google.
It is quite complex, and beyond the scope of a forum message. Here is the gist of it:
- a RichTextBox basically displays whatever is in an RTF document (which can be created using an app such as WordPad, or MS Word; or can be constructed programmatically by obeying the RTF specification).
- AFAIK the only way to have an image in an RTF, is by embedding all the image data using a MetaFile; there are two metafile formats, WMF and EMF, one is easier to construct, the other is what is needed eventually.
- there isn't an all-managed solution; you would need to call some native Windows functions (GdipEmfToWmfBits, DeleteEnhMetaFile), which requires P/Invoke.
The dataflow is like so:
Image -> Graphics -> Metafile(EMF) -> Metafile(WMF) -> RTFdocument
If you feel up to it, you now have a number of essential keywords. Good luck.
|
|
|
|
|
Luc Pattyn wrote: Image -> Graphics -> Metafile(EMF) -> Metafile(WMF) -> RTFdocument
Bloody hell - I'm glad I gave up trying to supply a richtext requirement in Silverlight, I can guarantee if I had I would have ended up dealing with this issue and I choked on the simple formatted text requirement.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I had exactly this requirement and can confirm that what Luc outlines here is the only way (at least, the only way I found) to make it work. You can embed an EMF in a metafile, according to the spec, but neither the RichText nor Word will actually display it.
|
|
|
|
|
BobJanova wrote: but neither the RichText nor Word will actually display it.
Now that is not correct; RichtTextBox, WordPad and Word happily display my programmatically generated RTF tables and images.
Of special interest to me is WordPad being always present in a Windows environment, with pretty much constant functionality over the years, and able to display a lot of things that it doesn't allow you to create interactively; all of this makes it a rather good report viewer, my reports then being RTF files.
|
|
|
|