Posts

Showing posts from May, 2013

vba - How to filter items sendername from Items_ItemAdd Events? -

private withevents items outlook.items private sub application_startup() dim ns outlook.namespace dim folder outlook.mapifolder set ns = application.getnamespace("mapi") set folder = ns.getdefaultfolder(olfolderinbox) set items = folder.items end sub private sub items_itemadd(byval item object) if typeof item outlook.mailitem printattachments item end if end sub i made rule outlook automatically print incoming email attachment, exception of few coworkers'email. if stop rule macro not working on own(supposing should,code error?) if rule's enabled every email attachment printed twice. one every page , 1 first page. there way work around this? kindly assist , in advance! work items.restrict method (outlook) exclude senders name. filtering items example private withevents items outlook.items private sub application_startup() dim olns outlook.namespace dim inbox outlook.mapifolder dim filter string filter = &qu

Azure Bot code seems to be erased -

Image
i'm working on bot (in testing) using azure bot framework , chat embed code. had started luis framework template , embedded section of website several days ago. working expected, of files/code (using azure editor) seem erased , chat embed throws 502. this looks may similar this: how recover bot made azure bot service (botframework)? but did not have answer work on end. this test bot (so didn't use continuous integration/source control anyhow), , learning @ point, appreciated. thanks! please download azure storage explorer here: http://storageexplorer.com/ login, , navigate resource group's storage account. when open it, you'll see file shares. there you'll find source bot. the bot service , bot framework in preview , being improved upon daily. apologize inconvenience, , hope future experiences bot framework productive , enjoyable.

ubuntu - IDE connect to VM as if programming locally -

is there way me have ide running in host side (phpstorm) connects vm (vagrant etc) in such way can edit project resides in guest side feels project in host side? i know can use ftp or ssh browse through remote files, treats vm separate machine in same network. using make phpstorm features unusable quick file searches, mapping of code definitions etc. know can download code host side , sync. if have many projects in vm, can bit tedious download sources first started. if download few files first, can't search on other files. there way have setup this? guest holds code guest has third party dependencies (memcache, etc) ide in host side ide accesses code in guest treats local code host browser accesses output via accessing guest's url (no problem here) i have windows host , ubuntu guest on vm. workstation runs guest running when fire phpstorm ide on ubuntu, guest slows down point of being unusable. have made optimizations host, guest , ide still slow down persists.

Android SQLite not deleting row by id -

i trying delete row given specific id , see update reflected in listview, row not deleted. same process works update , not delete. here code: mainactivity.java ... @override public void onpositiveclick(dialogfragment dialog, int which) { //shared preferences sharedpreferences pref = getsharedpreferences(editlog.pref_filename, 0); long id = 0; string date = ""; string hours = ""; string lessontype = ""; string weathercondition = ""; if (!(pref == null)) { id = pref.getlong("rowid", 0); date = pref.getstring("date", ""); hours = pref.getstring("hours", ""); lessontype = pref.getstring("lessontype", ""); weathercondition = pref.getstring("weathercondition", "");

issues when Iterate Map with list as value using groovy -

def map = new hashmap<string,list<string>>() def list = new arraylist<string>() def list1 = new arraylist<string>() list.add("hello1") list​.add("world1") list.add("sample1") list.add("sample1")​​​​​​​​​​​​​​​​​​​​​​​​ list1.add("hello2") list1.add("world2") list1.add("sample2") list1.add("sample2") map.put("abc",list) map.put("bcd",list1) def data = new arraylist<string>() for(e in map){ println "key = ${e.key} value=${e.value}" // data = "${e.value} string[]" data = "${e.value}" println "size ${data.size()} " --(b) check(data) ​} def check(input) { println "${input.size()}" ---(a) for(item in input){ print "$item "​​​​​​​​​​​​​​​​​} ​}​ i have pass string[] java function groovy script. trying read array list , convert string array. problem when assign {e.value} variable data , try size

python - how to join multiple csv files without repetition? -

i have 3 csv files should have same date column that: file1.csv file2.csv file3.csv date,price1 date,price2 date,price3 2017-03-03,1900 2017-03-03,1200 2017-03-03,1220 2017-03-04,2900 2017-03-04,2200 2017-03-04,2233 2017-03-04,1300 2017-03-04,1549 2017-03-04,1520 i want join them , using python: file4.csv date,price1,price2,price3 2017-03-03,1900,1200,1220 2017-03-04,2900,2200,2233 2017-03-04,1300,1549,1520 one can combine 2 files @ time. repeat process other files well. import pandas pd df1 = pd.read_csv('file1.csv') df2 = pd.read_csv('file2.csv') df3 = pd.read_csv('file3.csv') df12 = pd.merge(df1, df2, how='outer', on='date') df123 = pd.merge(df12, df3, how='outer', on='date') print(df123)

Use SPARQL property path on DBpedia -

i'd find out if property paths exist between 2 entities on dbpedia. sample query tried on snorql : select * { :braveheart (:|!:)* :mel_gibson } limit 100 the queries runs memory error: virtuoso 42000 error tn...: exceeded 1000000000 bytes in transitive temp memory. use t_distinct, t_max or more t_max_memory options limit search or increase pool sparql query: define sql:big-data-const 0 #output-format:application/sparql-results+json define input:default-graph-uri prefix owl: prefix xsd: prefix rdfs: prefix rdf: prefix foaf: prefix dc: prefix : prefix dbpedia2: prefix dbpedia: prefix skos: select * { :braveheart (:|!:)* :mel_gibson } limit 100 i suspect someone's going suggest setting local dbpedia mirror. if that's case, i'd love detailed steps on how so. i think query bit wrong you're trying answer... there no variables in select * can't project out (i'd consider bug compile this), let me rephrase query to ask { dbr:braveheart (<&

windows - Creating batch file to start cygwin and execute specific command -

i want create batch file thats start cygwin , executes specific command (the command read bash file , executes command inside it). this batch file have developed, works extent. cygwin terminal opens , tries read bash file, cannot execute commands inside: @echo off c:\cygwin64\bin\mintty.exe -li /cygdrive/c/(path-to-bash-file-location)/(mybashfile) pause how can make work? from batch file, launch cygwin's bash shell , use login flag. provides foundation setting path , environment variables through .bash_profile or .bashrc files. believe may source of difficulties. @ echo off c:\cygwin64\bin\bash --login -c "cd ~/path/to/desired; ./mybashfile.sh" if provide more details nature of bash file, can more specific. luck.

php - Codeigniter: load library array with default parameter array and other library in one line code -

hi below current code sample: as can seen, have load library mylog separately default parameter array. $this->load->library(['tank_auth', 'session', 'form_validation']); $log_config = array( 'module' => 'estate', ); $this->load->library('mylog', $log_config); is there way load mylog library others in 1 line has default parameters $log_config array passed it? there no way load library others in 1 line has default parameters array passed it. you cannot load library array default parameter array , other library in 1 line code. as per codeigniter docs, can load library in question $this->load->library(['tank_auth', 'session', 'form_validation']); or "library" single argument: array of parameters, in question: $log_config = array( 'module' => 'estate', ); $this->load->library('mylog', $log_config);

javascript - How I can store and fetch request from moongodb from and into Chrome Extension? -

here trying attempt. have chrome extension using on browser. wanted connect extension mongodb @ localhost . not understanding how can extension. here link complete extension: chrome extension code kindly suggest me how can connect mongodb extension? database name extension , collection name chrome .

ruby on rails - Get events accoding to user's time zone not DB + Rails4 -

i have 3 events. contains start_time of show. but problem facing time zone . value saved in db in utc rails default behaviour. how works: user can select date time date time picker. as per user, choosed 2017-04-08 04:00:00 ist, event saved in database 2017-04-07 21:30:00 utc. scenario : when user trying fetch events 8th april , returns nothing because there no events 8th april according database. in case time zone like: 1) mumbai (+05:30) 2) pacific time (us & canada) (-08:00) so in these cases, never correct events according user's time zone. below events created 8th april saved 7th april whenever user come , see event in calender, never appeared. <event id: "1250", title: "lgkg", description: nil, created_by: "12345", account_id: "35", repeat: true, start_time: "2017-04-07 21:30:00", created_at: "2017-04-07 05:17:33", updated_at: "2017-04-07 05:17:33"

rest - Getting connection refused error while hitting a URL -

i trying hit url through httpclient api,postmethod api passing json input value i'm inserting in entity part of post method. based on json input i'l getting output value. while executing execute(postmethod) i'm getting connection refused error.

linux - Verify if a local port is available in python -

i have project spawn subprocesses, again take port number bind to. port number assigned python script, take random port between 49152 , 65535. i want verify if port available , not used other tool on local system (*nix). from another question have snippet: import socket; sock = socket.socket(socket.af_inet, socket.sock_stream) result = sock.connect_ex(('127.0.0.1',80)) if result == 0: print "port open" else: print "port not open" could use in case? not open port , not close further use? simply create temporary socket , try bind port see if it's available. close socket after validating port available. def tryport(port): sock = socket.socket(socket.af_inet, socket.sock_stream) result = false try: sock.bind(("0.0.0.0", port)) result = true except: print("port in use") sock.close() return result

equalto query firebase angularjs giving null values -

Image
i have database structure in firebase this: i wan't query database through child 'organization' child 'access_points' match ssid equalto abacus , return access_point. have written code : var ref1 = new firebase("firebaseurl/organization"); var name = ref1.child("access_points").orderbychild('ssid').equalto('abacus') .on('value', function(snap) { $scope.acc_pt = snap.val(); console.log($scope.acc_pt); }); but query not going ssid , returning null values in console. don't know how query nested nodes. can help? var ref1 = new firebase("firebaseurl/organization"); here making reference on organization node , "access_points" not direct child of reference , direct child -kh3dxktbupqhs_bl5d- query must : var name = ref1.child("-kh3dxktbupqhs_bl5d-").child("access_points").orderbychild('ssid').equalto('abacus')

Angular 2 ControlValueAccessor for custom checkbox, How inside to outside value get updated? -

i trying implement custom component checkbox using bootstrap 4 checkbox layout. i following link implement custom component http://almerosteyn.com/2016/04/linkup-custom-control-to-ngcontrol-ngmodel i did radio, checkbox taking input array of ids , output array of ids based on selection. checkbox created based on list of js model instance. export class inputprop<t>{ displayname?:string; order?:number; constructor( public checked:boolean=false, public value:string, public id:t) {} } but 1 thing not understanding, how angular 2 read inner value , update outside modal there writevalue method read outside component ngmodel values. is there method readvalue source code checkbox-button.component.ts import { inputprop } './../../models/common.classes'; import { titlecasepipe } './../../../pipes/title-case.pipe'; import { formgroup, formcontrol, formbuilder, controlvalueac

java - Cannot deserialize JSON with missing polymorphic field -

i have class follows class xyz { private string type; private typespecific typespecific; public typespecific gettypespecific() { return typespecific; } @jsontypeinfo( use = jsontypeinfo.id.name, include = jsontypeinfo.as.external_property, property = "type" ) @jsonsubtypes({ @jsonsubtypes.type(value = atypespecific.class, name = "a") }) public void settypespecific(typespecific typespecific) { this.typespecific = typespecific; } } class atypespecific extends typespecific. i want deserialize json {"type":"b"} typespecific set null in object. getting following exception: com.fasterxml.jackson.databind.jsonmappingexception: missing property 'typespecific' external type id 'type' how deserialize above mentioned json object? dependency versions: jackson-annotations: 2.7.0, jackson-core: 2.7.4, jackson-databi

c# - Unable to start the windows service -

this question has answer here: activex control cannot instantiated because current thread not in single-threaded apartment 1 answer .net windows service needs use stathread 5 answers i writing service read data values simulator. when try debug service receiving following exception: " activex control cannot instantiated because current thread not in single threaded apartment ". in regard appreciated.

node.js - single quote escape - sequelize migration -

i'm using nodejs sequelize orm , postgress database i'm creating enum column named education_level in table using migration file below , enum value (bachelor's degree) has single quote , gives below error when try run migrations, thank helping! migration file 'use strict'; module.exports = { up: function(queryinterface, sequelize) { return queryinterface.createtable('education', { id: { allownull: false, autoincrement: true, primarykey: true, type: sequelize.integer }, school: { type: sequelize.string }, degree: { type: sequelize.string }, field_of_study: { type: sequelize.string }, year_started: { type: sequelize.string(4) }, year_graduated: { type: sequelize.string(4) }, education_level: { type: sequelize.enum, values: ['diploma','bachelor\'s degree','

Apache .htaccess: CORS * on localhost only -

i have 2 projects, 1 php web api following .htaccess : header add access-control-allow-origin "http://app.domain.com" header add access-control-allow-headers "origin, x-requested-with, content-type" header add access-control-allow-methods "put, get, post, delete, options" header set access-control-allow-credentials true rewriteengine on rewritecond %{script_filename} !-f rewritecond %{script_filename} !-d rewritecond %{script_filename} !-l rewriterule ^(.*)$ index.php/$1 note access-control-allow-origin header contains base url of second project (an angularjs application). this work, i'd change origin * if both projects being run on localhost, every developer within project can test changes without deploying first. how can achieve this? we not want use separate .htaccess local tests. prefer use single one.

C++ Transfer Files From Qt to External USB Drive -

i new in qt , need in transferring files specific path of local machine external usb drive. copying single file you can use qfile::copy . qfile::copy(srcpath, dstpath); note: function doesn't overwrite files, must delete previous files if exist: if (qfile::exist(dstpath)) qfile::remove(dstpath); if need show user interface source , destination paths, can use qfiledialog 's methods that. example: bool copyfiles() { const qstring srcpath = qfiledialog::getopenfilename(this, "source file", "", "all files (*.*)"); if (srcpath.isnull()) return false; // qfiledialog dialogs return null if user canceled const qstring dstpath = qfiledialog::getsavefilename(this, "destination file", "", "all files (*.*)"); // asks user overwriting existing files if (dstpath.isnull()) return false; if (qfile::exist(dstpath)) if (!qfile::remove(dstpath)) return false; // couldn't delete file

java - Timer.schedule() leaves an open thread after execution -

i'm trying use timer.schedule() schedule operation happen 1s after. problem i'm having after operation executed, there's open thread left hanging , i'm forced ctrl+c close it. am doing wrong? how stop timer leaving open thread? public class myclass { public static int waiting_window = 1000; private boolean waiting = true; public myclass() {} public void mymethod() { new timer().schedule( new timertask() { @override public void run() { setwaiting(false); } }, waiting_window ); } public void setwaiting(boolean waiting) { this.waiting = waiting; } } keep reference timer , call timer.cancel() . , read javadocs, it's documented there!

javascript - how to change jquery datepicker to US datepicker -

this datepicker div , want change datepicker datepicker. $(document).ready(function() { // $(document).on("click", "#datetimepicker3", function (e) { // $('#datetimepicker2').focus(); $('#datetimepicker2 , #datetimepicker3') .datepicker({ autoclose: true, // enddate: '+0d', format: 'yyyy/mm/dd', todayhighlight: true, //startdate: '+0d' startdate: date().tolocalestring() }) .on('changedate', function(e) { $('#datetimepicker2').datepicker('hide'); $('#guestsearchform').bootstrapvalidator('revalidatefield', 'servicedate'); }); }); <div class="col-lg-3 col-sm-6 home-date"> <div class="form-group"> <div class="input-group input-append date" id="datetimepicker3" align="center"> <input type="text" class="form-co

mysql - Find nearest column value from my value -

i need quick help, can please? i need nearest value table. have salary column in table , have values: 10000 20000 45000 50000 60000 70000 , on. and have 1 value e.g. 42000. need fetch nearest row value of 42000 (if 42000 in table, want same 42000.) you need sort absolute difference , select first row. select * salaries order abs(salary - 42000) asc limit 0,1; but might think order or limit clauses because 2 or more might have same minimum closest salary.

monaco editor - TypeScript vs JavaScript Language Service -

the monaco editor has both javascript , typescript language service, based on research , playing have done both use same worker , virtually same thing. what differences these 2 "language" services provide. appears typescript code works fine in javascript service , of course javascript works fine in typescript language mode. through lot of tests; appear same service, have 2 separate configurations. can confirm exact same service 2 separate configurations; or there deeper in language service i'm missing. the purpose question have lot of typing's want load editor; user using js or ts, , if same engine; i'll put editor ts mode js or ts files eliminate massive memory adding duplicate typing's both engines entail yes, same - see https://github.com/microsoft/monaco-typescript/blob/master/src/monaco.contribution.ts personally add them both. since monaco targeted desktops - i'd memory less problem having js being ts - @ least have make

c# - Use Binding in Resource without styles -

this question has answer here: binding resource 2 answers i have multibinding defined follows: <multibinding stringformat="{0}_{1}"> <binding path="..." /> <binding path="..." /> </multibinding> i need use in multiple places, , want define in resources, as: <multibinding x:name="mydefaultbinding" stringformat="..."> <!-- etc --> </multibinding> however, cannot work out how use it. tried staticresource like: <textblock text="{staticresource mydefaultbinding}" style="{staticresource someotherstyle}" /> this gave me compile error: "invalid resource type: expected type 'string', actual type 'multibinding'." . when tried access using binding like: <textblock text="{binding source=

java - Enhanced code coverage with Commons logging and Log4j 2.0 -

i'm migrating log4j 1.2 log4j 2. use apache commons logging 1.1 (jcl), log4j2 implementation. now when executing unit tests, statements if (log.isinfoenabled()) { log.info("example"); } will show uncovered lines in coverage report if log log level high (e.g. warn in examole), if body wont executed. in log4j 1 of company wrote custom logger return true log.isxxxenabled() methods if detects run maven surefire, this: import org.apache.commons.logging.log; import org.apache.commons.logging.impl.log4jlogger; public class log4jenhancedcoverage implements log { private static final long serialversionuid = -8715529047111858959l; private final log logger; private final boolean mavenrun; public logenhancedcoverage(string name) { this.logger = new log4jlogger(_name); this.mavenrun = testsruncontext.ismavensurefirerun(); } @override public boolean istraceenabled() { return (mavenrun) ? true : logger.istraceenabled(); } @overri

java bytebuffer slice not working as per documentation -

i have been working bytebuffers long time seldom used slice. have big issue slice() on bytebuffer . please see below code : import java.io.unsupportedencodingexception; import java.nio.bytebuffer; import java.util.arrays; public class test12 { public static void main(string[] args) throws unsupportedencodingexception { bytebuffer original = bytebuffer.wrap("234567".getbytes("utf-8")); printbuffer("org: ",original); original.position(1); original.limit(original.limit()-2); printbuffer("org: ",original); bytebuffer sliced = original.slice(); printbuffer("slc: ",sliced); bytebuffer duplicated = original.duplicate(); printbuffer("dup: ",duplicated); bytebuffer compact = original.compact(); printbuffer("cmp: ",compact); } private static void printbuffer(string prefix,bytebuffer buff) {

c++ - Bluez5.42 with Linux 3.8 -

i have been developing ble application openwrt on beaglebone black . earlier, using linux 4.4.14 openwrt , have created ble application (without using dbus ) in c++ programming language. can advertise, connect, bond, , can sort of operations. i planning switch linux 3.18 (as marked stable beaglebone black) , want use dbus ble application. is there dependency between linux version , bluez stack version?

javascript - Update HTML table after insertion on db from another page -

i developing simple web application .net mvc. application has 2 main pages (one operator , 1 client). client can insert rows in table. operator can read table. there way show table updated immediatly after client operation? reload partial view table every 3000 ms avoid it.. once page rendered client have 2 ways of forcing refresh. 1 javascript settimeout("location.reload(true);", timeout); the second meta tag: <meta http-equiv="refresh" content="600">

Using FFMPEG video convert, not play audio -

i using command works fine, remove audio of video file ffmpeg -i background.jpg -i man-1.mp4 -filter_complex [1:v]chromakey=0x3bbd1e:0.1:0.2[ckout];[0:v][ckout]overlay[out] -map [out] box3.mp4 remove map. ffmpeg -i background.jpg -i man-1.mp4 -filter_complex "[1:v]chromakey=0x3bbd1e:0.1:0.2[ckout];[0:v][ckout]overlay[o]" -map [o] -map 1:a box3.mp4

html - CSS: How to apply style to a specific class -

Image
i have css question please. i have following html code: <ion-item *ngfor="let item of dummyjobmodels" class="item-search-dummy"> </ion-item> this generates code below: i hide border-bottom . need set list-md class, elements under item-search-dummy class. have tried following, not work: .item-search-dummy.list-md { border-bottom: 0px; } if can advise how can selectively set class attribute, appreciate it. you may try, .list-md .item-search-dummy .item-inner{ border-bottom: none !important; }

mysql - VB.NET function return error and exit sub -

i have connection function in vb.net project public function openmysqlcon() mysqlconnection dim mmysqlconnection = new mysqlconnection() try dim strcondb string = "server='192.168.100.2'; database='mydb';port=3306; uid='epb'; password='hahaha'; pooling=true" mmysqlconnection = new mysqlconnection mmysqlconnection.connectionstring = strcondb mmysqlconnection.open() openmysqlcon = mmysqlconnection catch exceptionthaticaught system.exception openmysqlcon = nothing end try end function and call function in vb project like private sub frmtest_load(sender object, e eventargs) handles mybase.load using con=openmysqlcon() 'mycode here end using end sub however when connection not available, throw exception. how can avoid exception giving msgbox connection not available @ moment, please try again later , exit sub using function? end sub the best

visual studio 2015 - Windows 7 Start Debugging SSIS package in VS2015 results in DTSDebugHost.exe blocked by group policy -

i debug ssis package in visual studio 2015 enterprise newest version of "sql server data tools in visual studio 2015" installed. if start debugging, following error occurs: "this programm blocked group policy...(microsoft.datatransformationservices.vsintegration)" when check eventviewer, saw "dtsdebughost.exe" blocking in following path: "%osdrive%\users\<username>\appdata\local\microsoft\microsoft sql server\130\ssis\110\x86\dtsdebughost.exe" if delete dtsdebughost.exe in appdata path, every time, start debugging, dtsdebughost.exe copied somewhere appdata folder , execution blocked group policy. when start debugging same ssis-package in visual studio 2012 premium, debugging works fine, because dtsdebughost.exe starts in following directory: %programfiles%\microsoft sql server\110\dts\binn\dtsdebughost.exe how can change executing path of dtsdebughost.exe ? or best fix issue?

tensorflow - InvalidArgumentError: logits and labels must be same size: logits_size=[1,2] labels_size=[1,1] -

i've worked through few other errors that've been thrown, i've never seen error before , after doing research i'm still not sure issue here or how solve it. i'm guessing reshaping data @ point required, don't why issue, or sizes of [1,2] , [1,1] mean. the data input script [128 x 128 x 128 ndarray, binary label] the code i'm using is: import tensorflow tf import numpy np import os import math # input arrays x = tf.placeholder(tf.float32, [none, 128, 128, 128, 1]) # labels y = tf.placeholder(tf.float32, none) # learning rate lr = tf.placeholder(tf.float32) ##### code convnet here ##### # data input_folder = 'data/cubed_data/pp/labelled' images = os.listdir(input_folder) images.sort() td = [] count = 1 in images: im = np.load(input_folder + "/" + i) data = im[0] data = np.reshape(data, (128, 128, 128, 1)) label = im[1] lbd = [data, label] td.append(lbd) test_data = td[:100] train_data = td[100:] cross_

python - Join two RDDs on custom function - SPARK -

is possible join 2 rdds in spark on custom function? have 2 big rdds string key. want join them not using classic join custom function like: def my_func(a,b): return lev.distance(a,b) < 2 result_rdd = rdd1.join(rdd2, my_func) if it's not possible, there alternative continue use benefits of spark clusters? wrote pyspark not able distribuite work on small cluster. def custom_join(rdd1, rdd2, my_func): = rdd1.sortbykey().collect() b = rdd2.sortbykey().collect() = 0 j = 0 res = [] while < len(a) , j < len(b): if my_func(a[i][0],b[j][0]): res += [((a[i][0],b[j][0]),(a[i][1],b[j][1]))] i+=1 j+=1 elif a[i][0] < b[j][0]: i+=1 else: j+=1 return sc.parallelize(res) thanks in advance (and sorry english because i'm italian) you can use cartesian , filter based on conditions. from pyspark.sql import sparksession spark = sparksession.builder

swift - how can i use `#function` symbol in a `inline` function? -

i'd use name of function resolve problems, #function seems not work @inline(__always) , here codes: @inline(__always) func log() { print(#function) } func a() { log() } // want 'a()', got 'log()' func b() { log() } func c() { log() } //... can explain? or that's stupid idea. if intention print name of function calls log() , should pass default argument (which evaluated in context of caller), demonstrated in building assert() in swift, part 2: __file__ , __line__ in swift blog. example: @inline(__always) func log(_ message: string, callingfunction: string = #function) { print("\(callingfunction): \(message)") } func a() { log("hello world") } func b() { log("foo") } func c() { log("bar") } a() // a(): hello world b() // b(): foo c() // c(): bar this works regardless of whether log function inlined or not. (inlining not change semantics of program. in particular, not mean source code of f

javascript - getBoundingClientRect on chrome doesn't change on scroll -

today came across following problem getboundingclientrect . let's added scroll event listener. on scroll log boundingclientrect of element. noticed things works expected on desktop, when turn on responsive mode in chrome value returned doesn't change. i'm using chrome version 56.0.2924.87 (64-bit). things working expected on ff , safari. possible explanation? here code example: <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body { margin: 0; padding: 0; font-family: sans-serif; height: 3000px; width: 3000px; } #box { background-color: red; width: 200px; height: 200px; } </style> </head> <body> <div id="box-wrapper"> <div id="box"></div> </di

Recurrence function in React Native -

i add recurrence function in react native project, settimeout doesn't work. can tell me why? , how fix it? handleappstatechange(appstate) { if(appstate === 'background') { let = 0; function runaction() { i++; console.log('result'+i); settimeout("runaction()",1000); } runaction(); } } first argument of settimeout function, try to settimeout(runaction,1000);

Autohotkey combine mouse and keyboard? -

anyone knows why wont work in autohotkey?: ~rbutton & ~lbutton & ~t:: it says invalid hotkey. why? thanks. combinations of 3 or more keys not supported ( https://autohotkey.com/docs/hotkeys.htm#combo ). try this: #noenv #singleinstance force #installkeybdhook #installmousehook #usehook #if getkeystate("rbutton","p") && getkeystate("lbutton","p") t:: z:: k:: l:: u:: msgbox, rbutton + lbutton + optional key return #if

An asp.net core web API with swagger doesn’t work in Docker in Azure -

i create asp.net core web api application vs2017, .net core version 1.1. and add docker support web api application run web api in docker in local, works fine. deploy docker in azure using vs2017, works fine in docker in azure. add swagger ui .net core web api using swashbuckle. re-run web api in docker in local, works fine. re-deploy docker in azure using vs2017, doesn’t work. shows following error “network error (tcp_error) communication error occurred: "" web server may down, busy, or experiencing other problems preventing responding requests. may wish try again @ later time” then think may caused swagger , swashbuckle, works fine in docker in local. , also, tried remove swashbuckle , coding of swagger. still not work. does know issue maybe?

python - Gym Environment Creation -

i'm new openai , gym. i'm using ubuntu 14.04 , have dependencies installed me. i'm unable figure out sequence of execution of commands construction of 'new' gym environment. please refer https://github.com/hackthemarket/gym-trading . when i'm trying implement same on own, displays: raise error.unregisteredenv('no registered env id: {}'.format(id)) gym.error.unregisteredenv: no registered env id: trading-v0 please explain me correct sequence of execution of files example.

python - falcon, AttributeError: 'API' object has no attribute 'create' -

i'm trying test falcon routes, tests failed, , looks make things right. my app.py import falcon resources.static import staticresource api = falcon.api() api.add_route('/', staticresource()) and test directory tests/static.py from falcon import testing import pytest app import api @pytest.fixture(scope='module') def client(): # assume hypothetical `myapp` package has # function called `create()` initialize , # return `falcon.api` instance. return testing.testclient(api.create()) def test_get_message(client): result = client.simulate_get('/') assert result.status_code == 200 help please, why got attributeerror: 'api' object has no attribute 'create' error? thanks. you missing hypothetical create() function in app.py . your app.py should following: import falcon resources.static import staticresource def create(): api = falcon.api() api.add_route('/', staticresource()

python - OperationalError: no such table on some ManyToManyFields only -

i creating website product , user models, , wanted create multiple manytomany fields user model (products purchased, sold, etc). when added first cart manytomanyfield on user model , tried in shell: user.objects.get(username="root").cart.all() it worked fine , outputted query set of objects of user's cart. but added other 3 manytomanyfields user model: items_purchased = models.manytomanyfield("product", related_name="items_purchased") items_sold = models.manytomanyfield("product", related_name="items_sold") items_listed = models.manytomanyfield("product", related_name="items_listed") however, once checked latest fields: user.objects.get(username="root").items_purchased.all() i got error: operationalerror: no such table: home_user_items_purchased what tried: i made migrations , have synced them database. i deleted every migration files except init , 0001. i tried migrate mi

apache - Can I use multiple results from MySQL query in Apache2 mod_rewrite? -

i trying control access apache2 mod_rewrite. want allow ips accessing site. i understand can use file such rewritemap hosts-allow "txt:/path/to/hosts.txt" and have read can use sql query, apparently works 1 result , if multiple rows returned uses random one. there way use multiple results? otherwise, have automate saving ips mysql file myself use multiple results? if yes apache2 automatically flush cache of file whenever changes? any insights welcome, :) i got work. if have similiar problem apache2 file 000-default.conf (look location of file on linux distro) has this. <virtualhost *:80> dbdriver mysql dbdparams "host=localhost,user=root,pass=password,dbname=name" rewritemap whitelist "dbd:select ip users ip = %h limit 1" <directory /var/www> rewriteengine on rewritecond "${whitelist:%{remote_addr}|found}" "found" rewriterule "^" "&quo

javascript - Knockout JS - Observable doesn't update the View on Load -

first of all, i'm newbie knockout. got basic understanding. i'm using crossroad routing this current scenario. value url param.route().plan. work fine the value set observable in view model. however, binding doesn't work/value doesn't update when navigate route previous using location.href = "checkout/gold" gold plan. if reload page work fine. ps : view model work expected. doubled confirmed console.log now code - function redirects problematic view model // function handling subsription self.subscribe = function () { alert(self.selectedplan()); var currentuser = parse.user.current(); if (currentuser === null) { $('#loginbox').modal('show'); } else { // else redirect location.href = '#checkout/'+self.selectedplan(); // redirect checkout page } } // function ends here the view model seems work self

c++ - Does the standard make any guarantee that adding a constructor does not change the size? -

lets have class struct foo { uint32_t x; uint32_t y; }; does c++ standard make mention whether sizeof(foo) should same sizeof(bar) if bar adds constructor ? struct bar { uint32_t x; uint32_t y; bar(uint32_t = 1,uint32_t b = 2) : x(a),y(b) {} }; the reason why asking foo send across network void* , cannot change size, if possible add constructor. i found related: here , here , there answers focus on virtuals changing size , looking more definite "[...] implementations know of [...]" . ps: avoid misunderstanding... not asking how constsruct foo , send void* nor asking workaround make sure size not change, curious, whether standard says sizeof in specific case. c++ 98 guarantees layout “plain old data” objects , don't permit constructors. c++ 11 introduces “ standard layout types ”, still guarantee layout, permit constructors , methods added (and permits non-virtual bases added exceptions empty classes , duplicates).

javascript - Is there a way to position n number of divs inside a div container -

Image
is there way position n number of divs inside div container, each div cell won't collide each other using css , js. need set left value without changing height , top values. fine change cell width. please check code sample. .container { width : 400px; height : 1000px; background : #000; position : relative; } .cell { position :absolute; background : yellow; border: 2px solid red; } <div class="container"> <div class="cell" style="top:50px;width:100%;height:100px"></div> <div class="cell" style="top:150px;width:50%;height:50px"></div> <div class="cell" style="top:150px;width:50%;height:50px;"></div> <div class="cell" style="top:230px;width:33.33%;height:50px;"></div> <div class="cell" style="top:230px;width:33.33%;height:50px;"></div>

python - I have 8000 images, how should I turn them into features for Tensorflow? -

i'm familiar neural network architecture little rusty on image processing part. so far, i've managed turn each 600x400 rgb image array, array.shape = (400,600,3) i'm stuck @ trying create array of said arrays can scale features down. how do that? if want turn array in list images can feed algorithm this: input_for_tensorflow = np.array([image1,image2,image3]) predictions = sess.run(tfpredict_tensor, feed_dict = {input_image:input_for_tensorflow}) in case think still lack understanding of important principles need understand create model. recommend people follow course: https://www.kadenze.com/courses/creative-applications-of-deep-learning-with-tensorflow-iv/info hope answers question now!

c++ - CPP reference to pointer in std::list -

this question has answer here: stl containers reference objects 4 answers this following code doesn't want compile: #include <list> int main() { std::list<int *&> l; return 0; } it's *& , not *. why ? ho hell why doesn't work ? tried answer on internet no way relevant. please ? have day ! it not allowed use references container type. can use std::reference_wrapper instead. std::list<std::reference_wrapper<int>> l; or can use pointer pointer std::list<int**> l;

java - why getting inside PHPdebugger? -

problem started here. page1.php code snippet: <a href=page2.php?subid=1>xyz</a> nothing related gets logged in php error log. tried try.. catch block , seems page1.php works gets in trouble while redirecting page2.php. javabridge connection breaks? php notice: undefined index: start_debug, debug_host, debug_port in phpdebugger.php php warning: fsockopen(): unable connect :0 moreover, phpdebugger.php automatically generated file javabridge (javabridge/java/phpdebugger.php) there can't issue in file. looks there's issue latest version of bridge (7.0.1) enables phpdebugger default. see mailing list archive: https://sourceforge.net/p/php-java-bridge/mailman/message/35776970/ . check newer version or downgrade 6.2.1. alternatively forked version exists ( https://github.com/belgattitude/php-java-bridge/releases ) phpdebugger disabled default. basic installation can found here , drop support of java.inc in favour of soluble-japha client in comi

Indexing in Mysql on multiple tables -

i have 4 tables, transaction table, customer table, products table & plant table. i'm querying daily sale group product table item type, and, customer-wise sale on daily basis. but these queries execution time high (my tran table 2m rows only) how improve performance of db? i created tables follows : transaction table : create table `tran` ( `plant` char(4) not null collate 'utf8_bin', `tdate` date not null, `invno` varchar(10) null default null collate 'utf8_bin', `customer` char(8) not null collate 'utf8_bin', `icode` char(8) not null collate 'utf8_bin', `rqty` float(10,2) null default null, `fqty` float(10,2) null default null, `ramt` float(10,2) null default null, `taxamt` float(10,2) null default null, `tqty` float(10,2) null default null, `tamt` float(10,2) null default null ) collate='utf8_bin' engine=innodb row_format=compact ; customer details table : cre

How to process multiple Jpeg images in R -

i started using rstudio, available package analyze images in r. want analyze 50 images stored in folder. how can read each image (by forming loop), perform operation on each image , save output (my output list) vector? update: i wrote piece of code following: folder <- "f:/f_diff/1_d/glass/new folder/" # path folder holds multiple .jpg files file_list <- list.files(path=folder, pattern="*.jpg") # create list of .jpg files in folder (i in 1:length(file_list)){ assign(file_list[i], #read image im2 <- readimage(paste(folder, file_list[i], sep='')) #analyze each image b <- matrix(im2,nrow=808,ncol=610,byrow=false, dimnames=null) haarimtest <- tos2d(b, smooth = false, nsamples = 100) summary(haarimtest) )} i getting following errors: error: unexpected symbol in: " #analyze each image b" haarimtest <- tos2d(b, smooth = false, nsamples = 100)