Posts

Showing posts from August, 2012

Recently added/published/verified Google Business listing not showing in API -

we added client of ours on google , verified listing: https://www.google.com/search?q=green%20horizen%20llc%20140%20main%20st%20west%20kaysville&ludocid=15837666761009512619&hl=en but not showing in places api. how recent added customer? week ago. does have ideas if takes longer week listing show in places api? thanks!

npm - ember-cli installation not working -

$ npm install -g ember-cli c:\users..\appdata\roaming\npm\🐹 -> c:\users..\appdata\roaming\npm\nod e_modules\ember-cli\bin\ember c:\users..\appdata\roaming\npm `-- (empty) npm err! windows_nt 10.0.15063 npm err! argv "c:\program files\nodejs\node.exe" "c:\program files\nodejs\ node_modules\npm\bin\npm-cli.js" "install" "-g" "ember-cli" npm err! node v6.11.2 npm err! npm v3.10.10 npm err! path c:\users..\appdata\roaming\npm\ember npm err! code eperm npm err! errno -4048 npm err! syscall open npm err! error: eperm: operation not permitted, open 'c:\users..\appdata\ro aming\npm\ember' npm err! @ error (native) npm err! { error: eperm: operation not permitted, open 'c:\users..\appdata \roaming\npm\ember' npm err! @ error (native) npm err! errno: -4048, npm err! code: 'eperm',

Using MySQL how do I select data between two dates if the dates are in separate columns -

in database, have column check-in date , column check-out date. need select every row has check-in date <= 7/30/2017 , check-out date >= 7/30/2017. this code have now: select * `v_reservation_records` cast(checkin date) <= '7/30/2017' , cast(checkout date) >= '7/30/2017' here example date db: 2018-09-18 when run query, not results, know have check-in date equal 7/30/2017. missing? or there easier way accomplish goal? assuming casting valid values date should convert literal date select * `v_reservation_records` cast(checkin date) <= str_to_date('7/30/2017' , '%d/%m/%y') , cast(checkout date) >= str_to_date('7/30/2017' , '%d/%m/%y') and can use between select * `v_reservation_records` str_to_date('7/30/2017','%d/%m/%y') between cast(checkin date) , cast(checkout date)

objective c - Waiting for code to execute (already used dispatch groups) -

got lengthy section of code shown below , i've hit brick wall. code runs , want do. however, needs finish running code within section before printing "finished" @ end. adding semaphores or dispatch group forces breakpoint. might obvious, give me bit of advice on please? note: cannot use dispatch @ bottom call method. remember within loop. for (id in arr) { searchbyname = nil; if ([i containsstring:@"word1"] || [i containsstring:@"word2"]) { nsrange searchfromrange = [i rangeofstring:@"ong>"]; nsrange searchtorange = [i rangeofstring:@"</str"]; nsstring *substring = [i substringwithrange:nsmakerange(searchfromrange.location+searchfromrange.length, searchtorange.location-searchfromrange.location-searchfromrange.length)]; [allergens addobject:substring]; if ([substring isequaltostring:@"examee"] && veg_lac_ovosafe == true) { veg_ovosafe = false

oop - How i can create child view for parent view in PHP MVC? -

Image
when type address: http://localhost/gamelvl/world-of-tanks/tankguide/ i can enter tankguide view. inside folder folder called ussr when create controller , model ussr can not enter address: http://localhost/gamelvl/world-of-tanks/tankguide/ussr/ now, 1 can give me instructions on whether right thing or other solutions this? routing app <?php class app { public $controller = 'index'; public $method = 'index'; public $params = []; function __construct() { if (isset($_get['url'])) { $url = $_get['url']; $url = $this->parseurl($url); $this->controller = $url[0]; unset($url[0]); if (isset($url[1])) { $this->method = $url[1]; unset($url[1]); } $this->params = array_values($url); } $controllerurl = 'controllers/' . $this->controller . '.php';

javascript - How do you return a promise? -

i don't understand how return promise. here's i've got far: post('myprogram.cfm',done) function done(response) { log('done') log(response) } function post(url,callback) { const form = new formdata(document.queryselector('form')) fetch(url, { method: 'post', body: form }).then(then) .then(callback) .catch(fail) function then(response) { return response.json() } function fail(response) { log('fail!') log(response) } } what is: const promise = post('myprogram.cfm') promise.done(done) i think instead of doing then(callback) , should return something .

python - Query-based view that changes periodically -

so i'm working on django project restaurant's page , need make view menu changes weekly. class weeklychangingmenu(models.model): introduction_date = models.datefield() options = models.charfield(max_length=500) and have menu view: def menu(request): menu = weeklychangingmenu.objects.get(introduction_date < datetime.date.today()) return render(request, "menu.html", {"menu":menu}) and i'm looking way to, rather making same query on , over, making query once week by, say, manage.py command store , reuse info if hardcoded view week make lot easier database.

Angular 4 how to set page title -

i want set dynamic page title every time clicked route. app.route.ts export const routes: routes = [ { path: '', component: logincomponent, data: { title: 'login' } }, ]; in root index.html have this. <!doctype html> <html> <head> <base href="./"> <title>{{ title }}</title> </head> <body class="app"> <!-- app loading app injects in body... --> </body> </html> login component import { component, oninit } '@angular/core'; @component({ selector: 'app-login', templateurl: './login.component.html', styleurls: ['./login.component.scss'] }) export class logincomponent implements oninit { constructor() { } ngoninit() { } } i'm not sure if title names call in component or not. if needs called how do that? i'm using angular4 has different ways things. duplicate answer using messy

json - Convert JWK to DER (public key) -

i looking convert following public jwk key: https://cognito-idp.us-east-1.amazonaws.com/us-east-1_wgmuekpvv/.well-known/jwks.json to der file. either via online tool or locally (macos x).

localization - How can I see each permutation of `FormatStyle` for a localized `DateTimeFormatter` in Java? -

i cannot find documentation particular behavior of formatstyle set date portion , time portion of datetimeformatter when automatically localizing : datetimeformatter.oflocalizeddatetime(formatstyle datestyle, formatstyle timestyle) is there way know possible variations of strings generated particular locale ? if want know results of generated strings (the final result of format method), your answer covers well. i'd add external loop through locales, because different locales can have different format styles. if want know patterns , though, can use datetimeformatterbuilder.getlocalizeddatetimepattern method within same nested loops. used values() method instead of enumset (not sure if makes difference): for (locale locale : locale.getavailablelocales()) { system.out.println("--|for locale " + locale + "|-------"); (formatstyle styledate : formatstyle.values()) { (formatstyle styletime : formatstyle.values()) {

javascript - Android KeyUp, KeyDown, and KeyPress events not working with Angular2 -

i'm running issue when run either <input type="text" (keydown)="testkeycodes($event)"/> <!-- or --> <input type="text" (keyup)="testkeycodes($event)"/> i keycode of 229 in android chrome browsers, know has been mentioned several times on stack overflow, , i've seen recommendation use <input type="text" (keypress)="testkeycodes($event)"/> instead. problem is, keypress event not fired android phones. has found solution this? my end goal prevent users on android browsers entering special characters alphanumeric inputs. below regex i'd check against. //tried testkeycodes(event) { if (!/[a-za-z0-9 ]/.test(event.keycode) && event.keycode != '8') { event.preventdefault(); } } //and testkeycodes(event) { if (!/[a-za-z0-9 ]/.test(string.fromcharcode(event.keycode)) && event.keycode != '8') {

c# - ASP.Net Core Currency Format Not Working Properly -

while trying display currency attribute [datatype(datatype.currency)] , using @html.displayfor(model => model.variable) format not displaying correctly on os x computer while debugging locally. shows ¤ symbol instead of $. you can set culture info programatically server in startup.cs public startup(ihostingenvironment env) { cultureinfo.defaultthreadcurrentculture = new cultureinfo("en-us"); var builder = new configurationbuilder() .setbasepath(env.contentrootpath) .addjsonfile("appsettings.json", optional: false, reloadonchange: true) .addjsonfile($"appsettings.{env.environmentname}.json", optional: true) .addenvironmentvariables(); configuration = builder.build(); }

Microsoft Botframework integration with slack Unauthorized using REST API -

it appears in past week has changed in way microsoft bot framework connects slack, , result messages server sends botframework published in slack channel rejected 401 unauthorized error. created new bot account on friday , walked through setup process install bot on slack channel , botframework post data server when messages sent on slack channel bot added user, response server tries send fails unauthorized error. when using same bot in microsoft teams responses go through successfully, appears slack-specific (although haven't tried of channels). i able oauth token needed make request server bot framework using tutorial outlined here: https://blogs.msdn.microsoft.com/tsmatsuz/2016/08/19/build-skype-bot-with-microsoft-bot-framework-oauth-and-rest-api/ (with endpoints updated based on api changes in july). this issue began sometime between september 6th , 8th, able send messages our server bot framework , have them relayed slack channel on 6th, when tried again on 8th firs

javascript - Getting a portion of a sorted array from start value to end value -

i'm pretty new javascript , need portion (slice) of sorted array (numbers, timestamps basically) start_value , end_value. for example, let's have array of random timestamps last month, , want timestamps between 2 weeks ago , week ago. pretty simple algorithm write (using binary search) don't want mess code these computations. i've been searching way in javascript haven't found any. thanks future :) perhaps use filter ? var dates = [123, 234, 456, 468, 568, 678]; var min = 300; var max = 500; var inrange = dates.filter(function(date) { return min < date && date < max; }); console.log(inrange); on plus side, doesn't need them sorted. on down side, won't fast well-implemented binary search relevant start , end points. unless you've got harsh performance requirements don't think that'll matter.

statistics - Why does regression in R delete index 1 of a factor variable? -

this question has answer here: linear regression “na” estimate last coefficient 2 answers i trying regression in r using lm , glm function. my dependent variable logit transformed data based on proportion of events on non-events within given time period. dependent variable continuous whereas independent variable factor variable or dummies. i have 2 independent variables can take values of year year m, year variable month j month n, month variable the problem whenever run model summaries results april(index 1 month) , 1998 (index 1 year) not within results... if change april let's "foo_bar", august missing... please help! frustrating me , not know how search solution problem. if r create dummy variable every level in factor, resulting set of variables linearly dependent (assuming there intercept term). therefore, 1 facto

datagrid - Clear the renderer from a Grid column in Vaadin 8.1 -

in vaadin framework 8.1 app, on grid widget, how 1 clear column renderer after setting it? we can set renderer on grid.column calling setrenderer . how un-set it? passing null results in null pointer exception: java.lang.nullpointerexception: renderer can not null the default behavior before setting renderer seems calling tostring on column’s objects. ➟ how default behavior? there no way ask vaadin revert default. before setting new renderer, can ask existing default renderer. renderer<?> r = this.columninstant.getrenderer() ; then later re-apply it. mygridcolumn.setrenderer( r ) ; commonly, default renderer com.vaadin.ui.renderers.textrenderer . can instantiate new 1 if more convenient retaining reference old one. mygridcolumn.setrenderer( new com.vaadin.ui.renderers.textrenderer() ) ;

python - Reshape Keras Input for LSTM -

i have 2 ndarrays, inputs , results, both consisting of multiple arrays looking this: inputs = [ [[1,2],[2,2],[3,2]], [[2,1],[1,2],[2,3]], [[2,2],[1,1],[3,3]], ... ] results = [ [3,4,5], [3,3,5], [4,2,6], ... ] i managed split them train , test arrays, train contains 66% of arrays , test other 33%. i'd reshape them further use in lstm script fails when inputting them np.reshape() function. split = int(round(0.66 * results.shape[0])) train_results = results[:split, :] train_inputs = inputs[:split, :] test_results = results[split:, :] test_inputs = inputs[split:, :] x_train = np.reshape(train_inputs, (train_inputs.shape[0], train_inputs.shape[1], 1)) x_test = np.reshape(test_inputs, (test_inputs.shape[0], test_inputs.shape[1], 1)) please tell me how use np.reshape() correctly in case. basically loosely following tutorial: https://github.com/vict0rsch/deep_learning/tree/master/keras/recurrent you pass tuple np.reshape . for lstm layer, need sha

reactjs - Weird gestures behavior when svg is scaled down in react native -

i have following issue: there parent view wraps 2 children views - left , right panels. when move finger across screen animate width of left panel , scale content. content has 1 svg circle. want able capture onpress event of svg circle. but when press on circle while scaled down, animation flickers. if open console can see velocity of gesture bigger when press on scaled circle. if svg not scaled down, works expected. here snack: https://snack.expo.io/r1fp9fy5b . issue appears on physical android devices, scan qr code. is behavior of scaled gestures expected or bug? , how fix it? thanks in advance!

python 2.7 - Read data from serial port using docker -

i have python code (ard_temp.py) reads data usb serial port using pyserial library , display in port 50010 using bokeh. works on both widows , mac. any idea how can dockerize it? have made dockerfile follows: # use official python runtime parent image continuumio/anaconda # set working directory /app workdir /app # copy current directory contents container @ /app add . /app # install needed packages specified in requirements.txt run conda install pyserial run conda install bokeh # make port 80 available world outside container expose 80 expose 50010 expose 50011 # define environment variable env name world # run app.py when container launches cmd ["bokeh", "serve", "ard_temp.py", "--port", "50010"] just building code in dockerfile not working. (you can assume port com3).

AngularJS improve ng-repeat performance with out pagination -

i'm getting around 1000 records api. want show in ui without pagination(we having other issues @ moment). i'm loading records in html using ng-repeat. ng-repeat taking lot of time rendering page.i'm using 'track id' also. how can improve ng-repeat performance? options? if you're not going use pagination, should consider 1 time binding (see "one-time binding" section in https://docs.angularjs.org/guide/expression ), or if doesn't suit needs, can try https://github.com/kasperlewau/angular-bind-notifier however, still take time render, should consider simulating infinite scroll using limitto filter , increasing value scroll down. if want display 1000 items @ once, slow, no matter how optimised.

python - using function from module with button -Tkinter -

so doing learning modules. decent tkinter after using 5 months or so. can work if put functions inside main file. separating them separate modules can learn how work modules better. question more knowledge. i going have 3 files total, main loop (example_gui.py) , pythonic functions (example_funcs.py) , gui functions (more_example_funcs.py)... can see issue using "get_text()" inside more_example_funcs.py obvious why doesnt work in case. variable not defined inside .py file. how make work? told better way code having functions inside file(modules). with full scale app using tkinter , going have bunch of functions connected entries such going defined in example_gui.py easier if put functions inside more_example_funcs.py example below example_funcs.py from tkinter import * import tkinter tk def center(toplevel): toplevel.update_idletasks() w = toplevel.winfo_screenwidth() h = toplevel.winfo_screenheight() size = tuple(int(_) _ in toplevel.geometry().

python - Saving a pandas dataframe to separate jsons without NaNs -

Image
i have dataframe nan values. here sample dataframe: sample_df = pd.dataframe([[1,np.nan,1],[2,2,np.nan], [np.nan, 3, 3], [4,4,4],[np.nan,np.nan,5], [6,np.nan,np.nan]]) it looks like: what did after json: sample_df.to_json(orient = 'records') which gives: '[{"0":1.0,"1":null,"2":1.0},{"0":2.0,"1":2.0,"2":null},{"0":null,"1":3.0,"2":3.0},{"0":4.0,"1":4.0,"2":4.0},{"0":null,"1":null,"2":5.0},{"0":6.0,"1":null,"2":null}]' i want save dataframe json 2 rows in each json, none of nan values. here how tried it: df_dict = dict((n, sample_df.iloc[n:n+2, :]) n in range(0, len(sample_df), 2)) k, v in df_dict.items(): print(k) print(v) d in (v.to_dict('record')): k,v in list(d.items()): if type(v)==float: if math.isnan(v):

angular - need to update this implementation with promise chaining -

i have following method in viewmodelbuilder class: async buildviewmodel(request) { const bsm = this.getblogsearchmetadata(); await this.getblogpostsearchresults(request); await bsm; return this.vm; } this original implementation designed allow getblogsearchmetadata() , getblogpostsearchresults(request) execute @ same time. both set properties on this.vm , upon completion of both methods, buildviewmodel return this.vm. i have new requirement promise chaining needs used in method. this.getblogsearchmetadata() needs return first , then() promise chain should call this.getblogpostsearchresults(request) request values set based on response this.getblogsearchmetadata() . the method code provided above reflects current implementation. enough code describe specific changes can make code support new requirement? both subfunctions in method marked async keyword. i have new requirement promise chaining needs used in method. this.getblogsearchmetadata()

ios - How can I record which pieces of data in my app are accessed at startup? -

i want improve startup time of ios app putting of symbols used @ startup in executable, of order file. way, operating system can fetch needs start fewer pages , take less time. can order functions called in https://clang.llvm.org/docs/sanitizercoverage.html , , can see benefits startup time when order them. however, don't know of way record symbols, besides functions, accessed on. how might this?

javascript - How can I export a React Component as an NPM package to use in separate projects? -

i have created react component inside project i'd use in multiple projects. @ moment, care doing locally , development. react component rendered root div, project uses webpack , babel transpile jsx, es6 , es7 features bundle. i thought simple export component such can run npm install mycomponent , begin using in fresh project. however, find isn't straight forward. in particular, i've been reading hours , hours , seem getting more confused. if end goal keep developing 'mycomponent' in containing project, while using 'mycomponent' in number of other local projects, options? first thing did change main key of package.json /src/components/mycomponent , run npm pack . produces tgz file can install via absolute filepath in other projects. however, found es6 , jsx not being transpiled , client projects unable parse mycomponent . used webpack transpile lib/mycomponent , when have import mycomponent './path/to/mycomponent-1.0.0.tgz i'd

OpenShift build config - push to docker.io -

im trying build dockerfile using openshifts build config. the actual build completes successfully. i have set build config push resulting image dockerhub. i've supplied secret contains username , password docker.io - , have double checked credentials. yet when run following error: pushing image hughestech/grpcdev ... error: build error: failed push image: unauthorized: authentication required build config yml apiversion: v1 kind: buildconfig metadata: annotations: openshift.io/generated-by: openshiftnewapp creationtimestamp: '2017-09-11t20:32:47z' labels: app: grpcdev name: grpcdev namespace: testproject resourceversion: '72394' selflink: /oapi/v1/namespaces/testproject/buildconfigs/grpcdev uid: 5f70c545-9730-11e7-ab81-002421dde3d7 spec: nodeselector: null output: pushsecret: name: dockhub-hughestech to: kind: dockerimage name: hughestech/grpcdev postcommit: {} resources: {} runpolicy: seria

OpenCV: How can I make the PCA class only account for local transformation? -

introduction i reading "mastering opencv practical computer vision projects" have finished ch6, non-rigid face tracking. in chapter, have obtained eigenvectors of local transformation of face removing global transformation , putting final product through svd class. fine , worked well. yet, in ch7, book uses pca class , hence, planned use well. question the problem is, found or @ least think found, pca class accounts both global transformation , local transformation if send in shape data of faces in training set(provided muct database). there way account local transformation without going through hassle of deducting center of mass, procrusting, , projecting out global transformation? basically, there neat trick account when using pca class? note if point unclear, please ask me clarify in comments. try clarify best of ability. thank you.

View Cassandra Partitions using CQLSH -

using cassandra, how see how many partitions created base on how created primary key? have been following tutorial , mentions go bin/cassandra-cli , use list command. however, latest cassandra install not come , have read other articles online have indicated cli deprecated. is there anyway me see partitions created using cqlsh? thanks in advance! first of have investigate cassandra.yaml file see number of tokens configured. tells how many partitions each node own: $ grep num_tokens conf/cassandra.yaml ... num_tokens: 128 ... $ grep initial_token conf/cassandra.yaml ... # initial_token: 1 ... if initial token commented out, means node figure out it's own partition ranges during start-up. next can check partition ranges using nodetool ring command: $ bin/nodetool ring datacenter: dc1 ========== address rack status state load owns token

amazon web services - How to maintain active/active endpoint with cloudfront? -

Image
recently aws had biggest outage s3 on us-east-1. expand multiple regions deploying lambda , s3 data other regions. retain one single url can detect if region has outage , forward call active region. if both regions active, closest region receive request. tried aws route53 , did not https . since cloudfront cannot accept same cname on more 1 distribution. any on appreciated.

c++ - why does scanf not work when access a input of char type in C -

this question has answer here: scanf() leaves new line char in buffer? 3 answers #include <stdio.h> int main() { int age; char sex; printf("enter age: " ); scanf("%d", &age); printf("enter sex (f,m): " ); scanf("%c", &sex); printf("output message %d %c",age,sex); return 0; } for debugging, scanf("%c", &sex); line not work properly, when input age , press enter key,it skip input part of sex , showed output message directly. however, when appended getchar(),it works properly. #include <stdio.h> int main() { int age; char sex; printf("enter age: " ); scanf("%d", &age); printf("enter sex (f,m): " ); scanf("%c", &sex); getchar(); printf("output message %d %c&quo

selenium - How to test network traffic generated by Browser Mob proxy? -

as part of project working on qa member, need automate testing of har file generated through browser mob proxy development team. tried generate own har file through phantomjs, fact works on headless mode , have open bugs, meant can't use source of truth data given proxy. suggestions how this?

Swift - Variable used within its own initial value -

func presentloggedinscreen() { let stroyboard:uistoryboard = uistoryboard(name: "main", bundle: nil) let logginedinvcviewcontroller:logginedinvcviewcontroller = storyboard.instantiateviewcontroller(withidentifier: "logginedinvcviewcontroller" as! logginedinvcviewcontroller, self.present(logginedinvcviewcontroller, animated: true, completion: nil)) } how can avoid error? variable used within own initial value try this: func presentloggedinscreen() { let storyboard = uistoryboard(name: "main", bundle: nil) if let logginedinvcviewcontroller = storyboard.instantiateviewcontroller(withidentifier: "logginedinvcviewcontroller") as? logginedinvcviewcontroller { self.present(logginedinvcviewcontroller, animated: true, completion: nil) } } edit: use optional binding , whats causing error , , ) intellisense of xcode doesnt work properly, try analyze problem first :)

python - Simple Autoencoder on Tensorflow using pokemon -

i have implemented simple autoencoder close reference to: https://hackernoon.com/how-to-autoencode-your-pok%c3%a9mon-6b0f5c7b7d97 . results different expected (as unable post images now, please check them out in github: https://github.com/notha99y/autoencoder ) does know why model seems not learning? thanks in advance. my implementation is: 1) flatten out images. (none,64,64,3) => (none, 12288) 2) mean , variance normalized 3) encoding: 12288 => 1024 => 64 => 4. decoding: 4 => 64 => 1024 => 1228 4) multiply variance , add mean code: import numpy np import matplotlib.pyplot plt import os scipy.misc import imread import time sklearn.utils import shuffle import tensorflow tf os.environ['tf_cpp_min_log_level']='2' def getimages(batchsz = 100,random = false): '''access directory holding pokemon , returns images in array of shape (batchsz,width,breath,channels) if random set true, function take randomly sele

javascript - depthTestAgainstTerrain in cesium -

Image
i working on project have display groupmembers , myself on map terrain. because didn't want these members , myself visible through terrain activated scene.globe.depthtestagainstterrain = true; . problem is cut off @ angles can see on provided image. how can use depthtestagainstterrain without cutting off icons?

algorithm - Understanding asymptotic notation homework -

this problem steven skiena's algorithm design manual book. homework , not looking solution. want know if understand concept , approaching right way. find 2 functions f(n) , g(n) satisfy following relationship. if no such f , g exist, write none. a) f(n)=o(g(n)) , f(n)≠Θ(g(n)) so i'm reading g(n) strictly (little-oh) larger f(n) , average not same. if i'm reading correctly answer is: f(n) = n^2 , g(n) = n^3 b) f(n)=Θ(g(n)) , f(n)=o(g(n)) i'm taking mean f(n) on average same g(n) g(n) larger, answer is: f(n)=n+2 , g(n)=n+10 c) f(n)=Θ(g(n)) , f(n)≠o(g(n)) f(n) on average same g(n) , g(n) not larger: f(n)=n^2+10 , g(n)=n^2 d) f(n)=Ω(g(n)) , f(n)≠o(g(n)) g(n) lower bound of f(n): f(n)=n^2+10 , g(n)=n^2 now understanding of problem correct? if not, doing wrong? if correct, solutions make sense? appreciated. thanks!!

using gdb on fstream of c++ -

i have std::fstream object in code, std::fstream input reading values files. how can check status of input inside gdb debugger? tried print input.fail() , says: couldn't find method std::ifstream::fail this because have not installed debug symbols libstdc++ (this std::fstream resides). if try print input variable without debug symbols libstdc++: (gdb) p input $1 = <incomplete type> i've reproduced issue on fedora , issue gone ( input variable printed , input.fail() called) after installed debug info command: sudo debuginfo-install libstdc++ see similar issue std::stringstream here: https://www.reddit.com/r/learnprogramming/comments/5dwtbb/gdb_looking_into_streams/

c++ - Where is the destructor called? -

i'm learning c++ , want use objects in classes. output of program confuses me, because expected, data destructor called 2 times. object created "data data(3);" , it's destructor should called @ end of code block , when rects destructor called, destructor of data inside rect should called too. expected prints "data destructor" 2 times after code block ends. prints it, after data object created. why happen , how can delete allocated memory inside of data correctly? class data { private: int* data; int size; public: data() { size = 10; data = new int[size]; } data(int size) : size(size) { data = new int[size]; } virtual ~data() { // delete data; std::cout << "data destruktor" << std::endl; } void init(int val) { (int = 0; < size; i++) data[i] = val; } int& operator[](int index) { return data[index]; }

haskell - Using map and filter function -

i can't figure out how implement map , filter function matrix. have suggestions satisfy these tests? -- | matrix tests -- -- prop> mapmatrix (\a -> - 3) (mapmatrix (+ 3) x) == x -- -- >>> filtermatrix (< 3) matrix1 -- [[1,2],[2]] -- >>> filtermatrix (> 80) [] -- [] -- >>> transpose' matrix2 -- [[1,4],[5,8]] mapmatrix :: (a -> b) -> [[a]] -> [[b]] mapmatrix f [list] = [map f list] filtermatrix :: (a -> bool) -> [[a]] -> [[a]] filtermatrix = undefined transpose' :: [[a]] -> [[a]] transpose' = undefined matrix1 = [[1 .. 10], [2 .. 20]] matrix2 = [[1, 5], [4, 8]] some hints, not complete solution because sounds homework. mapmatrix , filtermatrix : write functions work on 1 row of matrix @ time, map onto list of rows. transpose' : 1 way list comprehension applies !! operator lists of indices, , recursive function removes 1 row @ time input , adds 1 column @ time output. is filtermat

javascript - Angular4, update component on route change -

how update component when route changes. have component : import { component, oninit } '@angular/core'; import { activatedroute } '@angular/router'; import { listservice } '../list/list.service'; @component({ selector: 'view', template: ` <div *ngif="!entity"> <p>select <b (click)="showrow()">row {{entity}}</b>!</p> </div> <div *ngif="entity"> <p >{{entity.id}}</p> <p >{{entity.name}}</p> <p >{{entity.weight}}</p> <p >{{entity.symbol}}</p> </div> `, styles: [] }) export class viewcomponent implements oninit { constructor( private route: activatedroute, private service: listservice ) { this.route.params.subscribe(params => { const id = parseint(params['id']); if (id) { const entity = this.service.getrow(id); this.enti

c# - Fit image into datagridview column -

i've datagridview of height , width 300x300 size. i'm reading image memory stream. want resize image datagridview column such fit in it. i've following code this code read image database byte[] img = (byte[])(datareader[5]); memorystream ms = new memorystream(img); code adding items in datagridview datagridview1.rows.add( image.fromstream(ms)); above code crops image , display 300x300 size of image. you can use datagridviewimagecolumn has imagelayout property, byte[] img = (byte[])(datareader[5]); memorystream ms = new memorystream(img); datagridviewimagecolumn imagecol = new datagridviewimagecolumn(); imagecol.headertext = "test1"; datagridview1.columns.add(imagecol); imagecol.imagelayout = datagridviewimagecelllayout.stretch; // trick datagridview1.rows.add(image.fromstream(ms)); hope helps,

android - Why is the Cursor set to 0 position after clicking button in ListView -

when click button cursor position changed 0 in onclick() function. in debug can see cursor.getposition() returns correct position when outside onclick() inside function gives me position 0. it if jumps top of screen screen element don't move. here onclick() function use inside binview in cursoradapater listview : viewholder.buttoniav.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { //int position = cursor.getposition(); log.d("cursor position2", string.valueof(position)); boolean isselected = selectionarray.get(position); log.d("is true2", string.valueof(isselected)); if(!isselected) { viewholder.artextv.setvisibility(v.invisible); setselected(position, true);

javascript - addClass breaks JS -

i wrote following code: document.addeventlistener("domcontentloaded", ()=>{ let menu = document.queryselector(' #menu-mainmenu '); menu.style.display = 'none'; }); let newbutton = document.createelement(' div '); this code didn't cause problem. the moment i've added following code right under let newbutton , suddenly, seems, js broke (no js load anywhere in site). newbutton.classname = 'menubutton'; console returns error: uncaught domexception: failed execute 'createelement' on 'document': the tag name provided (' div ') not valid name. why happen? problem creating div element way? you have spaces around div tag , cause error. remove them document.addeventlistener("domcontentloaded", ()=>{ //let menu = document.queryselector(' #menu-mainmenu '); //menu.style.display = 'none'; console.log('worked !!!'

Empty the log file every time I write with Enterprise Library Logging -

i have enterprise library logging used in project working fine, need last entry saved @ time. there configuration that? below current configuration. <add name="workflowlistener" formatter="workflow formatter" filename="..\@data\logs\workflow_log.txt" timestamppattern="yyyy-mm-dd-hh-mm-ss" rollfileexistsbehavior="overwrite" rollinterval="none" header="" footer="" traceoutputoptions="none" type="microsoft.practices.enterpriselibrary.logging.tracelisteners.rollingflatfiletracelistener, microsoft.practices.enterpriselibrary.logging, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />

How to post JSON using Retrofit 2 in android? -

Image
i new android , dont know how post using retrofit i have own server returns me data, need fetch one this how url body looks i have send "city name" taken edittext , pass inside "ms_data's" keyword, i.e keyword="india" this have tried far... retrofit builder class public class retrofitbuilder { public static retrofit retrofit; public static final string base_url = "my url"; public static retrofit getapidata() { if(retrofit==null) { retrofit = new retrofit.builder().baseurl(base_url) .addconverterfactory(gsonconverterfactory.create()).build(); } return retrofit; } } pojo class public class messagefromserver { private string city_name; public messagefromserver(string city_name) { this.city_name = city_name; } public string getcity_name() { return city_name; } public void setcity_name(string city_name) { this.city_name = city_name; } @override public boole

python - tf.string_split for a tensor of strings -

i have tensor looks like x = [b'1 2 3 4 5' b'3 2 1' b'1 2'] how can split single strings of tensor numbers? when apply tf.string_split(x) following error: typeerror: failed convert object of type <class 'tensorflow.python.framework.sparse_tensor.sparsetensor'> tensor. contents: sparsetensor(indices=tensor("stringsplit_1:0", shape=(?, 2), dtype=int64), values=tensor("stringsplit_1:1", shape=(?,), dtype=string), dense_shape=tensor("stringsplit_1:2", shape=(2,), dtype=int64)). consider casting elements supported type. when try tf.string_split(x).values , following tensor: x = [b'1' b'2' b'3' b'4' b'5' b'3 b'2 b'1' b'1 b'2'] this not want because information numbers belong gone. want this x = [[b'1' b'2' b'3' b'4' b'5'] [b'3' b'2' b'1'] [b'1' b'

php - how to increase container width to fix GridView scroll in yii2 -

i using yii2 gridview widget showing data in form of table. as there many fields show, gridview ( below table ) showing scroll it. don't want it. i want increase container width show table without scroll. i had search bootstrap.css file not found in directory. how change gridview width ? <?= gridview::widget([ 'dataprovider' => $dataprovider, 'filtermodel' => $searchmodel, 'columns' => [ ['class' => 'yii\grid\serialcolumn'], ......... ['class' => 'yii\grid\actioncolumn'], ], 'tableoptions' =>['style' => 'width: 1800px;'], ]); ?> or gridview container options <?= gridview::widget([ 'dataprovider' => $dataprovider, 'filtermodel' => $searchmodel, 'columns' => [ ['class' => 'yii\grid\serialcolu

elasticsearch - How to insert GeoJson file into elastic Search cloud without logstach and CURL command? -

how insert geojson file elastic search cloud without logstach? http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html geojson simple json file can index in es using curl command curl -xpost 'http://localhost:9200/test/test/1' -d @geo.json sample geo.json { "type": "feature", "geometry": { "type": "point", "coordinates": [125.6, 10.1] }, "properties": { "name": "dinagat islands" } }

ios - After the Objective-C and Swift are mixed together, the size of IPA became larger -

our project objective-c. after mixing swift, ipa size changed lot. if there few swift files, package increases lot , don't know how solve it. see app size in app store, updated apps greater 100mb, don't worry that. it's due apple new app thining , bitcode impact introduced ios 9 swift runtime libraries copied application bundle , around 30mb alone. if create new app swift , create ipa without anything, big in size (check on system) check link https://forums.developer.apple.com/thread/16339