Posts

Showing posts from March, 2014

oop - JavaScript Prototype property stealing / inheritance -

is correct way prototype inheritance , property 'stealing??'/inheritance. want inherit properties person constructor + methods. function product(name, price) { this.name = name; this.price = price; } product.prototype.tellme = function() { console.log('name = ' + this.name + ', price = ' + this.price); } function food(name, price, category) { product.call(this, name, price); this.category = category; } food.prototype = object.create(product.prototype); food.prototype.constructor = food; var b = new food('name', 123, 'category'); console.log(b); b.tellme(); var = new product('name2', 321); console.log(a); i appreciate if give me example. thanks! latest javascript standard, ecma6, enables perform inheritance writing class in similar fashion java oop. developer highly familiar java oop, have found approach easy understand , adapt. @ attached snippet code rewritten. hope helps. 'use strict'

reactjs - TypeError: Cannot read property 'map' of undefined in Redux -

while learning react redux trying render user details. getting typical error typeerror: cannot read property 'map' . can understand state.users in mapstatetoprops method undefined . tried using constructor set initial state. no luck. missing trivial? error on return this.props.users.map((user) => { line in createlistitems() method. containers\userlist.js import react, {component} 'react'; import bindactioncreators 'redux'; import {connect} 'react-redux'; class userlist extends component{ createlistitems(){ return this.props.users.map((user) => { // here error return ( <li key={user.id}> {user.firstname} {user.lastname} </li> ); } ); } render(){ return( <ul> {this.createlistitems()} </ul> ); } } function mapstatetoprops(state) { return { users: state.users };

r - Import a data frame stored in the global environment into a function using a character string -

this theoretical question , not reproducible. apologies in advance. i have n dataframes in global environment: df_1, df_2 ... df_n and want operate on these dataframes within function output new dataframes global environment. want function takes name of dataframe , brings function environment operated on, instance: myfun <- function(name){ ... need bring in df1, operate on it, , make new df}) once have function, i'll use lapply apply character string of dataframes need operate on. my question is, how use character string of dataframe names reference dataframes stored in global environment (i.e. - df1, df2 ... dfn) can create new dataframes these referenced ones?

html - Change slowly z-index value after hover has ended on image -

i have blog post set of images enlarged on hover. problem when enlarge element , overlaps other image later in page render order next image on top of enlarged one. the easy way stop give kind of z-index on :hover pseudo selector. have pesky problem when after stop hovering image next 1 on top of fraction of second. you can see behaviour in this imgur album or on jsfiddle (hover first image) in short have following css hovering effect: .photo-exp { position: relative; transition: .4s ease-in-out; /* properties deleted have no connection hovering effect */ } .photo-exp:hover { transform: scale(1.7); z-index : 10; } it easy have same effect javascript , settimeout function. but avoid javascript solution , have css workaround change z-index in time after hovering ends. i tried css transition not working tried eddit this snippet not working in way wanted. you need assign new transition-delay property, , remove hover begins. way z-index can persist time af

javascript - Unzip and Save uploaded Zip File using Node -

i'd appreciate figuring out how zip file unzip. app.post("/api/upload/", upload.single("recfile"), function(req, res){ console.log("saving new zipped shapefile"); console.log(req.file); var tmp_path = tostring(req.file.path; var target_path = "test/" + req.file.originalname; var dest = fs.createwritestream(target_path); var src = fs.createreadstream(tmp_path); src.pipe(unzip.extract({path: dest})); // tojson.fromshpfile(dest).pipe(dest); }); the files upload , save test folder i'm created, receive error regarding unzip code. error: enoent: no such file or directory, open '[object undefined]' i think since code asynchronous, isn't recognizing uploaded file in directory time code runs. promise work in case?

jquery - How to hide form in modal in javascript -

i have modal containing 2 forms, want switch between them when 1 of radio buttons checked, need hide 1 of them in modal load, did following code, doesn't hide, can me in that? form need hidden on modal load called locateonmap hide content. <div class="modal fade" id="modal-frm"> <div class="modal-dialog modal-sm" style="width:480px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h3 class="modal-title">add new farmer</h3> </div> <div class="modal-body"> <form action="addnewcustomer.php" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-sm-4

Loading and displaying dataframes from multiple files in python -

i trying read in multiples files directory , assign different variables using loop. when run script doesn't output results: import pandas pd import os os.chdir("~pathtodirectory") file1="baseball.csv" file2="baseball1.csv" output=dict() x=0 file in [file1,file2]: output[x]=pd.read_csv(file) output[x].head() x=+1 first of all, should using enumerate . secondly, should calling print . for i, file in enumerate([file1, file2]): output[i] = pd.read_csv(file) print(output[i].head()) # <------------ if keys going indices, why not use list instead? output = [] file in [file1, file2]: output.append(pd.read_csv(file)) ...

node.js - SerialPort 'close' event never fire -

i'm using nodejs's serialport package connecting computer ports. about package's close event here . i have created code, know why close / disconnect event never fire when disconnect com const express = require('express'); const router = express.router(); // const cors = require('cors'); router.use(cors()); // const serialport = require('serialport'); const readline = serialport.parsers.readline; const port = new serialport('com7',function (err) { if (err) { return console.log('error: ', err.message); } }); const parser = port.pipe(new readline()); /* var lastresult = ''; var count = 0; */ port.on('open', function() { console.log('~port open.'); parser.on('data', console.log); }); port.on('disconnect', function () { console.log('disconnected'); }); port.on('close', function () { console.log('closed'); }); router.get('/

forms - Why am I unable to override Rails' rendering elements with field_with_errors class? -

i'm told default, if error occurs in model, rails renders form element set so <div class="field"> <%= f.label :price, 'price', :class => "control-label" %> <span class="required">*</span> <br> <%= f.text_field :price, :size => 30 %> <div class='error'><%= show_errors(@user_event, :price) %></div> </div> as <div class="field"> <div class="field_with_errors"><label class="control-label" for="user_event_price">price</label></div> <span class="required">*</span> <br> <div class="field_with_errors"><input size="30" value="" name="user_event[price]" id="user_event_price" type="text"></div> <div class="error">please enter value price.</div> <

Converting existing python classes into Django Models -

i have small program command line interface uses number of python classes thorough implementations. want scrap command line interface , wrap app within django app, i'm learning django , i'm unfamiliar conventions. i have number of classes, in-memory storage structures, getters/setters etc , i'd convert them django models can persist them database , interact them around django app. there general approach doing this? should inherit django.db.models.model class in existing classes , set them direct interaction? or there better, more general/conventional way this? i able use of code in other apps, not necesarilly django ones, don't want modify existing classes in way make them work django. thought of creating models separately , sort of middle-man class manage interaction of actual in-memory class django model class, seems more places have make changes when extend/modify code. thanks ahead of time... personally, modify existing classes extend models.

sql - Listing database names from multiple databases that a user has access to -

i asked supervisor create ssrs report (using sql server 2008)that display database names user has access , making sure user still has active account. can query user names different databases can't seem list database names user has access to. is there way achieve eventhough databases located in different linked server. thank in advance, point me right direction highly appreciated. declare @dbuser_table table (dbname varchar(200), username varchar(250), logintype varchar(500), associatedrole varchar(200)) declare @username varchar(250) set @username = 'dbo' --change desired username set @dbuser_sql='select ''?'' dbname,a.name name,a.type_desc logintype,user_name(b.role_principal_id) associatedrole ?.sys.database_principals left outer join ?.sys.database_role_members b on a.principal_id=b.member_principal_id a.sid not in (0x01,0x00) , a.sid not null , a.type not in (''c'') , a.is_fixed_role &l

scala cats - How to transform a Kleisli[Try, I, A] into I => A -

is there existing combinator or better way write ? def combine[i, a](k: kleisli[try, i, a], default: a) : => = k.run.andthen(_.getorelse(default)) it possible mapping on monadic value using identity: def combine[i, a](k: kleisli[try, i, a], default: a): => = k.mapf[id, a](_.getorelse(default)).run example: scala> val div = kleisli[try, int, string](x => try(1000 / x).map(_.tostring)) div: cats.data.kleisli[scala.util.try,int,string] = kleisli(<function1>) scala> combine(div, "good")(10) res0: string = 100 scala> combine(div, "division zero")(0) res1: string = division 0

string - Python in operator looking for "night" but not counting "knight" -

this question has answer here: string exact match 6 answers regex match entire words only 3 answers i writing program needs find word "night" in string, not word "knight". know write if "night" in string , "knight" not in string but want still include strings include @ least 1 night. later on replaces word night knight, how both fix conditional , correctly replace string "night" "knight" (even if part of word)

php - Laravel not found CSS and JS file after deploy -

i deploy project shared hosting , controllers, models etc works great have problem css , js file becouse have 404 errors files. on xampp server style , script files works great. in opinion opinion may problem .htaccess file don't know how can change in file. .htaccess file: <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # main domain rewritecond %{http_host} ^(www\.)?mypage\.com$ [nc] rewritecond %{https} on [or] rewritecond %{http_host} ^www\. [nc] rewriterule ^ http://mypage.com%{request_uri} [r=301,l,ne] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule>

How to call a program within a bash chunk in R markdown file? -

in block below, tsf_process available directory (is in path env). however, when run chunk: {bash process, echo=true} tsf_process ./raw_data/settings.set 1 i error msg: /tmp/rtmpk4mjsr/chunk-code1c4af3bc4f8b8.: line 2: tsf_process: command not found however, if copy tsf_process file working directory , chunk: {bash process, echo=true} ./tsf_process ./raw_data/settings.set 1 ...everything works ok. is there way avoid step of copying binary file working directory?

scala - How to initialize shared variables before parallel test in scalatest -

i have scalatest codes following: class mytest extends flatspec paralleltestexecution { val testsuiteid: string = generatesomerandomid() should "print test id" in { println(testsuiteid) } should "print test id again" in { println(testsuiteid) } } the 2 tests cannot print testsuiteid generate before them. instead regenerate id , print it. understand because of paralleltestexecution extends oneinstancepertest, each test here runs on own instance , have copy of variable "testsuiteid". but want fixed id test suite , each test case in suite have access fixed without modifying it. tried create fixed id in beforeall{ } still didn't work. how should achieve want? one way work around put shared state in sort of external object: object suiteid { lazy val id: string = generatesomerandomid() } admittedly hack, , wouldn't surprised if scalatest has way handle built-in unaware of.

How to use another variable in Ansible variable? -

how make echo statement here correct?when use ansible debug module able correctly value, not in shell module. cat /data/info.txt a:8080,b:8081,c:8082 cat /data/num 0 - hosts: dev remote_user: root gather_facts: false tasks: - name: dir path , port info shell: cat /data/info.txt register: info - name: last num shell: cat /data/num register: num - name: test shell: echo {{ info.stdout.split(',')[{{ num.stdout }}].split(':')[0] }} >>/tmp/test.txt once open jinja2 expression {{ , should use bare variables until terminated }} . quoting faq : another rule ‘moustaches don’t stack’. see this: {{ somevar_{{other_var}} }} the above not work what might looking (because still didn't include expected result) is: shell: echo {{ info.stdout.split(',')[ num.stdout|int ].split(':')[0] }} >>/tmp/test.txt on top of not stacking moustaches, need pay a

firebase - admin.ref.on() is not working while once() works perfectly -

i found strange problem documented feature seems not working. i have working code: exports.getevents = functions.https.onrequest((req, res) => { cors(req, res, () => { admin.database().ref('events').orderbyvalue().once('value', function(snapshot) { res.status(200).send(snapshot.val()); }).catch(error => { console.error('error while reading data', error); res.status(403).send('error: ' + error); }); when change once() on() errors. what want achieve have server send new json payload when there changes events since have app reads events.json directly , can use link provide data (so sdk functions out). doing wrong? error log: typeerror: admin.database(...).ref(...).orderbyvalue(...).on(...).catch not function @ cors (/user_code/index.js:24:11) @ cors (/user_code/node_modules/cors/lib/index.js:188:7) @ /user_code/node_modules/cors/lib/index.js:224:17 @ origincallback (/user_code/node_modules/c

java - Gradle dependencies of local dependency -

so let's have project a, requires dependencies. , have project b, has project 1 of dependencies. have following code in project b's build.gradle: project b's build.gradle: dependencies { compile files("projecta_dir/build/libs/projecta.jar") } however, since gradle not include project a's dependencies in projecta.jar default. wondering if there's way let project b compile project without creating fatjar project a. the jar file doesn't contain transitive dependencies , doesn't have pom file describes dependencies used module. it means that, if importing jar file using compile files you have specify dependencies in project . you should use maven repository , private or public, avoid issue. in case, gradle downloads dependencies using pom file contains dependencies list.

c# - How can I get Texture2D from material? -

firstly sorry english. i'm trying texture2d material i'm getting error "texture '' no data". if tried normal texture, there no problem when tried texture2d, returns error. know how texture2d material?? thanks //this line of code i'm using now. texture2d temp = target.getcomponent<renderer>().material.maintexture texture2d;

sql - Converting from varchar to numeric -

i have 2 columns latitude , longitude . should have been set them numeric upon importing fixed width file, not have time re-do process. i'm using sql server express , have use import wizard. there 92 columns. anyways, using following code , getting error (shown below) when try change varchar(9) numeric (11,6) . have modified settings can make changes names , datatypes. know using design feature in object explorer yield similar error. other ways around dilemma? code: alter table dbo.tablename alter column latitude numeric(11,6); error: msg 8114, level 16, state 5, line 1 error converting data type varchar numeric. just found following code: alter table tablename alter column latitude float why did work, not previous? you need find value. i'm not sure sql server express supports isnumeric() , 1 possibility: select latitude tablename isnumeric(latitude) = 0; otherwise, can approximate like : where latitude not '%[^0-9.]%'

Manipulate string from File Stream in Elixir -

i new elixir. trying take text file turn graph. the file formatted such: 1 2 1 3 2 3 each number being id of connected nodes. how can take 2 values string.split/1 function somewhere else in program ? had far: file.stream!("../text_file") |> stream.map( &(string.replace(&1, "\n", ""))) |> enum.each(string.split/1) it output :ok atom, print content if swap string.split/1 io.puts/1 enum.each/2 meant used functions don't care return value (usually functions side effects, io.puts ). if want collect returned data, need enum.map/2 . also, if want delete trailing whitespace, should use string.trim_trailing/1 ) file.stream!("a") |> stream.map(&string.trim_trailing/1) |> enum.map(&string.split/1) |> io.inspect output: [["1", "2"], ["1", "3"], ["2", "3"]]

android - How do I access individual _id columns when there are multiple _id columns from a join? -

using typical _id column , joining tables , selecting columns when creating cursor, result in cursor contains multiple _id columns. to access specific _id column require using actual offset, opposed column name. using hard coded offsets can problematic, makes code harder read , maintain. for example 2 tables shops , aisles per shops table has columns _id shopname aisles has columns _id aisleshoplink aislename then might want cursor containing aisle , associated shop (aisleshoplink holding _id of respective shop aisle in). using select * aisles left join shops on aisleshoplink = shops._id will result in cursor has columns _id (aisle's _id offset=0) aisleshoplink (value respective shop's _id, offset = 1) aislename (offset =2) _id (the shop's _id, should match aisleshoplink, offset = 3) shopname (offset =4) the resultant cursor has nothing distinguish _id columns other offset. can't prefix table name in sql. i.e cursor

Is there a way to set maxDate or minDate with a function in bootstrap datapicker? -

i looking simple me did not find in here , in bootstrap datetimepicker documentations well. the idea simple. have 2 datetime fields have values @ page_load retrieved server. now want make sure maxdate of first date second date value , mindate of second date date of first field. here code: $(document).ready(function () { $('[id^="datetimepickerstartdate"]').datetimepicker({ usecurrent: false, format: applicationdatetimeformat, ignorereadonly: true, //maxdate: function() { // var id = $(this).attr('id'); // var str = id.split("_"); // if (str.length <= 1) { // var seconddatetimepicker1 = $('#datetimepickerfinishdate').data("datetimepicker").date(); // if (seconddatetimepicker1.length) { // return seconddatetimepicker1; // } // return null; // } else { // var seconddatetimepicker2 = $("#datetimepickerfi

ARIA Accessibility in Angular 2 and 4 -

i have been manually including aria attributes in component templates when came across angular-aria module: https://docs.angularjs.org/api/ngaria however, angularjs. there equivalent module angular 2 , 4 silently injects aria attributes on components @ runtime? i have looked @ question: how include ngaria in , angular 2 application? doesn't seem have answer. your question has short answer , long one, let's see those? is there equivalent module angular 2 , 4 silently injects aria attributes on components @ runtime? let's first refer kb angularjs: using ngaria simple requiring ngaria module in application. ngaria hooks standard angularjs directives , quietly injects accessibility support application @ runtime. as angular 2 has tried have built-in support aria , there no such equivalent module needed, , there no supplementary 1 i'm aware of. so, yes, it's implicitly supported, , no, there no such module (required). accessibili

raspberry pi - Processing and GLVideo Error eventually breaking RaspberryPi GPIO connection with sketch -

please help! sketch runs great, acts zoetrope - have bike wheel set sends pulse each revolution , pulse scrubs next frame of video. problem stops reading after few minutes. ideas why happening? import com.pi4j.io.gpio.gpiocontroller; import com.pi4j.io.gpio.gpiofactory; import com.pi4j.io.gpio.gpiopindigitalinput; import com.pi4j.io.gpio.pinpullresistance; import com.pi4j.io.gpio.raspipin; import gohai.glvideo.*; glmovie video1; gpiocontroller gpio; gpiopindigitalinput button; float interval = 0; void setup() { size(500, 500, p2d); gpio = gpiofactory.getinstance(); button = gpio.provisiondigitalinputpin(raspipin.gpio_02, pinpullresistance.pull_down); video1 = new glmovie(this, "wheel_1.mp4"); video1.play(); video1.jump(0); video1.pause(); } void draw() { //nocursor(); clear(); //whistlesong610pm if (button.ishigh()) { println(interval); clear(); // background(255); interval = interval + 15 ; if (video1.available()) {

kafka streams simulate join within the stream -

need suggestions on best approach solve problem - i developing kafka stream processing application source log stream contains 2 types of messages - employeeinfo , departmentinfo. not have control on log stream, cannot change schema or how written. following schema of messages - employeeinfo schema {employeeid, employeename, departmentid} departmentinfo schema {departmentid, departmentname} i need build log stream kinda simulates kafka stream join, merges these 2 types of message type follow - source ts 0 = employeeinfo { 1, first employee, 10 } source ts 1 = employeeinfo { 2, second employee, 20 } source ts 2 = employeeinfo { 3, third employee, 10 } source ts 3 = departmentinfo { 10, marketing } here, matched departmentinfo message departmentid=10, kafka processor has merge employeeinfo messages departmentid=10 , forward sink processor. sink stream: message 0 => employeedepartmentinfo { 1, first employee, 10, marketing } sink stream: message 1 => emplo

sql server - aggregate query sum value used twice in results -

this query problem part of barcode scanning system. can't results need show. either aggregate has right math, , displayed wrong, or displayed in desired format wrong math. i use sub-query aggregate "items pulled/scanned" , join order line items. problem in grouping. see examples. this results of subquery count "pulled" items. staff_id sumpulls iec-c13-6ft 2 pj-5000-wuxga 1 sam-tm300 1 desired format - grouped category, (and repeats use of sum value) category parentid item number qty sumpull sorting 2-consoles null sam-tm300 1 1 sam-tm300 2-consoles sam-tm300 iec-c13-6ft 1 **2** sam-tm300iec-c13-6ft 4-cmputers null laptop 1 null laptop 4-cmputers laptop laptop-ps-l90w 1 null laptoplaptop-ps-l90w 4-cmputers laptop mouse-wired 1 null laptopmouse-wired

logging - PowerShell Log Function Readability -

currently log function spits out information in single column , hard read. there way make split different columns each (displayname, poolname, poolsnapshot, , desktopsvivmsnapshot) , respective information put correctly? function log ([string]$entry) { write-output $entry | out-file -append "c:\logs\snapshot.csv" } add-pssnapin quest.activeroles.admanagement $date = get-date -format "mm-dd-yyyy" $time = get-date -format "hh:mm:sstt" # begin log log $(get-date) log "the below desktops not using correct snapshot." if (@($desktopexceptions).count -lt 1) { write-output "all desktops in $pool using correct snapshots." | out-file -append "c:\logs\snapshot.csv" } else { write-output $desktopexceptions | select-object displayname,poolname,poolsnapshot,desktopsvivmsnapshot | sort displayname | out-file -append "c:\logs\snapshot.csv" } log $(get-date) 09/11/2017 12:16

java - LocalDateTime.of returns null -

i trying unit test code uses java.time.localdatetime . i'm able mock working, when add time (either minutes or days) end null value. @runwith(powermockrunner.class) @preparefortest({ localdatetime.class }) public class localdatetimemocktest { @test public void shouldcorrectlycalculatetimeout() { // arrange powermockito.mockstatic(localdatetime.class); localdatetime fixedpointintime = localdatetime.of(2017, 9, 11, 21, 28, 47); bddmockito.given(localdatetime.now()).willreturn(fixedpointintime); // act localdatetime fixedtomorrow = localdatetime.now().plusdays(1); //shouldn't have npe? // assert assert.asserttrue(localdatetime.now() == fixedpointintime); //edit - both null assert.assertnotnull(fixedtomorrow); //test fails here assert.assertequals(12, fixedtomorrow.getdayofmonth()); } } i understand (well think do) localdatetime immutable, , think should new instance instead

ios - Swift: Keeping copies of data consistent across multiple viewControllers & Arrays -

i'm building app similar functionality instagram, , i'm not sure how best structure data tableviews , collectionviews. let's go on views first. newsfeed vc own array of posts (newest information) group vc own array of posts (group specific information there ~30 different groups) search vc own array of posts (search result specific) expanded vc displays post in full screen the problem user can like/comment on post in group/search vc might in newsfeed vc or vice versa. currently passing index vc vc , modifying data in array. has lead few problem end looping on other arrays sync likes/comments , have refresh tableview user change in present locally. i'm wondering if there more efficient/logical way store of data. need group data separate newsfeed data, , user can change group whenever want see other posts. i've never used core data, i'm open anything. ideally, i'd able store of information in 1 place single copy of every post. right if post

testing - how to test the result in goroutine without wait in test -

when ut of golang, need test result in goroutine, using time.sleep test, wondering there better way test. let's have example code this func hello() { go func() { // , store result example in db }() // } then when test func, want test both result in goroutine, doing this: func testhello(t *testing.t) { hello() time.sleep(time.second) // sleep while goroutine can finish // test result of goroutine } is there better way test this? basically, in real logic, don't care result in goroutine, don't need wait finished. in test, want check after finished. if want check result goroutine, should using channel. package main import ( "fmt" ) func main() { // in test c := hello() if <-c != "done" { fmt.println("assert error") } // not want check result hello() } func hello() <-chan string { c := make(chan string) go func() { f

Python Logging Error -

so i'm using python logging module first time, , i'm receiving error cannot find information on. at start of file, have following: logging.basicconfig(level=logging.info, filename='logs', filemode='a+', format='[%(asctime)-15s] %(levelname)-8s %(message)s') the line that's throwing error: logging.info(f'downloading: {file_name}\t{local_file_path}\t{os.path.abspath(local_file_path)}') --- logging error --- traceback (most recent call last): file "c:\python36\lib\logging\__init__.py", line 996, in emit self.flush() file "c:\python36\lib\logging\__init__.py", line 976, in flush self.stream.flush() oserror: [errno 22] invalid argument call stack: file "main.py", line 81, in <module> main() file "c:\python36\lib\site-packages\click\core.py", line 722, in __call__ return self.main(*args, **kwargs) file "c:\python36\lib\site-packages\click\core.py", line 6

sublimetext3 - SublimeText 3 - dynamically enable/disable invisible white space option -

is there dynamic way enable , disable invisible white space display apart persistent setting, via: "draw_white_space": "all", the way control state of display white space via changing setting reference in question, draw_white_space : // set "none" turn off drawing white space, "selection" draw // white space within selection, , "all" draw white space "draw_white_space": "selection", for many such settings boolean value, can bind key toggle_setting command, telling setting want toggle between. however, case of draw_white_space option, takes string argument of either "all" , "selection" or "none" , standard toggle command won't work. the following simple plugin implements toggle_white_space command performs operation you. use it, select tools > developer > new plugin... menu, replace stub code see plugin code here, , save .py file in location sublime d

ios - Only cellForRowAt indexPath not called all other dataSources and delegates are called -

i trying make framework , preferring in code figured out way main problem facing can't put data in table because cellforrowatindexpath not getting called. i have set delegate , datasource . i have added numberofrowsinsection , returns 10. i have added heightforrowatindexpath , returns 10. i have added cellforforatindexpath , return cell. the main problem these other methods called have added print statements in of them except cellforforatindexpath . the problem can't try debugging because method not called. class popcontrol: nsobject, uitableviewdatasource, uitableviewdelegate { let tableview = uitableview() func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath) { print("row selected") } func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell { print("cell row @ index path called") let cell = uitableviewcell() cell.textlab

angular - Multi item select feature in Angular4 drag and drop -

i working on angular4 , have requirement need implement drag , drop feature multiple items selected. have used ng2-drag-drop , dragula , these allow drag , drop single item . there way implement drag , drop in angular4 multi item select feature?

c++ - Is vftable[0] stores the first virtual function or RTTI Complete Object Locator? -

it's known c++ use vftable dynamicly decide virtual function should called. , want find out mechanism behind when call virtual function. have compiled following code assembly. using namespace std; class animal { int age; public: virtual void speak() {} virtual void wash() {} }; class cat : public animal { public: virtual void speak() {} virtual void wash() {} }; void main() { animal* animal = new cat; animal->speak(); animal->wash(); } the assembly code massive. don't quite understand following part. const segment ??_7cat@@6b@ dd flat:??_r4cat@@6b@ ; cat::`vftable' dd flat:?speak@cat@@uaexxz dd flat:?wash@cat@@uaexxz const ends this part defines vftable of cat. have 3 entries. first entry rtti complete object locator. second cat::speak. third cat::wash. think vftable[0] should imply rtti complete object locator. when checking assembly code in main proc , cat::cat proc, invoke animal->speak() imp

How to have component level data in EJS using Webpack -

i using ejs using htmlwebpackplugin webpack. @ moment have json file per each page , working ok. doing website different theme , love send data per component instead of per page. seems not possible through htmlwebpackplugin. in page have <%- include ../../components/header/header.ejs %> which works fine. however, have like <%- include('../../components/header/header.ejs', {site: 'secondwebsite'}); %> which getting error: error in ./~/html-webpack-plugin/lib/loader.js!./src/templates/pages/avalon/index.ejs module build failed: error: enoent: no such file or directory, open 'c:\projects\ui\src\templates\layouts\secondwebsite\('..\components\header\header.ejs', {site: 'secondwebsite'});' i wondering if has solution this?

python - Face comparison (Not recognition or detection) using OpenCV and Keras? -

first of here github link question . and here question: i face comparison function using python. , can successfully(?) recognize faces using opencv. now, how do comparison thing ? what understand this: in general machine learning approach, need gather lots of data particular person , finalize using cnn. however, got 2 images, how do comparison? should think in terms of classification or clustering (using knn)? thank in advance help. you can use idea of face-embeddings, example proposed in highly-cited paper facenet , implemented in openface (which comes pre-trained). the general idea: take preprocessed face (frontal, cropped, ...) , embedd lower dimension characteristic, similar faces in input should have low euclidean-distance in output. so in case: use embedding-cnn map faces reduced space (usually vector of size 128) , calculate distance in euclidean-space. of course cluster faces then, that's not task. the thing here besides general idea: op

java - Is it possible to combine Keyword Driven Framework with Robot Framework? -

i've followed tutorial http://toolsqa.com/selenium-webdriver/keyword-driven-framework/project-code-base/ create keyword driven framework project , it's succeed test webapps . is possible use keyword library on robot framework existing action keyword ? i've read post https://github.com/robotframework/javalibcore/wiki/annotationlibrary but still don't understand how use it. i've add dependencies , plugin robot framework, should next ?

android - Which dependency will Gradle choose given multiple maven repository? -

in gradle project, can define multiple remote / local maven repository. buildscript { repositories { mavenlocal() mavencentral() jcenter() maven { url 'https://example1.mavenrepo.com/public' } maven { url "https://example2.mavenrepo.com/release" } } dependencies { classpath 'com.example.mydependencies:mylibrary:1.0.0' } } if mylibrary exist in of maven repo. 1 gradle choose? can configure gradle download mylibrary in maven repo? as can find in the doc a project can have multiple repositories. gradle dependency in each repository in order specified, stopping @ first repository contains requested module .

openssl - authentication certificate error in ssl -

hi trying send publish , subscribe message through tls ssl. getting following error. ssl: certify: ssl_alert.erl:88:fatal error: unknown ca i followed website generate certificate keys: https://www.rabbitmq.com/ssl.html any appreciated.

intellij idea - Hot Swapping Webapp Files -

i running application in production mode (war not exploded) on glassfish server , want know if it's possible hot swap front end files? currently when hot swap, in backend (it being java). possible files under webapp directory? the run/debug configuration window glassfish-within-intellij supports hot deployment: for exploded artifacts, available options are: update resources . changed resources updated (html, jsp, javascript, css , image files). update classes , resources . changed resources updated; changed java classes (ejbs, servlets, etc.) recompiled. etc looks need choose update resources option. more details in docs . update 1: packed (i.e. unexploded) artifacts available options are: hot swap classes . changed classes recompiled , reloaded @ runtime. option works in debug mode. redeploy . application artifact rebuilt , redeployed. restart server . server restarted. application artifact rebuilt , redeployed.

sql server - Sql joining from two tables -

Image
i have 2 tables same structure. want display non matching records both tables based on id, should displayed in same row below image: there's little go on, maybe like: select table1.id, table1.name [, table1.etc] table1 left join table2 on table1.id = table2.id table2.id null union select table2.id, table2.name [, table2.etc] table2 left join table1 on table2.id = table1.id table1.id null

javascript - how to check overlapping of multiple number ranges injavascript -

i have problem in javascript in need determine if set of number ranges has overlapping. examples : 1 - 5, 4 - 6, 7 - 8 (has overlap) 1 - 5, 6 - 8, 9 - 12 (has no overlap) thanks in advance! the set of ranges must sorted first, starting element greater(not less than) previous starting number.in case sorted. every range check whether starting number greater previous ending number. if true ranges, non overlapping. var ranges=[[1,5],[4,6],[7,8]]; ranges.sort() // sorting done respect first element in array. for(var i=1;i<ranges.length;i++){ //start second element , compare first if(ranges[i][0]<=ranges[i-1][1]) break; } if(i==ranges.length) console.log("non overlapping") else console.log("overlapping")

python - Check if a Excel Sheet is empty -

i have excel workbook multiple sheets. need delete sheets empty, code when processing finds blank sheet fails. os.chdir(path) list_file=[] file in glob.glob("*.xlsx"): print(file) list_file.append(file) i have listed files here available. ab_list=[s s in list_file if "india" in s] cd_list=[s s in list_file if "japan" in s] then, store file names list per requirement. need delete empty sheets excel files before move them dataframe. loop through read files individual dataframe. you've tagged openpyxl assume you're using that. # workbook opened ms exel sheet opened openpyxl.workbook empty_sheets = [] name in workbook.get_sheet_names(): sheet = workbook.get_sheet_by_name(name) if not sheet.columns(): empty_sheets.append(sheet) map(workbook.remove, empty_sheets)

android - change color of spinner items -

how change text color of spinner item ithout custom adapter styles.xml <style name="mytheme1" parent="theme.appcompat.light"> <item name="android:textappearancelistitemsmall">@style/myspinnerstyle</item> </style> <style name="myspinnerstyle" parent="textappearance.appcompat.subhead"> <item name="android:textsize">13sp</item> <item name="android:textcolor">@color/white</item> </style> i adding style spinner <spinner style="@style/myspinnerstyle" android:id="@+id/cases" android:layout_width="wrap_content" android:layout_height="60dp" android:layout_alignparentbottom="true" android:layout_alignparentstart="true" android:dropdownverticaloffset="60dp" android:entries="@array/main_array" /> you n

r - Using observer to hold the resulted data subset in a vector -

i new shiny r. can me solve issue below. i trying plot data using dataset, , user defined option "all" added "selectlist" of "region" provided in ui. when "all" option selected "selectlist", how can use below observer store information regions vector "l", same can used query based on other user inputs observe({ if("all" %in% input$region) { selected <- setdiff(allchoice, "all") updateselectinput(session, "region", selected = selected) } }) ref: how add user defined value select list of values dataset ui.r library(shiny) library("rmysql") library(ggplot2) library(plotly) library(dt) library(dplyr) dataset <- read.csv("dataset.csv", header=true) dataset$x <- null allchoice <- c("all", levels(dataset$region)) fluidpage( title = "abc xyz", hr(), fluidrow( titlepanel("abc xyz"

Java XML Parser for huge files -

i need xml parser parse file approximately 1.8 gb. parser should not load file memory. any suggestions? aside recommended sax parsing, use stax api (kind of sax evolution), included in jdk (package javax.xml.stream ). stax project home: http://stax.codehaus.org/home brief introduction: http://www.xml.com/pub/a/2003/09/17/stax.html javadoc: https://docs.oracle.com/javase/8/docs/api/javax/xml/stream/package-summary.html

python - initialize matrices in tensorflow -

i have 6 matrices, model learn, defined them follow: self.r= tf.get_variable('r_',dtype=tf.float32, shape=[6,300 ,300], initializer=tf.random_uniform_initializer(maxval=0.1, minval=-0.1)) what need change initialization. want initialize each 1 of them identity matrix. can me that? if want create 6x300x300 matrix each 300x300 array identity matrix can simply: import numpy np; dimension = 300 singleidentitymatrix = np.identity(dimension, dtype= np.float32) stackedmatrix = np.dstack( [singleidentitymatrix] * 6) and pass matrix self.r = tf.variable(initial_value = stackedmatrix)

reset - Docker Chains will be resetted by iptables -

actually have issues docker service. after few min, following rules deleted iptables. iptables after: chain input (policy accept) target prot opt source destination fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh chain forward (policy accept) target prot opt source destination chain output (policy accept) target prot opt source destination chain fail2ban-ssh (1 references) target prot opt source destination drop -- x.x.x.x anywhere return -- anywhere anywhere chain trafficfilter (0 references) target prot opt source destination iptables before: chain input (policy accept) target prot opt source destination fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh chain forward (policy accept) target prot opt source destination docker-user -- any