Posts

Showing posts from July, 2013

augmented reality - Local Area Description: Learning -

i've started learning google tango , having troubles in understanding how implement local area description learning. have followed 1 of how-to-guides documentation, 1 placing virtual objects in ar , wanted app remember places kittens placed. attach scene unity , script i've tried enable savecurrent method areadescription. the scene unity , following code 1 how-to-guide have tried create thread saving current areadescription public class kittyuicontroller : monobehaviour { thread thread; public gameobject m_kitten; private tangopointcloud m_pointcloud; void start() { m_pointcloud = findobjectoftype<tangopointcloud>(); thread = new thread(thread123); } void update() { if (input.touchcount == 1) { // trigger place kitten function when single touch ended. touch t = input.gettouch(0); if (t.phase == touchphase.ended) { placekitten(t.position); thread.start(); } } } void placekitten(ve

Temporary disable logging completely in Python -

temporary disable logging completely i trying write new log-handler in python post json-representation of log-message http endpoint, , using request library posting. problem both request , urllib3 (used request) logs, , loggers has propagate=true, meaning logs log propagated parent loggers. if user of log-handler creates logger no name given, becomes root logger, receive messages, causing infinite loop of logging. bit lost on how fix this, , have 2 suggestions both seem brittle. 1) "reguest" , "urllib3" loggers, set propagate values false, post log message before setting propagate values old values. 2) check if incoming record has name contains ".request" or ".urllib3", , if ignore record. both of these break badly if request library either replaces urllib3 else or changes name of logger. seems method 1 problematic in multi-threaded or multi-process case. what want way of disabling logging current thread point , enable again after h

java - FailoverClientConnectionFactory not working for tcp-connection-factory -

i using tcp-connection-factory sending data client server on tcp. have 2 servers, data going 1st server , never goes 2nd server if 1st server down. if 1st server down, data should sent 2nd server. not working. here spring.xml file <ip:tcp-connection-factory id="client1" type="client" host="${host1}" port="${port}" serializer="serializer"/> <ip:tcp-connection-factory id="client2" type="client" host="${host2}" port="${port}" serializer="serializer"/> <bean id="failcf" class="org.springframework.integration.ip.tcp.connection.failoverclientconnectionfactory"> <constructor-arg> <list> <ref bean="client1"/> <ref bean="client2"/> </list> </constructor-arg> </bean> i haven't set single-use , so-timeout attribute. thi

How to draw a polygon like google map in android app? -

Image
i creating map app place city , want draw polygon around place. i have example of app idea in web google map picture: how can ? original documentation has clear explanation polygon api . need use method own coordinates , colors: googlemap map; // ... map. // add triangle in gulf of guinea polygon polygon = map.addpolygon(new polygonoptions() .add(new latlng(0, 0), new latlng(0, 5), new latlng(3, 5), new latlng(0, 0)) .strokecolor(color.red) .fillcolor(color.blue)); wiki

android - Monitor users bank history in realtime using Plaid API -

we looking monitor our users bank history in realtime, in order build savings solution similar acorn. we running issue of have access user’s information 30 mins before having reathenticate. please suggestions how gain realtime access once permission granted? wiki

SSL Error IBM Watson personality-insights Python -

i trying use ibm personality insights service inside loop. below. def generatetoken(username, password): r = requests.get("https://gateway.watsonplatform.net/authorization/api/v1/token?url=https://gateway.watsonplatform.net/personality-insights/api", auth=(username, password)) if r.status_code == requests.codes.ok: return r.text def personalityrequest(text, token): base_url='https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-08-17&consumption_preferences=true&raw_scores=true' headers = {'x-watson-authorization-token': token, 'content-type': 'text/plain'} r = requests.post(base_url, headers=headers, data={'body': text}) return r.text token = generatetoken('#username', '#password') user in range(0,user_data.shape[0]): user_data["user_personality"][user] = personalityrequest(user_data["user_preferences"][user], token)

java ee - EAR application and application.xml: library-directory element values -

starting basic ear file documentation , proceeding official oracle documentation, can't find on application.xml . should application.xml file have library-directory element? deploy fails: thufir@doge:~$ thufir@doge:~$ glassfish_server/bin/asadmin deploy /home/thufir/netbeansprojects/gradleear/build/libs/gradleear.ear remote failure: error occurred during deployment: org.xml.sax.saxparseexception; linenumber: 4; columnnumber: 22; deployment descriptor file meta-inf/application.xml in archive [gradleear]. cvc-complex-type.2.4.a: invalid content found starting element 'library-directory'. 1 of '{"http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon, "http://java.sun.com/xml/ns/javaee":initialize-in-order, "http://java.sun.com/xml/ns/javaee":module}' expected.. please see server.log more details. command deploy failed. thufir@doge:~$ build.gradle: plugins { id 'co

html - How to get questions length while it has filtered with some value in angular js? -

how question length while has been filtered other value using angular js? my plunker actually trying filtered question length have used total no of questions:{{question.length}} answer it's showing overall questions length like:- 4 . if used filter like: | filter:{status: 'pending'} there 2 data's showing on table, want show filtered questions length , expecting answer like: 2 please @ plunker reference my plunker . my html:- <tr ng-repeat="mani in resultvalue=((question) | filter:{status: 'pending'}) "> <td>{{$index + 1}}</td> <td>{{mani.title}}</td> <td>{{mani.upvotes }}</td> <td>{{question.length}}</td> </tr> <tr> <td>sum</td> <td></td> <td>{{resultvalue | sumofvalue:'upvotes'}}</td> <td></td> </tr> </table> <p class="color">total no of questions :{{q

concurrency - What field's value of a partially initialized object could a reader thread see according to Java Memory Model? -

more specifically, assuming object partially initialized , field x initialized null object's constructor, possible other thread reading partially initialized object can see other value null? if understand correctly, there's no guarantee in java memory model value null in such case. question is: considering cpu caches , jvm memory architecture, should reasonably expected value not null? by default, reference member variables initialized null. if constructor had set field non-null value, it'd have been possible other threads see null or non-null value. if constructor setting value null (which seems redundant in simple scenario), not possible other threads see value other null (the value field ever had null, there no question of seeing other value) wiki

Redis mark key volatile infinite expiration -

i want mark keys volatile dont want redis expire them unless hit max memory configuration. is possible mark key volatile infinite value? edit i searched googles , mailing list , not finding anything if in case, there no need normal key expiration, try trick method. but if want expire keys in normal ways, method wrong. set memory-policy volatile-ttl can evict keys expire set, , try evict keys shorter time live (ttl) first, in order make space new data added. and use expire command on volatile keys. expire volatile-key infinite-time the infinite-time should big make sure key not expired in normal way. then if redis server reaches maxmemory, follow volatile-ttl policy , remove oldest volatile-key define first. wiki

html - Remove text indentation from select (Windows) -

Image
i need cross-browser solution remove padding/text indentation of native select fields. using padding: 0 doesn't seem remove entirely. here's screenshot of chrome, no text space on left side: and here's screenshot of firefox, has text space on left side: however, should remove padding in e.g. edge/ie11/safari, etc. shouldn't firefox solution, rather cross-browser solution. here's code: select { font-size: 18px; height: 38px; line-height: 38px; padding: 0; width: 100%; background-color: red; color: #000000; display: block; -webkit-appearance: none; -moz-appearance: none; appearance: none; outline: 0; border-color: #000000; border-width: 0 0 1px 0; border-style: solid; } option { padding: 0; } <select> <option value="test1">test 1</option> <option value="test2">test 2</option> <option value="test3">test 3</option>

neo4j cannot use spatial.withinDistance but afaik right libraries in plugins folder (mac os x) -

i have restarted server after dropping following jars in plugin folders (both of app , database) neo4j-spatial-0.24-neo4j-3.1.1-server-plugin.jar neo4j-spatial-0.24-neo4j-3.1.1.jar i error, when trying make call withindistance there no procedure name `spatial.withindistance` registered database instance. please ensure you've spelled procedure name correctly , procedure deployed. the version of neo4j have 3.2.2, same version on windows works fine same jar in plugin folder of database. (though other code running spark , neo4j not work on windows on mac, computers passing fad. smh) call dbms.procedures() results: ╒═══════════════════════════════╤══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╤══════════════════════════════════════════════════════════════════════════════════════════╕ │"name" │"signature"

How to use service in android? -

i making simple music app. problem facing right how check id service running or not? last time when made music app without service fine there problem in it. whenever played music pressed , exited app, after again opening app when again played music started song playing first song still playing whenever closed , opened app , played music started playing song other songs playing @ same time. so using service wishing remove using bound service. want know when open , close app app remove instance of service self , if yes how can know service running , not bind again? use following inside activity: private boolean ismyservicerunning(class<?> serviceclass) { activitymanager manager = (activitymanager) getsystemservice(context.activity_service); (runningserviceinfo service : manager.getrunningservices(integer.max_value)) { if (serviceclass.getname().equals(service.service.getclassname())) { return true; } } return false

Passing kwargs into get_or_create method in Django -

i have model custom save function, want perform functions based on condition this: class classname(models.model): def save(self, *args, **kwargs): reindex = **kwargs.pop("reindex") super().save(*args, **kwargs) if reindex: people.objects.create() now inside task want call following: kwargs = { "reindex": false} classname.objects.get_or_create(**kwargs) when create, runs save function, it's giving me error saying reindex not field . have been researching while , can't figure out do. maybe can point me in right direction. i want pass in argument get_or_create , can conditionally perform function in save method. thank in advance! when do kwargs = { "reindex": false} classname.objects.get_or_create(**kwargs) it equivalent classname.objects.get_or_create(reindex=false) thus, since reindex appears not field defined in model classname , error. btw, beyond things appear errone

postgresql - Postgres Query copy to CSV with DateTime -

i have simple query run inside postgres sql query runs bunch of queries extracts csv, [without bunch of queries above it] is copy (select * public.view_report_teamlist_usertable_wash) 'd:/sf/reports/view_report_teamlist_usertable_wash.csv' delimiter ',' csv header encoding 'utf8' force quote *; can alter above @ append date/time [now()] filename? ie. 'd:/sf/reports/view_report_teamlist_usertable_wash_2017-08-23 14:30:28.288912+10.csv' i have googled many times come solutions runs command line if want use once or not regularly, use postgres do. but, if use script regularly, should write pl. either way, should this: do $$ declare variable text; begin variable := to_char(now(), 'yyyy-mm-dd_hh24:mi:ss'); execute format ('copy (select * public.view_report_teamlist_usertable_wash) ''d:/sf/reports/view_report_teamlist_usertable_wash_%s.csv'' delimiter '','' csv header encodi

C# copy data from local SQL Server file to Access .mdb -

i use below code copy sql server table access file. have no problem when choose local sql server express database (created db ssms in local express area), have problem local file. //using ace.oledb : oledbconnection accessconn = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source="+setting.uniqefolderpath+"\\"+setting.uniqeid+".mdb"); accessconn.open(); //new table, using select oledbcommand accesscommand = new oledbcommand( @"select * "+desname+" ["+sourcename+ @"] in '' [odbc;driver={odbc driver 11 sql server};server="+@"(localdb)\mssqllocaldb; database='localdb';trusted_connection=yes];", accessconn); accesscommand.executenonquery(); accessconn.close(); the problem happens when change database: //error when change file address or file oledbcommand accesscommand = new oledbcommand( @"select * "+desname+" ["+

python - How to arrange files in Odoo -

beginner odoo questions. how arrange model files , controller files in respective folders? , have write in init.py file? currently have models , controllers in root folder of module. like this addons\ -->mymodule\ -->views\ -->view.xml -->__init__.py -->__openerp__.py -->models.py -->controllers.py i have tried addons\ -->models\ -->models.py and import models.py using inside init.py from models import models but not work addons\ ->yourmodule\ ->controllers\ ->__init__.py ->controllers.py ->models\ ->__init__.py ->modelname.py ->__init__.py ->__openerp__.py content of init.py in controllers folder: from . import controllers content of controllers.py in controllers folder: from openerp import http content of init.py in models folder: from . import modelname content of init.py in module folder: from . im

javascript - controller is hitting the server but data is not displaying in angularjs -

when click on button go controller , hit server through api , return data html page. have created own api , placed in cloud accessing through web address, not using other sites api. code written hitting server through api data not displaying. my html code <body ng-app="myapp"> <div ng-controller="testctrl"> <button ng-click="loadtestctrl()">load ctrl</button> {{result}} </div> my controller code app.controller("testctrl",function($scope,$http){ $scope.loadtestctrl = function(){ $http.get("http://192.168.0.103:8081/kunera-pos/franchise/getfranchise/").then(function(response){ $scope.result = response.data; }); } }); the 3 error getting error 1 failed load resource: server responded status of 404 (not found) error 2 xmlhttprequest cannot load http://192.168.0.1

sql server - How to prevent SQL injection in dynamic sql for bulk insert? -

i'm using dynamic sql bulk insert parameter ( bulk insert using stored procedure ). declare @sql nvarchar(4000) = 'bulk insert tblvalues ''' + @filename + ''' ( fieldterminator ='','', rowterminator =''\n'' )'; exec(@sql); but... how avoid sql injection? you use quotename surround file name in single quotes: declare @sql nvarchar(4000) = 'bulk insert tblvalues ' + quotename(@filename,'''') + ' ( fieldterminator ='','', rowterminator =''\n'' )'; exec (@sql); wiki

.htaccess - HTTPS Redirect with htaccess and drop file extension -

currently installing ssls on numerous sites looking perfect solution redirect http https i have looked @ various answers on here none work perfectly. i need able redirect http:// , http://www , www https:// the web pages have .php extension removed via htaccess , want keep this. current code is options -multiviews rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d #rewriterule ^(.*)$ $1.php [l] rewriterule ^([^\.]+)$ $1.php [nc,l] rewritecond %{http_host} ^www\.(.*)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] rewritecond %{https} !=on rewriterule ^ https://%{http_host}%{request_uri} [l,r=301]\ now works can see on - http://trojandriveways.co.uk , when on child page such https://trojandriveways.co.uk/free-design.php .php extension there , removing. please can have amended htaccess file code fix issues! been trying days now. wiki

How to inform users that delete request as been sent to admin in Django -

so creating django forum site school project. have created question , comment model. i want add feature not know how go : if user clicks delete button comment, admin should receive request(message of sort) delete comment , popup or message should tell user request deleting comment been received admin. i want feature because not want users delete comments might important in future if wrote irrelevant things admin can delete comment wiki

sql - "Error converting data type nvarchar to numeric." -

i'm trying create function returns table bunch of fields. query used in function inserts data temp table inserts returning table. query runs fine when run outside of function when select function "error converting data type nvarchar numeric." error. the structure returning table same table selects , inserts returning table. below how function defined alter function [dbo].[func_prescriberdata](@networkid bigint, @startdate datetime, @enddate datetime) returns @rtntable table ( name nvarchar(1000) null,clinicid int null ,networkprescriberid int null,guidemedpatients int null, inactivepatients int null,avgage decimal null,avgphqscore decimal null, [%riskassessmenthigh] varchar(10) null ,[%riskassessmentmoderate] varchar(10) null,[%riskassessmentlow] varchar(10) null, toxicologytests int null,[%consistentresults] varchar(10) null, [%alcohol] varchar(10) null,[%negativeprescribed] varchar(10) null ,[%illicit] varchar(10) null,totalpdmps int null,[%aberr

html5 - MediaSource through socket stops -

i'm trying stream rtsp live stream through socket.io using ffmpeg (this works fine), need video socket , play on html5 video tag. to i'm using mediasurce , getting small pieces of video through socket , appending mediasource this solution reproduces video few seconds o minutes , stops , doesn't throw me error on chrome console var socket = io(); var ms = new mediasource(); var sourcebuffer; var queue = []; var video = document.getelementbyid("video"); video.src = window.url.createobjecturl(ms); socket.on('start', function (response) { console.log(response); socket.emit('streaming', $stateparams.id); ms.addeventlistener('sourceopen', videoload, false); ms.addeventlistener('sourceclose', videoclosed, false); }); function videoload() { sourcebuffer = ms.addsourcebuffer('video/webm; codecs="vorbis,vp8"'); sourcebuffer.a

javascript - How to "dragenter" is not blocked by child elements? -

https://jsfiddle.net/7scfk81l/ i have document structure this <div id="container"> <div id="inner"></div> </div> and add dragenter & dragleave listener container but when dragged file, trigger container dragleaver , 'dragenter' event when passing through child element is there way make parent element unblocked? i tried add pointer-events: none inner , that's not want, hope child elements can manipulated well.. solved myself set switch on child element event, , parent element filters events based on switch let ischildentered container.addeventlistener('dragenter', (e) => { if (!ischildentered) { console.log('dragenter') } }) container.addeventlistener('dragleave', (e) => { if (!ischildentered) { console.log('dragleave') } }, true) inner.addeventlistener('dragenter', e => { ischildentered = true }) inner.addeventlisten

android - How to fetch and set data in listview adapter using background thread? -

i have app contain listview list of installed apps in device , set adaptor problem freezes app second when getting list of apps installed in device. want these list , set adapter using background thread.how do that code:- asynctask.execute(new runnable() { @override public void run() { final list<cwhitelistappsmodel> installedapps = getinstalledapps(); getactivity().runonuithread(new runnable() { @override public void run() { installedappadapter = new cwhitelistappsadapter(mcontext, installedapps, cwhitelistappsfragment.this); appcount(); userinstalledapps.setadapter(installedappadapter); } }); } }); try implement asynctask inner class this show progressdialoginstead of shwing app hanged, hope helps! private class yourasynctask extends asynctask<string, string, arraylist<yourclass>

c# - Random number generator with no duplicates -

basically i'm creating program randomly generate 6 unique lottery numbers there no duplicates in same line, here code have far... //generate 6 random numbers using randomiser object int randomnumber1 = random.next(1, 49); int randomnumber2 = random.next(1, 49); int randomnumber3 = random.next(1, 49); int randomnumber4 = random.next(1, 49); int randomnumber5 = random.next(1, 49); int randomnumber6 = random.next(1, 49); textbox1.text = randomnumber1.tostring(); textbox2.text = randomnumber2.tostring(); textbox3.text = randomnumber3.tostring(); textbox4.text = randomnumber4.tostring(); textbox5.text = randomnumber5.tostring(); textbox6.text = randomnumber6.tostring(); } i'm getting random numbers there same number on same line, how make each number unique???? thanks in advance you need store them in collection , each time pick new number need make sure

Typo3 CKEditor image from FAL -

i set fresh typo3 8.7.4 installation ckeditor , rte_ckeditor_image images fal. in documentation rte_ckeditor_image says: the maximum dimensions relate configuration magic images have set in page tsconfig: # page tsconfig rte.default.buttons.image.options.magic { maxwidth = 1020 # default: 300 maxheight = 800 # default: 1000 } i did this, still can't make width of image bigger 300px. i looked @ source code typo3 already. there file typo3/sysext/core/classes/resource/service/magicimageservice.php which got 2 variables: $magicimagemaximumwidth , $magicimagemaximumheight . if change value of them, can make width of image bigger 300px. the file got function setmagicimagemaximumdimensions(array $rteconfiguration) should change thoose 2 variables seems doesn't so. did wrong or impossible change maximumg image dimensions? thanks. remove comments after maxwidth , maxheight ( # default: xxx ) , try again. comments in typo3 allowed new ro

reactjs - Flow: function call. Callable signature not found in statics of React$Component -

i error don't understand in flow: flow: function call. callable signature not found in statics of react$component with code: export default connect( null, { showmodal }, )(withrouter(footersection)); i error: function cannot called on member of intersection type intersection with code: export default connect( (state: state) => ({ teamid: state.user.user.team, }), { createproject, }, )(createprojectcontent); it happened when upgraded flow@0.53.1 i think problems arose when updated flow-typed directory well. so did, deleted flow-typed/npm directory , again installed types flow-typed install . i handled other errors , flow isn't complaining anymore. wiki

How to download Maven reports after a GitLab CI job failure -

i'm quite newbie gitlab ci. how can export maven surefire reports when job fails. i've tried artifacts works job in success. is there convenient approach exporting reports ? i've found myself. use "when" job: artifacts: when: on_failure wiki

python - How to use sides of a sprite rect in pygame? -

i attempting draw line between 2 different instances of same sprite class, sprite class being coded in shown here (this __init__ function): class atom(pygame.sprite.sprite): """creates atom of element. element can specified using element parameter. take dict argument, contained in constants file of sort.""" def __init__(self, element, centre_loc): pygame.sprite.sprite.__init__(self) self.image = pygame.surface((30, 30), pygame.srcalpha) pygame.gfxdraw.aacircle(self.image, 15, 15, 14, (0, 255, 0)) pygame.gfxdraw.filled_circle(self.image, 15, 15, 14, (0, 255, 0)) self.rect = self.image.get_rect() self.rect.center = centre_loc self.element = element self.show_text(element) self.print_properties(self.element) i have tried using code here: pygame.draw.line(screen, color, sprite.rect.right. sprite.rect.left) i have simplified above code, highlight have done. actual code above found here , commented out on lin

Can we call an variable and function directly when we include an file in php -

dbc.php <?php $con = mysqli_connect("****", "****", "****", "employees"); if(!$con) { echo "connection error"; die(); } ?> index.php <?php require("dbc.php"); $query = mysqli_query($con, "select * uname"); //error : undefined $con if(!$query) { echo "query error"; die(); } ?> how can call variables , functions when include file. why above declared $con showing error? wiki

google app engine - Urlfetch is not following some redirects -

i'm experiencing issue urlfetch. seems url used in code, follow_redirects=true works locally. here's code used testing: def redirect_test(): url = 'http://0214.by/job.php?busy=ПОСТОЯННАЯ' response = urlfetch.fetch(url, follow_redirects=true) if 'location' in response.headers: ret = 'redirect ignored. location: %s<br>' % response.headers['location'] url = urlparse.urljoin(url, response.headers['location']) response = urlfetch.fetch(url, follow_redirects=false) if 'location' in response.headers: ret += 'redirect followed manually , redirect response received' else: ret += 'redirect followed manually , no more redirects received' else: ret = 'redirect followed automatically' return ret the problem when i'm running code locally i'm getting "redirect followed automatically" message.

python - Django: Class to log a mail error -

i'm trying follow code django unleashed , (by mean often) have problems understand code in full. here exaple of function suppose log errors when mail not sent. part of login system. def log_mail_error(self, **kwargs): msg_list = [ 'activation email did not send.\n', 'from_email: {from_email}\n' 'subject: {subject}\n' 'message: {message}\n', ] recipient_list = kwargs.get( 'recipient_list', []) recipient in recipient_list: msg_list.insert( 1, 'recipient: {r}\n'.format( r=recipient)) if 'error' in kwargs: level = error error_msg = ( 'error: {0.__class__.__name__}\n' 'args: {0.args}\n') error_info = error_msg.format( kwargs['error']) msg_list.insert(1, error_info) else: level = critical msg = ''.join(msg_list).fo

When press the back button android shows blank page -

i have activity named submitactivity. in activity, have button. when click button, chrome custom tabs open. able application custom tabs, used intent-filters custom deep linking (host , scheme). with intent-filters(deep linking) i'm starting web view in app. if try go submitactivity via pressing button, before submitactivity, see blank page. could't solve problem. i used intent.setflags(intent.flag_activity_no_history); this code closing chrome tabs. so, can able go submitactivity. it's not helping blank page. i suspect webview goes , expects data (e.g url) that's blank since didn't receive anything. this different case might help wiki

javascript - Chartjs, How to make x tick space be different on line chart -

Image
i want use line chart , make such each x value maps it's respective y value based upon index. example know can this: labels: [1,2,10,20] and have data be: data: [1,2,3,20] which produce this: as can see space between 2 , 10 same x axis labels. want insert labels/data using same format (data:[1,2...]) want x axis realize spacing between each value should scaled depending on x value given still mapped y value. i know can insert data this: data: [{ x: -10, y: 0 }] but there way without having change format , have index based instead? wiki

ios - Set X and Y values of UILabel using NSLayout -

i adding ui label , trying out programmatic ui code. set label using code: let titlelabel: uilabel = { let lb = uilabel() lb.translatesautoresizingmaskintoconstraints = false lb.textalignment = .center lb.numberoflines = 1 lb.textcolor = uicolor.black lb.font=uifont.systemfont(ofsize: 22) lb.backgroundcolor = uicolor.white return lb and added constraints using code: func setuptitlelabel() { titlelabel.translatesautoresizingmaskintoconstraints = false titlelabel.heightanchor.constraint(equaltoconstant: 100).isactive = true titlelabel.widthanchor.constraint(equaltoconstant: 200).isactive = true titlelabel.centerxanchor.constraint(equalto: titlelabel.superview!.centerxanchor).isactive = true titlelabel.centeryanchor.constraint(equalto: titlelabel.superview!.centeryanchor).isactive = true } i call function later on. however, not sure how change x , y values. currently, set middle of page both x , y, how move top. a

jquery - How can you make buttons stretched only when the `navbar` is collapsed (Bootstrap)? -

Image
jsfiddle, https://jsfiddle.net/4tusk977/ . <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"> </head> <body> <div class="container-fluid"> <nav class="navbar navbar-default"> <div class="navbar-header"> <a class="navbar-brand" href="#">...</a> <button aria-expanded="false" class="collapsed navbar-toggle" data-target="#main_menu" data-toggle="collapse" type="button"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"

PHP exec not working for command that works in bash and python -

so i'm not sure what's going here , cannot figure out why. the command: echo shell_exec('wine /var/www/exes/validate_file.exe /var/www/exes/test_files/test1.txt'); outputs nothing (i expect printing "ok"). running same command through python os.system shows expected output ("ok") , on bash command line. if run different exe through wine, works expected, i'm not sure what's going on, permissions fine (i've tried 777 on both exe , txt, , wine worked different exe). i've tried putting command python file , wrapping php didn't produce output. the string exec ( string $command [, array &$output [, int &$return_var ]] ) has 3 arguments , result last line result of command. possible empty result if last line empty. output of executed command, sure set , use output parameter. status of command use return_var argument. if return_var argument present along output argument, return status of executed command

logging - Elasticsearch cluster design for ~200G logs a day -

i've created es cluster (version 5.4.1) 4 data nodes, 3 master, 1 client node (kibana). the data nodes r4.2xlarge aws instance (61g memory, 8vcpu) 30g memory allocated es java. we're writing around 200g of logs every day , keep last 14 days. i'm looking recommendations our cluster improve cluster performance, search performance (kibana). more data nodes? more client nodes? bigger nodes? more replica's? can improve performance option. is there close design or loads? i'll happy hear other designs , loads. thanks, moshe how many shards using? default of 5? pretty number. depending on ask shard should between 10g , 50g; logging use-case rather on 50gb side. which queries want speed up? target recent data or long time-spans? if interested in recent data, use different node types in hot-warm architecture. more power nodes recent data , less data; bulk of older , less accessed data on less powerful nodes. generally you'll need find bottlenec

javascript - simple delete two out four in a array -

hi have quiz multiple answer want when button pressed delete 2 out off 4 leaving 2 answers 1 correct , 1 false. var questions = [ ["what 10 + 4?", "12", "14", "16", "b"], ["what 20 - 9?", "7", "13", "11", "c"], ["what 7 x 3?", "21", "24", "25", "a"], ["what 8 / 2?", "10", "2", "4", "c"] ]; thank . wiki

javascript - Add class to element when scrolling 100px above it -

i trying add class each element (class abc) when reaches 100px below top of viewport. cannot class added each individual element. rather adding class divs. suggestions? $(function() { $(document).scroll(function() { if ($(this).scrolltop() >= $('.abc').offset().top - 100) { $(".abc").addclass("color"); } else { $(".abc").removeclass("color"); } }); }); #header { height: 150px; } .abc { background-color: orange; } .color { background-color: blue; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="header"> <h1>header</h1> </div> <div class="abc"> lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque semper aliquam neque, id condimentum orci egestas ac. maecenas ullamcorper semper finibus. quisque vitae semper lorem, ut mattis m

python - Converting list of list into 2 independent lists -

i have list of lists looks this: lol=[['"buy":17'], ['"hold":18'], ['"sell":3']] is there simple way convert list of lists 2 independent lists this?: list1=["buy","hold","sell"] list2=[17,18,3] first tried replace on list: lol.replace('[','').replace(']','') but outputed 'list' object has no attribute 'replace' then thought use regular expressions on lol @ least obtaining numbers in independent list following code: re.findall('\d{1,2}',lol.string) but returned outputed expected string or bytes-like object you can split strings on ':' , use ast.literal_eval produce final output: import ast l1, l2 = zip(*[map(ast.literal_eval, lst[0].split(':')) lst in lol]) print(l1, l2) # ('buy', 'hold', 'sell'), (17, 18, 3) wiki

android - build java method to change two textViews -

this question has answer here: attempt invoke virtual method 'android.view.window$callback android.view.window.getcallback()' on null object reference 1 answer i have 2 buttons , 2 textviews , when click "add2_a" ,then "score1" updated , increment 2 . the same "add2_b" increment "score2" i want use 1 method both of them ..the problem app crash ! this java code : import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.textview; public class app2 extends appcompatactivity implements view.onclicklistener { public int number =0; public int id; textview txt1= (textview) findviewbyid(r.id.score1); textview txt2 = (textview) findviewbyid(r.id.score2); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate);