Solution:
Use CultureInfo.CurrentUICulture
User can change the system language of Windows Phone at:
Settings > language+region > Phone language
How can I get the selected language (Phone language) from C# code?
Below is my phone settings:
Here is my code snippet:
System.Diagnostics.Debug.WriteLine(
"************************************* CultureInfo.CurrentCulture.Name = " + CultureInfo.CurrentCulture.ToString() + ", " +
"CultureInfo.CurrentCulture.CompareInfo = " + CultureInfo.CurrentCulture.CompareInfo + ", " +
"CultureInfo.CurrentCulture.DisplayName = " + CultureInfo.CurrentCulture.DisplayName + ", " +
"CultureInfo.CurrentCulture.EnglishName = " + CultureInfo.CurrentCulture.EnglishName + ", " +
"CultureInfo.CurrentCulture.Name = " + CultureInfo.CurrentCulture.Name + ", " +
"CultureInfo.CurrentCulture.NativeName = " + CultureInfo.CurrentCulture.NativeName + ", " +
"CultureInfo.CurrentCulture.TextInfo = " + CultureInfo.CurrentCulture.TextInfo
);
Here is the output:
CultureInfo.CurrentCulture.Name = zh-HK,
CultureInfo.CurrentCulture.CompareInfo = CompareInfo - zh-HK,
CultureInfo.CurrentCulture.DisplayName = Chinese (Traditional, Hong
Kong SAR), CultureInfo.CurrentCulture.EnglishName = Chinese
(Traditional, Hong Kong SAR), CultureInfo.CurrentCulture.Name = zh-HK,
CultureInfo.CurrentCulture.NativeName = 中文(香港特別行政區),
CultureInfo.CurrentCulture.TextInfo = TextInfo - zh-HK
I cannot find the 'Phone Language'
Use System.Threading.Thread.CurrentThread.CurrentCulture. It should correctly reflect the phone language.
you can check my answer, this will help you to change the language at runtime:
https://stackoverflow.com/a/17131401/2467917
Related
I just started using C# and I a have a textbox on a form. I want to display only numbers from ACCESS database, Like string stored in database is 12Kg but when I do update i should return only value i.e.12, I have searched but not getting any idea, I hope you can help me...
Query:
"Update Para Set PartNumber = '"+ txtPartNoL.Text + "', MacID = '" + cmb.SelectedValue.ToString() + "'"+" Para1 = '" + txtPara1L.Text + "', PType1 = '" + lblLPara1.Text + "'," + " val(LabourPara.Para4) = '" + txtPara4L.Text + "', PType4 = '" + lblLPara4.Text + "'," + " Qty = '" + txtQtyL.Text + "', PF = '" + txtPFL.Text + "', SF = '" + txtSFL.Text + "'," + " Amount = '" + txtAmt.Text + "'" + " WHERE QoNumber = '" + txtNo.Text + "' AND PartNumber = '" + txtPartNo.Text + "'";
You are updating everything as text, which can't be true for at least quantity and amount, so try:
sql = "Update Para Set PartNumber = '"+ txtPartNoL.Text + "', MacID = '" + cmb.SelectedValue.ToString() + "' " +
"Para1 = '" + txtPara1L.Text + "', PType1 = '" + lblLPara1.Text + "', " +
"LabourPara.Para4 = " + Val(txtPara4L.Text) + ", PType4 = '" + lblLPara4.Text + "', " +
"Qty = " + txtQtyL.Text + ", PF = '" + txtPFL.Text + "', SF = '" + txtSFL.Text + "', " +
"Amount = " + txtAmt.Text + " " +
"WHERE QoNumber = " + txtNo.Text + " AND PartNumber = '" + txtPartNo.Text + "'";
However, avoid this concatenating mess and - asap - go and learn how to use parameters.
I'm not familiar with XML and trying to get a bit network automation going. I get some XML responses like the following, and try to convert it to a hash or something to easily work with it. I have no idea if I'm doing something wrong. I get the output shown below.
Anyone can push me into a direction ? I tried the nokogiri documentation and guides, but I'm kinda lost.
My Data:
"show ip int brief vrf all | xml\r\n" +
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
"<nf:rpc-reply xmlns:nf=\"urn:ietf:params:xml:ns:netconf:base:1.0\" xmlns=\"http://www.cisco.com/nxos:1.0:ip\">\n" +
" <nf:data>\n" +
" <show>\n" +
" <ip>\n" +
" <interface>\n" +
" <__XML__BLK_Cmd_ip_show_interface_command_brief>\n" +
" <__XML__OPT_Cmd_ip_show_interface_command_operational>\n" +
" <__XML__OPT_Cmd_ip_show_interface_command_vrf>\n" +
" <__XML__OPT_Cmd_ip_show_interface_command___readonly__>\n" +
" <__readonly__>\n" +
" <TABLE_vrf>\n" +
" <ROW_vrf>\n" +
" <vrf-name-out>management</vrf-name-out>\n" +
" </ROW_vrf>\n" +
" </TABLE_vrf>\n" +
" <TABLE_intf>\n" +
" <ROW_intf>\n" +
" <intf-name>mgmt0</intf-name>\n" +
" <prefix>10.70.237.15</prefix>\n" +
" <ip-disabled>FALSE</ip-disabled>\n" +
" <iod>316</iod>\n" +
" <proto-state>up</proto-state>\n" +
" <link-state>up</link-state>\n" +
" <admin-state>up</admin-state>\n" +
" </ROW_intf>\n" +
" </TABLE_intf>\n" +
" </__readonly__>\n" +
" </__XML__OPT_Cmd_ip_show_interface_command___readonly__>\n" +
" </__XML__OPT_Cmd_ip_show_interface_command_vrf>\n" +
" </__XML__OPT_Cmd_ip_show_interface_command_operational>\n" +
" </__XML__BLK_Cmd_ip_show_interface_command_brief>\n" +
" </interface>\n" +
" </ip>\n" +
" </show>\n" +
" </nf:data>\n" +
"</nf:rpc-reply>\n" +
2.4.1 :363 > doc = Nokogiri::XML(my_data)
=> #<Nokogiri::XML::Document:0x173dda8 name="document">
2.4.1 :364 > doc.elements
=> []
Get rid of anything before <?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> XML declaration - in you case, omit "show ip int brief vrf all | xml\r\n" line.
Once your document is parsed, follow official tutorial on searching - for a beginner IMHO it's best to avoid Xpath and just stick with .css selectors, which will be easy to grasp if you've ever done any CSS or Jquery.
I successfully create and execute a flexiblesearch query with a WHERE clause comparing a custom property, added to CartModel, with a enum value.
But I don't know how to "translate" it to try on HAC (just to try and fix it before coding inside a class).
In my class I've the working code:
String MY_QUERY = "SELECT {" + CartModel.PK + "} FROM {" + CartModel._TYPECODE + "} "
+ "WHERE " + "( {" + CartModel.RESERVATIONORDERSTATUS + "} = ?reservedOnHybris)";
And I set the reservedOnHybris parameter with
searchQuery.addQueryParameter("reservedOnHybris", ReservationOrderStatus.INITIAL_STATUS);
How can I translate this to try it on the FlexibleSearch panel in the HAC?
Thanks in advance.
Ale
This should work:
String MY_QUERY = "SELECT {" + CartModel.PK + "} FROM {" + CartModel._TYPECODE + "} "
+ "WHERE " + "( {" + CartModel.RESERVATIONORDERSTATUS + "} =
({{SELECT {crse.PK} FROM {" + CartReservationStatusEnum._TYPECODE
+ " as crse} WHERE {crse.code} = '" + ?reservedOnHybris + "'}}))"
You should get the PK of your enum, you could do this by using a select query.
Try :
SELECT {PK} FROM {Cart} WHERE {RESERVATIONORDERSTATUS} = "Your status"
Basically things like "CartModel.PK" could be replaced by the String.
var timer = {display:'x', at:'12/23/2016', in : 3000000};
var text = timer.display + " on " + timer.at + ". Time Remaining : " + timer.in;
throws error in IE8 "Expected identifier, string or number"
var text = timer.display + " on " + timer.at + ". Time Remaining : " + timer['in']; works!!!
This works fine in chrome, is .in a keyword and why only IE8 behaving weird?
Isn't in considered as a keyword? You could use:
var timer = {"display":"x", "at":"12/23/2016", "in" : "3000000"};
var text = timer.display + " on " + timer.at + ". Time Remaining : " + timer["in"];
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
My report don´t accept the parameter.
I have created a parameter with "City" name.
In my code i want to full it:
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
crystalReport.SetParameterValue("City", lblCiudad.Text);
viewer.ReportSource = crystalReport;
the problem is that the report doesnt filter with my parameter, show without it.
Solution with formula:
crystalReportViewer.SelectionFormula = "{Clientes.Nombre} = '" + nombreCliente + "' AND {Registros.Host} = '" + host + "' AND {Registros.Servicio} = '" + service + "' AND {Registros.Fecha} <= " + "DateTime(" + fF.Year.ToString() + "," + fF.Month.ToString() + "," + fF.Day.ToString() + ","+fF.Hour.ToString() + "," + fF.Minute.ToString()+","+fF.Second.ToString()+") AND {Registros.Fecha} >= " + " DateTime(" + fI.Year.ToString() + "," + fI.Month.ToString() + "," + fI.Day.ToString() + ","+fI.Hour.ToString() + "," + fI.Minute.ToString()+","+fI.Second.ToString()+")";