Posts

Featured post

c# - Attribute value in root node of xml Linq to XML -

while parsing xml linq xml, came across strange behaviour (atleast me). below first xml parsed `<?xml version="1.0" encoding="utf-8"?> <testrun> <unittestresult testname = "arun" outcome = "i"> </unittestresult> <unittestresult testname = "arun1" outcome = "i"> </unittestresult> </testrun>` my code looks xdocument doc = xdocument.parse(filecontents); var result = doc.descendants("unittestresult"); the above works fine. if root node contain attributes same code not working. reason. xml sample below <?xml version="1.0" encoding="utf-8"?> <testrun id="7903b4ff-8706-4379-b9e8-567034b70abb" name="inaambika@inbelw013312a 2016-02-26 16:55:14" runuser="stc\inaambika" xmlns="http://microsoft.com/schemas/visualstudio/teamtest/2010"> <unittestresult testname = "arun" outcome = "...

android - Retrieve value from radioButtons in alertDialog -

i want retrive value radio buttons. doing below code. when click ok button of alert dialog app force closed. why is so. not retriving value properly final sharedpreferences settings = getsharedpreferences(prefs_name, mode_private); if (settings.getboolean("isfirstrun", true)) { layoutinflater li = layoutinflater.from(this); view promptsview = li.inflate(r.layout.prompts, null); alertdialog.builder alertdialogbuilder = new alertdialog.builder(this); alertdialogbuilder.setview(promptsview); final edittext userinput = (edittext) promptsview .findviewbyid(r.id.edittextdialoguserinput); final radiogroup radiogroup = (radiogroup) findviewbyid(r.id.radiogroup1); // set dialog message alertdialogbuilder.setcancelable(false).setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog,int which...

ios swift - uiimage array to video disorted and flipped -

Image
i modified of code in time lapse builder class in link https://github.com/justinlevi/imagestovideo take in array of images instead of url. everything seems working fine far taking images , creating video; however, i'm having issues way images being displayed in video. this how images , under how on iphone: i feel issue in fillpixelbufferfromimage method: func fillpixelbufferfromimage(image: uiimage, pixelbuffer: cvpixelbuffer, contentmode:uiviewcontentmode){ cvpixelbufferlockbaseaddress(pixelbuffer, 0) let data = cvpixelbuffergetbaseaddress(pixelbuffer) let rgbcolorspace = cgcolorspacecreatedevicergb() let context = cgbitmapcontextcreate(data, int(self.outputsize.width), int(self.outputsize.height), 8, cvpixelbuffergetbytesperrow(pixelbuffer), rgbcolorspace, cgimagealphainfo.premultipliedfirst.rawvalue) cgcontextclearrect(context, cgrectmake(0, 0, cgfloat(self.outputsize.width), cgfloat(self.outputsize.height))) let horizontalratio = c...

html - How to set background image using picture tag and src set -

how set image background div.so div should take height of image.this functionality need implemented using picture tag , srcset attribute in html.and if text overlays on image image should remain in same height div height should grow text. below code tried div height not increasing <style> .image { position: relative; width: 100%; /* ie 6 */ } .info{ position: absolute; top: 200px; left: 0; width: 100%; color: yellow; } </style> <script src="picturefill.min.js"></script> <div class="image"> <picture> <source srcset="new-york-city-wallpapers-desk.jpeg" media="(min-width: 1240px)"> <source srcset="new-york-city-wallpapers-tab.jpeg" media="(min-width: 940px)"> <source srcset="new-york-city-wallpapers-mob.jpeg" media="(min-width: 724px)"> <img srcset="" src="new-yor...

multithreading - What is thread local storage? Why we need it? -

i reading threads in os concepts , come across "thread local storage (tls)". understood tls similar static or global data, more unique individual thread. bit confusing on unique here? why can't pass data through runner (i.e., thread's actual codes) functions params function? let's supposed working in ada. in ada program define task (thread) includes [static] variable can accessed task. create multiple instances of task. need copy of [static] variable each task. that's implementation use thread local storage. in other words, static area of memory gets copied each thread in program. as alternative tls, thread allocate such storage @ top of stack.

xml - Xpath with xmlns -

although there tons of question on xpath , xmlns, not able achieve desired result. my xml :- <project xmlns = "https://afdsl/skdflsk/d"><name>amcr_positions</name><property name="included" type="hidden">true</property><locales><locale>en</locale><locale>de</locale></locales> <defaultlocale>en</defaultlocale> <namespace><name locale="en">amcr_positions</name> <name locale="de">amcr_positions</name> <lastchanged>2015-04-06t17:37:40</lastchanged> <lastchangedby>i575079</lastchangedby> <property name="included" type="hidden">true</property> <namespace> <name locale="en">database layer</name> <querysubject status="valid"> <name local...

scala, transform a callback pattern to a functional style internal iterator -

suppose api given , cannot change it: object providerapi { trait receiver[t] { def receive(entry: t) def close() } def run(r: receiver[int]) { new thread() { override def run() { (0 9).foreach { => r.receive(i) thread.sleep(100) } r.close() } }.start() } } in example, providerapi.run takes receiver , calls receive(i) 10 times , closes. typically, providerapi.run call receive(i) based on collection infinite. this api intended used in imperative style, external iterator. if our application needs filter, map , print input, need implement receiver mixes these operations: object main extends app { class myreceiver extends providerapi.receiver[int] { def receive(entry: int) { if (entry % 2 == 0) { println("entry#" + entry) } } def close() {} } providerapi.run(new myreceiver()) } now, question how use providerapi in functional style, internal ...