Posts

python 2.7 - How to use StreamXmlRecordReader to parse single & multiline xml records within a single file -

i have input file (txt) below <a><b><c>val1</c></b></a>||<a><b><c>val2</c></b></a>||<a><b> <c>val3</c></b></a>||<a></b><c>val4-c-1</c><c>val4-c-2</c></b><d>val-d-1</d></a> if observe input carefully, xml data record after third '||' split across 2 lines. i want use streamxmlrecordreader of hadoop streaming parse file -inputreader "org.apache.hadoop.streaming.streamxmlrecordreader,begin=<a>,end=</a>,slowmatch=true which unable parse 3rd record. i getting below error traceback (most recent call last): file "/home/rsome/test/code/m1.py", line 13, in <module> root = et.fromstring(xml_str.getvalue()) file "/usr/lib64/python2.6/xml/etree/elementtree.py", line 964, in xml return parser.close() file "/usr/lib64/python2.6/xml/etree/elementtree...

java - How to display AlertDialog on List Adapter -

contactsdatalist array list contains data of contacts. i have written following code pass data list adapter adapter= new contactsadapter(getapplicationcontext(), contactsdatalist); listview = (listview) findviewbyid(r.id.lv_contacts); listview.setadapter(adapter); on list view, want launch call_action event, whenever user clicks on item in list. i have written following code in adapter, giving me error message java.lang.illegalstateexception: need use theme.appcompat theme (or descendant) activity. contactsheading.setonclicklistener(new view.onclicklistener() { @override public void onclick(final view v) { alertdialog alertdialog = new alertdialog.builder(context).create(); alertdialog.settitle("alert"); alertdialog.setmessage("are sure want call "+contactsheading + "?" ); alertdialog.setbutton(alertdialog.button_positive, "ok", new dialoginterface.onclicklistener()...

preg replace - Remove div and contents of given class in PHP -

i using javascript package called medium editor allows replicate medium.com's text editor. to adds button content editable div class. button has + symbol , acts button adding images etc. the issue when posting content of div posting div , contents. i wish div class , remove before run through html purifier. this example of html wish remove string: <div class="medium-insert-buttons" contenteditable="false" style="dislollay: none">\r\n <a class="medium-insert-buttons-show">+</a>\r\n <ul class="medium-insert-buttons-addons" style="dislollay: none">\r\n <li><a data-addon="images" data-action="add" class="medium-insert-action"><slolan class="fa fa-camera"></slolan></a></li>\r\n <li><a data-addon="embeds" data-action="add" class="medium-insert-action"><slol...

amazon web services - Specifying resource group name when creating resource group in aws cli -

i'm trying figure out how specify resource group name when creating resource groups via aws cli, when @ cli documentation create-resource-group command see option specify tags, how specify name? , noticed when access console don't see resource groups created using cli. ideas?

Azure VM IIS unreachable from public IP / cloudapp.net domain -

Image
i setup windows server vm on azure space, reason iis configured on isn't available publicly... i can open iis welcome page trough localhost on server, no trough visiting external ip or cloudapp.net domain. something note can reach server trough mstsc external ip adress... i tried: shutting off windows firewall opened endpoints on non-classic management azure system i binded ip's cloudapp host checked online azure documentation so resolved it... don't know if it's supposed way, sure in azure "source port" defined * , not 80, or other. that absolutely not work if you're not defining "*". screenshot of azure here

c# - Print files modified in the last 24 hours to the console -

i'm taking c# course, , current assignment create console application transfers new files (modified in last 24 hours) directory "customer orders" directory "home office". at point i'm trying come way figure out files new. see if works, i'm using console.writeline print new files console window. however, print "system.linq.enumerable+wherearrayiterator'1[system.io.fileinfo]". i'm incredibly new language, , i'm worried i'm going wrong way. here code far (after hour of googling , getting ideas stackoverflow): class modifiedfiles { public string your_dir; public ienumerable<fileinfo> modified() { your_dir = @"c:\users\student\desktop\customer orders"; var directory = new directoryinfo(your_dir); datetime from_date = datetime.now.adddays(-1); datetime to_date = datetime.now; var files = directory.getfiles() ...

Why does SQL Server GEOGRAPHY allow longitudes between -15069° and +15069°? Why ±15069°? -

i using microsoft.sqlserver.types dll in projects validating latitudes , longitudes. the library validates longitude values between -15069 , 15069 degrees instead -180 180. can explain significance or reason microsoft checking longitude values between -15069 , 15069 degrees? microsoft has listed standards geo spatial standards on website mentions longitude values must between -15069 , 15069 degrees, inclusive. https://msdn.microsoft.com/en-us/library/ee301753(v=sql.105).aspx your inputs in understanding concept appreciated! why longitude not restricted [-180°..+180°]? here's brief thought experiment. of following 3 lines linestring (-180 0, 180 0) represent? a line going around whole globe along equator in eastward direction. a line going around whole globe along equator in westward direction. a line of length 0, since -180° latitude denotes same meridian +180° latitude. as decide on of 3 possibilities, find have no way of modelling other 2 cases li...