Posts

Showing posts from February, 2015

javascript - I need to put text in a <h> that is in a Div that is in another Div that is with in another yet another div -

i need put text in <h3> in div in div in yet div. here looks like: <div id="loginmodal" class="ui-dialog-content ui-widget-content" style="width: auto; min-height: 0px; height: 193.8px;"><iframe hspace="0" src="/client/en_us/cntest/search/patronlogin/https:$002f$002farrowhead.ent.sirsi.net$002fclient$002fen_us$002fcntest$002fsearch$002faccount$003fdt$003dlist" name="dialog_iframecontent610" style="width:350px;height:215px;" frameborder="0"> </iframe></div> <iframe hspace="0" src="/client/en_us/cntest/search/patronlogin/https:$002f$002farrowhead.ent.sirsi.net$002fclient$002fen_us$002fcntest$002fsearch$002faccount$003fdt$003dlist" name="dialog_iframecontent610" style="width:350px;height:215px;" frameborder="0"> </iframe> #document <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "h

node.js - How to test socket.io events being called with sinon.spy -

first of all, i'm trying test second time function being called returns correct value. more specific, i'm trying test second time event received socket.on() returns correct value. i know sinon.spy() can detect whether function being called or not. seems not working socket.io events. i'm trying test example, var socketio = io.connect(someurl); socketio.on(eventname, cb); if event 'connect' called. tried var spy = sinon.spy(socketio, 'on'); assert(spy.witharg(eventname).called); but says it's never being called. furthermore, if i'd test data in callback function right or not, example var socketio = io.connect(someurl); socketio.on(eventname, function(data) { data.should.equal(something); }); is possible test that?

c# - Access Denied!? I cant open a file from my install folder on the C Drive -

Image
what doing wrong? i have read/copy/write process access folder installed software. this worked great when testing build, once solution created stopped working. doing wrong? (breakdown of code) access pdf called ctw.pdf next create temp copy software fills in , flatted on completion, software saves new copy same directory new name (i add time , date file name) here's code: if (screenlock.text == "") { } else { string filenameexisting = @"c:\program files (x86)\compliance pro 2\ctw.pdf"; string filenamenew = @"c:\program files (x86)\compliance pro 2" + " ctw.pdf" + datetime.now.tostring("m/d/yyyy") + datetime.now.tostring("hh:mm:ss"); using (var existingfilestream = new filestream(filenameexisting, filemode.open)) using (var newfilestream = new filestream(filenamenew, filemode.create)) { // https://www.codeproject.com/tips/679606/filling-pdf-form-using-itext-pdf-library /

c# - Playing .WAV file on Internet Explorer -

i trying play .wav file on internet explorer thru windows media player ( assuming default media player client machine ) view <a class="" href="@url.action("voicesample", "report", new { num = item.num })">play voice</a> report controller public filestreamresult voicesample(string num) { filestream fs = null; string sfilename = ""; string fnamewithfullpath = @"c:\test.wav"; fileinfo myfile = new fileinfo(fnamewithfullpath); if (myfile.exists) { fs = new filestream(fnamewithfullpath, filemode.open, fileaccess.read); sfilename = "test.wav"; } return file(fs, "audio/x-wav"); } this works when run localhost , doesn't when publish code server , run server , windows media player opens , throws below error:- "windows media player

statistics - How to find Answer type using statistical methods nlp in java? -

i trying build simple question answering app using java. have used hardcoded rules answer type detection. arent enough (how can ever? ). wandering if there library uses pairs of (question, answer type) , deduces answer type other questions using statistical methods. i have tried stanford nlp not past dependencies, syntax errors , whatnot. know simple 1 can use? thanks in advance.

How to echo a variable that I don't know is set or not in an easy to read way in PHP -

just have simple question. think know answer hope not. i want able echo out variable don't know whether set or not. want default variable if not set , don't want have check if set first. so here example: i have $variable don't know whether set or not. then echo "this number: " . $variable; if $variable set 5, want print "this number: 5" , if not set, want print "this number: 0". i know this: echo "this number: " . ($variable? : 0); but still notice saying $variable undefined, though echo displays correctly. i this if (!isset($variable)) { $variable = 0); } echo "this number: " . $variable; but that's code if i'm doing lot. the null coalescing operator new best friend. echo "this number: " . ($variable ?? 0); the null coalescing operator available of php 7.0.0. alternative, use in older versions right php 5.3.0, use isset() , ternary operator ?: . echo &quo

jquery - Froala Editor how save content to textarea before send form -

i use in project froala. textarea element in form sent server. add text froala , click submit form button. textarea field on server empty(null). think need call froala method prepare textarea before submitting form server, not know one. what problem? view @using (html.beginform("updatepost", "post", formmethod.post, new { id = "postform" })) { <textarea id="previewtext" name="previewtext"></textarea> <button class="btn btn-success w-100">save</button> } server [httppost] public jobject updatepost([fromform] post postform) { //... } javascript $('#previewtext').froalaeditor({ language: 'ru', imageuploadurl: '../uploadimage', imageuploadparams: { postid: tmigin.cms.posteditor.postid }, imagemanagerloadurl: '../loadimages', imagemanagerloadparams

mysql - sql query add 1 year, less days passed in month -

i have table rows of dates, need rows 1 year: select date_format(cal_date, '%e %m') cal_date, price_client, price_owner, description table cal_date < date_add('2017-09-13' , interval 1 year) the result of query date rows dates 1 september 2017 until 12 september 2018. i result 13 september 2017 until 12 september 2018. thanks in advance for generic format based on curdate() use select date_format(cal_date, '%e %m') cal_date , price_client , price_owner , description table cal_date < date_add(date_add(last_day(date_sub(curdate(), interval 30 day), interval 1 day) , interval 1 year)

google cloud messaging - Android Background Runnable not working on older devices -

i have following running @ startup inside of intentservice threadmanager.postbackgroundrunnabledelayed(() -> { try { // calling gettoken , getid must on separate thread. otherwise, blocks ui thread. string token = instanceid.gettoken(sender_id, googlecloudmessaging.instance_id_scope); string id = instanceid.getid(); timber.d("id: " + id); timber.d("token: " + token); lazyrestqueue.get().sendgcmtoken(new gcmpushrequest(id, token), getsendgcmtokencallback()); setupanalytics(token); } catch (ioexception e) { timber.e(e, "exception during registration"); crashlytics.logexception(e); sethastoken(false); } catch (runtimeexception e) { // thrown if localytics not setup timber.e(e, "exception during registration");

Swift: Proper Firebase error-handling -

i'm not able understand why neither print lines executed when running following code: ref.child("schools/\(schooltextfield.text!)/settings/pin").observesingleevent(of: .value, with: { (snapshot) in print(snapshot.value) }, withcancel: { (error) in print(error.localizeddescription) }) it used work, until made changes regarding firebase authentication, don't see why withcancel block not executed! how catch whatever error occuring here? no error-message printed in log. edit: found similar question here suggests problem might related authentication after all. in appdelegate 's didfinishlaunchingwithoptions check if user auth-token exists in firebase auth: auth.auth().currentuser?.getidtokenforcingrefresh(true, completion: { (response, error) in guard error == nil, let uid = response else { print(error) return } ... }) in current case there error, printed: error domain=firautherrordomain code=17011 "there n

php - Nginx 502 FastCGI Error -

when try access page on server, returns 502 gateway error. (sometimes works reload page , shows 502 gateway page again). if check nginx error logs, error comes up: 2017/09/13 19:14:49 [error] 3762#3762: *22 upstream prematurely closed fastcgi stdout while reading response header upstream, client: serverip, server: localhost, request: "get /inventory.php http/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "localhost", referrer: "localhost" i tried looking error on google, no solutions far, , wondering if knows error & how fix it. thanks. edit 1: fastcgi_buffers set this: fastcgi_buffers 16 16k; fastcgi_buffer_size 120k; try increase values of next settings: fastcgi_buffer_size fastcgi_buffers https://nginx.ru/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffer_size https://nginx.ru/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffers

javascript - Dynamically generated input onChange function loses additional argument context -

i trying pass option.title parameter onchange function of corresponding generated radiogroup form component. onchange receives correct event, option.title value last 1 that's rendered. how bind option.title it's component's onchange ? presently, when event triggered, option.title has taken last generated element's value - , shown regardless of element triggered onchange . generatelist(){ var list = [] (var in configs){ var option = configs[i] list.push( <div> <div classname="optiontitle">{option.title}</div> <radiogroup onchange={(e) => this.handleradiochange(option.title, e)} classname="configcontainer" horizontal> {this.generateradio(option.options, option.title)} </radiogroup> </div> ) } return list } try this

angular - No component factory found for Component - component already added to NgModule -

i getting error when trying open modal component: no component factory found [componentname]. did add @ngmodule.entrycomponents? the same modal working elsewhere in app has been added declarations , entrycomponents sections of ngmodule . is there else message mean? most use dynamically loaded components dialog window. if case, need list them in entrycomponents property of @ngmodule, example: entrycomponents: [ mydialogcomponent ] you can see example here: https://material.angular.io/components/dialog/overview

reactjs - Pass value to TextInput onPress -

my component : class textinputcomp extends component { constructor(props){ super(); this.state = { thetext: '' } } submittext = (text) => { alert.alert("text submitted!", text); } render() { const rendata = this.props.people((data, index) => { return ( <view key={index} style={styles.card}> <text style={styles.names}> id: {data.id} - name: {data.name} </text> <touchableopacity onpress={()=>this.refs.mybox.focus()} > <text>open</text> </touchableopacity> </view> ) }); return ( <view style={mystyles1.container}> {rendata} <view> <textinput ref='mybox' style={{height: 40}} onchangetext={(thetext) => this.setstate({thetext})} /> <touchableopacity onpress =

oracle - ORA-01536: space quota , How to determine required space while limiting the amount? -

i getting error message when trying create table in database. oracle execute error: ora-30032: suspended (resumable) statement has timed out ora-01536: space quota exceeded tablespace i understand increase space within tablespace. however, how determine exact/estimate space needed script? want increase space meet minimum space requirements. not want give more space needed. there way this?

java - Trying to get Logstash running on Windows Server 2012 -

when try run logstash "the system cannot find path specified" error , won't run. have java installed , working, elasticsearch installed , working can't logstash running. found post: logstash on windows: system cannot find path specified i have ls_home pointed logstash installation: c:\program files\logstash-5.6.0. have java_home pointed java installation: c:\program files\java\jdk1.8.0_144. is there way find out logstash looking when gives error? how can fix this?

image - specifics for css layout -

Image
i'm attempting have text flow around images in following fashion: eg, images in 2 columns, 1 image in "center" column , number of them in right column. tried "floating boxes" via display:inline-block; , tried table-like config using display:table/display:table-cell, unable provide correct (changing) width text on left. (the apparent alignment of 2nd parag of text bottom of center image not necessary.) appreciation assistance! here's demo using float - accomplish want? .column { float: right; } .column img { clear: both; float: right; margin: 5px; } <div class="column"> <img src="http://via.placeholder.com/100x100" /> <img src="http://via.placeholder.com/100x100" /> <img src="http://via.placeholder.com/100x100" /> </div> <div class="column"> <img src="http://via.placeholder.com/200x200" /> </

php - Unable to get Google API access token using auth code - redirect uri mismatch -

i'm trying use google api php client library create folder in users drive space. unfortunately keep getting "redirect_uri_mistmatch bad request" error. i've looked @ several posts trying resolve issue no avail. steps i've taken being, verified urls correct , current client id in google developer console. clearing , re-entering said urls in dev console. updating client-secret.json file , manually verifying urls making file. switched drive_client->authenticate() fetchaccesstokenwithauthcode() error reporting. the code spread across 3 different files end requiring each other @ different points during execution - if makes difference, though i've tried combining 1 file , still had same issue. server running behind cloudflare if makes difference, toggle developer mode when ever working on this. generate oauth request , redirect user: $this->_google_client = new google_client(); $this->_google_client->setauthconfig("path/to/client_

lisp - Change variable defined in let function -

given following let function: (let ((foo (list b c d))) foo) how can modify list foo? (let ((foo (list b c d))) ;some code foo) so returned foo looks eks: '(some new list) or (a b modified d) i tried (set) foo still return original list. you can use setf modify specific element in list. (let ((foo (list 'a 'b 'c 'd))) (setf (third foo) 'modified) foo) this return (a b modified d) . or if want replace whole variable, can assign directly setq : (let ((foo (list 'a 'b 'c 'd))) (setq foo (list 'some 'new 'list)) foo) you can't use set lexical variables, special variables.

HTML/CSS - Mobile dropdown links not acting right -

i'm in process of making our mobile site , looking way want to, on mobile, when have dropdown menu open , try click on different menu below it, site clicks through different link on page. it's driving me mad! suggestions how fix it? i'd able open different dropdown menu rather link through different. @import 'https://fonts.googleapis.com/css?family=montserrat|open+sans'; .eventstitle{ text-decoration: none; } body{ height: 100vh; min-width: 720px; margin: 0px; } #s-lg-guide-main{ flex: 1; font-family: verdana, geneva, sans-serif; min-height: 70vh; } #s-lib-public-main, #s-lib-public-header, #s-lg-guide-header, .s-lg-col-boxes{ background-color: white; border-radius: 4px; } #s-lib-public-main, #s-lib-public-header, #s-lg-guide-header{ padding: 10px; } .s-lib-box-content{ padding: 10px; } /*hide footer libguides name , links*/ #s-lib-footer-public{ visibility: hidden; }

r - Filtering records that occur more than once with multiple variables -

this question has answer here: find duplicated elements dplyr 2 answers i have sample dataset. objective keep records user_id and plan_id occur more once. understand can count frequency of variable in column n_occur <- data.frame(table(test$user_id)) but how 1 count frequency of variables in 2 columns and then filter original dataset occur more once? example, here test dataset: > test user_id plan_id hour 1 1 10 2 2 2 10 4 3 3 20 23 4 4 20 12 5 5 10 8 6 1 10 10 7 5 20 6 8 1 20 5 9 1 20 18 10 5 10 7 11 1 30 6 and here intended output: > output user_id plan_id hour 1 1 10 2 2 5 10 8 3 1 10 10 4 1 20 5 5 1 20 8 6

bash - A variable modified inside a while loop is not remembered -

in following program, if set variable $foo value 1 inside first if statement, works in sense value remembered after if statement. however, when set same variable value 2 inside if inside while statement, it's forgotten after while loop. it's behaving i'm using sort of copy of variable $foo inside while loop , modifying particular copy. here's complete test program: #!/bin/bash set -e set -u foo=0 bar="hello" if [[ "$bar" == "hello" ]] foo=1 echo "setting \$foo 1: $foo" fi echo "variable \$foo after if statement: $foo" lines="first line\nsecond line\nthird line" echo -e $lines | while read line if [[ "$line" == "second line" ]] foo=2 echo "variable \$foo updated $foo inside if inside while loop" fi echo "value of \$foo in while loop body: $foo" done echo "variable \$foo after while loop: $foo" # output: # $

c# - How to know if a message was not delivered from stomp using rabbitmq? -

i'm using rabbitmq c# , stomp. when message not delivered consumer because it's down, can use basicreturn command broker sends handle mistake in c#. public void publish(string message) { var body = encoding.utf8.getbytes(message); channel.basicreturn += (sender, e) => basicreturn(sender, e); channel.basicpublish(exchange: topic_name, routingkey: getagenttosend(), mandatory: true, basicproperties: null, body: body); console.writeline(" [x] sent {0}", message); } private void basicreturn(object sender, rabbitmq.client.events.basicreturneventargs e) { console.writeline(e); var message = encoding.utf8.getstring(e.body); var routingkey = e.routingkey; appendtext(string.format("not delivered: agent: [ {0} ] message: [ {0} ] ", routingkey, message)); }

Plotting piecewise functions in R -

Image
i'm trying plot piecewise function below using if statements, , keep getting the error: unexpected '}' in "}" message. of braces seem fine me, don't know coming from. advice here appreciated. (also, first time i've done in r, please bear me). x.values = seq(-2, 2, = 0.1) n = length(x.values) y.values = rep(0, n) (i in 1:n) { x = x.values[i] if (x <= 0) { y.values = -x^3 } else if (x <= 1) { y.values = x^2 } else { y.values = sqrt(x) } y.values[i] = y } this can done without loop taking advantage of fact r functions vectorized. for example: library(tidyverse) theme_set(theme_classic()) dat = data.frame(x=x.values) in base r, can do: dat$y = with(dat, ifelse(x <= 0, -x^3, ifelse(x<=1, x^2, sqrt(x)))) with tidyverse functions can do: dat = dat %>% mutate(y = case_when(x <= 0 ~ -x^3, x <= 1 ~ x^2, true ~ sqrt(x))) then, plot: ggplot(dat, ae

Setup OVH CDN on Wordpress -

i wondering how setup ovh cdn wordpress. i've done before, few years ago, can't seem make work. could provide step step guide? cdn under alias cdn.example.com ovh provided following instructions to activate cdn, must: 1) report backends (ip of servers) ; 2) declare domain/sub-domains want intergrate cdn ; 3) point domain cname created after domain registered; 4) add first cache rule. adding domain on cdn generates cname format yourdomain.ext.web.cdn.anycast.me, need point dns of yourdomain.ext cname activate it. once configured, time delay necessary of cdns operational. otherwise, reach full performance progressive caching set rules

python - Can't get a Histogram (matplotlib.pyplot.hist) to update for new data in tkinter -

i making gui using tkinter , matplotlib in python. displays data , graphs spread on several notebook tabs. user makes selections graphs , text update. working until added histogram. don’t know how change data or xlim , ylim. the below code extract of code show how works. import tkinter tk import tkinter.ttk ttk matplotlib.backends.backend_tkagg import figurecanvastkagg matplotlib.figure import figure import numpy np root = tk.tk() root.geometry('1200x300') def configframe(frame, num=50): x in range(num): frame.rowconfigure(x, weight=1) frame.columnconfigure(x, weight=1) def runprog(): mu, sigma = 0, .1 y = np.array(np.random.normal(mu, sigma, 100)) x = np.array(range(100)) lines2[1].set_xdata(x) axs2[1].set_xlim(x.min(), x.max()) # need change limits manually # know y isn't changing in example put in others see lines2[1].set_ydata(y) axs2[1].set_ylim(y.min(), y.max()) canvas2.draw() configframe(root) nb = ttk.notebook(root) #

lme4 - Repeated Measure Syntax When Using LMER in R -

i have following data.frame id overlap.image.om.before.om overlap.image.om.after.om acesscore panaspreom_amused panaspostom_amused panaspreom_happy panaspostom_happy aceslog acessqr 3 6192 3.07092199 3.3758865 2 0.5886525 1.3617021 0.07801418 0.7588652 0.6931472 1.414214 4 6191 0.07092199 0.3758865 0 0.5886525 1.3617021 0.07801418 0.7588652 -inf 0.000000 6 8421 -0.92907801 -1.6241135 0 0.5886525 1.3617021 1.07801418 -0.2411348 -inf 0.000000 7 9991 -1.92907801 0.3758865 10 0.5886525 0.3617021 -0.92198582 0.7588652 2.3025851 3.162278 8 9992 1.07092199 -2.6241135 5 -0.4113475 0.3617021 1.07801418 -0.2411348 1.6094379 2

python - read multiple file and compare with the fixed files -

i have 50 files in directory suppose compare 1 file, e.g., original.txt. have following code. works when give file name one-by-one, manually. want automate used 'glob.blog' folder = "files/" path = '*.rbd' path = folder + path files=sorted(glob.glob(path)) here complete code: import glob itertools import islice import linecache num_lines_nonbram = 1891427 bits_perline = 32 total_bit_flips = 0 num_bit_diff_flip_zero = 0 num_bit_diff_flip_ones = 0 folder = "files/" path = '*.rbd' path = folder + path files=sorted(glob.glob(path)) original=open('files/mull-original-readback.rbd','r') #source1 = open(file1, "r") filename in files: del_lines = 101 open(filename,'r') f: i=1 while <= del_lines: line1 = f.readline() lineoriginal=original.readline() i+=1 i=0 num_bit_diff_flip_zero = 0 num_bit_diff_flip_ones = 0 num_lines_diff =0 i=0 j=0 k=0 a_writ

javascript - In Jquery, How to check empty and duplicate value in Json object? -

var data = { "obj":[{ "name": "john", "age": "10", "alias": "person", "where":[{"city1":"foo", "city2":"foo2"}] },{ "name": "mike", "age": "", "alias": "person", "where":[{"city1":"test1", "city2":"test2"}] }] } data.obj[0].alias , data.obj[1].alias duplicate. also data.obj[1].age empty. if empty or duplicate value exists in json object, return false. how can check empty , duplicate value? you can use filter it first check empty age. if empty age, send false alert. if sends false alert, item not in final . else try check duplicate alias . if item exists in temp list that's mean it's passed once. return false . if no item exists in temp list, push item in temp , return true . if total

c - Collatz and Printing with Spaces -

i have following code: #include <stdlib.h> #include <stdio.h> #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int main(int argc, char** argv) { const char* name = "collatz"; const int size = 4096; int num = atoi(argv[1]); int shm_fd; void *ptr; shm_fd = shm_open(name, o_creat | o_rdwr, 0666); ftruncate(shm_fd, size); ptr = mmap(0, size, prot_read, map_shared, shm_fd, 0); pid_t id = fork(); if (id == 0) { shm_fd = shm_open(name, o_rdwr, 0666); ptr = mmap(0, size, prot_write, map_shared, shm_fd, 0); while (num != 1) { sprintf(ptr, "%d", num); ptr++; if (num % 2 == 0) num /= 2; else num = 3 * num + 1; } sprintf(ptr, "%d", num); ptr++; } else { wait(null); printf("parent: %s\n", (char*) ptr); shm_unlink(name); } return 0; } i prin

c# - The Calendar Type for input it to database -

Image
for project use monthcalendar this: from toolbox in order make project more have variances on date time rather use datetimepicker it. datetimepicker option, use method datetime dates = dtpdate.value; and then, save value loc newr.rentdate = dates; while use monthcalendar option, can't use method because option have option of autocomplete code . in case, use loc newuser.dob = caldob.dateselected.value.tostring("dd/mm/yyyy"); but unfortunately, there error on dateselected part. said error 12 event 'system.windows.forms.monthcalendar.dateselected' can appear on left hand side of += or -= e:\version\5.0\agenindo\kepegawaian.cs 206 38 agenindo so how can pick date save in database format "dd/mm/yyyy". :d you can subscribe of these events:- caldob.dateselected += new system.windows.forms.daterangeeventhandler(this.caldob_dateselected); caldob.datechanged += new system.windows.forms.daterangeeventhandler(this.cal

How to put other image extensions in Laravel 5.2? -

i have solution upload image of user profile picking storage folder working. question how can play extension of image bank or how can validate in controller other extensions can me? controller public function getaccount() { return view('account', ['user' => auth::user()]); } public function postsaveaccount(request $request) { $this->validate($request, [ 'email' => 'required|email|max:100' ]); $user = auth::user(); $old_email = $user->email; $user->email = $request['email']; $user->update(); $file = $request->file('image'); $file_email = $request['email'] . '-' . $user->id . '.jpg'; $old_file_email = $old_email . '-' . $user->id . '.jpg'; $update = false; if (storage::disk('local')->has($old_file_email)) { $old_file = storage::disk('local')->get($old_fil

logback logstash connection reset by peer -

my logstash in docker container.so port 80 docker host port 8805 ,which configure it. logback.xml: <appender name="stash" class="net.logstash.logback.appender.logstashtcpsocketappender"> <destination>172.16.10.5:8805</destination> <keepaliveduration>5 minutes</keepaliveduration> <reconnectiondelay>1 second</reconnectiondelay> <encoder charset="utf-8" class="net.logstash.logback.encoder.logstashencoder" /> </appender> logstash.conf: input { tcp { port => 4560 codec => json_lines } } i run bin/logstash -f logstash.conf --debug when run logback test demo send logs remost host logstashtcpsocketappender. logstash shows sth: [2017-09-13t10:25:35,543][debug][logstash.inputs.tcp ] accepted connection {:client=>"10.18.12.222:55206", :server=>"0.0.0.0:80"} [2017-09-13t10:25:35,550][debug][logstash.codecs.

mysql - Status: "MariaDB server is down" -

hope can me: i have many sites running on server , using mariadb. when do: sudo service mysql restart i get: job mariadb.service failed because control process exited error code. see "systemctl status mariadb.service" , "journalctl -xe" details. systemctl status mariadb.service mariadb.service - mariadb database server loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) drop-in: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf active: failed (result: exit-code) since thu 2017-09-14 03:16:51 utc; 1min 6s ago process: 13247 execstart=/usr/sbin/mysqld $mysqld_opts $_wsrep_new_cluster $_wsrep_start_position (code= process: 13086 execstartpre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && var= || var=`/usr/bin/gale process: 13070 execstartpre=/bin/sh -c systemctl unset-environment _wsrep_start_position (code=exited, s process: 13033

c++ - isButtonPressed(sf::Mouse::Left) in SFML not working -

the problem boolean variable isbuttonpressed not set every time press left button on mouse. works when press exiting button in upper right corner on window. while (window.isopen()) { sf::event my_event; while(window.pollevent(my_event)) { if (my_event.type == sf::event::closed) window.close(); else if (my_event.type == sf::mouse::isbuttonpressed(sf::mouse::left)) std::cout << "left_button_pressed" << std::endl; else break; } window.draw(background); window.display(); }

java - Mockito : Mocking and returning a different type value -

is possible return different type using when-return in mockito. my function m.finddocument(id) returns document based on id converting string further processing. but, testing fetching string id file. so, want string returned when function called below : when(m.finddocument(id)).thenreturn('that_string_from_id_file'); since, 1 of document type , other of string, there way in mockito can same ? thanks thing is: using mocking framework doesn't change java language. when signature of method public foo bar() - when calling bar() on mocked object, method has return instance of foo. can't use mocking silently change declared return type of method. but of course, can do: document mockeddocument = mock(document.class); documentfinder mockedfinder = mock(documentfinder); when(mockedfinder.finddocument(id)).thenreturn(mockeddocument); when(mockeddocument.getsomeinfo()).thenreturn("that string"); but please note: mock document insta

lambda - lazy evaluation and late binding of python? -

when lazy evaluation? (generator, if, iterator?), when late binding? (closure, regular functions?) = [1,2,3,4] b = [lambda y: x x in a] c = (lambda y: x x in a) #lazy evaluation d = map(lambda m: lambda y:m, a) #closure in b: print i(none) # 4 4 4 4 in c: print i(none) # 1 2 3 4 in d: print i(none) # 1 2 3 4 this looks homework, won't give answers. here 2 functions can step through , see how values change. def make_constants_like_generator(): def make_constant(x): def inner(y): return x return inner results = [] in [1, 2, 3, 4]: results.append(make_constant(i)) f in results: print f(none) return results def make_constants_like_list(): x = none results = [] in [1, 2, 3, 4]: x = def inner(y) return x results.append(inner) f in results: print f(none) return re

html - Warning</b>: Invalid argument supplied for foreach() in getting this error on parsing &,>,<, i.e htmlspecialchars to php script.How to avoid it? -

i trying parse data in handson table server side .i passing row row in json format , decoding array on server side. works fine when row doesn't have html specialchars gives above error when '&' ,'>','<' character present , data not updated row.here server side code. have data handsontable's row in $all_data variable. have php 5.1.6 , using pear extension json encode/decode. here php code: <?php include("/lan/fed/etpv/cgi-bin/testplans/php/my_functions.php"); ?> <?php $dbh=mysql_connect('a','b','c'); if(! $dbh ) { die('could not connect: ' . mysql_error()); } $json = new services_json(services_json_loose_type); // json decode string array $database=mysql_select_db('testmohit'); $data_size = (int) $_server['content_length']; $testplan_name=$_post['testplan_name']; $product=$_post['product']; $release=$_post['release']; $pv_engg=$_post['

node.js - Correct Passportjs strategy to use (hash vs jwt) -

i have laravel app i'm trying convert nodejs. in original app have api access protected random generated tokens - assigned each user , stored in our db. automatically generate secret token when user first registers use long use our services. (we verify subscription details users using these tokens). i'm trying replicate same on nodejs i'm bit lost right authentication strategy use, passportjs has json web tokens (jwt) , 'hash'. both seem correct can't figure out difference , appropriate in case. if hash correct strategy have use jwt generate token , assign each user? haven't understood concept of hashes , token authentications. differences between hashes , token authentication purposes? i did more research , found out jwt not using or need our app. create sha hashes each user based on personal details , secret key. hash created , used in new application correctly. simpler thought. , wanting learn bit more jwt, medium article lot: https://m

Firebase database rules only two out of three conditions work -

Image
i have "uid" database (uid root each user). try share "uid" roots between users, , want give read access "uid" root in 1 of 3 cases: 1. user access owner. 2. user access located in "uid\permitted_users" of target root. 3. user access located in "uid\temp_users" of target root. to accomplish created next rule: ".read" : "$uid === auth.uid || (root.child(root.child(auth.uid).child('pre_share').val()).child('temp_users').haschild(root.child(auth.uid).child('temp_permit').val()) || root.child(root.child(auth.uid).child('current_share').val()).child('permitted_users').haschild(auth.uid))" but disapointed discover first 2 conditions checked, , third not. (i changed order of conditions , every time access using first 2 in row). is there way solve this? edit: adding db example: so after lots of tests found problem. code deletes pre_share temp_users, , when ru

how to pass username and password with api in angular? -

i have api. if open u should enter username , password. want data in api how? , if write get("....api-url....") shows unauthorized error. how can pass username , password api? constructor(private _http: http) { this.getmyblog(); } private getmyblog() { return this._http.get('http://localhost:8088/.../...') .map((res: response) => res.json()) .subscribe(data => { this.data = data; console.log(this.data); }); } i'm assuming want send along request query parameters? this terrible bad practice (the users password part of url - while body contents may protected ssl, actual url visible attackers) - read more @ https://www.fullcontact.com/blog/never-put-secrets-urls-query-parameters/ also, http module being deprecated - @ using httpclientmodule instead ( https://angular.io/guide/http ) if still want this: public getmyblog(username, password): observable<any> { const params = n

cobalt - Test case maxGranularityPlaybackRate random fail -

dears: youtube need pass following test case: maxgranularityplaybackrate0.25 maxgranularityplaybackrate0.50 maxgranularityplaybackrate1.00 maxgranularityplaybackrate1.25 maxgranularityplaybackrate1.50 maxgranularityplaybackrate2.00 it seems following code in test case check max timeupdate event interval, less 260ms required: if (times !== 0) { var interval = date.now() - last; if (interval > maxgranularity) maxgranularity = interval; } if (times === 50) { maxgranularity = maxgranularity / 1000.0; test.prototype.status = util.round(maxgranularity, 2); runner.checkle(maxgranularity, 0.26, 'maxgranularity'); runner.succeed(); } i found timeupdate event notify web app every 250ms in cobalt src/cobalt/dom/html_media_element.cc: const double htmlmediaelement::**kmaxtimeupdateeventfrequency** = 0.25; and playback_progress_timer_.start( from_here, base::timedelta::frommilliseconds(

postgresql - sql - aggregate count and share by group -

with table t1 below, need count each make , share each make +--------+ | make | +--------+ | toyota | | audi | | bmw | | bmw | | audi | +--------+ with below can get car_cnt per make select make , count (*) car_cnt t1 group make how share (%) each make ? using count analytic function, can make single pass on table , compute market share each car. select distinct make, count(*) on (partition make) car_cnt, 100.0 * count(*) on (partition make) / count(*) on () car_pct t1 output: make car_cnt car_pct 1 audi 2 40 2 bmw 2 40 3 toyota 1 20 demo here: rextester

java - List versus ArrayList -

this question has answer here: polymorphism: why use “list list = new arraylist” instead of “arraylist list = new arraylist”? [duplicate] 8 answers which 1 better , why ? a) list<string> list = new arraylist<>(); b) arraylist<string> list = new arraylist<>(); it depends on context. if care list semantics , not particular implementation, go list<string> . if want enforce particular implementation, go arraylist<string> , linkedlist<string> or else. in cases, want go on interface , not particular implementation.

Unit test Execution Results in SonarQube server -

this regarding unit test case execution result in sonarqube server. i don't have actual solution file of product execution results should converted .log file sonarqube generic format. i had uploaded files sonarqube server. how display execution results or can see execution results? per requirement, none other code analysis required. unit test case execution results needs displayed. how set dashboard unit test case execution results? best regards, salini s.

scala - Sort list of string based on length -

i have list of strings list("cbda","xyz","jlki","badce") i want sort strings in such way odd length strings sorted in descending order , length strings sorted in ascending order list("abcd","zyx","ijkl","edcba") now have implemented iterating on each elements separately, finding length , sorting them accordingly. store them in separate list. hoping know if there other efficient way in scala, or shorter way (like sort of list comprehensions have in python) ? you can sortwith , map: list.map(s => {if(s.length % 2 == 0) s.sortwith(_ < _) else s.sortwith(_ > _)})

Crashlytics does not work in corona sdk -

after project launched, application not added dashboard. i launched project on android sdk same package name. after that, application added dashboard. events such "sendcustomevent" work. crash still not sent. know solution? todd fabric here. corona not supported our sdks due way builds projects. barring official support, i'd love hear if 1 has gotten , running , steps used so. thanks!