|
Many thanks.Its really much appreciated.
What i want is to have multiple parent link.So when you click on Home to will not hide service Link.
when you implement like you mentioned it comes with an error.
"Exactly one element is required directly inside the element".
Please advice.
Many thanks
|
|
|
|
|
That's what I get for trying to go from memory! You have to wrap everything in one <siteMapNode></siteMapNode> element. If you are using this with a SiteMapDatasource, you can change the ShowStartingNode property to false if necessary.
<siteMap>
<siteMapNode>
<siteMapNode title="Home" url="default.aspx">
<siteMapNode title="Page1" url="page1.aspx" />
<siteMapNode title="Page2" url="page2.aspx" />
</siteMapNode>
<siteMapNode title="Services" url="services.aspx">
<siteMapNode title="Page3" url="page3.aspx" />
<siteMapNode title="Page4" url="page4.aspx" />
</siteMapNode>
<siteMapNode title="Contact" url="contact.aspx">
<siteMapNode title="Page5" url="page5.aspx" />
<siteMapNode title="Page6" url="page6.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>
|
|
|
|
|
Many thanks.It works very well Now.
Thanks
|
|
|
|
|
Hello! I recently started writing my first Windows Service project in C#, and I'm at a point now where I have a lot of time to perfect things before I continue.
I was wondering what's considered generally "good practice" with regards to Windows Services. Specifically, the stopping mechanism.
When my service starts, it kicks off a few threads that perform some file manipulation. When the service stops, I want it to shut those threads down gracefully. Ideally, shutting down the service puts the file system in a state where the manipulation can be easily resumed upon restarting the service. So, when shutting down the service, I'd prefer to let one of the threads (if it's currently doing work) finish the works it's already started, but in some cases, this can take several minutes.
Is this considered bad practice, or is this something I shouldn't really be concerned with? Are there other things anyone thinks I should consider?
|
|
|
|
|
It sounds OK to me, though "several minutes" sounds excessive. Is there a way to have them stop after the current operation even though there are still other things to do?
agent00zelda wrote: it kicks off a few threads that perform some file manipulation
Can those be in their own Services?
|
|
|
|
|
Thank you for your response!!
PIEBALDconsult wrote: Can those be in their own Services?
Actually, yes, and they are.. I guess I should have mentioned that part
The way I had it implemented before I made the initial post was I pretty much let it finish everything until it was able to submit the data to the other services. But Windows spazzed out because it couldn't stop the main service until it finished the preceding operations.
What I ended up doing was defining like a project "state" DataTable that could be exported and imported again when the service restarts. Your suggestion was well-taken -- pretty much made the current operation finish and then updated the project state based on that. I don't know if using a DataTable is the best approach, but it seems to work much better, since it takes considerably less time to stop the service.
Still open to suggestions if you or anyone can think of a better approach, though!! I guess I'm in a C# experimentation phase
|
|
|
|
|
Hi folks,
I could please need some help with custom Configuration Sections:
Let me first describe what I want to acheive:
I want to have a Configuration section which consists of several items (I already managed that, it's working fine)
Now each of these items can should have another list of subsitems.
The resulting config file should look like this:
+ section
- parentitem
- childitem
- childitem
...
- parentitem
- childitem
...
As I said I already managed add the section and create the "parent items".
Now I tried using a ConfigurationElementCollection derived class for the collection of
"childitems" but they won't show up.
Does anyone have an idea how I can acheive my goal?
Many thanks in advance.
Stefan
|
|
|
|
|
Hi guys,
Quick question:
I got this class:
public class PresaHidraulica<br />
{
.....
public System.Collections.ArrayList listaRevizii;
}
and i want to overload the operator + to add an object of another class(Revizie) in this ArrayList from this class.
I tried :
public static PresaHidraulica operator +(Revizie r1)<br />
{<br />
}
And i get the error : The parameter of a unary operator must be the containing type
Any suggestions please?
Regards,
Alex
“Be the change you want to see in the world.”
|
|
|
|
|
That means that your parameter r1 is of wrong type: Revizie.
When you overload operator + you must pass in parameter PresaHidraulica
public static PresaHidraulica operator +(PresaHidraulica ph)
{
}
Maybe you should create a method called AddRevizie
public void AddRevizie(Revizie r1)
{
listaRevizii.Add(r1);
}
|
|
|
|
|
The first parameter must be the containing type. In this instance, you should change the operator method signature to public static PresaHidraulica operator +(PresaHidraulica self, Revizie r1)
|
|
|
|
|
Thanks a lot. It worked just fine
here it is:
public static PresaHidraulica operator +(PresaHidraulica p, Revizie r)<br />
{<br />
p.ListaRevizii.Add(r);<br />
return p;<br />
}
Regards,
Alex
“Be the change you want to see in the world.”
|
|
|
|
|
You're very welcome. And thank you for working the code out - too many people here expect to be spoon-fed
|
|
|
|
|
Hi,
this is a bad idea.
When you have integers a, b, c and execute c = a + b; do you expect a or b to change?
That is what your code is doing!
You should not change the value of the operands,
Overloaded operators are not the right solution, create an Add() method instead.
|
|
|
|
|
I totally agree. What you are trying to do is also adding apples and oranges:
foo = 3.1415 + "Hello";
Use an Add method, rather than trying to twist the compiler into effectively allowing implicit casts between unrelated objects.
That didn't make as much sense when I read it back. Try this:
...
int a, c;
string b;
...
c = a + b;
...
You would not expect that to compile, would you?
So why would you expect this to compile?
class AClass
{
private static AClass operator + (BClass b)
...
}
class BClass
{
...
}
...
AClass a, c;
BClass b;
...
c = a + b;
...
|
|
|
|
|
I agree to a point. There are situations where it could be acceptable (the OP's may be one).
To continue your adding apples and oranges analogy, imagine a class FruitBasket that has a List of Apples. Adding a new Apple to the basket via an overloaded + binary operator could make sense. I prefer exposing the list of Apples as a property so it's Add method can be called directly or creating an AddApple method, but it's not 'bad' IMO.
public class FruitBasket
{
private List<Apple> _Apples;
public FruitBasket()
{
_Apples = new List<Apple>();
}
public static FruitBasket operator +(FruitBasket basket, Apple apple)
{
basket._Apples.Add(apple);
return basket;
}
}
public class Apple
{
public Apple(string name)
{
Name = name;
}
public string Name
{
get;
set;
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I see what you are saying, that there may be instances where it could be acceptable.
I am not sure though, that it adds anything usefull over using an Add method - at least you expect
fruitBasket.Add(apple); to change fruitBasket without looking at the implementation. I wouldn't expect
foo = fruitbasket + apple; to result in a change in foo and fruitBasket at first view. Surely, good practice would say "don't do it"?
Just a thought, not an arguement...
|
|
|
|
|
i'm new to programming n networking, i like to know more about how bittorrent working. so, recently i start building torrent retriever. i come across this site http://dotnet.org.za/weareu/archive/2007/04/12/decoding-bencoded-streams-in-c.aspx with the following code to decode torrent file. In the (public static object BDecode(BinaryReader reader)). there have four different type return. if i called this method, how to retrieve the four different variable. thanks.
public class BEncoding
{
public static object BDecode(string filePath)
{
byte[] data = File.ReadAllBytes(filePath);
return BDecode(data);
}
public static object BDecode(Stream stream)
{
if (!stream.CanSeek)
{
throw new Exception("Your stream needs to support seeking for this algorithm");
}
BinaryReader reader = new BinaryReader(stream, System.Text.Encoding.ASCII);
return BDecode(reader);
}
public static object BDecode(byte[] data)
{
return BDecode(new MemoryStream(data));
}
public static object BDecode(BinaryReader reader)
{
char ch = reader.ReadChar();
Int64 ires = 0;
if (ch == 'd')
{
ch = (char)reader.PeekChar();
Hashtable hash = new Hashtable();
while (ch != 'e')
{
object key = BDecode(reader);
hash[key] = BDecode(reader);
ch = (char)reader.PeekChar();
}
return hash;
}
else if (ch == 'l')
{
ch = (char)reader.PeekChar();
ArrayList list = new ArrayList();
while (ch != 'e')
{
list.Add(BDecode(reader));
ch = (char)reader.PeekChar();
}
return list;
}
else if (ch == 'i')
{
ch = reader.ReadChar();
string number = "";
while (ch != 'e')
{
number += ch;
ch = reader.ReadChar();
}
return Int64.Parse(number);
}
else if (Int64.TryParse(ch.ToString(), out ires))
{
string number = "";
while (Int64.TryParse(ch.ToString(), out ires))
{
number += ch;
ch = reader.ReadChar();
}
string line = "";
for (int i = 0; i < Int64.Parse(number); i++)
{
line += reader.ReadChar();
}
return line;
}
throw (new Exception("Torrent Error"));
}
}
|
|
|
|
|
This is really badly formed code. You should rewrite it as a more type-safe method. Your original question however: check the return type. Something like this:
object result = BDecode(...);
string resultAsAString = "";
HashTable resultAsHashTable = null;
ArrayList resultAsArrayList = null;
if(result != null)
{
if(result is string)
resultAsAString = result.ToString();
else if(result is HashTable)
resultAsHashTable = result as HashTable;
else if(result is ArrayList)
resultAsArrayList = result as ArrayList;
}
This is just a kludge however. Your original method is still badly in need of a refactor
|
|
|
|
|
thanks for your valuable answer. i get it working.
|
|
|
|
|
nay one can tell me how we use joining more than one table in asp.net by inner join and outer joi
please send website name to find out
rizvan sivally
|
|
|
|
|
sheemap wrote: please send website name to find out
google[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
that site is nnot accessibe please send again
rizvan sivally
|
|
|
|
|
|
What, have you lost the internet?? How is google not accessible.
Here is a nice list of EVERY google site (that I was able to find, using google)
google.de
google.com
google.at
google.pl
google.fr
google.nl
google.it
google.com.tr
google.es
google.ch
google.be
google.gr
google.com.br
google.lu
google.fi
google.pt
google.hu
google.hr
google.bg
google.com.mx
google.si
google.sk
google.ro
google.ca
google.co.uk
google.cl
google.com.ar
google.se
google.cz
google.dk
google.co.th
google.com.co
google.lt
google.co.id
google.co.in
google.co.il
google.com.eg
google.cn
google.co.ve
google.ru
google.co.jp
google.com.pe
google.com.au
google.co.ma
google.co.za
google.com.ph
google.com.sa
google.ie
google.co.kr
google.no
google.com.ec
google.com.vn
google.lv
google.com.mt
google.com.uy
google.ae
google.ba
google.co.nz
google.com.ua
google.co.cr
google.ee
google.com.do
google.com.tw
google.com.hk
google.com.my
google.com.sv
google.com.pr
google.lk
google.com.gt
google.com.bd
google.com.pk
google.is
google.li
google.com.bh
google.com.ni
google.com.py
google.com.ng
google.com.bo
google.co.ke
google.hn
google.com.sg
google.mu
google.ci
google.jo
google.nu
google.com.jm
google.com.ly
google.co.yu
google.tt
google.com.kh
google.ge
google.com.na
google.com.et
google.sm
google.cd
google.gm
google.com.qa
google.dj
google.com.cu
google.com.pa
google.gp
google.az
google.as
google.pl
google.mn
google.ht
google.md
google.am
google.sn
google.je
googlee.com
google.com.bn
google.com.ai
google.co.zm
google.ma
google.rw
google.co.ug
google.com.vc
googlenews.de
google.com
google.at
google.com.gi
google.to
google.com.om
google.kz
google.co.uz
if every single one is inaccessible, then I will do your research for you. Not before.
|
|
|
|
|
You have way too much time on your hands
|
|
|
|