Posts

Showing posts from March, 2014

Can' locate a certain element using xpath locator in python -

i've written xpath element unfortunately not being able to. i can't understand i'm getting deviated. hope provide me little help. i'm trying locate address below elements. here elements: <div class="detail-contact-address"> <i class="fa fa-map-o"></i> address:36 sukhumvit, soi 15, wattana, klongtoey-nua, bangkok 10110, thailand </div> i trying with: //div[@class='detail-contact-address']/*[contains(@class,'fa-map-o')]/../text() user below xpath text : //div[@class='detail-contact-address'] or based on string match //div[@class='detail-contact-address'][contains(.,'address')] so text like print driver.find_element_by_xpath("//div[@class='detail-contact-address']").text

java.text.SimpleDateFormat#parse has different behaviour between Scala and Clojure -

i'm trying assign pdt string java.util.date using simpledateformat . scala, gives me right format pdt ( utc-07:00 ) , or without setting timezone os timezone "america/los_angeles" . scala> import java.util.timezone import java.util.timezone scala> import java.util.date import java.util.date scala> import java.text.simpledateformat import java.text.simpledateformat scala> timezone.getdefault res0: java.util.timezone = sun.util.calendar.zoneinfo[id="america/los_angeles",offset=-28800000,dstsavings=3600000,usedaylight=true,transitions=185,lastrule=java.util.simpletimezone[id=america/los_angeles,offset=-28800000,dstsavings=3600000,usedaylight=true,startyear=0,startmode=3,startmonth=2,startday=8,startdayofweek=1,starttime=7200000,starttimemode=0,endmode=3,endmonth=10,endday=1,enddayofweek=1,endtime=7200000,endtimemode=0]] scala> val df = new simpledateformat("yyyy-mm-dd't'hh:mm:ssxxx") df: java.text.simpledateformat = j

android - How to set size width of customize fragment tab with adapter? -

i create eash tab customize tab textviw, here code: private void setuptabicons() { textview tabone = (textview) layoutinflater.from(this).inflate(r.layout.schedulestab2, null); tablayout.gettabat(0).setcustomview(tabone); textview tabthree = (textview) layoutinflater.from(this).inflate(r.layout.schedulestab3, null); tablayout.gettabat(1).setcustomview(tabthree); textview tabfour = (textview) layoutinflater.from(this).inflate(r.layout.schedulestab4, null); tablayout.gettabat(2).setcustomview(tabfour); } the on layout textview customize tab : <?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/schedulestab3" android:layout_width="10dp" android:layout_height="wrap_content" android:layout_alignparentright="false" android:layout_centerhorizonta

mathematical optimization - Why aren't neural networks convex? -

unlike linear , logistic regression, anns cost functions not convex, , susceptible local optima. can provide intuition why case anns , why hypothesis cannot modified produce convex function? i found sufficient explanation here: https://stats.stackexchange.com/questions/106334/cost-function-of-neural-network-is-non-convex basically since weights permutable across layers there multiple solutions minima achieve same results, , function cannot convex (or concave either).

mapreduce - Design a service to get top 10 URLs visited by user in 1 week -

i want know high level design (client server) , end design of how design service. can have millions of users visiting 1000's of sites. if want determine top 10 websites visited particular user in last week. how should this? should store data? should use map reduce aggregate data , information? consider websites have id it. user1, id1, t1 user2, id1, t1 user1, id2,t2 user1, id1,t3 , on. need determine top 10 ids visited particular user on period of time. please how design type if system.

c# 6.0 - Checking a nullable property after a null-conditional check of parent object -

appreciate there have been question close asking not quite here. have been checking ?. operator , came upon following scenario. situation follows: internal class dog { public int? age { get; set; } } checks in main code follows: dog d2 = new dog() { age = 10 }; int age1 = d2.age.value; // compiles okay int age2 = d2?.age.value; // cs0266 i know why code line age3 requesting explicit cast. d2.age being type int? , age.value being type int doesn't vary between 2 usages. once use null-condicional operator, resulting value can null . that's why can never int . what need is: int age2 = (d2?.age).value;

java - Unable to call external Bash program when exporting project as runnable jar -

i have java project requires external bash script work. works fine in eclipse, once export runnable jar, following error: cannot run program "src/script.sh": error=2, no such file or directory i have tried: runtime.getruntime().exec("script.sh"); as as new processbuilder("src/script.sh").start(); the bash script takes in no input , not return output your script buried inside jar file , doesn't exist standalone file, that's why java can't "execute" it. need read @ runtime using resources api, save (temporary?) directory, set executable permission, , run using processbuilder or such.

image - Histogram equalization help in MATLAB -

my code shown below: g= histeq(imread('f:\thesis\images\image1.tif')); figure,imshow(g); the error message got following , i'm not sure why appearing: error using histeq expected input number 1, i, two-dimensional. error in histeq (line 68) validateattributes(a,{'uint8','uint16','double','int16','single'}, ... error in testfile1 (line 8) g= histeq(imread('f:\thesis\images\image1.tif')); your image colour. histeq works on grayscale images. there 3 options available depending on want do. can either convert image grayscale, can histogram equalize each channel individually or perceptually better convert image hsv colour space, histogram equalize v or value component, convert rgb. tend prefer last option colour images. therefore, 1 method enhanced grayscale image, , other 2 enhanced colour image. option #1 - convert grayscale equalize g = imread('f:\thesis\images\image1.tif'); g = histeq(rgb2g

Java escape characters in strings - string contains \r (need to keep "r") -

i have string "ead\rgonzalez" passed me. need pull out "rgonzalez" it. running problems "\" character. cannot find index of it, cannot replace it, etc. on pulling data after "\" appreciated. string receive in format of domain\username; data can vary. another example us\ngross \n interpreted newline character. to clarify, not adding '\', trying split string on '\' this string contains '\r' in character, special one. need way make \r contained within string 2 separate characters, '\' , 'r'. you haven't provided code, i'm assuming you're doing this: string user = request.getparameter("user"); // user = "ead\rgonzalez" if declare static string in application, have escape backslash because special character java strings: string user = "ead\\rgonzalez"; to split string on backslash must escape twice in regex pass split method. once beca

swift - iOS slide the whole viewcontroller like Facebook -

when use facebook app , slide screen left right it'll open new view controller. , it's not navigation effect because whole view controller move, including status bar (like this picture ). if use gesture move view, can move view container, can't move whole view include status bar. if use (viewcontroller.addsubview) . these 2 views use same status bar. ( this pic ), can see these views use individual status bar. want create effect don't have idea how implement. know how effect? read uiswipegesturerecognizer, others have said. here's link: https://developer.apple.com/documentation/uikit/uigesturerecognizer look it, , ask if have more questions.

python - How to use Celery in Tornado with redis as broker and backend? -

it raises exception when try use celery3.1.11, tornado-celery0.3.5 in tornado4.2 yield. works without yield, cannot result asynchronous...i find works when use rabbitmq broker, while redis raise below error... here code. from mycelery import celery_task import tcelery tcelery.setup_nonblocking_producer() token = yield tornado.gen.task(celery_task.get_rongcloud_token.apply_async,args=[3]) print token my celery task: from celery import celery, platforms celery.schedules import crontab celery.utils.log import get_task_logger celery.exceptions import softtimelimitexceeded platforms.c_force_root = true # linux 下要root用户才不报错 broker = 'redis://:'+settings.redis_pass+'@127.0.0.1:6379/5' backend = 'redis://:'+settings.redis_pass+'@127.0.0.1:6379/6' app = celery('tasks', broker=broker, backend=backend) @app.task(name='mycelery.celery_task.get_rongcloud_token') def get_rongcloud_token(user_id): print 'xxxxx' = 'xxx

ember.js - How do I specify a mix of an expression and a string as a class for an ember component? -

i want this {{#my-custom-component class="some-class-name {{dynamicproperty}}" }} but literally rendering some-class-name {{dynamicproperty}} classname, rather value represents. use concat helper: {{#my-custom-component class=(concat 'some-class-name' dynamicproperty) }}

sql - MYSQL Fetch Date and Time Stored as String and ORDER BY -

i have specific reason storing date , time in database table string in below format datefmt = "dd-mm-yyyy"; timefmt = "hh:mm a"; now while fetching want sort converting string date , time , sort display in tableview, row newer ones come on top. this wil work if store date , time, order `date` desc, `time` desc how convert string , use order by use str_to_date() : order str_to_date(date, '%d-%m-%y') i should add: can think of no reason storing date in format in database. should using built-in date/time types. exist reason. if have store date string (which have occasionally), should use yyyy-mm-dd format. iso standard, converts readily date, , sorts correctly.

google polyline: string out of range -

i try use google polyline decode data. data looks like 'y rwfpjpbmbdxb|bxatbxajfhdrfndfhlbnatbtazbvavfrdl@\\ mffnho@~ctf|bxln@adp@}cp@mcfaud\{alkmg@@]l{@paog nup@bcol @gbf@ec^gbb@cbjd{p\obvyafga?cas@_qk}@q_aycaa@ca]i@m@w@w@q@a@wucyacak@}@o@aa{@}@}@abubg[m@m@oeufcawamb}cedag_fcjqaecm@oake@yu@c@aba@cb[ebea@fceblcyzgq@zzg' if put string code polyline.decode('y rwfpjpbmbdxb|bxatbxajfhdrfndfhlbnatbtazbvavfrdl@\\ mffnho@~ctf|bxln@adp@}cp@mcfaud\{alkmg@@]l{@paog nup@bcol @gbf@ec^gbb@cbjd{p\obvyafga?cas@_qk}@q_aycaa@ca]i@m@w@w@q@a@wucyacak@}@o@aa{@}@}@abubg[m@m@oeufcawamb}cedag_fcjqaecm@oake@yu@c@aba@cb[ebea@fceblcyzgq@zzg'), gives me data. however, if run program , save string list, code[], , run code polyline.decode(code[0]), error say: indexerror: string index out of range i tried many times , cannot figure problem.can tell me i'm doing wrong? in advance!

Error: nodename nor servname provided, or not known (python sockets) -

i trying learn how use sockets using tutorial: https://www.tutorialspoint.com/python/python_networking.htm have copied code site directory , ran done in tutorial got errors. here code tutorial. #!/usr/bin/python # server.py file import socket # import socket module s = socket.socket() # create socket object host = 'localhost' # local machine name port = 12345 # reserve port service. s.bind((host, port)) # bind port s.listen(5) # wait client connection. while true: c, addr = s.accept() # establish connection client. print("asdf") c.send('thank connecting') c.close() # close connection and client.py #!/usr/bin/python # client.py file import socket # import socket module s = socket.socket() # create socket object host = socket.gethostname() # local machine name port = 12345 # reserve port service.

max - MATLAB finding local maximum in certain range -

Image
figure above time domain signal , area enclosed in black area of interest. what want following: identify global minimum point find local maximum point comes before global minimum point i have succesfully identified global minimum point this: ii=1:size(1) jj=1:size(2) [min_amp, min_index]=min(signal(ii,jj,:)); min_time(ii,jj)=time(min_index); end end minbound = floor(mean(min_time(:))*fs); size(1) , size(2) represent scan area , tried find time @ global minimum occurs @ each point , took average. can me 2. find local maximum point comes before global minimum point? thanks in advance it not clear how variable signal (3d) orientated. assume third dimension time, otherwise search minimum not make sense. once identified minimum [min_amp, min_index]=min(signal(ii,jj,:)); you have index (min_index) located, , have restrict search maximum until point (as has before that). [max_amp, max_index]=max(si

c# - Best practices for passing Access Token to Web API to perform calls on behalf of user -

disclaimer: first time dealing oauth. i'm setting web api middleman between user (using mobile application), , xero public application. for user access xero data, must first authenticate xero public application. user supplied access token , access token secret @ end of authentication process. done via oauth 1.1. at point, mobile application has access token , access token secret - supplied xero public application. point user never talk xero public application again. what need have user send post web api contains xero username , xero access token (and possibly xero access token secret). web api controller receive request, , send request xero public application ensure works. when ok response has been received xero public application, web api register user storing user (with xero username), , organisation (with access token + secret) in database. at point, necessary credentials stored in web api database, , web api controllers can perform requests on behalf of user. en

ruby on rails - link_to tag is being called with my project -

<div class="container-fluid" id="manage"> <h2>managing users</h2> <table> <tr> <td></td> <td><%= link_to "add user", users_new_path, method: :get, class: "btn btn-primary" %> <br /> <!-- go add-user-page --></td> </tr> <tr> <td><button class="btn btn-danger navbar-btn"> emails</button><br /></td> <td><button class="btn btn-danger navbar-btn"> delete</button><br /></td> </tr> <% @users.each |user| %> <tr> <td><button class="btn btn-info"><%= user.email %></button></td> <td><%= link_to "del", users_delete_path(id: user.id), method: :delete ,class: "btn btn-info", data: { confirm: "you sure?" }%></td>

UWP background task to read Sensor -

Image
here current project read sensor value uwp application. my sendors connected virtual serial port ( com1,2,3... ). , display value on ui. here requirement application. repeat read sensor value 24 hours, 365 days. display value ui with uwp, extendedexecutionsession , application should running without stopping/suspending. and recently, found article. https://docs.microsoft.com/en-us/windows/uwp/launch-resume/access-sensors-and-devices-from-a-background-task ( read document, described maximum background job time 10 minute ). if so, not match requirement ? question should use ( deviceusetrigger ) ? please advice me. first uwp application. then, don't have confident best way start background job read sensor value repeatedly. background job change ui value. appservice or should use appservice on uwp ? my own update deviceusetrigger good. maximum time 10 minute in desktop family. then, not idea. then, thought, extendedexecutionsession , can run uwp appli

Copy Rows from one SQL Server database to another when table changes -

i looking method copy rows selected table 1 sql database whenever change happens selected tables. our client has live database , needs fetch changes our database associated new website. we planning implement triggers on selected tables invoke coping mechanism. please tell me if cause performance issues, , recommend if suggested method same. replication solution.as requirements not getting clear question still check link [ https://www.codeproject.com/articles/715550/sql-server-replication-step-by-step]

html - Python Selenium Scraping Crashes, Can I Find Elements For Part of The Web Page? -

i trying scrape data website. website has 'load more products' button. i'm using: driver.find_element_by_xpath("""//*[@id="showmoreresult"]""").click() to hit button , loops set number of iterations. the problem i'm running once number of iterations have been completed, want extract text webpage using: posts = driver.find_elements_by_class_name("hotproductdetails") however, seems crash chrome, , can no data out. i'd do, populate posts new products have loaded after each iteration. after 'load more' has been clicked, want grab text 50 products have loaded, append list , continue. i can run line posts = driver.find_elements_by_class_name("hotproductdetails") within each iteration, grabs every element on page every time, , slows down process. is there anyway of achieving in selenium or limited using library? this full script: import csv import time selenium import webdriver imp

Convert JSON array containing nested content to List -

i have been tasked maintaining legacy scala application , have come across json parsing problem don't know how solve. need list of json objects nested inside json array. here json content looks like: [{"name":null, "tags":[], "content":{ more nested json here }}, {"name":null, "tags":[], "content":{ more nested json here }, ...] we using argonaut library our json parsing. if had following json: val json = {"name":null, "tags":[], "content":{ more nested json here } then use following code access content json want: val lens = jobjectpl >=> jsonobjectpl("content") val s = parse.parseoption(json) val content = lens.get(s) and content json object, access fields. however, actual problem need list of json objects, each object content array. if wondering why need this, must validation of list against list of known , expected values. the closest came solutio

xamarin.android - How to debug an apps playstore version using Xamarin -

i have published app beta testing through google play console, when so, 1 particular function failing, application not crash. there way debug playstore version? can use "debug application" option in "developer options" tab in visual studio? i have gone through this link without luck.

jquery - Why aren't my drop down lists working? -

doing portfolio page challenge on fcc. can use html/css/bootstrap/jquery. problem : working on navigation bar , drop down, clickable, highlighted buttons. copied instructions w3schools here not working. /*--drop down buttons--*/ li a, .dropbtn { display: inline-block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover, .dropdown:hover .dropbtn { background-color: #4caf50; } li.dropdown { display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #000000; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; /*how right:0; keep text going off screen?*/ right: 0; } .dropdown-content { color: #ffffff; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .dropdown-content a:hover {background-color: #4caf50} .dropdown:hover .dropdown-content { display: block; } <div class="container-fluid"> <!----nav bar ----> <ul> <li&g

colorama - H2O cluster show status charmap error -

when trying print out cluster show status of h2o cluster on windows computers, gives following error: h2o.init(nthreads = -1, strict_version_check = false) file "c:\python27\lib\site-packages\h2o\h2o.py", line 267, in init h2oconn.cluster.show_status() file "c:\python27\lib\site-packages\h2o\backend\cluster.py", line 237, in show_status ["python version:", "%d.%d.%d %s" % tuple(sys.version_info[:4])], file "c:\python27\lib\site-packages\h2o\display.py", line 49, in init self.pprint() file "c:\python27\lib\site-packages\h2o\display.py", line 59, in pprint print(r) file "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 40, in write self.__convertor.write(text) file "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 141, in write self.write_and_convert(text) file "c:\python27\lib\site-packages

spring mvc - How can I get RedirectAttributes in HandlerInterceptor.postHandle() method -

background: web project uses springmvc framework required front-back seperation reconstruct. frontend going use react , , of backend's controllers used return jsp view need return jsonobject . data passed jsp through modelmap needed transferred json , write through response . , avoid modify every controller , came idea of using interceptor job down. works controllers pass data modelmap , dosen't pass data redirectattributes . problem: of controllers return redirect , use redirectattributes pass attributes. since posthandler() has 4 params: request,response,handler , modelandview , can hardly attributes of redirectattributes these. controller code: @requestmapping(value="save") public string save(carinfoentity entity, httpservletrequest request, httpservletresponse response, redirectattributes redirectattributes, model model){ redirectattributes.addflashattribute("message", "success!"); return "redirect:/dem

How to get list of sheets id(s) from specific SpreadSheet with Google Sheets API? -

i can put data in cell, can copyto make new sheet existing sheet. but when want delete several sheets, need list of sheet id(s) but don't know how list of sheet id(s) speadsheet? does know how it? the following function display sheet names , id's active spreadsheet. function getsheetid() { var ss=spreadsheetapp.getactive(); var sh=ss.getactivesheet(); var allsheets=ss.getsheets(); var ids=[]; for(var i=0;i<allsheets.length;i++) { ids[allsheets[i].getname()]=allsheets[i].getsheetid(); } var s='<table width="100%">'; for(key in ids) { s+=utilities.formatstring('<tr><td><strong>sheet name</strong></td><td>%s</td><td><strong>sheet id</strong></td><td>%s</td></tr>',key,ids[key]); } s+='</table>' var userinterface=htmlservice.createhtmloutput(s).setwidth(800).setheight(450); spreadsheetapp.ge

html - Create Clickable verification link PHP mail -

for email verification, creating hash each user , sending verification email user.the message body given below. $message_body = ' hello '.$first_name.', thank signing up! please click link activate account: http://www.alphaktu.co.in/verify.php?email='.$email.'&hash='.$hash ; but want convert verification link clickable link. for starters, might want use html links within email body, this: $message_body = ' hello '.$first_name.', thank signing up! please click link activate account: <a href="http://www.alphaktu.co.in/verify.php?email='.$email.'&hash='.$hash.'"> verification link </a>' ; secondly, work, need use html mime type when setting headers email. if haven't, this: // set content-type when sending html email $headers = "mime-version: 1.0" . "\r\n"; $headers .= "con

c++ - Can an iterator be turned into a pointer? -

in "13.7.3 async()" of "a tour of c++" (first print), following provided example: double comp4(vector<double>& v) { if (v.size() < 10000) return accum(v.begin(), v.end(), 0.0); auto v0 = &v[0]; auto sz = v.size(); auto f0 = async(accum, v0, v0 + sz/4, 0.0); auto f1 = async(accum, v0 + sz/4, v0 + sz/2, 0.0); auto f2 = async(accum, v0 + sz/2, v0 + sz*3/4, 0.0); auto f3 = async(accum, v0 + sz*3/4, v0 + sz, 0.0); return f0.get() + f1.get() + f2.get() + f3.get(); } where accum defined follows: double accum(double* beg, double* end, double init) { return accumulate(beg, end, init); } vector , async , accumulate standard library versions. running produces following error: error: cannot convert ‘std::vector<double>::iterator {aka __gnu_cxx::__normal_iterator<double*, std::vector<double> >}’ ‘double*’ argument ‘1’ ‘double accum(double*, double*, double)’ return accum(v.begin(), v.end(), 0.0);

How to import android library from GitHub to eclipse -

how add gradle library in android project. we download project github. https://github.com/michael-rapp/chromeliketabswitcher we follow these step showing error. import library folder above zip android project. it create folder of main blank src, copy data folder java src. after refresh in eclips it's showing error in src folder of functions. we import example folder , follow same step above, no luck. let me know if wrong or can test library on eclips. thanks..

spring boot - Http Only Cookie && Unsecured -

i have server api returns unsecured, http cookie set-cookie header. when make subsequent ajax calls http cookie not getting appended server request , hence server rejecting request. while test same api postman/curl works fine. please let me know needs done browser add cookie request note : both client , server running on localhost https not configured cookie in question jsessionid created using spring security

node.js - Electron USB Printer Connection -

we have developed electron windows app using react js framework. have used thermal printer node library connect usb printer print data. i have tried using share printer in printer properties , using command \system_name\printer_sharename , it's work in windows 8 but window 7 it's not working. idea connect usb printer via electron app using node js ?

css - Transition on search box not working -

Image
i'm trying expand width of search box when focus. works fine transition not working. please put light on it, wrong in these code. couldn't figure out. //css file // class name of div(.searchbox) .searchbox { margin: 100px auto; width: 300px; height: 200px; background-color: #ccc; padding-left: 20px; padding-top: 20px; -webkit-transition: 2s easy-in-out; -moz-transition: 2s easy-in-out; transition: 2s easy-in-out; } // class name of input box .search { padding: 10px; font-size: 1em; } /* input[type="search"]:focus { width: 250px; background-color: #ddd; } */ .searchbox form .search:focus { width: 250px; background-color: #444; } the code these after changes (unfortunately transition not working) try this, .searchbox { margin: 100px auto; width: 300px; height: 200px; background-color: #ccc; padding-left: 20px; padding-top: 20px; } .search { padding: 10px; font-size: 1em; width: 130px;

handler - why PersistStateMachineHandler added listener,but listener don't work well -

i created statemachine statemachinefactory , statepersist handler. in document, executing handler.handleeventwithstate method can trigger listener, code run failes. has idea why? @override public void submit(string machineid, string curstatus,long[] ids) { statemachine<string, string> machine = statemachinefactory.getstatemachine(machineid); persiststatemachinehandler handler = new persiststatemachinehandler(machine); handler.addpersiststatechangelistener(new testlistener(jdbctemplate)); system.out.println("状态机是否终结:" + machine.iscomplete() + "machine-uuid:"+machine.getuuid()); state<string, string> s = machine.getinitialstate(); system.out.println("状态id:" + s.getid() ); if(machine.iscomplete()) { machine.start(); } machine.sendevent("start"); system.out.println("状态机是否终结:" + machine.iscomplete()+ machine.getstate().getid()); handler.handleeventwithstate(messagebuil

django - python - Skip weekend and public holiday when calculating duration between 2 datefield -

greeting everyone, i have 2 datefield in form, start_date , end_date , floatfield called duration . figure out how automatically save duration without user input calculating duration of start , end date, how can give condition skip weekend, , particular public holiday? any appreciated below code : model.py : class leave(models.model): employee = models.foreignkey(employee, on_delete=models.cascade, related_name='+') start_date = models.datefield() end_date = models.datefield() duration = models.floatfield(null=true, blank=true) form.py : class leavesdetailform(forms.modelform): class meta: model = leave fields = ('employee', 'start_date', 'end_date', 'duration') widgets = {'start_date': forms.dateinput(attrs={'type': 'date'}), 'end_date': forms.dateinput(attrs={'type': 'date'}), 'employee'

javascript - I had getting an error on 2nd button for popup, in this I want two different popups by pressing 2nd button extra popup will be empty with join button -

// modal var modal = document.getelementbyid('mymodal'); // button opens modal var btn = document.getelementbyid("btn"); var cat = document.getelementbyid("cat"); // <span> element closes modal var span = document.getelementsbyclassname("close")[0]; // when user clicks button, open modal btn.onclick = function() { document.getelementbyid("balance").value = "25"; document.getelementbyid("txt1").value = "+ rs.125"; document.getelementbyid("txt2").value = "+ rs.250"; document.getelementbyid("txt3").value = "+ rs.600"; document.getelementbyid("headerpop").innerhtml = "add funds account"; document.getelementbyid("oopspop").innerhtml = ""; modal.style.display = "block"; } // first popup working fine pressing 2nd button not ge

c++ - OpenCV Aborted (core dumped) When the Window Is Closed -

i try read camera frame , show through cv::namedwindow using cv::cuda::gpumat . here c++ code: cv::namedwindow("frame", cv::window_opengl); cv::resizewindow("frame", frame_width, frame_height); while (true) { cv::mat frame; cv::cuda::gpumat frame_gpu; camera.read(frame); frame_gpu.upload(frame); cv::imshow("frame", frame_gpu); //frame_gpu.download(frame); if (cv::waitkey(1) == 27) { break; } } cv::destroyallwindows(); if close window got error: opencv error: function/feature not implemented (you should explicitly call download method cuda::gpumat object) in getmat_, file /home/nvidia/opencv-3.2.0/modules/core/src/matrix.cpp, line 1276 terminate called after throwing instance of 'cv::exception' what(): /home/nvidia/opencv-3.2.0/modules/core/src/matrix.cpp:1276: error: (-213) should explicitly call download method cuda::gpumat object in function getmat_ aborted (core dumped) if type esc ke

javascript - How to apply ng-class on button click -

this question has answer here: angular ng-class if-else expression 7 answers plunker. to textbox want apply errorhilight class when ng-model contains '' or undefined , , when submit button click need's check. <input type="text" class ="errorhilight" ng-model="name" ng-class="{'errorhilight': (name == '' || name == 'undefined')}"> how can apply errorhilight class on button click. there many ways it. example <input type="text" ng-model="name" ng-class="{errorhilight: highlighterrors && !name}"> <input type="submit" ng-click="validate();"> $scope.validate = function(){ $scope.highlighterrors = true }

javascript - jQuery replace ],[ with comma -

i have string : [[{"en":"search\r\n","fr":"chercher","it":"cercare"}],[{"en":"more information:","fr":"plus d'inforamtion:","it":"informazioni:"}],[{"en":"why choose ?","fr":"pourquoi nous choisir ?","it":"perché scegliere noi?"}],[{"en":"here main values lead choose elgatek project:","fr":"voici les principales valeurs qui vous amèneront à choisir elgatek pour votre projet informatique :","it":"i valori chiave che portano scegliere elgatek per il vostro progetto it:"}],[{"en":"creativity & innovation","fr":"crÉativitÉ & innovation","it":"creatività e innovazione"}] i want replace occurrence part string ],[ comma. tried str.replace('],[',',') works on fi

match - How to build an Elasticsearch phrase query that matches text with special characters? -

during last few days i've been playing around elastic-search indexing , searching , i've build different queries intended to. problem right being able build query able match text special characters if don't type them in "search bar". i'll give example explain mean. imagine have document indexed contains field called page content . inside field, can have part of text such "o carro joão é preto." (means joão's car black in portuguese) what want able type like: o carro joao e preto and still able proper match. what i've tried far: i've been using match phrase query provided in documentation of elasticsearch ( here ) such example below: get _search { "query": { "match_phrase": { "page content": { "query": "o carro joao e preto" } } } } the result of query gives

javascript - Rockets are not changing direction after mutation -

i have problem machine learning stuff. after first gen rockets not mutating , follow same path. tried different ways solve can see neither of them work. wrote in openprocessing.org tried on local. don`t see problem buti think in rocket constructor function. var rockets = []; var bf = -1; var br; function setup() { createcanvas(windowwidth, windowheight); background(100); nostroke(); fill(255, 50); framerate(10); target = createvector(width, height / 2); (var = 0; < 10; i++) { rockets.push(new rocket()); } } function draw() { background(100); ellipse(width / 2, height / 2, 40, 40); ellipse(width - 10, height / 2, 40, 40); (i = 0; < rockets.length; i++) { rockets[i].show(); //console.log(rockets[i].pos.y); if (!rockets[i].killed) { rockets[i].applyforce(); //it fittness counter inside } } //console.log(rockets); if (rockets[0].counter >= rockets[0].route.length) { findbest();

restore mysql backup file using php -

i can backup file mysql database using php , every thing gone nice , when trying restore backup file have mysqli error you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'insert radpostauth values ('289','ah','ah','access-accept','2017-08-14 10:' @ line 7 in other hand when take query writed file , past in php admin directly executed without error sure query right have 3 empty line between every insert query when run file first insert query executed error show when want execute second insert query insert radcheck values ('1229','ah','cleartext-password',':=','ah','','','','','','','',''); insert radpostauth values ('289','ah','ah','access-accept','2017-08-14 10:04:22'), ('290','muh','asdfghjkl','access-acc

java - JPA Criteria Query Builder: Get last Entry -

i building complex query jpa criteriabuilder. in query join little databases. need last entry of joined table. don't know must applicate in query. here dummy jpa query: private criteriaquery<class2> getclass2function { criteriaquery<rootclass> cq = cb.createquery(rootclass.class); root<rootclass> root = cq.from(rootclass.class); join<rootclass, class2> class2 = root.join(rootclass_.class2id); listjoin<class2, class3> class3 = class2.join(class2_.listofclass3); list<predicate> predicates = new arraylist<>(); predicates.add(cb.isnull(class3.get(somemodel_.dtdl))); predicates.add(cb.isnull(class2.get(somemodel_.dtdl))); predicates.add(cb.isnull(root.get(somemodel_.dtdl))); return cq.select(class2).where(predicates.toarray(new predicate[] {})) .orderby(cb.asc(class2.get(class2_.id))); } now need last entry of listjoin class3 , how can this? greetings i have found solution

php - how to pass variable in route name in laravel? -

i have defined route route::get('/edit-industry/{id}', 'industries@edit')->name('admin.editindustry'); and passing variable by {{ route('admin.editindustry', ['id'=>1]) }} or {{ route('admin.editindustry', [1]) }} this not working. how pass variable here? if have 1 parameter can : {{ route('admin.editindustry', 1) }}

javascript - Magnific Popup video iframe callback (load complete) -

i use magnific popup codeactually , want find way know when current iframe load complete. can me please? i build gallery of video : $('.contentlist').magnificpopup({ delegate: 'a', type: 'iframe', tloading: 'loading image #%curr%...', mainclass: 'mfp-fade', removaldelay: 160, preloader: true, preload:0, fixedcontentpos: false, closemarkup: "<button title=\"%title%\" type=\"button\" class=\"mfp-close\">back<\/button>", gallery: { enabled: true }, iframe: { markup: '<div class="mfp-iframe-scaler">' + '<div class="mfp-counter"></div>' + '<div class="mfp-title">some caption</div>' + '<div class="wrapper">' + '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></i

WSO2 Developer Studio - when is the next version of Eclipse to be released? -

looking @ wso2 developer studio downloads website, latest version of eclipse use eclipse javaee luna released in 2014. http://wso2.com/products/developer-studio/ it seems rather out of date. however, can't find information on future plans next release date? anyone know more this? the tooling found download here now: http://wso2.com/products/enterprise-service-bus/#download click on download tooling obtain tooling. tooling shipped eclipse mars , not eclipse luna

rest - Turn Firebase 'idToken' into 'access token' with no backend? -

i'm trying use firebase rest api creating anonymous user calling: https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupnewuser?key=[api_key] . no problem there, response (modified abit secrecy): { "kind": "identitytoolkit#signupnewuserresponse", "idtoken": "eyjhbgcioijsuzi1niisimtpzci6ijm0ntbimgjhowuzmtcymmuwotblzdixmzviy2rin2mxnzdhmzjmmjcifq.eyjpc3mioijodhrwczovl3nly3vyzxrva2vulmdvb2dszs5jb20vzmlzagluyy1hchailcjwcm92awrlcl9pzci6imfub255bw91cyisiml1zci6imzpc2hpbmmtyxbwiiwiyxv0af90aw1lijoxntazmdq1njy4lcj1c2vyx2lkijoiq2hkruj3vk5heva0nmteqza3d1vkmuj3y3q3myisinn1yii6iknoskvcd1zor3lqndzrrenwn3dvsjfcd2n0nzmilcjpyxqioje1mdmwndu2njgsimv4cci6mtuwmza0oti2ocwizmlyzwjhc2uionsiawrlbnrpdgllcyi6e30sinnpz25faw5fchjvdmlkzxiioijhbm9uew1vdxmifx0.jdmupvgvmt6qzoxynpgmqurqg9zrvbpl1kxxmbhoglggi9u1hhwqft5hhkis3qbs87-rr5bceitcu5sehcdlwl3rzex87fcthmy4z-vdquukiqjkhfb0q04sbzbkvuvuug9o-acwmdlwfz54u4alk7kfdlbti3600kqw_4-ugura2jippose9f8hiz_qgao_5kptjo6v

issue with simple currency conversion with php -

i cant value of selected currency converted properly. did correctly set array? <?php $amount_input = filter_input(input_post, 'amount_input'); $currency1 = filter_input(input_post, 'currency_type_from'); $currency2 = filter_input(input_post, 'currency_type_to'); $currencies = array(); $currencies['gbp'] = array( 'gbp' => 1, 'eur' => 1.09710, 'usd' => 1.28917 ); $currencies['eur'] = array( 'eur' => 1, 'gbp' => 0.911383, 'usd' => 1.17616 ); $currencies['usb'] = array( 'usd' => 1, 'eur' => 0.849851, 'gbp' => 0.774699 ); $currencies = 0; // when comment undefined index @ line below $amount_output = $amount_input*$currencies[$currency1][$currency2]; ?> form convert currency select type <form actio

gcc - Error while installation of Apache httpd 2.4.2 on AIX OS -

we getting below error while running make command build apache files. carrying out installation on aix 6.1 os. installation completed upto configuration step per procedure given in below link: http://httpd.apache.org/docs/2.4/install.html the error : util_pcre.c:48:18: error: pcre.h: no such file or directory util_pcre.c: in function 'ap_regfree': util_pcre.c:103: error: 'pcre_free' undeclared (first use in function) util_pcre.c:103: error: (each undeclared identifier reported once util_pcre.c:103: error: each function appears in.) util_pcre.c: in function 'ap_regcomp': util_pcre.c:129: error: 'pcre_caseless' undeclared (first use in function) util_pcre.c:131: error: 'pcre_multiline' undeclared (first use in function) util_pcre.c:133: error: 'pcre_dotall' undeclared (first use in function) util_pcre.c:136: warning: implicit declaration of function 'pcre_compile' util_pcre.c:136: warning: assignment makes pointer integer