How to specify string parameters in C# using webservice - c#

Hello I recently used a weather asmx web service here is the link as well http://www.webservicex.com/globalweather.asmx?op=GetWeather , im wondering though how can I only show off what I need.
this is the result I get:
Berlin-Tegel, Germany (EDDT) 52-34N 013-19E 37M May 03, 2013 - 04:50
PM EDT / 2013.05.03 2050 UTC from the NNE (030 degrees) at 3 MPH (3
KT):0 greater than 7 mile(s):0 51 F (11 C) 33 F (1 C) 50% 30.03 in. Hg
(1017 hPa) Success
My code(one line): Label1.Text = ws.GetWeather("Berlin", "Germany");
as you can see above the webservice provides the weather and other details that I really not interested to show in my page thus im wondering how can I only show the details I need

you are not getting back the result in your question. You are getting back the following:
<?xml version="1.0" encoding="utf-16"?>
<CurrentWeather>
<Location>Berlin-Tegel, Germany (EDDT) 52-34N 013-19E 37M</Location>
<Time>May 03, 2013 - 04:50 PM EDT / 2013.05.03 2050 UTC</Time>
<Wind> from the NNE (030 degrees) at 3 MPH (3 KT):0</Wind>
<Visibility> greater than 7 mile(s):0</Visibility>
<Temperature> 51 F (11 C)</Temperature>
<DewPoint> 33 F (1 C)</DewPoint>
<RelativeHumidity> 50%</RelativeHumidity>
<Pressure> 30.03 in. Hg (1017 hPa)</Pressure>
<Status>Success</Status>
</CurrentWeather>
The individual items in the xml will allow you to display only the things you need

Related

How to get sorted Values from HTML Table in C#?

Hello fellow Programmers.
I now spend a whole Day reading Threads to solve this Problem.
I am Parsing HTML from an automatic generated schedule, the same schedule programm was discussed 6 years ago on this thread: Parsing complex HTML tables
But this java / javascript solutions wont work for me. Also the mentioned Programs arent working anymore, I think they released a new Version of the Software. This is the Example I am trying to Parse: https://www.ostfalia.de/cms/de/b/studium/stundenplaene/download/ss19_b_stdgrp_ai_6.html
I need the Parsed Data in the right sequence because I want to generate an iCalendar file with it, or pass/send the data into an self written schedule App
I am using the HTML Agility Pack and Im already sucessful with parsing what I need but I cant get it in the right order its complete split because the HAP displays by row like any other parser. Im so desperate I was close to just count the emtpy trs to estimate when a new row begins but this doesnt work because the program has sometimes more sometimes less empty lines. Does somebody of you has an idea?
This is my Code to get the infos I need:
WebClient client = new WebClient();
string html = client.DownloadString("https://www.ostfalia.de/cms/de/b/studium/stundenplaene/download/ss19_b_stdgrp_ai_6.html");
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
var erg = doc.DocumentNode.SelectNodes("//td[#class='v']");
for (int i = 0; i < erg.Count; i++)
{
txt_check.Text = (erg[i].InnerText);
list_check.Items.Add(erg[i].InnerText);
}
"class v" is the event and "class t" is the time in this example its just class v
I get:
The output of class='v' looks like:
10:30 - 12:00 UhrAI 6.1 Komponentenbasierte SoftwareentwicklungB. RogallaB 109
13:00 - 14:30 UhrAI WPF-12 CCNA 2 Cisco Routing & SwitchingChr. HollmannA 201
13:00 - 14:30 UhrAI WPF Inst. u. Betrieb einer Datenb. a. B. OracleD. HeringA
14:45 - 16:15 UhrAI WPF Mathematik III für InformatikerT. WaldeerB 27 114
14:45 - 16:15 UhrAI WPF-18 AutomatisierungstechnikF. DziembowskiA 107
The output of class='t' looks like:
"Di, 05.03.2019"
"Mi, 06.03.2019"
"Do, 07.03.2019"
"Fr, 08.03.2019"
"Sa, 09.03.2019"
I hope someone has an idea how I can Sort and Match the informations in an Dictionary or List to get it in an ICS.
The Output should be like:
"MI, 06.03.2019 , 8:45 - 10:15 ,AI 6.1 Komponentenbasierte Softwareentwicklung B. Rogalla B109 , 10:30 - 12:00 AI 6.1 Komponentenbasierte Softwareentwicklung B. Rogalla B109"
...
So I can bring it in the ICS Format or DATE/TIME for an Calendar App or something.
Pastbin for the whole HTML:
https://pastebin.com/hHbJTujN
Some Pictures of the Output:
https://drive.google.com/open?id=16Y_hISdVEvzlrS6LCmBMcwAarGhz__t0

Xamarin.IOS exception while running ibtool: object cannot be nil (key: family)

I'm getting a weird error while trying to build my solution:
Exception while running ibtool: *** setObjectForKey: object cannot be nil (key: family)
I've googled it but there is no answers to this problem, just questions... Maybe worth mentioning is that I use Visual Studio Community 2015, I got the latest Xcode installed on my Mac and I have a updated iPhone 5s connected to the Mac. The OS on my Mac is El Capitan (10.11.4).
I think this problem mainly comes from my storyboard, at first I got this error when i tried to create a segue for a button between two views. I removed it and it worked as usual, now I got the same error later on in this project and it's not thanks to the segue.
If I exclude my storyboard, I can build the solution without any trouble, but I can't run the app on my iPhone since the storyboard is missing.
Anyone got a clue what the problem might be? Here are the error logs if necessary:
Severity Code Description Project File Line Source Suppression State
Error Exception while running ibtool: *** setObjectForKey: object cannot be nil (key: family)
Backtrace:
0 __exceptionPreprocess (in CoreFoundation)
1 objc_exception_throw (in libobjc.A.dylib)
2 -[__NSDictionaryM setObject:forKey:] (in CoreFoundation)
3 0x00000001181c6b41 (in IDEInterfaceBuilderCocoaTouchIntegration)
4 0x000000011814ee00 (in IDEInterfaceBuilderCocoaTouchIntegration)
5 0x000000011814d775 (in IDEInterfaceBuilderCocoaTouchIntegration)
6 0x000000011815f133 (in IDEInterfaceBuilderCocoaTouchIntegration)
7 0x000000011815eeac (in IDEInterfaceBuilderCocoaTouchIntegration)
8 0x000000011815ec66 (in IDEInterfaceBuilderCocoaTouchIntegration)
9 0x000000011815d934 (in IDEInterfaceBuilderCocoaTouchIntegration)
10 0x00000001181cb205 (in IDEInterfaceBuilderCocoaTouchIntegration)
11 0x00000001181ccce7 (in IDEInterfaceBuilderCocoaTouchIntegration)
12 -[IBDocumentCompiler invokeWhileUsingSourceAsIntermediateDocument:] (in IDEInterfaceBuilderKit)
13 -[IBDocumentCompiler invokeWithIntermediateDocumentOfTargetRuntime:alwaysCopy:block:] (in IDEInterfaceBuilderKit)
14 0x00000001181cc40a (in IDEInterfaceBuilderCocoaTouchIntegration)
15 0x00000001181b8b4d (in IDEInterfaceBuilderCocoaTouchIntegration)
16 -[IBStoryboardSceneCompilationGroup compilationResultsForCompilationUnits:options:returningErrors:] (in IDEInterfaceBuilderKit)
17 -[IBStoryboardDocumentCompiler compileUnitsFromCompilationGroups:filter:options:errors:] (in IDEInterfaceBuilderKit)
18 __78-[IBStoryboardDocumentCompiler compileContentsOfStoryboardWithOptions:errors:]_block_invoke (in IDEInterfaceBuilderKit)
19 IBWithAutoInvalidationPool (in IDEInterfaceBuilderKit)
20 -[IBStoryboardDocumentCompiler compileContentsOfStoryboardWithOptions:errors:] (in IDEInterfaceBuilderKit)
21 -[IBStoryboardDocumentCompiler internalCompileWithOptions:error:] (in IDEInterfaceBuilderKit)
22 0x00000001181b8f5e (in IDEInterfaceBuilderCocoaTouchIntegration)
23 __57-[IBStoryboardDocumentCompiler compileWithOptions:error:]_block_invoke (in IDEInterfaceBuilderKit)
24 -[IBDocumentCompiler invokeWithIntermediateDocument:] (in IDEInterfaceBuilderKit)
25 -[IBDocumentCompiler invokeWithIntermediateDocumentOfTargetRuntime:alwaysCopy:block:] (in IDEInterfaceBuilderKit)
26 -[IBStoryboardDocumentCompiler compileWithOptions:error:] (in IDEInterfaceBuilderKit)
27 +[IBDocumentCompiler compileContentsOfDocument:options:error:] (in IDEInterfaceBuilderKit)
28 __47-[IBDocument compiledPackageWithOptions:error:]_block_invoke (in IDEInterfaceBuilderKit)
29 -[IBDocumentAutolayoutManager ignoreAutolayoutStatusInvalidationDuring:] (in IDEInterfaceBuilderKit)
30 -[IBDocument compiledPackageWithOptions:error:] (in IDEInterfaceBuilderKit)
31 -[IBDocument compileAndWriteToPath:withOptions:error:] (in IDEInterfaceBuilderKit)
32 0x000000010ceb52da (in ibtoold)
33 0x000000010ceb10e7 (in ibtoold)
34 0x000000010ceb36ab (in ibtoold)
35 0x000000010ceb75c8 (in ibtoold)
36 0x000000010ceb7c5a (in ibtoold)
37 0x000000010ceb7b2d (in ibtoold)
38 0x000000010cea695b (in ibtoold)
39 0x000000010ceb71c3 (in ibtoold)
40 0x000000010ceb6274 (in ibtoold)
41 start (in libdyld.dylib) FridgeMe.iOS Build
Edit: I removed my second view controller and created a whole new one, this seems to have fixed the problem. Still not sure what was causing the problem, but if anyone knows I would really like to know if this happens agian.
Edit 2: The error came back as soon as I added a button on the other (new) view controller. It also refers to a run time error regarding the button not having a code behind (which I thought was created when you added the button on the storyboard). See the image.
Seems like the code for the button isn't generated properly.
I'm hoping this could be some help for other people who run into this issue. I'm still a bit stuck since I tried to manually copy everything regarding a button (changing it's name of course) from my working view controller to the new one, but I don't seem to get it to work.
I have added following to my ViewControllerCreate.designer.cs:
UIKit.UIButton BtnCreateAccount { get; set; }
void ReleaseDesignerOutlets()
{
if (BtnCreateAccount != null)
{
BtnCreateAccount.Dispose();
BtnCreateAccount = null;
}
}
Any ideas?
i got the same error.
After analyzing the code main.storyboard, I discovered that, in my case, the error jump if a button or other control has something like:
<fontDescription key="fontDescription" name="HelveticaNeue" pointSize="17" />
The family font is the problem, try change to
<fontDescription key="fontDescription" type="system" pointSize="17" /> or just delete de line.
Regards,
Marcelo
I am not sure the following code may be helpful for you.
internal class CustomUIView : UIView
{
internal CustomUIView(IntPtr value) :base(value)
{
}
}
Example:
UIView view = new CustomUIView(IntPtr.Zero);
Refer for more information here

Sphinx + xmlpipes2 + Mysql Connector. Problems with cyrillic

I have a problem configuring sphinx+mysql on my machine (Windows 7).
I use sphinx 2.0.6 and MySQL connector 6.5.5 to get to sphinx from C# code. Everything works fine when I try to search a words in English ("madrid" for ex.). But when I send a query from C# code which contains a cyrillic word (that had to be indexed) I receive no results. Here is what I see in the "query.log" file:
[Tue Mar 26 16:35:12.642 2013] 0.000 sec [ext2/0/ext 0 (0,10)] [airportIndex] ????
Latin words looks normal:
[Tue Mar 26 16:35:06.195 2013] 0.000 sec [ext2/0/ext 0 (0,10)] [airportIndex] *mosc*
The charset_table seems to be correct in config:
charset_type = utf-8
charset_table = 0..9, A..Z->a..z, _, a..z, \
U+410..U+42F->U+430..U+44F, U+430..U+44F, U+0401->U+0435, U+0451->U+0435
I just don't know what to do. I've googled for solution the whole day I tried many different solutions, but none of them helped me. Maybe anyone could help me here? Please...
Found it. It was a connector bug (or feature, I'm not sure). It was trying to get the server datetime offset, and failed because sphinx does not have this function. I've just commented this code line (inside MySql.Data.dll) and it started working correctly.

I need to write a dataset as XML data

I need to generate the following xml output from the following dataset. I have attached the dataset and the xml output sample. I am going to put the C# code in a SSIS script task. Can you guys help me to write to code in C#. I am a database guy but i really don't know how this XML works with dataset. I'd really appricate if you can help. Thanks In advance.
AGENTID STARTDAY STARTMONTH STARTYEAR STARTHOUR STARTMINUTE ENDHOUR ENDMINUTE EXCEPTION
910180 5 5 2011 10 30 11 0 OPEN
910180 5 5 2011 11 0 11 30 OPEN
910180 5 5 2011 11 30 12 0 OPEN
910180 6 5 2011 17 30 18 0 OPEN
910180 7 5 2011 18 0 18 30 OPEN
911568 6 5 2011 16 30 17 0 OPEN
911568 6 5 2011 19 0 19 30 OPEN
911568 6 5 2011 19 30 20 0 OPEN
911568 6 5 2011 20 0 20 30 OPEN
911568 6 5 2011 20 30 21 0 OPEN
911568 6 5 2011 21 0 21 30 OPEN
911568 6 5 2011 22 0 22 30 OPEN
911568 7 5 2011 10 30 11 0 OPEN
911568 7 5 2011 11 0 11 30 OPEN
<?xml version="1.0" encoding="ISO-8859-1" ?>
<agentScheduleList>
<agent>
<id>470185</id>
<schedule>
<day>12</day>
<month>8</month>
<year>2002</year>
<exception>
<startdate>
<day>12</day>
<month>8</month>
<year>2002</year>
</startdate>
<starttime>
<hour>22</hour>
<min>0</min>
</starttime>
<endtime>
<hour>2</hour>
<min>0</min>
</endtime>
<code>Open</code>
</exception>
<exception>
<startdate>
<day>13</day>
<month>8</month>
<year>2002</year>
</startdate>
<starttime>
<hour>2</hour>
<min>0</min>
</starttime>
<endtime>
<hour>3</hour>
<min>0</min>
</endtime>
<code>Lunch</code>
</exception>
<exception>
<startdate>
<day>13</day>
<month>8</month>
<year>2002</year>
</startdate>
<starttime>
<hour>3</hour>
<min>0</min>
</starttime>
<endtime>
<hour>7</hour>
<min>0</min>
</endtime>
<code>Open</code>
</exception>
</schedule>
</agent>
<agent>
<id>470185</id>
<schedule>
<day>13</day>
<month>8</month>
<year>2002</year>
<offexception/>
</schedule>
</agent>
</agentScheduleList>
The DataSet class has a WriteXml function to write your data to a file, or GetXml to return it as a string. The documentation on MSDN has further explanation of customizing the output to get it to match exactly what you need, if your XML structure differs from your database structure.
I think you can just use:
string xml = yourDataSet.GetXml();
You can read it back into a DataSet using the DataSet method ReadXml.
You can also use the following to get an XmlDataDocument:
System.Xml.XmlDataDocument xmlDoc = new System.Xml.XmlDataDocument(yourDataSet);

Ingenico 6550 won't display signature box

I'd call Ingenico's tech support, but I don't have a month to wait for their callback.
Our app uses the 6550 and it displays all the forms just fine except, on one machine it's not showing the signature box on the signature capture form. It shows the buttons and text just fine.
I've tried using our app, I've tried the Ingenico test app. Everything seems to check out fine. The only thing I get in th log is this:
2/17/2011 8:43:33 AM (31813 ms) EC0000 Device name [Ing6XXX] - UPOS-Interface-App error code=0xFD
It's followed by these lines after I dismiss the form:
2/17/2011 8:43:33 AM (31860 ms) EC0000 Device name [Ing6XXX] - Last platform error code from device=0x2, desc=SingleButtonEntry: ssaSecFuncKe
2/17/2011 8:43:33 AM (31860 ms) EC0111 Device name [Ing6XXX] - SIG - Direct IO - Command 12 - Invalid command, or function code missing. Length 5 [Package {00 05 95 FD 6D}] [Translation {iDataLength 0}{ucFunctionCode 95}{ucResponseCode FD}{ucResultCode 6D}{sData }]
2/17/2011 8:43:33 AM (31860 ms) EC0111 Device name [Ing6XXX] - SO APP - Direct IO - Command 12 - Invalid command, or function code missing. Length 5 [Package {00 05 95 FD 6D}] [Translation {iDataLength 0}{ucFunctionCode 95}{ucResponseCode FD}{ucResultCode 6D}{sData }]
I'm not sure if that's related. Does anyone have experience with these things. Any idea what might cause the failure to display the signature box?
The problem turned out to be a missing registry setting for the form location. Not sure how we missed that.

Categories