Posts

swift2 - swift 2.0 healthkit requestAuthorizationToShareTypes - Type of expression is ambiguous without more context -

after converting swift 1.2 2.0 following error: type of expression ambiguous without more context when request authorisation follow: healthkitstore.requestauthorizationtosharetypes(writetypes: healthkittypestowrite, readtypes: healthkittypestoread,completion: { success, error in if success { print("success") } else { print(error.description) } }) any ideas? i fixed problem, , not sure has error message itself. 1) healthkittypestoread , write: removed [ ] set ( [ ] ) 2) created new completion duple 3) changed call follow bellow example: let healthkittypestoread = set( arrayliteral: hkobjecttype.characteristictypeforidentifier(hkcharacteristictypeidentifierdateofbirth)!, hkobjecttype.characteristictypeforidentifier(hkcharacteristictypeidentifierbiologicalsex)!, hkobjecttype.workouttype() ) let newcompletion: ((bool, nserror?) -> void) = { (success, er...

seo - Schema.org setup for related products? -

i setup schema.org markup related products. i have tried code have doubt in mind: itemprop="isrelatedto" itemscope itemtype="http://schema.org/product" my product page https://www.amigotrekking.com/everest-base-camp-trek.html if it’s "functionally similar" product, use issimilarto property. if it’s "consumable" product, use isconsumablefor property. if it’s "accessory or spare part" product, use isaccessoryorsparepartfor property. if it’s "somehow related" product, use isrelatedto property. so related product, microdata example be: <article itemscope itemtype="http://schema.org/product"> <aside> <article itemprop="isrelatedto" itemscope itemtype="http://schema.org/product"></article> </aside> </article>

javascript - listen loaded event of each resource (all scripts, css, images, etc) -

i working page loaded percentage bar based on every single resource in page loading: mean monitoring every image, or script, css, etc , use "loaded event" increase general page loaded percentage i have readed in posts difficult monitor loaded event of elements, question how using javascript / jquery? strategy can use achieve result? i tried this, not working well function calc(element){ console.log(element.outerhtml); progress++; var loadingstatus = ( progress * 100 / totallength ); console.log(loadingstatus); document.getelementbyid('loadingbar').style.width = loadingstatus+'%'; } document.onreadystatechange = function(){ if(document.readystate == "interactive"){ progress = 0; var styleelements = document.queryselectorall('style'); var linkelements = document.queryselectorall('link'); var scriptelements = document.queryselectorall('script[src]'); var...

javascript - Update data on mysql using ajax -

i'm trying send id of image when user click on using ajax. in update.php file i'd update id of image. i'm new on ajax, i'm not able figure out error. $(document).ready(function(){ $('.show_people_image .love').on('click', function() { var id = $(this).attr('id'); var idpage = "<?php echo $id ?>"; var svar1 = encodeuricomponent(id); var svar2 = encodeuricomponent(idpage); var svar3 = "<?php echo $_session['aaa'] ?>"; var svar4 = "<?php echo $_session['bbb'] ?>"; if (svar1 == svar2) { $.ajax({ type: "post", url: "update.php", data: {lid:svar1, ml:svar3, mem:svar4}, success: function(data) { alert(data); }, error: function () { alert('error'); } }); } }); }); the update.php file is: if (isset($_post['lid']) , ...

sql - Temp Table cannot load content without timing out -

when trying load page times out after time , have no idea how edit query , fix problem. the sql follows: <createtemptable nml-type="string"> declare global temporary table temp_tdt (subject_id_num bigint) on commit preserve rows not logged replace </createtemptable> the dataset not long @ still times out. there has never been problem having no index in past, loaded data no problem, instead of loading data times out first time , goes loading fast. sql written in websphere in xlm file. looking more efficient way. we're missing lot of detail here. either temporary table created every user (every new connection) or every app restart, plus there no indexes on temp table. do timeouts occur on first invocation or after while? best change proper table indexed , if timeouts, analyse queries run against it.

java - Add something after an argument? -

okay writing simple little stringbuilder, curious how add after arguments. example if do: args[0] = "how" args[1] = "do" args[2] = "i" args[3] = "google" how make output this: "how+do+i+google", without plus @ end of last argument? this have far. stringbuilder sb = new stringbuilder(); (int = 0; < args.length; i++){ sb.append(args[i]).append(" "); } string allargs = sb.tostring().trim(); with pre-jdk8 can use guava's joiner : return joiner.on("+").skipnulls().join(args); for jdk8, @chengpohi seems enough, little correction: return string.join("+", args); to extend op code: stringbuilder sb = new stringbuilder(); (int = 0; < args.length; i++){ sb.append(args[i]); if(i != (args.length - 1)) { sb.append('+'); } } string allargs = sb.tostring().trim();

XML Deserialization C#, newline character \n is replaced with \\n -

i trying deserialize simple xml document. <?xml version="1.0" encoding="utf-8"?> <data> <somedata> data1\ndata2\n </somedata> </data> this function. public class datatry { public static string deserialize() { xmlserializer deserializer = new xmlserializer(typeof(data)); textreader reader = new streamreader(@"d:\myfile.xml"); object obj = deserializer.deserialize(reader); data xmldata = (data)obj; reader.close(); return xmldata.somedata; } [serializable, xmlroot("data")] public class data { [xmlelement("somedata")] public string somedata { get; set; } } } the result data1\\ndata2\\n. don't want newline character \n replaced \\n. this behaving expected. your string data1\ndata2\n . \n here not newline character, literal string \n . when @ in debugger, see in escaped form \\n . if wa...