|
I cannot really follow your description. What do you want to achieve?
Do you talk about splitting an entry like
<Operation>BSRS*IBN****REPAIR RIGHT SIDE DAMAGE</Operation>
into several fields, with * being the saparator?
But then it is (at least) three field, not two!
|
|
|
|
|
I apologize. Let me try an explain further. I need to split the Operation Element innertext which is being done. The issue is trying to get that text into the datatable row properly. I have modified the function some to add columns as I know what those are going to be. It is the childnode values that change and I need to take Operation childnode and change the loop to add the OpCode and Description strings rather than the Operation childnode innertext.
public static DataTable ConvertXmlNodeListToDataTable(XmlNodeList xnl)
{
DataTable dt = new DataTable();
string strOpCode, strDescription;
dt.Columns.Add("RecordID");
dt.Columns.Add("SWR");
dt.Columns.Add("OpCode");
dt.Columns.Add("Description");
dt.Columns.Add("PartsAmount");
dt.Columns.Add("LaborAmount");
int ColumnsCount = dt.Columns.Count;
for (int i = 0; i < xnl.Count; i++)
{
DataRow dr = dt.NewRow();
for (int j = 0; j < ColumnsCount; j++)
{
if (xnl.Item(i).ChildNodes[j].Name == "Operation")
{
CodesDesc(xnl.Item(i).ChildNodes[j].InnerText, out strOpCode, out strDescription);
dr[j] = strOpCode.ToString();
dr[j+1] = strDescription.ToString();
j++;
}
else
{
dr[j] = xnl.Item(i).ChildNodes[j].InnerText;
}
}
dt.Rows.Add(dr);
}
return dt;
}
Does this help clear things up? I amnot able to insert the text into the datarow properly during the for loop which is where my headaches are coming from..
modified 27-Aug-14 14:44pm.
|
|
|
|
|
|
You can't.
The problem is that the remaining HTML is generated by javascript code at "run-time" of the HTML page, using data retrieved over separate HTTP requests. Unless you're code can execute the javascript itself and figure out what it's outputting, you'll never get this to work.
I don't know of any implementations that can scrape this.
|
|
|
|
|
Thanks all
I have done that
|
|
|
|
|
Hi All,
Can anyone help, I am getting an object reference error in my code. All I am doing is adding two tables to one table, the tables that are being added are Genealogy Table and Relationship Table to Details Table.
The error is below:
An object reference is required for the non-static field, method, or property 'MvcGenealogy.Models.GRHolding.GetDetailID(System.Web.HttpContextBase)'
The error is part of a holding model, the code that is causing the error is below:
public static GRHolding GetDetail(HttpContextBase context)
{
var detail = new GRHolding();
detail.GRHoldingID = GRHolding.GetDetailID(context);
return detail;
}
It references the GetDetailID, the code is below and come from the same Model.GRHolding:
public string GetDetailID(HttpContextBase context)
{
if (context.Session[DetailsSessionKey] == null)
{
if (!string.IsNullOrWhiteSpace(context.User.Identity.Name))
{
context.Session[DetailsSessionKey] = context.User.Identity.Name;
}
else
{
Guid tempDetailsID = Guid.NewGuid();
context.Session[DetailsSessionKey] = tempDetailsID.ToString();
}
}
return context.Session[DetailsSessionKey].ToString();
}
I do have a Session in my Model call DetailsSessionKey which is a string and identifies with the DetailsID. The code that declares this is here:
public const string DetailsSessionKey = "DetailsID";
I think the problem is in my session because the error is with this line of code "detail.GRHoldingID = GRHolding.GetDetailID(context);", which under the GetDetail in my GRHolding.cs model. It is not converting it to a string properly. I think it is something minor in the session, can anyone help? All I am to doing is associating two tables, (Genealogy table and Relationship table), with one table, (Details table).
|
|
|
|
|
Best guess? Check the GetDetail method parameter: I'd start by looking to see if context is null in the debugger.
You looking for sympathy?
You'll find it in the dictionary, between sympathomimetic and sympatric
(Page 1788, if it helps)
|
|
|
|
|
Hi OriginalGriff,
I did check out the GetDetail, that was okay, I changed the GetDetailID to static and now I am getting a another compiler error in the return.
The error is as follows Cannot implicitly convert type 'string' to 'int'".
Now I have the DetailID declared as a string in GRHolding.cs Model, and my in my sql table, Details, DetailID is a int. The code causing the error is as follows:
return context.Session[DetailsSessionKey].ToString();
My declaration value is
public const string DetailsSessionKey = "DetailsID";
Changing the GetDetailID to "static" seems to have solved the original compiler error and created another. It seems to be an error with the conversion of a string to an int on a return value.
Do you have any ideas, it would be appreciated.
Regards
Anthony
|
|
|
|
|
Either your GetDetailID method needs to be static , or the GetDetailID method call needs to be made against an instance of the GRHolding class.
So, either:
public static string GetDetailID(HttpContextBase context)
{
...
}
or:
var detail = new GRHolding();
detail.GRHoldingID = detail.GetDetailID(context);
return detail;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
I Changed the to Static GetDetailID, I am now getting a compiler error.
The error is "Cannot implicitly convert type 'string' to 'int'"
Now I have the DetailID declared as a string in GRHolding.cs Model, and my in my sql table, Details, DetailID is a int. The code causing the error is as follows:
return context.Session[DetailsSessionKey].ToString();
My declaration value is
public const string DetailsSessionKey = "DetailsID";
I thank you very much for the help with original compiler error, that seems to solve compiler error, but now I have another problem with the conversion of a string to an int on a return value.
Do you have any ideas, it would be appreciated.
Regards
Anthony
|
|
|
|
|
Ehm, that's actually beginner's stuff, isn't it?
Look:
detail.GRHoldingID = detail.GetDetailID(context);
assigns the return value of the GRHoldingID function to the GRHoldingID property.
From the code snippet you showed us, we can see that GRHoldingID returns a string.
From the error message, we can conclude that the GRHoldingID property is an integer.
Since we do not have more information about that class and its business rules, we cannot provide a "correct" solution safely.
You might change the GRHoldingID property to a string, or you might try to get an integer value from the string, i.e.
string strID = detail.GetDetailID(context);
int id;
if (int.TryParse(strID, out id))
{
detail.GRHoldingID = id;
}
else
{
}
|
|
|
|
|
Hi. I want to develop an application that recognizes the language. This app will listen to (capture sound from the microphone) the speech, and if it detects a specific language (Armenian), the application will show the message "The Armenian language is found." The app will work with only one language, and only discover it.
How realize it? How to teach this application to detect the language?
|
|
|
|
|
With the state of speech recognition as it stands right now, this is next to impossible. There are too many things that affect the quality of speech recognition that throwing in another uncertainty would not help. Suppose that I was to use the Geordie phrase (it's an English regional dialect) of "Why aaz a ganning hyem". What language would it identify? I still speak English, but in this case, it would determine that I'm speaking Danish which has a similar phrase.
|
|
|
|
|
Impoossible(((
Thank you
|
|
|
|
|
Nothing is impossible. Very hard possibly, but not impossible.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Pete O'Hanlon wrote: "Why aaz a ganning hyem" Thanks for asking, mine's a pint of dog.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
+5 just for getting the drink right.
|
|
|
|
|
Still one of my favourite beers, there's a cold one in the fridge for supper
It goes down very well with Tarka masala - which is like Tikka Masala except it's 'Otter - boom boom!
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 26-Aug-14 10:47am.
|
|
|
|
|
Pete O'Hanlon wrote: I'm speaking Danish which has a similar phrase.
A few more, via Google translate, mostly Norwegian:
English | Geordie | Norwgeian |
---|
Jumper | Ganzie | Gensere | Baby | Bairn | Barn | Stool* | Cracket | Krakk | Flea | Lop | Loppe | Go | Gan | gå | Pig | Gissie | Gris | Cloth | Cloot | Klut | Cow | Coo | Ku | Sparrow | Spuggie | Spurv |
I rmember Melvyn Bragg (in "The Adventure of English"? ) going on about parts of the Cumbrian dialect being mutually intelligible with modern Norwegian.
* as in foot- not -sample, for those unluck enough to be born outside the people's republic.
Alberto Brandolini: The amount of energy necessary to refute bullshit is an order of magnitude bigger than to produce it.
|
|
|
|
|
Eddie Izzard did a program fro Discovery a few years ago called "Mongrel Nation" where he had an intelligible conversation with a Frisian farmer from Nothern Netherlands
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Your best bet would be to start up approx. 250 processes - one for each language and pass the audio input to each one in parallel. After a set time, any that haven't recognised the language should shut down - eventually you will get to your required language.
|
|
|
|
|
Or, he'll get to several possible matches or, none.
|
|
|
|
|
Yes - but these too are valid.
What I'm trying to hint at is that this is a parallelisable problem...
|
|
|
|
|
Given his stated aim that the app will work with only one language, then returning multiple potential positives fails to satisfy the request.
|
|
|
|
|
In that case I guess loading a set of very likely words or phrases and waiting for them should work?
"My voice is my passport, identify me" should work
|
|
|
|