|
I'm currently using JQPlot[^]
I'm dynamically defining the chart depending on the selected data. Works pretty good.
You can also use : dygraphs[^]
And there are probably other libraries too.
You 'could' write your own tool, but that would be time consuming.
|
|
|
|
|
Please supply us with a question, what you have here is closer to a statement of intent.
Please refer to this site's guidance about asking a question.
|
|
|
|
|
|
Hi,
Thanks for your reply. I have used mschart but I couldn't get the chart as desired
I will upload a snapshot which describes my requirement.
Thanks and Regards Sagar G K
|
|
|
|
|
|
|
I have a string like:
string s1 = "dog().Cat(\"Happy\")";
I want to:
1) count the number of round brackets '(', I expect as result 2
2) get the text inside, I expect "\"Happy"\", which appear in console output as "Happy"
No idea for 1. I try the following for 2
string k = Regex.Match(s1,@"\((\w+)\)").Groups[1].Value;
But It fails in understanding the \" character
Any Idea?
|
|
|
|
|
You might get a better response if you post this in the RegEx forum.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
TheGermoz wrote: But It fails in understanding the \" character That is because the string in memory does not contain the backslash characters. These are used as escape characters to tell the compiler to allow the embedded double quote (or whatever character follows the backslash). So your final string in memory actually contains only the following characters:
dog().Cat("Happy")
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
To add to what Richard says about the backslash: if you are trying to insert a double quote into the regex, then you have to be aware that it is a special character in C# as well, so it requires an escape character in the C# code: either \" or "" depending on whether you are prefixing the string with an '@' or not:
string s = "text\"Hello\"more text";
string t = @"text""Hello""more text"; Both produce the same string:
text"Hello"more text
From there, you can use the number of Matches as the brackets count, but you should replace the '+' in your regex with a '*' if you want two matches from your sample string. '+' is "one or more", '*' is "zero or more" and since there are no characters between the brackets of "dog()" it would not match your expression.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
How do I expose the LoadCompleted method in the WebBrowser class in WPF C#?
I am trying to write a C# program in wpf that retrieves the content of a web page.
The first thing I tried was to try the WebRequest and WebResponse classes. This did not provide the actual displayed content. WebResponse reveils the HTML code that is sent to the browser. But I discovered that, while the page is being loaded by the browser, javascript can change what content is finally displayed in the browser.
So I decided to use the WebBrowser class.
Immediately I found that there are two WebBrowser classes. Thee is the one that is documented for WinForms and there is another that is documented for WPF. I need to understand the one documented for WPF. What I think I neeed to know what to do is to retrieve code after the "LoadCompleted" method is caused. But I do not know how to this and I cannot find any example demonstrating how this is done.
|
|
|
|
|
|
Take a look at the DocumentCompleted [^] event, I have used this in a normal C# program to good effect.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi
I'm doing a RSA project in which I have encrypt and decrypt functions that get a BigInteger value when called and return encrypetd or decrypted BigInteger value. I get the number to encrypt or decrypt from the user (from textbox) and send it to the proper function. This work good when the user entered numeric values in the text box but now I try to make it work for any string that the user gives (numbers, letters and special chars) so I need to convert the input string to a unique BigInteger value so I can decrypt and encrypt it properly. I tried to use UTF8 encoding and Ascii Encoding (convert the string to byte array, the byte array to biginteger and send the biginteger to the proper function). both didn't work well because I couldn't decrypt a message after encrypting it using the methods above and after I converted the bigniteger value back to string it just showed me alot of strange characters ("?" and sqaures). So how can I make it work and what's the best method to convert a string to an unique BigInteger?
(
My program works well when the input is "259327521" for example (I can encrypt and decrypt such inputs), however this doesn't work when the input has letters or special chars "hello this is secret message!" so what I tried to do is to convert this kind of string to the BigInteger (using UTF8 encoding and Ascii encoding) but with no success because I couldn't decrypt properly a cipher after encrypting it and also I got weird chars after trying to convert the BigInteger back to the string
)
thanks alot
|
|
|
|
|
Your process has 3 separate steps
1) Encoding/Decoding of string to byte array
2) Conversion of byte array to BigInteger and vice versa
3) Encryption/Decryption of BigInteger
Your will need to know which step or steps are giving an error to solve this problem.
Certainly ASCII encoding won't be suitable unless the input is restricted to characters codes below 128. UTF8 should be ok, but the test is the round trip conversion from string to byte array and back again.
BigInteger conversion from/to a byte array, presumably via the BigInteger(byte[]) constructor and the ToByteArray method, should be ok as well, but again don't assume anything and perform a few tests.
Do the same for the encrypt/decrypt cycle and then you should be in a much better position to move forward towards a solution.
Alan.
|
|
|
|
|
|
Most public key encryption algorithms work by encrypting a symmetric key (i.e. a large number) by the public key method (e.g. RSA), and then using that symmetric key to encrypt the stream. Encrypting the entire stream content is expensive and unnecessary.
|
|
|
|
|
I have a bunch of different structs that implement IMyType . I also have some more advanced structs that are essentially containers for x number of IMyType instances (they are not lists). They need to be iterated so I am implementing IEnumerable<IMyType> . At the moment I have made a custom enumerator that has a params IMyType[] myTypes parameter in the contructor and using this type of code in the IEnumerable structs:
public IEnumerator<IMyType> GetEnumerator()
{
return new MyTypeEnumerator(
new IMyType[] {
new MyType(...),
new MyTypeOther(...) });
}
This works fine but I've been considering getting rid of the MyTypeEnumerator and using this instead:
public IEnumerator<IMyType> GetEnumerator()
{
IEnumerable<IMyType> collection = new IMyType[] {
new MyType(...),
new MyTypeOther(...) };
return collection.GetEnumerator();
}
Obviously both work just fine and are pretty much identical. Which would you prefer?
Edit: Alternatively, I could just use return new MyTypeEnumerator(this); and let the MyTypeEnumerator take care of it. I don't like that idea - ignore
modified 27-Oct-12 10:19am.
|
|
|
|
|
You'd normally only create a custom enumerator if you want to be able to enumerate the (virtual) collection without holding the whole list in memory all at once. So I don't quite understand the purpose of your implementation. If you can define a list form for your object, why not just expose that?
public IList<IMyType> Items {
get {
IList<IMyType> list = new List<IMyType>();
list.Add(new MyType(...));
list.Add(new MyTypeOther(...));
return list;
}
}
public IEnumerator<IMyType> GetEnumerator() { return Items.GetEnumerator(); }
Actually you don't need to implement IEnumerable at all if you do that, you can put the List property on the interface and users can do foreach(IMyType item in myObject.Items) instead of foreach(IMyType item in myObject).
|
|
|
|
|
There is another class that has a method:
public void Send(IEnumerable<IMyType> collection)
{
foreach(IMyType myType in collection)
{
}
}
This is the only place the IEnumerable is used (no need for any sort of list at all), so that leaves the second method as the prefered, essentially what your list is doing but without the list.
|
|
|
|
|
But the point is you are creating the list anyway (well, an array to be precise, but it's pretty much the same thing). However, implementing only IEnumerable and not IList (or exposing a list) implies that the enumeration can be run without the whole thing being in memory all at once.
It would be cleaner to expose the list and to pass that to Send (i.e. instead of calling Send(myObject), call Send(myObject.Items), to my mind.
|
|
|
|
|
I see where you're coming from. Richard's solution below is the best for this particular situation I think as the array doesn't actually need to be in memory all at once. I can simply create the instances as required using yield return directly.
Thanks for your input though, it has helped clarify some of my thinking in regards to iterators and foreach which will be helpful in future, and encouraged me to dig deeper into the whole thing that I previously just took for granted
|
|
|
|
|
Another alternative to consider:
public IEnumerator<IMyType> GetEnumerator()
{
yield return new MyType(...);
yield return new MyTypeOther(...);
...
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Good thinking, much better creating the new IMyType s as needed. 5d
|
|
|
|
|
As was said earlier, there is not much reason to create a custom enumerator these days. The reason for an enumerator is to be able to use the ForEach loop. The Yield statement. Then there is also LINQ, Not sure why you are even bothering with an Enumerator given the alternatives avaialable.
|
|
|
|