|
John Simmons / outlaw programmer wrote: Silverlight is a completely different animal, and it requires still more special knowledge to get it working with a web service.
Just for the record, both WPF and Silverlight are client-end technologies and are pretty much identical in how they work with web services, aside from some limitations in Silverlight with its smaller .NET runtime...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Silverlight requires "special knowledge" if you're working on a secure site. It took me a couple of weeks to figure how how to put that jigsaw puzzle together...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I was very reluctant to start learning ASP .NET because I regarded coding in HTML as awful and disgusting. But I have switched from WinForms to WPF recently and I found it a right move. Since in WPF you code XML, it was easier for me to create my first ASP page which happened two weeks ago or so.
Greetings - Jacek
|
|
|
|
|
Great. I am not sure if I do need to learn ASP.net or any xml/html coding, since I do not want to do front end website design. I am mostly interested in the middle and backend of web development. Do you think I need to know ASP.net?
|
|
|
|
|
Software2007 wrote: Do you think I need to know ASP.net?
IMHO yes -- to fully understand how it works. But this is a question for proffesionals not me.
Greetings - Jacek
|
|
|
|
|
Hi,
I have a datatable in which i know one value of a column. How to get entire row of that particular data?
Thanks
|
|
|
|
|
|
Hi,
I need to split a large string and split that splitted string again. I have the following string:
root
{
stringB =
{
"key": "value",
"key": "value",
"StringC":
{
"key": "value",
"key": "value",
"key": "value",
"key": "value",
}
"StringD": "value",
"StringE":
{
"key": "value",
}
}
}
The result I actually want is something like this:
string[] AllStrings = StringB,StringC,StringD,StringE
Is there a way to do this? I used Regex.Split option.
Thanks in advance!
|
|
|
|
|
That doesn't look regular enough. And try the Regex forum.
|
|
|
|
|
You could probably do it with String.Split()[^].
The best things in life are not things.
|
|
|
|
|
I believe you are trying to parse a JSON string. If yes then this link might be of some help to you!
|
|
|
|
|
You can parse using JavaScriptSerializer.. This may help to you
string s = "{\"StringC\":"+
"{"+
"\"key1\": \"value\"," +
"\"key2\": \"value\"," +
"\"key3\": \"value\"," +
"\"key4\": \"value\"" +
"},"+
"\"StringD\": \"value\"," +
"\"StringE\":" +
"{"+
"\"key1\": \"value\"" +
"}"+
"}";
JavaScriptSerializer f =new JavaScriptSerializer();
JsonData jsd = f.Deserialize<JsonData>(s);
public class JsonData
{
public Hashtable StringC { get; set; }
public string StringD {get; set;}
public Hashtable StringE { get; set; }
}
|
|
|
|
|
Just so you know, your sample string isn't very consistent. I would think there would have to be a comma after the closing braces.
Beyond that, it seems to me you want to Split on the "{" character, and then the "," character on each of the first split result strings. I would probably write a method that accepted the delimiter character and the string to be split that returned an array of split items.
Regex is not what you want to use - sometimes, you just gotta write the code.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Try
(.*((\"([\d\w]+)\":)|(\s([\d\w]+) =)))*
The group no 4 contains keys like key or stringC and group 6 contins keys like StringB
EDIT: Of course you need to code
string expr = @"(.*((\"([\d\w]+)\":)|(\s([\d\w]+) =)))*";
var m = Regex.Match(expr);
var group4 = m.Groups[4];
var group6 = m.Group[6];
string[] allStrings = group4.Captures.Select(c=>c.Value).Union(group6.Select(c=>c.Value)).ToArray();
captures now contains strings you need
DISCLAIMER:
1. not tested.
2. use named groups if you want to.
Greetings - Jacek
modified on Wednesday, June 15, 2011 3:38 AM
|
|
|
|
|
In Windows 7 if you go to the Control Panel and then to Region and Language and then to the Locaton Tab there is a dropdown of the locations (countries).
How can I get this list via C#/.NET or even a WINAPI call.
I know about GetCultures and the Telephony registry entries and that I could create a table based off the ISO specification.
GetCultures doesn't return all the countries like Cuba.
Telephony Registry entries are phone country codes so the list is not correct for just countries.
Windows must have this list somewhere since they are using it in the Location Tab.
|
|
|
|
|
I'm not sure it will match the Control Panel, however I would suggest you try CultureInfo.GetCultures()
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.4
|
|
|
|
|
Please go abck and read my original post.
I know what GetCultures does and it doesn't return a valid list of countries. It's missing many countries for example Cuba.
|
|
|
|
|
Oops. Seems like I got distracted and missed half of your post. Sorry.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.4
|
|
|
|
|
MrSmoofy wrote: doesn't return all the countries like Cuba
How many were you expecting? I thought there was only one country like Cuba. 
|
|
|
|
|
There is only one Cuba and GetCultures does not include it.
|
|
|
|
|
Windows probably does, but there is an alternative. Haave a look at GeoNames[^] - they has varaious web services which will provide you with such info, even by country code if you need it.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I know there are external webservices available but our application will not have access to them as it runs on a private network with no external internet access.
|
|
|
|
|
MrSmoofy wrote: Windows must have this list somewhere since they are using it in the Location Tab.
That doesn't mean that it has to be publicly available. Do you allow other vendors to re-use every resource in your application?
You can find the list in the registry, under this key;
HKLM\Software\Microsoft\Windows\CurrentVersion\Telephony\Country List "Cuba" is number 52 in there
Bastard Programmer from Hell
|
|
|
|
|
Again read my original post. The Telephony Country List is not correct it lists Telephone codes not just countries.
Look at number 5399 "Guantanamo Bay" is not a country
Look at number 800 "International Freephone Service" is not a country
870, 871, 872, 873, 874 are not countries
Also some countries have more then one Telephone code so they are listed twice based on where the town/city/region is in the country.
|
|
|
|
|
MrSmoofy wrote: Again read my original post. The Telephony Country List is not correct it lists Telephone codes not just countries.
I haven't checked the Telephone-codes, I looked in the registry - and Cuba is available.
MrSmoofy wrote: Look at number 5399 "Guantanamo Bay" is not a country
Open up the regional settings and take a look at the "country" list that you wanted - it is also specifying Guantanamo Bay. It's the list that you requested, and no, there is no official list. Here's[^] why.
You're welcome
Bastard Programmer from Hell
|
|
|
|