when i try run this:
User_Person = input("What is your name? ")
print("Hello " + User_Person + " i am 2xx-350")
User_Age = int(input("How old are you?"))
Robot_Age = 187
I_am_years_older = Robot_Age - User_Age
if User_Age == Robot_Age:
print("I am " + Robot_Age + " years old too")
else:
print("I am " + 187 + " years old")
print("That means i am " + I_am_years_older + "
years older than you.")
I am a beginner so I may just be missing something obvious
Pls point out any solutions
Related
I'm using a native query to get a specific resulset since there's a conflict when using LIMIT in JPA. When I call the method via spring-boot I get 1 row but when I execute the SQL command directly I get 5 rows. I think this is a JPA native query issue it's always returning 1 row.
#Query(value = "SELECT\n" +
" DISTINCT pt1.******\n" +
" FROM\n" +
" ***** ptvt1 \n" +
" INNER JOIN\n" +
" **** pt1 \n" +
" ON ptvt1.****** = pt1.id \n" +
" WHERE\n" +
" pt1.id IN (\n" +
" SELECT\n" +
" ptvt2.****** \n" +
" FROM\n" +
" ***** ptvt2 \n" +
" INNER JOIN\n" +
" ***** pt2 \n" +
" ON ptvt2.****** = pt2.id \n" +
" WHERE\n" +
" ptvt2.******** = ptvt1.******** \n" +
" ORDER BY\n" +
" pt2.executiondate DESC LIMIT 1 \n" +
" ) \n" +
" AND NOT EXISTS (\n" +
" SELECT\n" +
" ptvt3.* \n" +
" FROM\n" +
" ***** ptvt3 \n" +
" INNER JOIN\n" +
" ***** pt3 \n" +
" ON ptvt3.****** = pt3.id \n" +
" WHERE\n" +
" ptvt3.******** = ptvt1.******** \n" +
" AND (\n" +
" pt3.status = 'OK' \n" +
" OR pt3.status = 'CREATED' \n" +
" OR pt3.status = 'PENDING' \n" +
" OR pt3.status = 'VOID' \n" +
" ) \n" +
" )", nativeQuery = true)
List<String> find*****();
I am using Spring Boot and PostgreSQL to create a table in which I want to insert the latest data from another table.
I was using H2 and everything was fine but when I migrated to PostgreSQL, the error "SELECT ... FROM must be followed by a reference to the table appeared e.g. SELECT * FROM table as FOO" .
However, when modifying my query with AS, I am still having the same error.
"CREATE TABLE IF NOT EXISTS EOD AS " +
"(SELECT ID, " +
"CUSIP, " +
"NAME, " +
"ISIN, " +
"NAV, " +
"RIC, " +
"RTV," +
"VOLATILITY as volatility, " +
"CURRENCY as currency, "+
"ASK_ISSUER as ask_issuer, " +
"ASK_KECH as ask_kech, " +
"AVERAGE_SCORE as average_score, " +
"BID_ISSUER as bid_issuer, " +
"BID_KECH as bid_kech, " +
"BID_ONLY as bid_only, " +
"CREATOR as creator, " +
"DECENTER as decenter, " +
"DENOMINATION as denomination, " +
"FORCE_PUBLISH as force_publish, " +
"ISSUER_SPREAD as issuer_spread, " +
"KECH_MARGIN as kech_margin, " +
"KECH_SPREAD as kech_spread, " +
"DISTANCE_TO_BANDS_SCORE as distance_to_bands_score, " +
"DIFFERENCE_TO_LEXIFI_PRICE_SCORE as difference_to_lexifi_price_score, " +
"METRIC_C as metric_c, " +
"PRICE_EXPRESSION as price_expression, " +
"PRODUCT_TYPE as product_type, " +
"PUBLISHED as published, " +
"PUBLISHING as publishing, " +
"TIMESTAMP as timestamp " +
"FROM " +
"(" +
"SELECT * FROM RTDATABASE AS T " +
"JOIN (SELECT MAX(CONVERT(TIMESTAMP, DATETIME)) AS LATESTDATE FROM T GROUP BY ISIN)" +
") tm " +
"WHERE CONVERT(tm.TIMESTAMP, DATETIME) = tm.LATESTDATE) AS LATESTDATA;";
Any idea how to solve this issue?
Many thanks in advance !
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'm trying to fix a bug in a third party application (vagrant). I have 2 variables and for some reason they are not equal. I've checked and they are both strings and both have the same value. What can be the reason?
Debug string:
"'" + Vagrant::VERSION + "', '" + windows_version + "', " + Vagrant::VERSION.class.name + ", " + windows_version.class.name + ", " + (windows_version == Vagrant::VERSION ? "true" : "false")
Output:
'1.9.6', '1.9.6', String, String, false
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