Posts

Showing posts from May, 2010

jquery - Remove the element from the array in javascript? -

this question has answer here: remove duplicates javascript array 53 answers var arr = ["cat", "dog", "bear", "cat", "bird", "dog", "dog","cat"]; arr.remove("cat", "dog"); console.log(arr); i want delete string "cat" , "dog" want print them 1 time in result. can me? use filter function. var arr = ["cat", "dog", "bear", "cat", "bird", "dog", "dog","cat"]; arr = arr.filter(function(item, pos) { return arr.indexof(item) == pos; }); console.log(arr);

sql - Select statement with multiple, conditional, conditions -

i'm working on existing .net system , have sql table "offers" being made between 2 users. "offers" go two-ways (giggidy) usertype1 usertype2 , vice versa. make "simple" there "offertype" field defines way offer going in order correct user "accept" offer. simple enough when want query it, can execute queries quite if want data on single offer. here's problem: i'm trying build view shows list of offers user1. in view should show offers of "offertype1" user1 "offerloginuser" , offers of "offertype2" user1 "offerrecipientuser" offerid offerloginuserid offerrecipientuserid offertype 1 1 2 1 2 2 1 2 3 1 3 1 4 3 1 2 5 3 4 2 i need able see offerid'

javascript - DOM object not referenced -

i have simple class has parent element, , store it's child element progress, when add child element nothing happens class myclass { constructor(element) { this.elem = element; this.child = this.elem('.child'); this.fill(); } fill() { this.elem.innerhtml += '<span class="child2"></span>'; } update(val) { this.child.style.width = val + '%'; } } when call update function nothing happens. if print child element see has style of val% don't see "update" in dom. it's copying object , not storing reference. btw: works ok this.elem.queryselector('.child').style.width = val + '%'; also tried children[0] won't work. thank in advance! a simple utility converts markup documentfragment push around. var dummy = document.createelement('div'); function fromhtml(markup){ dummy.innerhtml = markup; for(var frag = document.createdocumentfragme

css - Chrome / Edge don't resize container containing responsive images -

how make browser redraw / resize surrounding <div> scaled svgs other images? if place image inside absolute positioned element, it's width or height adapt accordingly, this: <div style="position: absolute; height: 40%; background: blue;"> <!-- square transparent gif --> <img style="height: 100%; width: auto; background: #0f0; opacity: 0.6" src="data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///yh5baeaaaaalaaaaaabaaeaaaibraa7" > </div> and works if use svg, –except– if resize browser in chrome/edge. works in firefox. try resizing fullscreen demo in safari, chrome, firefox <div style="position: absolute; height: 40%; background: blue;"> <!-- square transparent gif --> <img style="display: block; height: 100%; width: auto; background: #0f0; opacity: 0.6" src="data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///yh5baeaaaaalaaaaa

ios - Getting Value from NSMutableArray -

i developing ios app , working on google map. draw lines on google map , coordinates add on mutablearray , coordinate save on nsuserdefault data save perfectly.but when getting data on nsuserdefault , show coordinate on google maps.but in gmsmutablepath app crash error msg exc_bad_access (code=1,address=0*4).please in advance. for (int = 0; < [coordinatearray count]; i++) { nsdictionary *dic = [coordinatearray objectatindex:i]; nsstring *lat = [dic valueforkey:@"lat"]; nsstring *longitude = [dic valueforkey:@"long"]; _valuepoints.latitude = [lat doublevalue]; _valuepoints.longitude = [longitude doublevalue]; gmsmutablepath *path = [[gmsmutablepath alloc] initwithpath:self.polyline.path]; [path addcoordinate:_valuepoints]; self.polyline.path = path; } save coordinate array directly, [_arr addobject:coordinate]; nslog(@"%@",_arr); nsuserdefaults *default

Haskell count elements in a list tail recursion -

i have amount of card in list of cards through tail recursion. given following code: amountcard :: int -> card -> [card] -> int my attempt far: amountcard n c [] = n amountcard n k (x:xs) = if k == x amountcard (n+1) k xs else amountcard n k xs did use tail recursion here? well wikipedia article says: [a] tail call subroutine call performed final action of procedure . if tail call might lead same subroutine being called again later in call chain, subroutine said tail-recursive , special case of recursion. tail recursion (or tail-end recursion) particularly useful, , easy handle in implementations. (formatting added) now if use if - then - else , nothing after that, know body of then , else clause last things "procedure" do . since in body of these then , else clauses simple calls (there no "post processing" 1 + (amountcard n k xs) ), yes indeed tail-recursion. i more elegant use guards if - then - els

java - Filling a generic List with objects of a subclass of an abstract class -

let's have abstract class called figure , static method addfigure inside. addfigure should fill existing list objects of user-specified type. public abstract class abstractfigure { public static <t extends abstractfigure> void addfigure(list<t> list, class<t> clazz, int n) { (int = 0; < n; i++) { try { t obj = clazz.newinstance(); list.add(obj); } catch (instantiationexception ex) { ex.printstacktrace(); } catch (illegalaccessexception ex) { ex.printstacktrace(); } } } } then have subclass, square . public class square extends abstractfigure { } the invocation follows: public class genericsproblem{ public static void main(string[] args) { arraylist<square> arraylistsquare = new arraylist<>(); abstractfigure.addfigure(arraylistsquare, square.class, 12); } } th

google analytics - ga:dfpRevenue is Restricted -

i trying fetch double click publishers data google analytics account, dfp metrics not possivble fetch via reporting api. am right need have ga360 this? that's error message: restricted metric(s): ga:dfprevenue can queried under conditions. details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets . can fetch data via google dfp api? set doubleclick publishers reporting integration preflight checklist see dfp reports in ga following criteria must met: you have google analytics 360 account. the majority of tags on site google publisher tags (gpt). select user administrator of both dfp , ga premium. this work 360 account has been set use gpt

node.js - Saving session data across multiple node instances -

i'm working on platform decided have api running on port 3001 whilst web application running on port 3000. decision made make monitoring traffic more easy. now, we're talking express applications defaulted using express-session npm package. wondering if it's @ possible save session data stored on node instance running on port 3001 , retrieved node instance running on port 3000 if makes sense. to elaborate, our user authentication flow: user navigates our web app running on port 3000. user signs in sends post request api running on port 3001, session data stored when credentials correct, response sent web app knows user authenticated. user refreshes page or comes web app after closing browser web app loses authenticated state. on load sends request api on port 3001 check if there's session data available, mean user logged in, can let web app know user authenticated. (if train of thought @ fault here, please let me know) the problem express-session doesn

javascript - Passing two values from child page to parent page -

i have script on child page should pass variable , image parent page. <script type="text/javascript"> //<![cdata[ function choose(newvalue) { parent.document.getelementbyid(location.search.substring(1)).value = newvalue; } jquery(window).load(function(){ jquery(".td-image-finiture").on("click", function(){ var finitura = jquery(this).children("img").attr("src"); parent.document.getelementbyid(location.search.substring(1)).src = finitura; }); }); //]]> </script> on parent page have code: <a class="cboxelement" href="<?php echo mage::geturl('', array('_secure' => mage::app()->getstore()->iscurrentlysecure())) . $_option->getdescription() ?>?options_<?php echo $_option->getid() ?>_text"><?php echo $this->__('choose color') ?></a> <input id="options_<?php echo $_option-&g

c# - Using Microsoft.AspNetCore.Mvc in .NetStandard 1.4 or below class library -

i have requirement create .netstandard library should support .net core , .netframework 4.5.2. , must have use microsoft.aspnetcore.mvc in both targets(.net core app , .netframework 4.5.2) but microsoft.aspnetcore.mvc supported on .netstandard 1.6 on wards , .netframework 4.5.1. i can build .netstandard 1.6 calss library consume in .net 4.5.2. (this not working below problem) i cannot consume .netstandard 1.6 .netframework 4.5.2. (i getting below exception during run not load file or assembly 'system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified) same question posted on github no solutions yet.( https://github.com/aspnet/mvc/issues/6028#issuecomment-289606346 ) thanks in advance. you can find matrix of versions of .net standard supported framework here: https://docs.microsoft.com/en-us/dotnet/articles/standard/library so no, .net standard 1.6 not supported 4.5.2.

How to resolve docker host names (/etc/hosts) in containers -

how possible resolve names defined in docker host's /etc/hosts in containers? containers running in docker host can resolve public names (e.g. www.ibm.com) docker dns working fine. resolve names docker hosts's (e.g. 127.17.0.1 smtp) containers. my final goal connect services running in docker host (e.g. smtp server) containers. know can use docker host ip (127.17.0.1) containers, thought docker have used docker host /etc/hosts build containers's resolve files well. i quite sure have seen working while ago... wrong. any thoughts? giovanni check out --add-host flag docker command: https://docs.docker.com/engine/reference/run/#managing-etchosts $ docker run --add-host="smtp:127.17.0.1" container command in docker, /etc/hosts cannot overwritten or modified @ runtime (security feature). need use docker's api, in case --add-host modify file. for docker-compose , use extra_hosts option. for whole "connect services running in hos

sql - Group price by hour -

i have data this dt | price --------------------------- 2016-02-02 12:33:33 3.3 2016-03-02 12:33:33 3.3 2016-02-02 12:03:33 3.3 2016-02-02 12:50:33 3.3 2016-02-02 13:33:33 3.3 i need summed price grouped hour, though need include year, month , day parts also desirable result: 2016-02-02 12:00:00 9.9 2016-02-02 13:00:00 3.3 2016-03-02 12:00:00 3.3 i have query, gives result. question is, may there more efficient way this? my current query: select to_timestamp(d, 'yyyy-mm-dd hh24:mi:ss') hours, price ( select substr(dt, 1, 13) d, sum(price) price table group substr(dt, 1, 13) ) order hours try this select trunc(dt,'hh24'), sum(price) table group trunc(dt,'hh24') order 2 desc;

Alexa Custom Skill Development HTTP Error 405 in Response -

i developing custom skill in alexa, , trying return hard coded response on https service endpoint on port 8443 based on sample utterances , intent schema defined on amazon alexa console. while testing alexa service emulator getting error there error calling remote endpoint, returned http 405 : method not allowed while accessing endpoint url postmen below mentioned response {"response":{"shouldendsession":true,"outputspeech":{"text":"all appliance working expected","type":"plaintext"}},"sessionattributes":{},"version":"1.0"} i finding hard understand doing wrong. alexa pretty picky when comes hosting skills externally. sounds issue. can done, have follow rules alexa defines. from docs the service must support http on ssl/tls, leveraging amazon-trusted certificate. the service must accept requests on port 443 for testing, amazon accepts different methods provid

database design - Modeling Employee-Manager relationship -

each employee in company has unique employee id a particular number of employees form team, eg employees 1 - 5 form team a team a, , every other team, has 1 manager. manager employee, own employee id. what best way of going model relationship? here couple of suggestions. groundwork: assuming employees may member of more 1 team, you'll want separate employees table, separate team table, , table of links between two. team id (pk) name employee id (pk) name teamemployees id (pk) teamid(fk->team.id) employeeid (fk->employee.id) leader: now groundwork in place, here choices begin - have leader structure: team table - leaderemployeeid (fk->employee.id) advantage - 1 leader per team, simple possible disadvantage (depending on requirements) - leader doesn't have employee exists in teamemployees table, additional checks may required teamemployees table - isleader (bit) possible advantage (depending on requirements) -

c# - Get innerHTML from Div into mvc Model -

i work on mvc website, , have div contenteditable flag, it's big input field ( can't change ! ). the div look's : <div id="email-text" contenteditable="true"> here editable text want </div > now want text div model found no way it. i don't know keywords helpful problem. you have innerhtml of email-text via jquery or javascript before form submit , put input. <form id="myform"> <input type="hidden" name="text" id="emailtextinput" /> <div id="email-text" contenteditable="true"> here editable text want </div> <input type="submit" name="submit" id="btn" /> </div> <script> $(document).ready(function(){ $("#btn").on("click",function(){ var emailtext = $("#email-text").html(); $(

datagrid - WPF troubles hooking CollectionChanged events -

i have datagrid need calculate total of price column of nested datagrid, so: image i'm trying follow this example items observable collection each person object gets notified on changes. difference i'm implementing inside class, not view model. public class person : notifyobject { private observablecollection<item> _items; public observablecollection<item> items { { return _items; } set { _items = value; onpropertychanged("items"); } } private string _name; public string name { { return _name; } set { _name = value; onpropertychanged("name"); } } public double total { { return items.sum(i => i.price); } set { onpropertychanged("total"); } } public person() { console.writeline("0001 constructor"); this.items = ne

java - How do I read HTTP status code from RestTemplate? -

i call rest api using resttemplate. response don't has issues.i need http status code this. request ok- 200 unauthorized - 400 according many post met bellow answer. resttemplate template = new resttemplate(); httpentity<string> response = template.exchange(url, httpmethod.post, request, string.class); string resultstring = response.getbody(); httpheaders headers = response.getheaders(); in here used exchange method response.(template.exchange....) used postforobject method this code public balancecheckresponse accounttotal(string counteralias, string counterauth, string subscribertype, string subscribervalue, string accessmode, string token) { balancecheckresponse objresponse = new balancecheckresponse(); try { balancecheckrequest objrequest = new balancecheckrequest(); objrequest.setcounteralias(counteralias); objrequest.setcounterauth(counterauth); objrequest.setsubscribertype(subscribertyp

c++ - How to make cin take only numbers -

here code double enter_number() { double number; while(1) { cin>>number; if(cin.fail()) { cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << "invalid input " << endl; } else break; cout<<"try again"<<endl; } return number; } my problem when enter 1x, 1 taken input without noticing character left out run. there way how make work real number e.g. 1.8? i use std::getline , std::string read whole line , break out of loop when can convert entire line double. #include <string> #include <sstream> int main() { std::string line; double d; while (std::getline(std::cin, line)) { std::stringstream ss(line); if (ss >> d) { if (ss.eof()) { // success break; } } std:

php - Joomla 3 Change website language from framework -

we have our site in dutch opening version in france. decided have french language when people go .fr version of our site , dutch version if people go .nl version. so created onafterinitialise plugin gets domain , want set language french. created overrides important language strings. but how change language fr_fr? tried documentation noticed setlanguage deprecated in joomla 3? greetings, you need use jlanguage::getinstance instead of setlanguage deprecated. change language of site can use $lang_code = "fr_fr"; $newlang = jlanguage::getinstance($lang_code); $app = jfactory::getapplication(); $app->loadlanguage($newlang); this load french language in .fr site.

php - Jquery .attr() not working to update name of input field -

following html code calling function delete selected image gets store in name property of input tag. <input id="im1" type="file" name ="upimage1" onchange="readurl(this);" class="upload" required/> <span class="trash-area1" id="im1" onclick="readur(this)"><img class="trash-box" src="img/trash.png" width="24px" height="24px"></span> following jquery code gets call on onclick function. not letting me make name attribute empty of input tag. function readur(input) { var id = $(input).attr('id'); var ch = id.substr(id.length - 1); $('.trash-area'+ ch).css('display','none'); $('#'+id).attr('src','img/plus.png'); $('#'+id).attr('name',''); } you have s

kendo ui - kendoToolBar with display:none attribute doesn't wok on resize screen -

i have simple exmaple of kendo ui toolbar, $("#toolbar").kendotoolbar({ items: [ { type: "buttongroup", attributes: { style: "display:none", }, buttons: [ { text: "foo" }, { text: "bar" }, { text: "baz" } ] } ] }) as can see, when run part of code, toolbar dotn display nothing, because has attribute "display:none", if change screen size, minimaze,maximaze, or resize seems attribute leaves, , display everything. is bug of telerik kendo? try add '!important': attributes: { style: "display:none !important", }

php - Wordpress Comet cache does not start after session_start() for frist time? -

i using code , after first entry of new user page comet cache not send cached content. $status = session_status(); if($status == php_session_none){ session_start(); } if (isset($_session['comparison']) && is_array($_session['comparison']) && count($_session['comparison'])>0){ define('donotcachepage', true); }

android - Show a ProgressBar while saving/showing a SQLite database -

i new android development. trying complete application, app saving data sqlite database, showing, updating, deleting, etc. when try show rows database, takes time. want add progressbar show users it's taking time. where in code can add progressbar? this mainactivity: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //instantiate database handler db=new databasehandler(this); lv = (listview) findviewbyid(r.id.list1); pic = (imageview) findviewbyid(r.id.pic); nazev =(edittext) findviewbyid(r.id.nazev); objem =(edittext) findviewbyid(r.id.objem); obsah_alkoholu =(edittext) findviewbyid(r.id.obsah_alkoholu); aroma =(edittext) findviewbyid(r.id.aroma); chut =(edittext) findviewbyid(r.id.chut); dokonceni =(edittext) findviewbyid(r.id.dokonceni); poznamka =(edittext) findviewbyid(r.id.poznamka); vsechnyradky =(textview) findviewby

c++ - Blender debug is crashing with error -

now try build complete version of blender. @ step building , installing dll had not problems, when try debug blender receive: 'blender.exe' (win32): loaded 'c:\windows\system32\rsaenh.dll'. symbols loaded. debug assertion failed! program: d:\blenderbuild4\bin\debug\blender.exe file: d:\program files\microsoft visual studio 12.0\vc\include\xstring line: 1168 expression: invalid null pointer information on how program can cause assertion failure, see visual c++ documentation on asserts. (press retry debug application) blender.exe has triggered breakpoint. debugging stop on: _std_begin #ifdef _debug _crtimp2_pure void __clrcall_pure_or_cdecl _debug_message(const wchar_t *message, const wchar_t *file, unsigned int line) { // report error , die if(::_crtdbgreportw(_crt_assert, file, line, null, l"%s", message)==1) { ::_crtdbgbreak(); } } _crtimp2_pure void __clrcall_pure_or_cdecl _debug_message(const unsigned short *message, co

postgresql - Redirect me back to login page after clicking register button in my django application -

i stuck in piece of code don't messed real.any contribution appreciate .every time try access register form redirected login others working fine middleware.py file import re django.conf import settings django.shortcuts import redirect django.urls import reverse django.contrib.auth import logout exempt_urls = [re.compile(settings.login_url.lstrip('/'))] if hasattr(settings, 'login_exempt_urls'): exempt_urls += [re.compile(url) url in settings.login_exempt_urls] class loginrequiredmiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): response = self.get_response(request) return response def process_view(self, request, view_func, view_args, view_kward): assert hasattr(request, 'user') path = request.path_info.lstrip('/ /') print(path) if not request.user.is_authenticated(): if not any(url.match(path) ur

.net - Visual studio build order working with nugets -

given solution has 2 projects: 1,2 - let's assume project 2 depends on project 1. now , if use project references - vs/msbuild can resolve correct build order , build project 1 before project 2. but, if want use nugets manage dependencies? project 2 defines depends on "nuget 1". doesn't msbuild aware of this. there way resolve , without defining manually build order in each solution? is there way resolve , without defining manually build order in each solution? just lex li mentioned, it`s design of msbuild , nuget. when use nugets manage dependencies, msbuild build dependence "nuget 1" first, work according nuget design, find , download dependence rather build , generate project 1. in order able dependence "nuget 1", have to build project 1 manually first, otherwise, msbuild throw exception not find dependence. all of related design of nuget, find , download dependence rather build , generate. hope can you.

java - Hibernate reloading entities in a fetch join -

i having problem hibernate reloading entities in query though being fetched part of main query. the entities follows (simplified) class data { @id string guid; @manytoone(fetch = fetchtype.lazy) @notfound(action = notfoundaction.ignore) datacontents contents; } class dataclosure { @id @manytoone(fetch = fetchtype.eager) @fetch(fetchmode.join) @joincolumn(name = "ancestor_id", nullable = false) private data ancestor; @id @manytoone(fetch = fetchtype.eager) @fetch(fetchmode.join) @joincolumn(name = "descendant_id", nullable = false) private data descendant; private int length; } this modelling closure table of parent / child relationships. i have set criteria follows final criteria criteria = getsession() .createcriteria(dataclosure.class, "dc"); criteria.createalias("dc", "a"); criteria.createalias("dc.descendant", "d

jquery - How can I change the color of my dropdown inside a list on hover? -

i have list inside webpage, need color dropdown red when hover it, , keep red when inside dropdown list. .dropdown-content { display: none; position: absolute; background-color: rgb(255, 255, 255); border: 0.5px solid black; border-radius: 2px; min-width: 113px; text-align: left; -webkit-box-shadow: rgba(0, 0, 0, 0.129412) 0px 2px 4px 0px; } .dropdown:hover .dropdown-content { display: block; } .dropdown a:hover { background-color: #d60041; } .dropdown-content { text-align: left; } .dropdown-link { padding: 5px; text-decoration: underline; } .dropdown-link:hover .drop { background-color: #3e8e41; } <ul> <li class="textnavbar"> <div class="dropdown"> <a href="#" id="mybtn">il mio account</a> <div class="dropdown-content"> &

Environment variable used by CMake to detect Visual C++ compiler tools for Ninja -

i have mingw64 gcc 6.3.0 (always in path ) , visual c++ compiler tools visual studio 2017 rtm (not in path ). if run cmake . -g "mingw makefiles" , gcc 6.3.0 selected. if run cmake . -g "ninja" , gcc 6.3.0 selected. my visual c++ compiler tools none standard, keep parts need , delete rest (like msbuild, ide etc.). use own batch script set path , include , lib (works fine). if run batch script , run cmake . , msvc selected , build nmake. with same environment, cmake . -g "ninja" , gcc 6.3.0 selected instead of msvc. so question is, how tell cmake want use msvc + ninja rather gcc + ninja when both in path ? environment variable should set? you can use inverted approach , exclude compilers don't want cmake_ignore_path . takes list of paths ignore, aware needs exact string match. advantage can declare directly command line. so did take path compiler found "not taken" cmake_ignore_path . and on system there 3 gcc com

javascript - Bind input checkbox's property checked to a field -

Image
i need prepare kendo listview in each item input checkbox shown in image. this listview bound a list of objects having 2 properties: "title" & "ischecked" i have used following template prepare listview: <script type="text/x-kendo-tmpl" id="checkboxlisttemplate"> <div style='margin-left:5px;'> <label style='font-weight: normal;'> <input type="checkbox" />#: title# </label> </div> </script> var _data = []; _data.push({"title" : "123", "ischecked" : true}); _data.push({"title" : "abcd", "ischecked" : false}); var _datasource = new kendo.data.datasource({ data: _data }); $("#lstview").kendolistview({ datasource: _datasource, template: kendo.temp

visual studio - Should nuget .props and .targets files be part of the source code repository? -

those files created during package restore that's why assume don't have in repository. there further documentation of purpose of files might answer question? for .net core project nuget.g.targets , nuget.g.props generated nuget restore. created in obj folder. not need have these in version control. typically files in obj folder not included in version control. visual studio automatically restore these files on opening solution if missing. if using build server can run dotnet restore restore these files. msbuild 15 when installed visual studio 2017 can used restore these files running msbuild /t:restore solution. the nuget.g.targets , nuget.g.props files define various properties, such path packages cache on machine. include msbuild imports nuget packages referenced project need. for example, if have microsoft.net.test.sdk nuget package referenced, nuget.g.targets , nuget.g.props import msbuild files included in nuget package. when using packages.config fi

android - Changing default locale with the format of b+<language_code>? -

i want users able change language of app without changing language of phone. i'm able method found: public static void changelanguage(context context) { locale locale = new locale("in"); locale.setdefault(locale); resources resources = context.getresources(); configuration config = resources.getconfiguration(); if (build.version.sdk_int >= build.version_codes.n) { config.setlocale(locale); } else { config.locale = locale; } if (build.version.sdk_int >= build.version_codes.n_mr1) { context.createconfigurationcontext(config); } else { resources.updateconfiguration(config, resources.getdisplaymetrics()); } } the new locale("in") going work if have values-in . i'm using values-b+id . i've tried new locale("b+id") , new locale("id") it's not working either. note : translation working if change language of phone

javascript - React Modify value being displayed without changing the value of input form -

i've got input field wants display currency. want display things based on current local (which i'm using react-intl accomplish). issue formatnumber method returns string , need value, on submit, integer. don't have access or control on submit functionality able have input field maintain sort of internal state float while @ same time displaying float string react-intl's formatnumber. there way achieve this?

reflection - why SomeClass::class is KClass<SomeClass> but this::class is KClass<out SomeClass> -

i want print values of properties of class. fun print() { val cl = this::class cl.declaredmemberproperties.filter {it.visibility != kvisibility.private}.foreach { println("${it.name} = ${it.get(this)}") } } when try build code compiler error: error:(34, 40) kotlin: out-projected type 'kproperty1<out someclass, any?>' prohibits use of 'public abstract fun get(receiver: t): r defined in kotlin.reflect.kproperty1' when change this class name someclass fine fun print() { val cl = someclass::class cl.declaredmemberproperties.filter {it.visibility != kvisibility.private}.foreach { println("${it.name} = ${it.get(this)}") } } so problem compiler changers type of this::class kclass<out someclass> instead of using kclass<someclass> . idea why happen? the reason difference that, when use someclass::class reference, sure class token representing someclass , not 1 of possible

javascript - loading google maps in windows phone 8.1 using webview -

i have created sample app load google maps in windows phone 8.1. using webview approch i'm not able launch google maps, please me in fixing this.. below code: default.html: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>maps</title> <!-- winjs references --> <!-- @ runtime, ui-themed.css resolves ui-themed.theme-light.css or ui-themed.theme-dark.css based on user’s theme setting. part of mrt resource loading functionality. --> <link href="/css/ui-themed.css" rel="stylesheet" /> <script src="//microsoft.phone.winjs.2.1/js/base.js"></script> <script src="//microsoft.phone.winjs.2.1/js/ui.js"></script> <!-- maps references --> <link href="/css/default.css" rel="stylesheet" /> <script src="/js/default.js"></script> </head> <body> <h1>google maps api on windo

Selecting Data from json Format, is this possible? -

i try select data json source. working 433_trl collect data temperature , humidity sensors in json format file, search , collect needed information. works charm when sensor has unique id this: {"time" : "2017-03-28 10:06:48", "model" : "prologue sensor", "id" : 9, "rid" : 178, "channel" : 1, "battery" : "low", "button" : 0, "temperature_c" : 21.600, "humidity" : 31} but 3 of sensors sending information: {"time" : "2017-03-28 10:06:24", "model" : "kedsum temperature & humidity sensor", "channel" : 3, "temperature_c" : 17.056, "humidity" : 49} i use following string select temp , humidiy when sensor send unique id: temp2=$(jq 'select(.rid == 178)| .temperature_c' /tmp/pilight_rtl.txt| xargs -n1 | tail -1) and tryed this, select name , channel, did not work, use channel , se

android - Add views dynamically and get value from those views -

Image
i need regarding adding new set of views , value views. in example, want add 4 textviews on button click , open timepicker each view click , display new selected time on respective textview. below screenshot of view. if these 4 views fixed create xml , add them single holder set invisible. if mean dynamic either 4 or 99 views, i'd recommend recyclerview. plenty of examples on internet. if create recyclerview custom adapter easy respective data per view. for future, please add more context question you've tried, result , why isn't expected result. broad question.

actionscript 3 - Make a Text Field the same size as the font size -

i wondering if there way make text field same size font used text inside of it. one of options i've tried was: mytextfield.height = mytextfield.textheight but didn't job, because textheight height of highest letter in text, not can rely on. i've tried using gettextformat().size: mytextfield.height = mytextfield.gettextformat().size but returned: error 1118 implicit coercion of value static type object possible unrelated type number.

php - Download photos in zip file -

hi guys , can give. here in code in uploading img mysql data base using form,this data base. database create table `user_pic` ( `id` int(11) unsigned not null auto_increment, `img` longblob not null, `img_name` varchar(200) not null, `upload_date` datetime not null default current_timestamp, `user_id` int(11) null default null, primary key (`id`) ) collate='latin1_swedish_ci' engine=innodb here load photos in variable load_img.php $couple_login_id = $_session['users']['id']; $statement = $conexion->prepare("select * user_pic user_id = $couple_login_id"); $statement->execute(); $fotos = $statement->fetchall(); an here loop images , display images on html gallery.php <?php foreach($fotos $foto):?> <div class="col-xs-12 col-sm-4 col-md-3 item-photo"> <div class="photo"> <?php echo '<img class="img-responsive" src="

python - How can do repeatable job every m minutes between start hour until end hours for n days? -

i import schedule package in python , need run task example n days starts @ 1:00 , ends @ 1:30 every 10 minutes (3 times per day) , need repeat pattern until n days finish. many thanks! how schedule jobs: https://schedule.readthedocs.io/en/stable/ how clear scheduled job: https://schedule.readthedocs.io/en/stable/faq.html#clear-job-by-tag import schedule n_days = 5 # run 5 days tasks_done = 0 # track number of times run tasks_per_day = 3 # no of times task runs def do_task(): global tasks_done, tasks_per_day, n_days tasks_done += 1 print("i'm working...") if tasks_done >= (tasks_per_day * n_days): # n days on schedule.clear('daily-tasks') times = ["01:00", "01:10", "01:20"] t in times: schedule.every().day.at(t).do(do_task).tag('daily-tasks', t)

excel - Look in separate folders then specify message details on attached file location -

i have code picks recent pdf out of folder , send specfied email address (courtesy of user answered previous post). it working individual folders , various email specs i'd folder , have different message specifications if file found in other folder. my code @ moment re-runs process , looks in other folder (this hasn't worked due on complication , confusing variables). know lot of cry looking @ attempt i've made scrappy, clunky poor quality - @ moment sends files processed first message spec, , last 1 processed again second message specification. option explicit sub sendfiles() dim objoutlook object dim fso object dim strfile string dim fsofile dim fsofldr dim dtnew date, snew string dim newoutlookinstance boolean set fso = createobject("scripting.filesystemobject") if getoutlook(objoutlook, newoutlookinstance) strfile = "c:\temp\" 'path folder set fsofldr = fso.getfolder(strfile) dtnew = now() - t

XML to create from an oracle query -

i wrote below query generate xml file select xmlelement("providers", xmlelement("provider" ,xmlattributes( "unique id" "uniqueid"), xmlelement("providertype", "provider type"), xmlelement("specialities", xmlelement("speciality", "specialty")), xmlelement("relationships", xmlelement("relationship", "relationship")), xmlelement("serviceaddress", xmlelement("addressline1","p address line 1"), xmlelement("addressline2","p address line 2"), xmlelement("addressline3","p address line 3"), xmlelement("addressline4","p address line 4"