Posts

Showing posts from January, 2011

TypeScript - pass to constructor entire object -

i have class @ type script: export class child { name:string; age:number; } i want force class instances have properties class declaration has. for example, if firebase object: myfirebaseservice.getchild(id).then(function(child){ var currentchild = new child(child); }) so when object is: {name:"ben", color:"db"}, want result be: currentchild = {"name":"ben"} becouse "color" not field of "child". i tried this: export class child { name:string; age:number; constructor(tempchild:child = null) { if (tempchild){ (var prop in tempchild) { this[prop] = tempchild[prop]; } } } } but not help. "currentchild" of fields , attached them class instance. (of course, can use following code: export class child { name:string; age:number; constructor(tempchild:child = null) { if (tempchild){ this.nam = tempchild.name; this.age =tempchild.age

excel - Python - TypeError: 'Cell' object is not iterable -

what i'm trying write new excel file data list. contents of list row contents i'm trying write in new excel file using xlsxwriter (specifically xlsx because i'm using xlsx). assuming have code snippet below, yields me error : typeerror: 'cell' object not iterable the whole stacktrace points out during write event. traceback (most recent call last): file "desktop/excel-copy.py", line 33, in <module> sheet.write_row(row_index, col_index, cell_value) file "/usr/local/lib/python2.7/dist-packages/xlsxwriter/worksheet.py", line 64, in cell_wrapper return method(self, *args, **kwargs) file "/usr/local/lib/python2.7/dist-packages/xlsxwriter/worksheet.py", line 989, in write_row token in data: typeerror: 'cell' object not iterable import xlrd import xlsxwriter new_workbook = xlsxwriter.workbook() sheet = new_workbook.add_worksheet('stops') #copy row , column contents new worksheet row_inde

visualization - How do I visualize the intersection of spheres in MATLAB? -

Image
it seems question has been asked in few places ( including on so ). came across need when visualizing results of trilateration problem. in every case, answer directs inquiry @ wolfram math excludes code. math great reference, if i'm asking question on programming, code might well. (it appreciated when answers code question avoid pithy comments "writing code trivial"). so how can 1 visualize intersection of spheres in matlab? have simple solution below. i wrote small script this. feel free make suggestions , edits. works checking if surface of each sphere falls within volume of of other spheres. for sphere intersection, it's better (but slower) use larger number of faces in sphere() function call. should give denser results in visualization. sphere-alone visualization, smaller number (~50) should suffice. see comments how visualize each. close clear clc % centers : 3 x n matrix of [x;y;z] coordinates % dist : 1 x n vector of sphere radii

Running python codes from outside the directory when script has filepaths -

so have python script my_script.py inside folder test , outside folder. script requires access input data file my_data.dat stored inside folder test . now, when try run script outside folder test , using simple python my_script.py , tries locate my_data.dat in folder running script , fails. how can tell use correct path without modifying path in my_script.py? i don't want modify paths in script because script used generically various paths , whole thing automated later. you need use absolute file path instead of relative file path. to absolute path of directory containing python file: import os root_dir = os.path.dirname(__file__) and can absolute path of my_data.dat data_file_path = os.path.join(root_dir, 'my_data.dat') afterward use data_file_path instead of "my_data.dat"

How to disable business hours in FullCalendar -

i trying incorporate fullcallendar in 1 of our application show events. facing problem business hours. in month view showing wrong end date (one day less actual) if event ends before 9 am. example, have 2 following events event 1: start date&time : 2016-11-09t10:00, end date&time : 2016-11-20t17:30 event 2: start date&time : 2016-11-09t10:00, end date&time : 2016-11-20t08:30 in case in month view, event 1 covering dates 9 20, event 2 covering dates 9 19. i tried in google issue , found following link how set business hours but not solved issue. want disable business hours. tried setting false. nothing happen. please help please use nextdaythreshold option in full calendar nextdaythreshold: '00:00:00' for more information: https://fullcalendar.io/docs/event_rendering/nextdaythreshold/

javascript - Scrolling bar on IE using devexpress -

i use devexpress gridview vertical scroll bar, when user focus on record of gridview , press down arrow focuse move next record scroll bar dosen't move write code in javascript make scroll bar moving , record focused still visible me works on firefox , chrome doesn't work on ie 11 there way deal scroll bar in gridview in ie document.onkeydown=function(e){ e=(e || event) if(e.keycode == 40){ var ix = grid.getfocusedrowindex(); var v= grid.getvisiblerowonpage(); if(((ix%2==0) || (ix%3==0)) && (ix!=2)){ return true; } e.preventdefault(); return false; } } you may need use dx aspxgridview js scroll helpers like: aspxclientgridview.setverticalscrollposition - set vertical scroll position aspxclientgridview.getverticalscrollposition - vertical scroll position these methods should ie11 compatible since included in official release. see more details in following post: https://www.devexpress.com/support/c

xcode - Manage provisioning profiles on my Mac OS Sierra build host -

i used have iphone configuration utility obsoleted on mac os after upgrade sierra . replaced apple configurator great managing external devices not mac os host itself. how can manage installed provisioning profiles (delete some) on mac os (sierra) build host?

c# - Universal Windows Platform App with google calendar -

hey im trying make universal windows platform app google calendar in it, cant figure out how convert code, got code work on wpf app. not best @ coding https://developers.google.com/google-apps/calendar/quickstart/dotnet site use guideline in start if help, help? code below: using system; using system.collections.generic; using system.io; using system.linq; using system.text; using system.threading; using system.threading.tasks; using google.apis.auth.oauth2; using google.apis.calendar.v3; using google.apis.calendar.v3.data; using google.apis.services; using google.apis.util.store; namespace test1uwa { class googleevents4 { public string title { get; set; } public datetime? startdate { get; set; } public datetime? enddate { get; set; } } class googleclass4 { public list<googleevents4> googleevents = new list<googleevents4>(); static string[] scopes = { calendarservice.scope.calendarreadonly }; stat

java - beanutils set property in two level object and hash map -

i trying use beanutils set property in 2 level java object , map not working. public class scheme { private schemedetails details; private string code; public string getcode() { return code; } public void setcode(string code) { this.code = code; } public schemedetails getdetails() { return details; } public void setdetails(schemedetails details) { this.details = details; } } public class schemedetails { private hashmap<string, string> detailsmaster; private integer amount; public integer getamount() { return amount; } public void setamount(integer amount) { this.amount = amount; } public hashmap<string, string> getdetailsmaster() { return detailsmaster; } public void setdetailsmaster(hashmap<string, string> detailsmaster) { this.detailsmaster = detailsmaster; } } void run() { beanutils.setproperty("scheme", "code", "123"); //working beanutils.setproperty("scheme", &qu

mean stack - Authentication in angular 2 universal, nodejs -

i downloaded universal-starter nodejs , started migrating website old angular-rc4. when have implement authentication (in case it's jwt stored in localstorage), server dont have localstorage , cookie angular rendered on client. i've follow guide: https://github.com/angular/universal-starter/issues/148 didnt work. below code: authentication.services.ts import { opaquetoken } '@angular/core'; export let auth_services = new opaquetoken('auth.services'); export interface authenticationservice { forgotpassword(email: any); isauthenticated(); getcurrentuser(); refreshtoken(); signin(user : any); signout(); signup(user : any); } server.authentication.ts import { injectable } '@angular/core'; import { authenticationservice } './authentication.services'; @injectable() export class serverauthenticationservice implements authenticationservice { forgotpassword(email: any) { throw new erro

html - check or uncheck radio buttons when i click on text -

<input type="radio" name="allotdeallot" value="allotment" />allotment <input type="radio" name="allotdeallot" value="de-allotment" />de-allotment i have 2 radio buttons want check or uncheck on label click. as per html standards, every form element must have label attach it. wish hide text of label, can hide text of lable , using position:absolute label . here answer, <input id="allotment" type="radio" name="allotdeallot" value="allotment" /><label for="allotment">allotment</label> <input id="de-allotment" type="radio" name="allotdeallot" value="de-allotment" /><label for="de-allotment">de-allotment</label> the id of input field must same for attribute of label .

rust - How to write generic functions that take types which are themselves generic? -

i'm looking write function takes different types differ in ( const / mut ) of member, take generic type. to simplify question, i'm looking write function takes either constant or mutable struct. eg: pub struct ptrconst<t> { ptr: *const t, } pub struct ptrmut<t> { ptr: *mut t, } how write function takes either ptrconst<sometype> or ptrmut<sometype> ? this snippet rather long, i've attempted simplify it. playbook link. // --------------------------------------------------------------------------- // test case: isn't working! // how make generic function? // see below 'ptrconst' & 'ptrmut'. pub trait ptranyfuncs { fn new() -> self; fn is_null(&self) -> bool; } pub trait ptrany: deref + copy + clone + partialeq + ptranyfuncs + {} impl<tptr> ptrany tptr tptr: deref + copy + clone + partialeq + ptranyfuncs + {} fn generic_test&l

python - What is the best built in function to compute the temporal series for the Lorenz System? -

i using several runge-kutta methods compute solutions lorenz system typical values make unstable: sigma=10, beta=8/3, rho=28. the problem don't know method should trust more (apart theoretical global truncation error) i know if there built in function can import compute numerical solutions lorenz system

java - "does not support writing" IOException when opening Access 97 .mdb file with Jackcess -

i need open .mdb file recover genealogy data. i try jackacess 2.1.5 following java.io.ioexception : file format [v1997 [version_3]] not support writing genealogy.mdb how can avoid this? you exception access_97 database file if try do database db = databasebuilder.open(new file(dbpath)); but can avoid exception if instead database db = new databasebuilder() .setfile(new file(dbpath)) .setreadonly(true) .open();   update: should no longer issue. using static .open(file) method, jackcess 2.1.6 , later open access 97 database file read-only instead of throwing exception.

javascript - Why does if(asynchronous.get()) work and is it ok to use it this way -

when use like if(asynchronous.get()){...} and ansynchronous.get() asynchronous function, wonder how ever work if statement isn't testing unless function returns value. somehow have in code , works can explain why works , if should change it. edit: assumption function asynchronous wrong, answered now. the if statement checks if expression evaluates truthy value. seems function returns promise, function object, truthy value. the function executed, not able process result way , if statement never evaluated false. you need wait function resolve value , check value: asynchronous.get().then(val => { if (val) {...} })

visual studio - How to create ASP.NET websocket .ashx file's URL? -

i newbie of websocket. have created asp.net web project in visual studio named capwebsocketproject. inside project there .ashx file named cpwebsocket.ashx. inside ashx file, there c# codes. here codes: public class cpwebsocket : ihttphandler { public long fngetterminalinfo() { string strcom = "com4"; // hard coded testing string strgetterminalinfocommand = "c900"; <xxxx> clsterminal = new <xxxx>(); long lgportstat = clsterminal.sendcommand(strcom, strgetterminalinfocommand); return lgportstat; } } now, question how create websocket cpwebsocket.ashx file's url can access browser? i don't think .ashx websocket, need inherit websocketservice need create object of websocket in javascript , give url of websocket , key want listen it, here's example: http://www.codeproject.com/articles/1063910/websocket-server-in-csharp

visibility - Magento 2 Products not found during Catalog Search reindex -

we working on magento 2.1.0 we facing issue of no products found during catalog search reindexing. have large catalog, process taking time completed , during time website not showing products. please if has faced kind of issue. in advance. try check category. is there 1 main/root category? you cant have 2 main/roots. like: allproducts bags sportbag shopingbag outdoor-bag shoes sportshoes xxx xyz xxx

WPF MVVM Calendar Emulate Control Click on Date -

is there way emulate control click on calendar control? want add day press selection or deselect day selection? currently attached trigger calendar, @ point, click deselect other days , selecteddates contains last clicked date. <i:interaction.triggers> <i:eventtrigger eventname="selecteddateschanged"> <i:invokecommandaction command="{binding ac_selcteddatechanged}" commandparameter="{binding elementname=calender, path=selecteddates}" /> </i:eventtrigger> </i:interaction.triggers>

A Login web using Java Servlet and mySQL, problems about connected to MySQL -

this question has answer here: how install jdbc driver in eclipse web project without facing java.lang.classnotfoundexception 13 answers i wrote login web , can't work well. may problem of mysql connecting. here code. it's simple. there servletlogin.java , index.jsp. servletlogin.java package login; import java.io.ioexception; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import javax.servlet.http.httpsession; import java.sql.*; public class servletlogin extends httpservlet { private static final long serialversionuid = 1l; private string name; private string pass; public servletlogin() { super(); // todo auto-generated constructor stub } protected void doget(httpservletrequest request,

HTML Email template Mailchimp, CSS problems in Outlook and Gmail -

i've developed html email template , imported mailchimp. works perfect in testing mode. when send it, gmail, outlook , windows mail have problems css style loading. shows html. then tried develop tables without linking css, again perfect in mailchimp testing , problems gmail, outlook , windows mail. there not loading style attribute of tables. please help. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>email design</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </head> <body style="margin: 0; padding: 0;"> <table align="center" border="1" cellpadding="0" cellspaci

How to map a C# enum to a Cassandra field using Datastax C# Driver? -

i save , retrieve poco object , cassandra using datastax c# driver (.net framework 4.6.1, datastax c# driver 3.0.8) example: public enum documentstate { new = 0, approved = 1, rejected = 2 } public class documentreadmodel { public guid documentid { get; set; } public documentstate state { get; set; } } what best way persist object in cassandra? my approach not seem work. for tried save int in cassandra: create table if not exists documentreadmodel ( documentid uuid primary key, state int); also used mapping configuration offered datastax driver following code: mappingconfiguration.global.define( new map<documentreadmodel>() .tablename("documentreadmodel") .partitionkey(o => o.merchantid) .column(o => o.state, c => c.withname("state").withdbtype<int>())); but still exception: cassandra.invalidtypeexception: unknown cassandra target type clr t

.net - IdentityServer Authentication Endpoint -> error=invalid_request failureReason="STATUS_CODE" -

i implementing sso 1 third-side service. service doesn't support oidc or oauth, need implement proprietary. have middleware, handles requests. when reckognizes request login request third side app, creates authorize link , redirects [identityserver]/connect/authorize, authorize endpoint. server should give me jwt token, process. anyway identity server gives me error , when log file can see failurereason="status_code" . response.redirect() sets status code 302 , should fine, shouldn't be? client set fine. using implicit flow. authorizationcode or clientcredentials sends me error page message: client application not known or not authorized. status code 204. middleware snippet: string url = $"{context.request.scheme}://{context.request.host}"; discoveryclient discoveryclient = new discoveryclient("https://localhost:44300/"); discoveryresponse doc = await discoveryclient.getasync(); authorizer

typescript - Using external library with angular cli -

i have installed 1 3rd party module jspdf angular app. module works error in console: cannot find module '../../../node_modules/jspdf/dist/jspdf.min.js' . what did: install module via npm: npm install mrrio/jspdf --save import module in component: import * jspdf '../../../node_modules/jspdf/dist/jspdf.min.js'; then works module in component. is missing here? have @ instructions here: github.com/angular/angular-cli#3rd-party-library-installatio‌​n . if jspdf (or other library) needs in global scope, need add js file apps[0].scripts in angular-cli.json file, webpack bundles if loaded <script> tag. if that, can @ adding declare var jspdf: any; in src/typings.d.ts or component. however, looks there typings jspdf npmjs.com/package/@types/jspdf can include after running npm install --save-dev @types/jspdf ; should able import { jspdf } 'jspdf'; in component.

xcode - iOS ad-hoc deployment -

with apples ad-hoc deployment option testing purposes, understand there 100 device limit. i wondering, before purchase developer licence, there limitation on how long ad-hoc apps can used for, know using test flight had 30 day limitation. the app valid until distribution certificate used sign expires, @ point won't run. if memory serves, apple distribution certificates non-enterprise developer accounts have expiration of 1 year. source.

node.js - Sequelize - sequelize.sync() -

i don't understand how work istruction sequelize.sync() . example: into server.js file: db.sequelize.sync().then(function() { app.listen(port); console.log("express listen on port: " + port); }) and db.js file create new database: //create sequelize database export server.js var sequelize = require('sequelize'); var sequelize = new sequelize(undefined, undefined, undefined, { 'dialect': 'sqlite', 'storage': __dirname + '/data/dev-todo-api.sqlite' // location create new sqlite database }); var db = {}; db.todo = sequelize.import(__dirname + "/models/todo.js"); db.sequelize = sequelize; //contain settings of database db.sequelize = sequelize; module.exports = db; and __dirname + "/models/todo.js" have created tables/models. server.js when launch db.sequelize.sync() , how know models must stored database? never call db.todo ( create models ) thank morris

What is the minimum Hardware insfracture required for spark to run on spark standalone cluster mode? -

Image
i running spark standalone cluster mode in local computer .this hardware information computer intel core i5 number of processors: 1 total number of cores: 2 memory: 4 gb. i trying run spark program eclipse on spark standalone cluster .this part of code . string logfile = "/users/bigdinosaur/downloads/spark-2.0.1-bin-hadoop2.7 2/readme.md"; // sparkconf conf = new sparkconf().setappname("simple application").setmaster("spark://bigdinosaur.local:7077")); after running program in eclipse getting following warning message initial job has not accepted resources; check cluster ui ensure workers registered , have sufficient resource this screen shot of web ui after going through other people answer on similar problem seems hardware resource mismatch root cause. i want more information on what minimum hardware insfracture required spark standalone cluster run application on ? as per know. spark allocates memory whatever

ios - Can't add constraints between UICollectionView cell and the cell subview -

well, after run app, crashes , reason is: "unable install constraint on view. constraint reference outside subtree of view? that's illegal." image subview of cell, doing wrong? let image = uiimageview(frame: cgrect(x: 0, y: 0, width: 300, height: 50)) image.image = uiimage.init(named: "bitmap") cell.contentview.addsubview(image) let bottomconstr = nslayoutconstraint(item: image, attribute: .bottom, relatedby: .equal, toitem: cell.contentview, attribute: .bottom, multiplier: 1, constant: 0) //let leftconstr = nslayoutconstraint(item: image, attribute: .leading, relatedby: .equal, toitem: cell.contentview, attribute: .leading, multiplier: 1, constant: 0) //let rightconstr = nslayoutconstraint(item: image, attribute: .trailing, relatedby: .equal, toitem: cell.contentview, attribute: .trailing, multiplier: 1, constant: 0) let heightconstr = nslayoutconstraint(item: image, a

mongodb - mongo find function mismatch -

Image
mongo version : 3.2.8 my sample json below my query fetch name equal apple doesn't work. db.collection.find( { "products.foods.name": "apple" } ) instead fetches records, strange? neither $eq, $lt or $gt work. result entire data. db.aggregation.find( { "products.foods.min_price": {$eq:10} } ) thanks in advance. if entire document in _id, if query matches db.collection.find( { "products.foods.name": "apple" } ) though document in foods array entire document displayed, getting other fruits well. to solve first use $unwind aggregation pipeline break foods array individual documents , use $match . please refer post , similar question , have answered steps in detail in post.

javascript - Unable to get scroll on custom uib tabset -

i have following code , dynamic data load involved. need have scroll ng-repeat data. height 0 , doesn't allow create scroll. <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-10"> <section class="arrivals-details zero-margin"> <div class="vignette-img zero-margin"> <img class="img-responsive" src="images.jpg"/> </div> <section class="my-tabs" ng-init="indextab = 1"> <!-- uib tabs--> <uib-tabset> <uib-tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disable="tab.disabled"> <div ng-include="tab.content" class="tabs-container-area">{{tab.content}}</div> </uib-tab>

python - pip install pygraphviz: No package 'libcgraph' found -

i succeed in installing graphviz , cgraph with $ sudo pip install graphviz .... installed graphviz-0.5.1 $ sudo pip install cgraph ... installed cgraph-0.1 i encounter issue no package 'libcgraph' found while running sudo pip install pygraphviz . below full stacktrace. $ sudo pip install pygraphviz directory '/users/sparkandshine/library/caches/pip/http' or parent directory not owned current user , cache has been disabled. please check permissions , owner of directory. if executing pip sudo, may want sudo's -h flag. directory '/users/sparkandshine/library/caches/pip' or parent directory not owned current user , caching wheels has been disabled. check permissions , owner of directory. if executing pip sudo, may want sudo's -h flag. collecting pygraphviz downloading pygraphviz-1.3.1.zip (123kb) 100% |████████████████████████████████| 133kb 1.5mb/s installing collected packages: pygraphviz running setup.py install pygraphviz ... error

Converting a nested python dictionary into a multi-indexed pandas dataframe -

how convert nested dictionary pandas multi-indexed dataframe? here example: dct={'outer':{}} in dct: dct[i]={'middle':{}} j in dct[i]: dct[i][j]={} j in dct[i]: dct[i][j]['inner']=10 print dct which outputs: {'outer': {'middle': {'inner': 10}}} i want in pandas dataframe looks this: outer middle inner value inner2 value middle2 inner value outer2 middle inner value inner2 value middle2 inner value i'm aware multi-indexing way i'm not sure how make data frame. can give me pointers? i think can use concat created dict comprehension dataframe.from_dict , last stack - output series multiindex : dct={'outer':{}, 'outer2':{}} in dct: dct[i]={'middle':{}, 'middle2':{}} j in dct[i]: dct[i][j]={} j in dct[i]: dct[i][j]['inner']=10 dct

python - Replacing an object with mocks -

i'm not sure i'm doing wrong. perhaps have wrong end of stick mocking. assumption when use mocks magic , replaces objects in original code. sites.py class sites: def __init__(self): pass def get_sites(self): return ['washington', 'new york'] my_module.py from mylib import sites def get_messages(): # sites sm = sites.sites() sites = sm.get_sites() print('sites:' , sites) site in sites: print('test: ' , site) my_test.py import my_module import unittest unittest.mock import patch class mymoduletestcase(unittest.testcase): @patch('my_module.sites') def test_process_the_queue(self, mock_sites): mock_sites.get_sites.return_value = ['london', 'york'] print(mock_sites.get_sites()) my_module.get_messages() if __name__ == '__main__': unittest.main() running following output: .['london', 'york']

ruby - Installing proj4rb on Ubuntu : Cannot find proj_api.h header -

trying install proj4rb on ubuntu or linux mint fails error : building native extensions. take while... error: error installing proj4rb: error: failed build gem native extension. ./siteconf20161110-4168-1b7och9.rb extconf.rb checking proj_api.h... no extconf.rb:6:in `<main>': cannot find proj_api.h header (runtimeerror) it isn't clear packages needed, , couldn't find related post on stackoverflow. just install libproj-dev package : sudo aptitude install libproj-dev gem install proj4rb # building native extensions. take while... # installed proj4rb-1.0.0

swift - find project path in derived data folder in xcode 8 -

i have searched lot can not find helpful link find project location in derived data folder using swift in xcode 8. please me regarding issue. you can't path swift app: "derived data" folder useful xcode, not app, doesn't "see" @ all. xcode ide , uses folder when building app - app not aware of xcode or folders, app independent ide.

jquery - Automatically update JavaScript object property when another object's property is set -

i have array of objects, each containing property named title . title property can hold 1 of 2 possible string values - "main" or "local" . single element in array can have "main" title value @ given time, , rest of elements should have title property set "local" . for instance, take following array: var locations = [ { title:"main", place:"uk" }, { title:"local", place:"usa" }, { title:"local", place:"russia" } ] when setting place:"usa" object's title property "main ", want place:"uk" object's title property automatically set "local" . how achieve javascript? one way set title values local , before setting desired object main . way remember index set main , revert local when main changed.

html - text box with emoji property data-emojiable="true" on keypress not working -

my initial html <div class="p-10 p-chat-box"> <div class="input-group"> <span class="input-group-addon"> <img src="assets/images/emojis/1f603.png" class="letter-icon"> </span> <p class="lead emoji-picker-container"><input id="readyforchat" data-emojiable="true" type="text" class="form-control" placeholder="add message ..."></p> </span>' + attachmentlist + '<span style="cursor:pointer;" onclick=newswidget.startchat(event) class="input-group-addon"> <i class="icon-arrow-right6"></i> </span> </div> </div> i using emojji.js generating emoji in text box data-emojiable="true" property html after applying(emojiable="true") property on input type="text" from favorite web link write note pick file photo ga

Excel add-in - get workbook name of "thisworkbook" -

Image
i can't name of workbook when use add-in. i'm trying develop add-in runs each time open excel , reads filename of open file. if file name xcfil.skv something... this code should it, doesn't. missing? code stops , if debug , press f8 works fine, won't run on it's own. private sub workbook_open() if thisworkbook.name = "xcfil.skv" msgbox "y" end if end sub background: based in statement the code stops , if debug , press f8 works fine, won't run on it's own. assume problem relies on speed of processor not sync code (own experience). solution: since excel , problem seems rely in opening of instance itself, may use application wait or any of other functions matter . further thoughts: life cycle comes mind in these kind of scenarios. this web page has neat lifecycle diagram of excel instance (attached since try explain scenario) as may see "application" first cycle of excel applicatio

android - MPAndroidChart BarChart bars getting cut off -

i using mpandroidchart drawing chart in android app. one requirement need bar chart starting non-zero y position, suggested in this . had using candlestickchart same. bars getting cut off @ start , end. is there way give padding @ start , end of graph not cut off. note: xaxis values "4nov", "5nov"... after trying many things, found out solution, graph.getxaxis().setaxismaximum(candledata.getxmax() + 0.25f); graph.getxaxis().setaxisminimum(candledata.getxmin() - 0.25f);

android:process=":remote" doesnt prevent separate process from being destroyed with Force Close -

im using sumsung gt-s7710 android version 4.1.2 . when force close app app list in phone manually - separate service process becomes dead. can see in studio. , trully doesnt work more (i used check shedulled launching of notification sound). in many places on net people android:process=":remote" option prevent service being killed, seems not working force close case. suggestions appreciated. thx in advance. <service android:name=".actservice" android:process=":remote"/> when force close app app list in phone manually what appear mean going settings app, apps screen within there, finding app, , tapping "force stop" button. separate service process becomes dead sure. of processes terminated if user force-stops app through settings. but in many places on net people android:process=":remote" option prevent service being killed, seems not working force close case. correct. not supposed work case. s

vba - EXCEL 2007: Compare each column A cell in workbook1 to see if it exists in the strings of of column A in workbooks 2-4 -

i have no idea begin, not afraid vba if needed (never done it, can code in other languages). my company possesses master list of 800 numbers. have 4 global regions. 4 global workbooks column represents last 4 of 800 numbers master list. need check every "last 4" checked against master list , report not represented. so needs each regional workbook column , return true if exists in master workbook column a. else, need generate list of rows not matched against master list. where can learn such skills? edit added: masterbook example region1 exmaple region2 example if master workbook's location same region workbook , isn't changed, use formula cell b2 , press ctrl+shift+enter fill down: =if(or(text(a2,0)=right('masterlist example.xlsx'!$a$2:$a$1000,4)),"yes","no")

selenium webdriver - Protractor moves on to next test without waiting -

i'm using protractor , when run tests on browserstack receive following error staleelementreferenceerror: stale element reference: element not attached page document or depending on in beforeall error: index out of bound. trying access element @ index: 0, there 0 elements match locator by.cssselector ... here code snippet causing error: describe('...', () => { it('...', () => { expect(element.all(by.css(...)).count()).tobe(9); expect(element.all(by.css('.items').get(0).isdisplayed()).tobetruthy(); }); } describe('', () => { beforeall((/* done */) => { element(by.css('.go-home').click(); // .then(done); //browser.driver.get('/');//.then(done); }); ... }); for reason beforeall continues , changes url, while previous it still running (i guess based on error). now, managed hack such works. i've added done it follows describe('...', () =&g

python - How to set compiler in waf -

i'm trying compile 3rd party software uses waf build tool. run problems immediately. > python waf configure --prefix=install checking program 'g++, c++' : cc not determine compiler version ['cc', '-dm', '-e', '-'] the config.log file says (with crap deleted): checking program 'g++, c++' cc ['cc', '-dm', '-e', '-'] out: no supported cpu target set, cray_cpu_target=x86-64 used. load valid targeting module or set cray_cpu_target err: cc-2130 crayc++: warning in command line "-d" commandline option unsupported. cc-2289 crayc++: error in command line invalid characters after option '-d' in command line item '-dm'. cc-2107 crayc++: error in command line no valid filenames specified on command line. i don't know how debug waf scripts. have suggestions? guess have tell waf use gcc (or c++) compiler, can't figure out how tell waf that. waf has

json - Uncover object type after it has been converted to string -

i have rather peculiar issue need workaround, in ruby. i receive list of values, say: ["foo", "0.0", "1", "{}", "[]"] i want uncover actual type of each element, having no power on fact has been converted string type. my initial attempt load each value individually using json deserialization, e.g.: my_list.each |element| puts json.load(element).class end however has various caveats mean doesn't work quite right. e.g. json.load("0.0").class give me float , json.load("foo").class will, of course, bomb out. solution use try/catch or rescue block when actual string, it's not reliable breaks custom classes (say said s = someclass.new, json.load("s") rescues string) , ends rather ugly code. my_list.each |element| puts json.load(element).class rescue string end alas, question have ask is, there exist way "unconvert" string , find out object type of whatever contain

how to compute loss for each individual training instance in theano / keras -

i trying tweak keras code generate loss each individual training instance in each training epoch. _fi_loop(.) keras / theano function below generates average loss each batch, happening at outs = f(ins_batch) any hints on how array contains loss values individual instances in each batch , epoch? thanks in advance. def _fit_loop(self, f, ins, out_labels=[], batch_size=32, nb_epoch=100, verbose=1, callbacks=[], val_f=none, val_ins=none, shuffle=true, callback_metrics=[]): '''abstract fit function f(ins). assume f returns list, labeled out_labels. # arguments f: keras function returning list of tensors ins: list of tensors fed `f` out_labels: list of strings, display names of outputs of `f` batch_size: integer batch size nb_epoch: number of times iterate on data verbose: verbosity mode, 0, 1 or 2 callbacks: list of callbacks called during traini

angular - Accessing shared styles from an Angular2 NgModule -

i have angular2 project (generated angular-cli ). in project have main module , sub-module. sub-module represents defined concept, fits have (potentially reusable) ngmodule . the sub-module encapsulates different components, , exposes 1 component outwards. nice, works module reusable. however, module have 1 global dependency, stops being decoupled, reusable module. scss file accesses common scss file using @import . common scss file outside module. so, specifically, scss style file inside module refers scss file outside module using relative paths, this: @import './../../../assets/styles/common-props'; i don't want copy scss file module. best way consume common scss file, module becomes easy reuse? there best practice? not sure if there best practice here. depends on how want import , manage external scss resources. if want scss resource updated homebrew or npm update importing source directory way go. if want manually control upgrade path

angularjs - Angular - file upload request, adding @RequestParam -

i want add @requestparam http request match spring mvc @requestparam . how can add file upload request: /* @param file - file input @param uploadurl - url */ this.uploadfiletourl = function(file, uploadurl){ var fd = new formdata(); //add file formdata fd.append(file.name, file); //send request $http.post(uploadurl, fd, { transformrequest: angular.identity, headers: {'content-type': undefined} }) .success(function(result){ console.log(result); }) .error(function(err){ console.log(err); }); } in backend error required string parameter 'filename' not present here spring mvc controller (only header part): @controller @requestmapping("/file") public class fileuploadcontroller { /**

javascript - connect three.js project to database -

a have quick quesion three.js. i'm working 3d project uses datbase connection, use mysql first time. did had experience on connecting three.js mysql or other databases? that's important me start learning product. used work unity , blend4web. if has special experience on feathures simplify process etc many given!!!

wordpress - Can WooCommerce track product views? -

woocommerce offers 'recently viewed products' widget natively. is there way adapt function record , display number of times each product has been viewed in admin->products lists? perhaps along lines of woocommerce hook , custom field...? incidentally, woocommerce product views plugin not need! thanks in advance help!

java - Extract certificate from SSLContext -

i'm creating sslcontext in standard way: take .p12 certificate file, create keystore , load certificate it, create keymanagerfactory, init keystore, , keymanagers, create trustmanagerfactory, init null, , trustmanagers. create sslcontext , init keymanagers , trustmanagers. the question - how can extract keystore , certificate data sslcontext? task obtain fingerprint hash certficate. is possible or have separately, reading certificate file? it can done if have custom trustmanager. can refer link custom class. private savingtrustmanager static class. and place using java's default trustmanager, use class can retrieve certificate server sent. sslcontext context = sslcontext.getinstance("tls"); trustmanagerfactory tmf = trustmanagerfactory.getinstance(trustmanagerfactory.getdefaultalgorithm()); tmf.init(dummytruststore); x509trustmanager defaulttrustmanager = (x509trustmanager) tmf.gettrustmanagers()[0]; savingtrustmanager savingtrustmanag

ios - Publish to iTunes invalid profile -

Image
i'm trying publish application on itunes but... 1) if publish via xcode 8 (automatically signing), passed validation , uppload application, noappears in itunes. 2) next (grow version code) truing use applicationloader , got error: 3) remove developer , distribution keys keychain , downloads again 4) , trying set manually got error: p.s certificates valid i'ts not user, dosen't have access remove , create new certificates certificates have been set in build settings also: it might because did not add permission in info.plist like privacy - camera usage description , privacy - photo library usage description you can found permissions here