Posts

Showing posts from July, 2014

radio button - RadioGroup add RadioButton duplicate when standby phone android -

i have problem radiogroup , add dynamically radiobutton have function: private void createradio() { radiogroup rgp= (radiogroup) findviewbyid(r.id.radiogroup); radiogroup.layoutparams rprms; for(int i=0;i<radios.length();i++){ radiobutton radiobutton = new radiobutton(this); try { jsonobject object = radios.getjsonobject(i); radiobutton.settext(object.getstring("name")); radiobutton.setid(object.getint("id")); rprms= new radiogroup.layoutparams(radiogroup.layoutparams.wrap_content, radiogroup.layoutparams.wrap_content); assert rgp != null; rgp.addview(radiobutton, rprms); } catch (jsonexception e) { e.printstacktrace(); } } } where radios jsonarray retrieve db. , problem when put in "stand by" app, , activity stopped when reopen activity found value of

c - Can someone help me with pointers -

struct complex{ int x; int y; }; void add(struct complex *b[]); int main(int argc, char** argv) { struct complex a[3]; struct complex *ptr[] = { &a[0] , &a[1] , &a[2] }; printf("indtast a->x = "); scanf("%d", a[0].x); printf("indtast a->y = "); scanf("%d", a[0].y); printf("indtast a2->x = "); scanf("%d", a[1].x); printf("indtast a2->y = "); scanf("%d", a[1].y); printf("indtast a3->x = "); scanf("%d", a[2].x); printf("indtast a3->y = "); scanf("%d", a[2].y); add(ptr); return 0; } void add(struct complex *b[]){ printf("%d + i%d",b[0].x + b[1].x + b[2].x, b[0].y + b[1].y + b[2].y); } im trying point array of structure til function, print calculated complex number. gives me error. can please help? in advance you forgot add "&

algorithm - N-Queens puzzle solution - cannot understand -

i reading description solution n-queens puzzle on sicp , cannot understand of them. here solution: one way solve puzzle work across board, placing queen in each column. once have placed k - 1 queens, must place kth queen in position not check of queens on board. can formulate approach recursively: assume have generated sequence of possible ways place k - 1 queens in first k - 1 columns of board. each of these ways, generate extended set of positions placing queen in each row of kth column. filter these, keeping positions queen in kth column safe respect other queens. produces sequence of ways place k queens in first k columns. continuing process, produce not 1 solution, solutions puzzle. suppose 8 8 chessboard looks this: eyes destroyed cannot use pictures. 0 means no queen, 1 means queen. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 work across board, placing q

php - Send Mail to Multiple Address in Cakephp 3 : Cannot modify an existing config -

i trying send email multiple recipient address in cake php 3. my codes : $this->loadmodel('asindividualdetails'); $emaildetails = $this-> asindividualdetails->find('all',['fields'=>'email']); $emaildetails = $emaildetails->toarray(); foreach ($emaildetails $key => $a) { $this->loadmodel('domainemaildetails'); $domainemaildetails = $this-> domainemaildetails->find('all')->first(); $domainemaildetails = $domainemaildetails->toarray(); $host = 'ssl://'.$domainemaildetails['host_name']; $username = $domainemaildetails['user_name']; $password = $domainemaildetails['user_password']; $port = $domainemaildetails['port']; $email_to = $a['email']; $sendername = 'abc'; $email_id ='xyz110@gmail.com'; email::configtransport('webmail', [

angularjs - Destroying connection when $destroy in SignalR -

i have page running signalr, angular, , typescript. when current $scope gets destroyed (like page change), try disconnect client signalr server: controller.ts $scope.$on("$destroy", () => service.disconnect()); my frontend service has function: service.ts public disconnect() { this.hub.disconnect(); } so when change page, client disconnects hub. works perfectly, can see in console: signalr: stopping connection. signalr: closing websocket. signalr: fired ajax abort async = true. signalr: stopping monitoring of keep alive. works perfectly. however, when load new state , connection gets set again, old connection somehow "kept", because tries connect twice. if go different page , again, tries connect 3 times. edit it seems statechanged gets called multiple times. multiple times being amount of times connection setup has been called. hmm, wonder why that, when disconnect client hub. fixed simple if connected variabl

multithreading - Cassandra java driver - high latency while extracting data with multiple threads -

i can see strange behavior datastax cassandra driver (3.0). i've created new cluster, i've started set of threads using same cluster object. if keep threads 1 or 2, see avg extraction time of 5ms, if increase threads 60, extraction time increase 200ms (per single thread). strange thing that, if let 60 threads app running , start on same machine process 1 threads, extraction time single threaded app again 5ms. seems related client. i've repeated same tests many times avoid cache cold start problem. here how cluster object configured: poolingoptions poolingoptions = new poolingoptions(); poolingoptions .setconnectionsperhost(hostdistance.local, parallelism, parallelism+20) .setconnectionsperhost(hostdistance.remote, parallelism, parallelism+20) .setmaxrequestsperconnection(hostdistance.local, 32768) .setmaxrequestsperconnection(hostdistance.remote, 2000); this.cluster = cluster.builder() .addcontactpoints(nodes)

go - Group slice by subarray values in Golang -

i have array of subarrays in following format array ( [0] => array ( [unit_id] => 6504 [assignment_name] => grade assignment [assignment_description] => [assignment_total_score] => 10 [unit_type_name] => homework [is_graded] => 1 [standard_id] => 1219 [scoring_type] => score [attempt_score] => 8 [unit_duedate] => 2016-02-10 09:00:00 [standard] => array ( [0] => stdclass object ( [unit_id] => 6504 [is_formal] => 1 [assignment_name] => grade assignment [assignment_description] => [standard_id] => 1220 [standard_name] => 9-10.rl.3

python - ValueError: cannot use inplace with CategoricalIndex -

i using pandas 0.18 . this fails cat_fields[f[0]].add_categories(s,inplace=true) however docs say inplace : boolean (default: false) whether or not add categories inplace or return copy of categorical added categories. am missing ? i creating superset of categories/columns across many dataframes able concatenate them. my error: valueerror: cannot use inplace categoricalindex i think need assign original column, because series.add_categories has inplace parameter , works nice. but in categoricalindex.add_categories has inplace parameter, fails. think bug. cat_fields[f[0]] = cat_fields[f[0]].add_categories(s) or: cat_fields[f[0]] = cat_fields[f[0]].cat.add_categories(s) sample: cat_fields = pd.dataframe({'a':[1,2,3]}, index=['a','d','f']) cat_fields.index = pd.categoricalindex(cat_fields.index) cat_fields.a = pd.categorical(cat_fields.a) print (cat_fields) a 1 d 2 f 3 s = ['b',

docker - Kubernetes - Unknown admission plugin: DefaultStorageClass -

kubernetes api server not getting started due defaultstorageclass. the connection server 10.85.40.165:8080 refused - did specify right host or port? (kubectl failed, retry 2 times) ubuntu: 14.04.4 kubectl version client version: version.info{major:"1", minor:"2", gitversion:"v1.2.0", gitcommit:"5cb86ee022267586db386f62781338b0483733b3", gittreestate:"clean"} server version: version.info{major:"1", minor:"2", gitversion:"v1.2.0", gitcommit:"5cb86ee022267586db386f62781338b0483733b3", gittreestate:"clean"} docker info docker info containers: 0 running: 0 paused: 0 stopped: 0 images: 0 server version: 1.10.3 storage driver: aufs root dir: /var/lib/docker/aufs backing filesystem: extfs dirs: 0 dirperm1 supported: true execution driver: native-0.2 logging driver: json-file plugins: volume: local network: bridge null host kernel version: 4.2.0-27-generic operating syst

python - Is there something like `inspect_types()` for a numba ' @jitclass`? -

my numba @jitclass fails typingerror , unhelpful error message, once try instantiate it: can't infer type of variable '$0.1': list(undefined) . variable $0.1 correspond (ok, first 1 encountered, in function?). normal functions, inspect_types() helpful here. however, doesn't seem exist, neither on jitclass, nor on it's methods. there jitclasses? i'm on numba 0.28.1 (currently latest stable), in general, i'm interested recent version of numba.

python - PyQT4: why does QDialog returns from exec_() when setVisible(false) -

i'm using python 2.7 , pyqt4. i want hide modal qdialog instance , later on show again. however, when dialog.setvisible(false) called (e.g., using qtimer), dialog.exec_() call returns (with qdialog.rejected return value). however, according http://pyqt.sourceforge.net/docs/pyqt4/qdialog.html#exec , _exec() call should block until user closes dialog. is there way hide dialog without _exec() returning? #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os pyqt4 import qtgui, qtcore class mydialog(qtgui.qdialog): def __init__(self, parent): qtgui.qdialog.__init__(self, parent) def closeevent(self, qcloseevent): print "close event" def hideevent(self, qhideevent): print "hide event" class mywindow(qtgui.qmainwindow): def __init__(self): qtgui.qmainwindow.__init__(self) self.setwindowtitle("main window") button = qtgui.qpushbutton("press me", self)

ibm mq - Import MQIC.DLL in C# -

in system, need load mqic.dll (ibm websphere mq) send , messages mq server. currently, service running in vb5, , need upgrade .net. when try load library, error: attempted read or write protected memory. indication other memory corrupt. the code: [dllimport("mqic.dll", entrypoint = "mqconnstd@16", setlasterror = true)] public static extern void mqconn(string qmgrname, long hconn, long compcode, long reason); does have idea why it's happening? the vb5 code: declare sub mqconn lib "mqic.dll" alias "mqconnstd@16" (byval qmgrname string, hconn long, compcode long, reason long) this mqod struct: public struct mqod { public string strucid; //structure identifier' public long version; //structure version number' public long objecttype; //object type' public string objectname; //object name' public string objectqmgrname; //object queue manager name' public string dynamicqname; //dynami

excel - Searching occurrence of custom codes in data set -

i tying accomplish following in microsoft excel through vba. use help! i have 2 sets of data: data dump & key containing codes (each of contains list of strings). the objective search data dump & assign true/false & count value each code in our key in accordance whether code found in data dump or not & if found, how many times occurred, case may be. we can code found in data dump when each of strings of particular code found in data dump. providing sample eg. below clarify whole problem: let's have key containing following codes each of comprises of multiple string values: usa: ford, ferrari, chevrolet india: maruti, modern, hero korea: kia, hyundai, daewoo japan: honda, yamaha, suzuka germany: bmw, mercedes, audi now, in given data dump, want count how many times each of usa, india, korea, japan, germany occur. each of usa's "occurrence", each of ford, ferrari, chevrolet need found once in dump. if these values found 4 times

javascript - JQuery undo append -

i've got table button inside td, once press button adds text td. want remove text inside td once press button again. note this button used multiple times in table hence class attribute. method use done? this code: $(document).on('click', '.releasebutton', function () { // button class="releasebutton" var label = $(this).text(); if (label == "add") { // "add" default $(this).text("cancel"); $('.releasetd').append("<br>" + "test"); // td class="releasetd" } // code above works else { $(this).text("add"); $('.releasetd').remove("<br>" + "test"); // wrong correct code }; }); you create id text inside this: $(document).on('click', '.releasebutton', function () { // button class="releasebutton" var label = $(this).text(); if (lab

javascript - TYPO3 7.6 none lightbox extensions work -

i'm trying make work lightbox-style image popups, nothing - of extensions not work. seems wrong typo3 config or whatelse. e.e. "perfect lightbox" - installed, template added, in contect images checkboxes "click enlarge" , "lightbox" checked. nothing happens. in browser console no js errors, js files perfect lightbox loaded. in page source piece of code around image looks like: <a href="http://.../index.php?eid=tx_cms_showpic&amp;file=17&amp;md5=14b002d6aa25f9dd945e2a4e6c21ea4347298d11&amp;parameters%5b0%5d=yto0ontzoju6indpzhroijtzojq6ijgwmg0io3m6njoiagvpz2h0ijtzojq6ijyw&amp;parameters%5b1%5d=mg0io3m6nzoiym9kevrhzyi7czo0mtoipgjvzhkgc3r5bgu9im1hcmdpbjowoybi&amp;parameters%5b2%5d=ywnrz3jvdw5koinmzmy7ij4io3m6ndoid3jhcci7czoznzoipgegahjlzj0iamf2&amp;parameters%5b3%5d=yxnjcmlwddpjbg9zzsgpoyi%2bihwgpc9hpii7fq%3d%3d" onclick="openpic('http:\/\/...\/index.php?eid=tx_cms_showpic\u0026file=17\u0026md5=14b002d6aa

java - how to Disable TouchEvent of BackGroundLayout? -

disable touchevent , click of backgroundlayout . in app have problem touchevent. here have 2 image describe. i create 1 layout tutorial purpose only, user can understan batter. layout [image1] with transparent theme , 1 button [got it]. as tutorial says (touch draw), user follow tutorial , touch anywhere draw line draw line on background layout see [image2] .it draw line on touchevent i can not understad why allow touch 1 view in background. in short when user following tutorial not allow touch , draw line on main layout. and don't ant disable touchevent of background view. i checking disable child layout of layout still click , touch event of background layout. have same problem activity image 3 i put code in side top layout's touch event @override public boolean ontouchevent(motionevent event) { return false; } @override public boolean onkeydown(int keycode, keyevent event) { // make checkbox not

asp.net mvc - Bind results from search -

i cannot bind results search in kendo grid. i've tried many times, i'm in trouble 4 days, don't know wrong here, when debug action working perfect,data ok, return grid result ok, results aren't shown in kendo. here code: <script> $(function() { $("a.k-button").on('click', function (e) { debugger; e.preventdefault(); var dataobj = serializebyfieldswrap(".invoiceform"); var dataurl = $(this).data('url'); // dataobj.toolboxid = toolboxid; $('body').css('cursor', 'wait'); var result = $.ajax({ type: "post", url: dataurl, datatype: 'json', data: dataobj, //complete: $("#invoices-grid").data("kendogrid").data.read(), }); result.done(function (data) { console.log(data); var grid = $('#invoices-grid').data("kendogrid");

python - Haskell: How can we define a general purpose logging wrapper function? -

suppose want have function log accepts function, wraps around function , logging input/output of function. pseudo-code: func log(func f, input) { var output = f(input); log_data(input); log_data(output); } how possible in haskell? how can define general function pointer general list of inputs in function call? similar python decorators loggin. to more specific , want general mechanism add logging input/output of functions in application. of course possible adding 2 lines of code each function log input , output want general-purpose solution works functions input. a sample logging decorator in python: def logged(f): @wraps(f) def wrapped(*args, **kwargs): print "logging..." r = f(*args, **kwargs) print "call finished" return r return wrapped @logged def myfunc(myarg): print "my function", myarg return "return value"

How I can set file permissions in a custom project added to Android AOSP -

i add aosp device-owner app. create directory @ packages/apps/myapp copy myapp.apk , device-owner.xml packages/apps/myapp create android.mk: local_path := $(call my-dir) include $(clear_vars) $(shell mkdir -p $(target_out_data)/system) $(shell cp $(local_path)/device_owner.xml $(target_out_data)/system) local_module_tags := optional local_module := myapp local_certificate := presigned local_privileged_module := true local_src_files := $(local_module).apk local_module_class := apps local_module_suffix := $(common_android_package_suffix) local_post_install_cmd := chown system:system $(target_out_data)/system/device_owner.xml include $(build_prebuilt) device-owner.xml <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <device-owner package="com.test.test.myapp" /> after flash userdata.img device have permissions: -rw-r--r-- root root 112 2016-09-22 06:29 device_owner.xml but must have such

php - How to pass Codeigniter controller array to view and use foreach function? -

i can't access codeigniter controller array values in view. did miss. mymodel function get_data(){ $this->db->select('prod_id, content, details'); $query = $this->db->get('tblesample'); return $query->result(); } controller public function index(){ $this->load->model('mymodel'); $user_info = $this->mymodel->get_data(); $this->load->view('inc/header_view'); $this->load->view('data_view', $user_info); } data_view <div class="col-md-9"> <?php foreach ($user_info $info) { echo $info->content; } ?> </div> you better off using associative array pass on view: public function index(){ $this->load->model('mymodel'); $data = [ 'user_info' => $this->mymodel->get_data(), ]; $this->load->view('inc/hea

c# - Using Data Annotations in ASP.NET MVC with AJAX jQuery Datatables -

i've implemented ajax in jquery datatables following simple tutorial i'm not sure how use data annotations created in data viewmodel. how do this? before ajax, have in view (using razor): <tbody> @foreach (callablenoteviewmodel vm in model) { <tr> <td>@html.displayfor(modelitem => vm.underlyingasset) </td> <td>@html.displayfor(modelitem => vm.payoutcurrency)</td> <td>@html.displayfor(modelitem => vm.term)</td> <td>@html.displayfor(modelitem => vm.autocalllevel)</td> <td>@html.displayfor(modelitem => vm.frequency)</td> <td>@html.displayfor(modelitem => vm.barrier)</td> <td>@html.displayfor(modelitem => vm.couponbarrier)</td> <td>@html.displayfor(modelitem => vm.autocallablestart)</td> <td>@html.displayfor(modelitem => vm.upsideparticipation)</td>

automation - How to perform webdriver backed selenium in selenium 3? -

how perform webdriver backed selenium in selenium 3 ? selenium 3 has removed feature called 'webdriver backed selenium' i have perform mouseover, type operations this, no more supported in selenium 3. selenium = new webdriverbackedselenium(driver, "http://www.google.com"); selenium.openwindow("http://www.google.com", "google"); selenium.mouseover(anelement); i have tried movetoelement method , doesn't executes in site . thats why using webdriver backed selenium in selenium 2 (webdriver). what work around have in selenium 3 as know, webdriverbackedselenium provides selenium 1.x (selenium rc) compatible interfaces it's 100% implemented using webdriver. there many downside use it, example - webdriverbackedselenium slower using webdriver apis directly. let's stick original question :) with release of selenium 3.0 , decided delete original selenium core implementation. 1 have used old rc interfaces, selenium team h

go - Find disk attached to vm using govc -

i looking find details of virtual machine using govc . i able fetch details of instance using govc vm.info , result had details of cpu, memory, ip address , other not disk storage , can see on vsphere console or logging system. is there using govc find disk attached instance ?? you can information devices using $ govc device.info -vm virtualmachinename

html - Align div top to the bottom of a sibling div -

i want place dropdowncontainer below inputcontainer , without dropdowncontainer being encased within autocompletecontainer . when scrolled, dropdowncontainer should move inputcontainer . same when token divs removed or added. if remove position:absolute dropdowncontainer aligns correctly, appears inside autocompletecontainer i prefer without js/jquery, i'll use if there no other option. here's codepen link: http://codepen.io/rishadjb/pen/lrxzpn thank you. .maincontainer{ width:700px; position: relative; } .autocompletecontainer{ background: none repeat scroll 0 0 #ececec; float: left; width: 100%; /* height:60px; */ max-height: 100px; z-index: 1; padding: 4px 0; display: flex; flex-wrap: wrap; cursor: text; text-align: left; background-color: #e4e4e4; overflow-y: auto; overflow-x: hidden; } .token{ background-color: #f7982f; border-radius: 10px; color: #fff;

c# - Redirect HTTP to HTTPS for all pages -

if type in example.com redirects https://example.com want to. when typing http://example.com/blog still redirects https://example.com <rewrite> <rules> <clear/> <rule name="force https" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="off" ignorecase="true"/> </conditions> <action type="redirect" url="https://{http_host}/{r:1}" appendquerystring="false" redirecttype="permanent" /> </rule> </rules> </rewrite> how can make add https whatever user wrote? you can use attribute [system.web.mvc.requirehttps] controller. if need on controller, can use following code ( only asp.net mvc6/core ). public void configureservices(iservicecollection services) { services.addmvc(

Node.js request method callback -

this question has answer here: how return response asynchronous call? 24 answers javascript: what's difference between function name & function reference? 5 answers client.get method not work in redis node.js //blog function module.exports = { index: function () { var data = new object(); data.ip = base.ip(); var redis = require("redis"); var client = redis.createclient(6379,'192.168.33.10'); client.get("foo",function(err,reply,callback) { var x=reply.tostring(); }); data.y=x; return data; } }; data.y="bar" expects x not defined. where problem? your problem client.get asynchronous method, can't return from. need sort of asynchronous control flow, such callb

javascript - JS: json, dynamic method creature and closure -

sorry not clear title,but don't know problem is. so, need write function creates js objects json , fields begins underscore must create setters , getters. this test json: { "_language":null, "_country":null } this function wrote function jsontoobject(json){ return json.parse(json,function(key,value){ if (value && typeof value === 'object') { return (function(value){ var replacement = {}; (var k in value) { if (object.hasownproperty.call(value, k)) { //if private field if (k.lastindexof("_", 0) === 0){ replacement[k]=value[k]; var name=k.substring(1); var getname="get"+name.charat(0).touppercase() + name.slice(1); replacement.constructor.prototype[getname]=function(){

python - Do I need different MIB with those OID? -

i got legacy powershell script retrieve information via snmp, i'm trying port in python using snimpy . $printersip = '10.100.7.47', '10.100.7.48' function get-snmpinfo ([string[]]$printers) { begin { $snmp = new-object -comobject oleprn.olesnmp } process { foreach ($ip in $printers) { $snmp.open($ip,"public",2,3000) [pscustomobject][ordered]@{ name = $snmp.get(".1.3.6.1.2.1.1.5.0") ip = $ip uptime = [timespan]::fromseconds(($snmp.get(".1.3.6.1.2.1.1.3.0"))/100) model = $snmp.get(".1.3.6.1.2.1.25.3.2.1.3.1") description = $snmp.get(".1.3.6.1.2.1.1.1.0") #contact = $snmp.get(".1.3.6.1.2.1.1.4.0") #sn = $snmp.get(".1.3.6.1.2.1.43.5.1.1.17.1") #location = $snmp.get(".1.3

html - Javascript replaceChild -

i have line of html need change dynamically based on screen size. have javascript check screen size having trouble getting replace html need. need remove link tag , have text , divs styling. first line of code have, second need change to: var smslink = document.getelementbyid("smstextlink"); var smstextnode = document.createtextnode('text agents available 8am - 10pm cst 7 days week'); smstextlink.parentnode.replacechild(smstextnode, smstextlink); <a href="" id="smstextlink">text <div style="color:#888888">agents available 8am - 10pm cst<br>7 days week</div> </a> text <div style="color:#888888">agents available 8am - 10pm cst<br>7 days week</div> you referencing var smslink = document.getelementbyid("smslink"); but in html id="smstextlink"

Best place to format date expressions. SSRS side or SQL Server side? -

i working on ssrs dashboard report , report has graph displays comparison of values current , previous year. query have on sql side returns weekstartdate , weekenddate columns in result set. displaying data on report, need have formatted date. i have 2 options here: to format date in required format in derived column (derives weekstartdate , weekenddate columns) on sql side , use column directly on ssrs. not having derived column on sql side, writing ssrs expression format dates on ssrs side. i know 1 more preferable, effective performance standpoints. other information: if may have consider other factors, there 3 other data sets used same report dashboard report, , there various other expressions conversions , conversions performed on ssrs side well. also, result sets huge. looking forward thoughts , suggestions. cheers. formatting should always part of front end, not backend (or worse: database!). in report, chose 1 of predefined date formats (not hardcod

node.js - How to automatically update relative CSS paths for minification? -

i update relative paths minification, because use separate folders each js / css component , folder depth can different each component, example: css/ style.min.css // final minified , processed file common.scss components/ gallery/ gallery.scss // url(../../../img/mypic.png) img/ mypic.png after minification, style in style.min.css still have ../../../img/mypic.png . however, must updated ../img/mypic.png , otherwise webbrowsers not find picture. how can automatically postcss or package? i found postcss-url project , provides function custom url transformation, didn't find example how this. right use gulp , nodejs , autoprefixer , postcss minification. there parameter called url in postcss-url can used pass custom function postcss-url . function able modify urls postcss-url , code must manually written. here use in project: var outdir = './src/css'; // output folder css gulp.task('min:css', functio

android - Gradle: "apply plugin" at the top or at the bottom -

Image
has same effect add "apply plugin" @ beginning or end of file build.gradle in android studio projects? for example add 'com.google.gms.google-services' plugin, firebase official documentation recommends adding @ end, i've seen other codes add @ beginning. i know question seems irrelevant, i'm developing plugin android studio manage dependencies , have doubt. thanks in advance gradle scripts interpreted top bottom order can important. keep in mind gradle has configuration phase , execution phase order isn't important. it's common apply plugins @ top of script since plugins add extension objects , tasks gradle model can configured lower down in build script. for example, can't following because test task added java plugin: test { include 'org/foo/**' } apply plugin: 'java'

performance - Is it faster to add a key to a dictionary or append a value to a list in Python? -

i have application need build list or dictionary , speed important. declare list of zeros of appropriate length , assign values 1 @ time need able check length , have still meaningful. would faster add key value pair dictionary or append value list? length of lists , dictionary small (less 100) isn't true , in worst case larger. i have variable keep track of in list if both of these operations slow. best way use time() check execution time. in following example dict faster. from time import time st_time = time() b = dict() in range(1, 10000000): b[i] = print (time() - st_time) st_time = time() = [] in range(1, 10000000): a.append(i) print (time() - st_time) 1.45600008965 1.52499985695

jQuery UI Spinner displaying in hours and minutes -

i need build spinner allows increment/decrement 15 minutes (text input disabled) in format of: 2 hours 15 minutes increment 2 hours 30 minutes the related question's top answer seems depreciated (.change doesn't trigger anything). other answers focused on question's particular use case , hard adapt issue. i appreciate possible here code requirement.this simple place step:15 increment min spinner 15 min.....happy coding <input id="spinner" /> <script> $(function() { $('#spinner').spinner({ min: 2, max: 20, step: 15 }); }); </script>

javascript - React library similar to Backbone Models/Collections -

is there library helps manipulating downloaded json structure? mean making helpers in bb models eg. isclosed() equivalent this.stage === 'open' , one. if not have idea how implement type of behavior in plain react, without using bb? dont wanna use redux in case because fetching lot of nested json structure data , sharing within 1 parent component. if want use backbone models/collections in react, can checkout library binds backbone models/collections react view. i.e. when data changes, react view trigger forceupdate . here link react.withbackbone

ajax - Run long SAS stored proc from php without hanging browser -

i need call sas stored proc takes 5 minutes run without hanging browser. i'm using yii stack , calling sas through url. i'd attach code, i've tried many things @ point there's not version of code makes sense anymore. direction appreciated. note: i've tried exec() , doesn't seem work. i've tried ajax, , prefer async ajax call, @ point i'll try anything. other information needed, let me know. update: created controller action in php completes stored process if go directly controller action in url of browser. however, if call controller action ajax get, stored process doesn't execute. ajax should work fine! if stored process called without parameters, can try using h54s (html5 sas) javascript library . wrote guide on here . example code - once configured - follows: var adapter = new h54s(); // need 1 instance var myparams = {}; // create empty object if no parameters var jstablesobject = new h54s.tables([myparams],'sascontrolta

ios - How to Show Different View For Selected PickerView? -

Image
i have categories , want show different text-fields user each category. how can this? tried add different views in same view controller think it's not possible , true way. you need add function func pickerview(pickerview: uipickerview, didselectrow row: int, incomponent component: int) { index = row if (index == 0) { //show view } else if (index == 1) { //show view } else if (index == 2) { //show view } }

ios - Zooming is not working after after Xcode 8 upgrade -

Image
i use swift. viewforzoominginscrollview not working after upgraded xcode version 8. zooming code working before updated xcode. code. import uikit class viewcontroller: uiviewcontroller,uiscrollviewdelegate { /*scrollview zoom code 01*/ @iboutlet var scrollview: uiscrollview! @iboutlet var imageview: uiview! override func viewdidload() { super.viewdidload() /*scrollview zoom code 02*/ self.scrollview.minimumzoomscale = 1.0 self.scrollview.maximumzoomscale = 6.0 } override func didreceivememorywarning() { super.didreceivememorywarning() } /*scrollview zoom code 03*/ func viewforzoominginscrollview(scrollview: uiscrollview) -> uiview? { return imageview } } xcode suggest new code not work zooming when running on iphone: replace method func viewforzooming(in scrollview: uiscrollview) -> uiview? , should work method.

Pass a YAML-based property value to @Scheduled annotation in Spring Boot -

this question possibly duplicate of older question . i'm working on spring boot 1.4 application , have method of bean annotated @scheduled . need pass cron value annotation and, since i'm using yaml based configuration, cron value stored in yaml file ( application.yaml ). i can't find way pass property value app.cron annotation. for instance, doesn't work @scheduled(cron = ${app.cron}) i have tried use el expression, no luck. what proper way pass yaml based property value spring annotation? try putting in javaconfig first , should work el: @configuration @configurationproperties(prefix = "app") public class cronconfig() { private string cron; @bean public string cron() { return this.cron; } public void setcron(string cron) { this.cron = cron; } } and use @scheduled(cron = "#{@cron}") i didn't tried scheduled taks had similar problem injecting annotation.

python - Sort a list where there are strings, floats and integers -

is there way in python sort list there strings, floats , integers in it? i tried use list.sort() method of course did not work. here example of list sort: [2.0, true, [2, 3, 4, [3, [3, 4]], 5], "titi", 1] i sorted value floats , ints, , type: floats , ints first, strings, booleans , lists. use python 2.7 not allowed to... expected output: [1, 2.0, "titi", true, [2, 3, 4, [3, [3, 4]], 5]] python's comparison operators wisely refuse work variables of incompatible types. decide on criterion sorting list, encapsulate in function , pass key option sort() . example, sort repr of each element (a string): l.sort(key=repr) to sort type first, contents: l.sort(key=lambda x: (str(type(x)), x)) the latter has advantage numbers sorted numerically, strings alphabetically, etc. still fail if there 2 sublists cannot compared, must decide do-- extend key function see fit.

RabbitMQ + C# + SSL -

i'm trying use c# rabbitmq 3.6.2 use ssl/tls on windows 7 against erlang 18.0. i'm running errors when i'm enabling ssl in c# code. have gone through steps set ssl/tls here . i've gone through [troubleshooting steps][2] show turn successful (except couldn't stunnel step due lack of knowledge of stunnel). here's c# code trying connect rabbitmq: var factory = new connectionfactory() { // note: guest username works hostname "localhost"! //hostname = environment.machinename, hostname = "localhost", username = "guest", password = "guest", }; // without line, rabbitmq.log shows error: "ssl: hello: tls_handshake.erl:174:fatal error: protocol version" // when add line go tls 1.2, .net throws exception: remote certificate invalid according validation procedure. // https://stackoverflow.com/questions/9983265/the-remote-certificate-is-invalid-according-to-the-validation-procedure: //

javascript - Should jQuery $.getJSON() method fail when the response is text/html? -

is possible force $.getjson() function raise error when try html (not application/json ). seems deferred returns empty object (or done). how can find in then handler content-type processed in response? have situation when server can return html instead of json when service isn't available. $.getjson() fails when response text/html . see example: $.getjson('http://httpbin.org/html') .then(() => console.log('success'), () => console.log('error')) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

javascript - Get the week as full dates from moment? -

i looking entire week full dates ie: sun sep 18 2016 00:00:00 gmt-0500 mon sep 19 2016 00:00:00 gmt-0500 tue sep 20 2016 00:00:00 gmt-0500 wed sep 21 2016 00:00:00 gmt-0500 thu sep 22 2016 00:00:00 gmt-0500 fri sep 23 2016 00:00:00 gmt-0500 sat sep 24 2016 00:00:00 gmt-0500 im building infinite scroll calendar , need 1 week @ time based on moment().startof('week').tostring() or whichever method best... moment.weekdays() gets me part of way there, if moment.weekdays().robust() ideal... , direction welcomed , appreciated! okay, came solution, works now... const start = moment().startof('week').weekday(0) const week = [...array(7)].map((_, i) => { return start.add('d', 1).format('mmmm yyyy') }) returns: //[ 'september 19th 2016', // 'september 20th 2016', // 'september 21st 2016', // 'september 22nd 2016', // 'september 23rd 2016', // 'sep