Posts

Showing posts from September, 2013

python - python2.7 histogram comparison - white background anomaly -

my program's purpose take 2 images , decide how similar are. im not talking here identical, similarity. example, if take 2 screenshots of 2 different pages of same website, theme colors similar , therefor want program declare similar. my problem starts when both images have white background pretty takes on histogram calculation (over 30% of image white , rest distributed). in case, cv2.comparehist (using correlation method, works other cases) gives bad results, is, grade high though different. i have thought taking white (255) off histogram before comparing, requires me calculate histogram 256 bins, not when want check similarity (i thought using 32 or 64 bins best) unfortunately cant add images im working due legal reasons if can idea, or code solves grateful thank much you can remove white color, rebin histogra , compare: compute histrogram 256 bins. remove white bin (or make zero). regroup bins have 64 bins adding values of 4 consecutive bins. pe...

spring security - Remember-me cookie deleted after app restart - is this OK? -

i have remember-me implemented in spring boot app, can see cookie created correctly after login, proper expiration time etc. cookie doesnt survive app restart on tomcat server. scenario simple. user login remember me , cookie available in browser. app redeploy in tomcat , now, when user refreshes app in browser window, logged out , cookie deleted browser. shouldn't cookie survive , allow automatic login app restarts in tomcat? here snippet springboot security config. app.logout().deletecookies("nh_remember").logoutsuccessurl("/").logouturl("/logout").permitall().and().rememberme().remembermecookiename("nh_remember").tokenvalidityseconds(1209600).key("xxxxxxxx") you have persist token between restarts of tomcat. check out documentation: http://docs.spring.io/spring-security/site/docs/current/reference/html/remember-me.html specifically need setup persistenttokenbasedremembermeservices contains information database...

swift - change uinavigation bar item position -

Image
how can change uinavigation baritem position leftbarbuttonitem rightbarbuttonitem function for need create custom barbuttonitem , set right side, need hide default backbarbutton , try thing this. add below code inside viewdidload . self.navigationitem.hidesbackbutton = true let btnforward = uibutton(frame: cgrect(x: 0, y: 0, width: 25, height: 25)) btnforward.setimage(uiimage(named: "forward_arrow"), forstate: .normal) btnforward.addtarget(self, action: #selector(self.buttonaction(_:)), forcontrolevents: .touchupinside) let backitem = uibarbuttonitem(customview: btnforward) self.navigationitem.rightbarbuttonitem = backitem after add action method inside viewcontroller func buttonaction(sender: uibutton) { self.navigationcontroller?.popviewcontrolleranimated(true) }

swift3 - How to declare exponent/power operator with new precedencegroup in Swift 3? -

there's been change in swift 3 xcode 8 beta 6 , i'm not able declare operator power did before: infix operator ^^ { } public func ^^ (radix: double, power: double) -> double { return pow((radix), (power)) } i've read bit , there's new change been introduced in xcode 8 beta 6 from i'm guessing have declare precedence group , use operator this: precedencegroup exponentiativeprecedence {} infix operator ^^: exponentiativeprecedence public func ^^ (radix: double, power: double) -> double { return pow((radix), (power)) } am going in right direction make work? should put inside {} of precedence group? my final aim able make power operations simple operator in swift, e.g.: 10 ^^ -12 10 ^^ -24 your code compiles , runs – don't need define precedence relationship or associativity if you're using operator in isolation, such in example gave: 10 ^^ -12 10 ^^ -24 however, if want work other operators, chaining multiple expon...

android - Storing list of position in sharedPreferences, and retrieve in another activity -

i want similar this , have used cardview recyclerview. added favourite button cardview below can see full code. in recyclerview adapter print toast per position , working fine, need save int value of position in shared preferences in arraylist , display arraylist in next intent. this recyclerview adapter public void onbindviewholder(nameviewholder holder, final int position) { holder.textview.settext(names.get(position).textview); holder.favourite.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { sharedpreferences sp = preferencemanager.getdefaultsharedpreferences(view.getcontext()); sharedpreferences.editor editor = sp.edit(); editor.putint("key", position); //may or may not be. //add code here save position in array toast.maketext(view.getcontext(),"fav "+position,toast.length_short).show(); } }); cardview.xml <?x...

hibernate - Why Document Fields Still Have Uppercase Characters after Using LowerCaseFilterFactory? -

i think analyzer should apply both indexing , search processes, correct? if true, why document fields still have uppercase characters after using lowercasefilterfactory filter in analyzer? i use luke check document fields. here related code. @indexed @analyzerdef(name = "remarksanalyzer", tokenizer = @tokenizerdef(factory = standardtokenizerfactory.class) , filters = { @tokenfilterdef(factory = lowercasefilterfactory.class), @tokenfilterdef(factory = snowballporterfilterfactory.class, params = { @parameter(name = "language", value = "english") }) }) public class book { ... @field(store = store.yes) @analyzer(definition = "remarksanalyzer") private string remarks; ... } did try search on index lowercased words? i'm pretty sure work. the fact is, if use store=store.yes, store unanalyzed string in index , analyzed tokens. might allow use highlighter instance: highlighted s...

curl - PHP echo CSRF & STATE not appearing -

greetings stacksoverflow devs, i'm trying figure out earlier why hidden input values @ website not appearing when try echo , used preg_match_all , made hidden value post. i want echo both @ same time problem couz it's not appearing. here code: <?php function get_data($url) { $ch = curl_init(); $timeout = 10; curl_setopt($ch,curlopt_url,$url); curl_setopt($ch,curlopt_returntransfer,1); curl_setopt($ch,curlopt_connecttimeout,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } $returned_content = get_data('https://secure.tesco.com/account/en-gb/login'); $container = $returned_content; preg_match_all('(<form\s.*</form>)', $container, $forms); print_r($forms); $_post['_csrf'] = $csrf; $_post['state'] = $state; echo "<font color=red><b>csrf</b></font> : ".$csrf."<br/>"; echo "<font color=red...

formal languages - Greek syllabification library for Javascript -

does know syllabification library or script greek written javascript? tried use hyphenator.js results poor... <script src="hyphenator.js" type="text/javascript"></script> <script src="patterns/grc.js" type="text/javascript"></script> <script type="text/javascript"> var hyphenchar = '|'; hyphenator.config({hyphenchar:hyphenchar}); var t = 'αποκαλυψις ιησου χριστου ην εδωκεν αυτω ο θεος δειξαι τοις δουλοις αυτου α δει γενεσθαι εν ταχει και εσημανεν αποστειλας δια του αγγελου αυτου τω δουλω αυτου ιωαννη'.split(" ").map(function(word){return hyphenator.hyphenate(word, 'grc')}); console.log(t); </script> will output: ["απο|κα|λυ|ψις", "ιησου", "χρι|στου", "ην", "εδω|κεν", "αυτω", "ο", "θεος", "δει|ξαι", "τοις", "δου|λοις", "αυτου...

text - Grep expression filter out lines of the form [alnum][punct][alnum] -

hi first post thought simple ... i haven't been able find example of similar problem/solution. i have thousands of text files thousands of lines of content in form <word><space><word><space><number> example: example 1 useful when 1 for. 1 ,boy wonder 1 ,hary-horse wondered 2 in above example want exclude line 3 contains internal punctuation i'm trying use gnu grep 2.25 not having luck my initial attempt (however not allow "-" internal pattern): grep -v [:alnum:]*[:punct:]*[:alnum:]* filename so tried grep -v [:alnum:]*[:space:]*[!]*["]*[#]*[$]*[%]*[&]*[']*[(]*[)]*[*]*[+]*[,]*[.]*[/]*[:]*[;]*[<]*[=]*[>]*[?]*[@]*[[]*[\]*[]]*[^]*[_]*[`]*[{]*[|]*[}]*[~]*[.]*[:space:]*[:alnum:]* filename however need factor in spaces , - these acceptable internal string. i had been trying :punct" set see contains - not work i have stored procedure in tsql process these prefer preproc...

How do I filter data from a CSV file in Excel or with Ruby? -

i have huge csv file (over 57,000 rows , 50 columns) need analyze. edit: hi guys, answers , comments, still confused how in ruby, , have no idea how use mysql. try more specific: the csv files: csv on storm data details 2015 csv on storm data details 2000 the questions: prior question start, answers, exclude rows have county/parish, zone, or marine name begins letters a, b, or c. find month in 2015 state of washington had largest number of storm events. how many days of storm-free weather occurred in month? how many storms impacting trees happened between 8pm est , 8am est in 2000? in year (2000 or 2015) did storms have higher monetary impact within boundaries of 13 original colonies? the problems: 1) able use filters in excel determine "thunderstorm wind" events in washington happened in july (6 entries), , there 27 days of storm-free weather. however, when tried check work in spotfire, got different results. (7 entries in may, , 28 days of storm-free...

editor - PyCharm to open new file in the tab right next to the right of current-active tab? -

currently pycharm 2016.03, when open new file, tab opened @ end of tab pane. i google , see 1 old post - open right next feature in past , changed open @ end now. so if know, if possible, how switch tab-opening mode in pycharm, please share! that config no longer available (at least in 5.0.5 pro version). still have tabs appearance , closing policy configs under editor -> general -> editor tabs menu, no opening policy. as workaround can left-click , drag tab in whichever position like.

hadoop - Hvie: Could not create ServerSocket on address 0.0.0.0/0.0.0.0:9083 -

i have issue hive meta using " netstat -apn|grep 9083 ", port 9083 free, , no process regarding hive running. then run " bin/hive --service metastore " or " bin/hive --service metastore -p 9083 & " (i tried other port numbers, have same issue), following errors logged: error [main]: metastore.hivemetastore (hivemetastore.java:startmetastore(5256)) - org.apache.thrift.transport.ttransportexception: not create serversocket on address 0.0.0.0/0.0.0.0:9083. ... error [main]: metastore.hivemetastore (hivemetastore.java:main(5138)) - metastore thrift server threw exception... org.apache.thrift.transport.ttransportexception: not create serversocket on address 0.0.0.0/0.0.0.0:9083. below of configurations of hive: <property> <name>hive.metastore.uris</name> <value>thrift://192.168.38.128:9083</value> <description>thrift uri remote metastore. used metastore client connect remote m...

Taking user input and inserting it into an associative array using PHP -

i need put user input associative array. program asks user how many people in group. asks each person's name along order. proceeds print out group member's names along orders. idea use for loop add each data set array. think have figured out except how put data array. here code far: <?php $people=readline("how many orders?"); $orders=[]; for($i=0; $i<$people; $i++) { print("order "); print($i); print(" name: "); $name=readline(); print("order "); print($i); print(" order: "); $food=readline(); } print("total order:\n"); foreach($orders $names=>$orders) { print($names); print(": "); print($orders); print("\n"); } ?> php has of best documentation of programming language, advise taking peak @ array intro , show need know. as tip, because you're going keeping track of multiple datums per order (name, foo...

Installing Cordova -

i getting error message when trying install cordova: c:\>npm install -g cordova npm warn deprecated minimatch@2.0.10: please update minimatch 3.0.2 or higher avoid regexp dos issue c:\users\invitado\appdata\roaming\npm `-- (empty) npm err! windows_nt 10.0.10586 npm err! argv "c:\\program files\\nodejs\\node.exe" "c:\\users\\invitado\\appdata\\roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cordova" npm err! node v4.5.0 npm err! npm v3.10.6 npm err! path c:\users\invitado\appdata\roaming\npm\node_modules\.staging\abbrev-208fc6c5 npm err! code enoent npm err! errno -4058 npm err! syscall rename npm err! enoent enoent: no such file or directory, rename 'c:\users\invitado\appdata\roaming\npm\node_modules\.staging\...

node.js - Nginx nodejs on same port in windows -

this question answered in how run nginx node.js on windows? . following doesn't seem work. went http://nginx.org/en/docs/windows.html doesn't much. here brief problem. jxcore running on http://localhost:3434/ , successful serves test file hello.js nginx on port 80 works fine usual. so redirected have followed above url , below current configuration. server { listen 80; server_name localhost; access_log d:\nginx-1.10.1\logs\access.log; location ~ ^/(javascripts|stylesheets|images) { expires max; location / { root html; index index.html index.htm; #i tried adding hello.js here didn't work } location /pubsub { #node js files in sub directory under nginx root proxy_pass http://localhost:3434; } } after restart nginx , go localhost serves static files. when go localhost/pubsub gives 403 forbidden. says permission issue when configuring nginx in windows, says need meddle permi...

Python url encode/decode - Convert % escaped hexadecimal digits into string -

for example, if have encoded string as: url='locality=norwood&address=138+the+parade&region=sa&country=au&name=pav%c3%a9+cafe&postalcode=5067' the name parameter has characters %c3%a9 implies character é. hence, output be: new_url='locality=norwood&address=138+the+parade&region=sa&country=au&name=pavé+cafe&postalcode=5067' i tried following steps on python terminal : >>> import urllib2 >>> url='locality=norwood&address=138+the+parade&region=sa&country=au&name=pav%c3%a9+cafe&postalcode=5067' >>> new_url=urllib2.unquote(url).decode('utf8') >>> print new_url locality=norwood&address=138+the+parade&region=sa&country=au&name=pavé+cafe&postalcode=5067 >>> however, when tried same thing within python script , run myscript.py, getting following stack trace: unicodedecodeerror: 'ascii' codec can't decode byt...

ruby on rails - When stripe verification fails why am I not being shown a flash? -

Image
for example, if purposely make card decline, shown error page. so: instead of error page want notified flash instead. have below code, why not alerted using flash? class chargescontroller < applicationcontroller def new end def create # amount in cents @amount = 100 # credit card details submitted form customer = stripe::customer.create( :email => params[:email], :source => params[:stripetoken] ) # create charge on stripe's servers - charge user's card begin stripe::charge.create( :amount => @amount, :currency => 'usd', :customer => customer.id, :description => 'example charge custom form' ) current_user.subscribed = true current_user.stripe_id = customer.id current_user.expiry_date = date.today + 30.days current_user.save flash[:success] = "thank subscribing. account has been unlock...

Java LibGDX cannot move with physics bodies and gravity enabled -

i use i'm stuck on this. i'm trying make block in simple game ground , block fall onto , possibly bounce little able move box left or right fall off of first block. can me please? for interested in answer poprosturonin , dermetfan's youtube videos able results looking for, can try below code in project , change sprite textures. private box2ddebugrenderer debugrenderer; private orthographiccamera camera; private float spritespeed = 500000; private world world; private sprite playersprite; private sprite groundsprite; private body playerbody; private body groundbody; private vector2 movement = new vector2(); private array<body> tmpbodies = new array<body>(); public teststate(gamestatemanager gsm) { super(gsm); gdx.input.setinputprocessor(this); batch = new spritebatch(); debugrenderer = new box2ddebugrenderer(); camera = new orthographiccamera(); // sprites playersprite = new sprite(new texture("badlogic.jpg")); ...

Looking for Elasticsearch updateByQuery syntax example (Node driver) -

you have elasticsearch index 2 docs: [ { "_index": "myindex", "_type": "mytype", "_id": "es1472002807930", "_source": { "animal": "turtle", "color": "green", "weight": 20, } }, { "_index": "myindex", "_type": "mytype", "_id": "es1472002809463", "_source": { "animal": "bear", "color": "brown" "weight": 400, } } ] later, updated data bear: { "color": "pink", "weight": 500, "diet": "omnivore", } so, want update "color" , "weight" values of bear, , add "diet" key "bear" doc. know there's 1 doc "animal": "bear" (but don't know _id): usi...

vBCrLf is not working in my vb6 -

i'm make simple chat room i want chat's output this i'm using vbcrlf or chr(13)&chr(10) or vbnewline not like this this code private sub command1_click() 'sending text1 client server me.winsock1.senddata me.text1.text doevents 'filling text2 text1 me.text2.text = me.text2.text & vbcrlf & label1.caption & me.text1.text me.text1.text = "" am wrong? set multiline property of text2 true

dspace - Editing the bodies of emails sent in the "Request a Copy" process -

i edit bodies of emails sent in dspace "request copy" process. documentation says there keys can edited in jspui 'messages.properties' file, using mirage2, , xmlui. found 1 in email templates directory, messages.xml file. it's message templates below want alter: itemrequest.response.body.approve itemrequest.response.body.reject itemrequest.response.body.contactauthor itemrequest.response.body.contactrequester you have 2 options: change [dspace-src]/dspace-api/src/main/resources/messages.properties -- note in case need use full build option (invoke maven in [dspace-src]); or copy file [dspace-src]/dspace/modules/additions/src/main/resources/messages.properties , edit latter. you'll have create directory hierarchy first. able use full or quick build option.

ios - When Using JSQMessagesViewController the UI does not appear -

i trying implement jsqmessagesviewcontroller, , following ray wenderlich tutorial( https://www.raywenderlich.com/122148/firebase-tutorial-real-time-chat ), ui not appearing on view controller, blank. pod file. source 'https://github.com/cocoapods/specs.git' use_frameworks! target "sell goods" pod 'firebase' pod 'firebase/storage' pod 'firebase/database' pod 'google/signin' pod 'jsqmessagesviewcontroller' end i have tried using bridging header did not work, , followed tutorial step step. segue chatviewcontroller override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { guard let editingvc = segue.destinationviewcontroller as? chatsviewcontroller else { preconditionfailure("bad") } editingvc.senderid = userid editingvc.senderdisplayname = username } chatviewcontroller import firebase import jsqmessagesviewcontroller clas...

php - laravel 5 all::() method ALWAYS 500s on large queries -

i have been trying find constant workarounds data issues laravel 5 in project i'd migrate , can't seem find satisfactory answer why laravel 5 throw 500 error whenever try use "::all()" method on model. i've implemented "chunk" method not getting result sets want , i'm in essence wanting simple "select * from" feel shouldn't big deal. it work if result set less few thousand, on , kills program. have php.ini set allow 1024m, query has no joins in case, max_execution_time @ 1000, isn't post max_post_value 1024m -- gives? surely laravel can support bringing large datasets? model::chunk(200, function( $entries ) { // iteration of all/200 foreach( $entries $entry ) { // iteration of 200 entries } } if still dying, not memory issue, more of max execution issue. have applications can muster through hundreds of thousands of rows ease.

Java enum method -

the following code has no problem compiling , running. question use of public int getvalue(int bid) [ not getvalues(int bid) ? how call method? package com.main; public class bridge { public enum suites{ club(20), dimond(20), hearts(30), spades(40){ public int getvalue(int bid){ return ((bid-1)*30)+40; } }; private int points; suites(int points){ this.points = points; } public int getvalues(int bid){ return points*bid; } } public static void main(string[] args){ system.out.println(suites.club.getvalues(3)); system.out.println(suites.hearts.points); system.out.println(suites.values()); } } out put : 60 30 [lcom.main.bridge$suites;@2a139a55 the use case getvalue method specified spades if method same , and signature specified suites enum, e.g. this: public class test { public enum suites { ...

html - Using Nokogiri's CSS method to get all names within a team page -

i trying use nokogiri's css method names html. this example of html: <section class="container partner-customer padding-bottom--60"> <div> <div> <a id="technologies"></a> <h4 class="center-align">the team</h4> </div> </div> <div class="consultant list-across wrap"> <div class="engineering"> <img class="" src="https://v0001.jpg" alt="person 1"/> <p>person 1<br>founder, chairman &amp; cto</p> </div> <div class="engineering"> <img class="" src="https://v0002.png" alt="person 2"/></a> <p>person 2<br>founder, vp of engineering</p> </div> <div class="product"> ...

python - Django Form Not updating -

i'm trying update form in django. have following: models.py from django.db import models django.core.urlresolvers import reverse class list(models.model): def get_absolute_url(self): return reverse('view_list', args=[self.id]) # create models here. class item(models.model): text = models.textfield(default = '') list = models.foreignkey(list, default = none) forms.py from django import forms lists.models import item empty_item_error = "you can't have empty list item" class itemform(forms.models.modelform): class meta: model = item fields = ('text',) widgets ={ 'text' : forms.fields.textinput(attrs={ 'placeholder': 'enter to-do item', 'class': 'form-control input-lg', }), } error_messages = { 'text' : { 'required': empty_item_error } ...

python - TypeError: unsupported operand type(s) for -: 'str' and 'str'? -

i'm new programming , can't figure out how fix error: traceback (most recent call last): file "/users/aubreyoleary/documents/cashier.py", line 31, in <module> changepennies = int((amountreceived - amountdue) * 100) typeerror: unsupported operand type(s) -: 'str' , 'str' my code: import math class cashier: def getdollars(self, x): return x / 100 def getquarters(self, x): y = x % 100 return y / 25 def getdimes(self, x): y = x % 100 return y % 10 def getnickels(self, x): y = x % 100 return y % 5 def getpennies(self, x): y = x * 1 return y while true: thecashier = cashier() amountdue = input("please enter amount due: ") amountreceived = input("please enter amount received: ") changepennies = int((amountreceived - amountdue) * 100) print(thecashier.getpennies(changepennies)) print(thecashier...

Xamarin.forms XAML Rounded Button -

i'm trying place rounded button in xamarin.forms application, can't it. i read custom controller button, didn't find docs rounded buttons in xamarin.forms . does know how it? i'm building android , ios application. you can use borderradius property create rounded corners on button <button text="bluebutton" bordercolor="blue" borderradius = "5" borderwidth = "2"/>

elasticsearch - Colorize row based on a field value on kibana 4 -

is there way colorize or, in general, apply styles results table on kibana 4? i'm talking discover result table. basically, our logs have level field , want add colors on result table based on value, can recognized. e.g: error messages should red, warning messages yellow. i know elastic search has highlighting capabilities know not how use them kibana seems custom formatters way go. i.e: writing new component using javascript , html this example creates formatter highlight text. it's not being asked, should work base.

xaml - How can I move an EllipsePath using animation in WPF? -

i want make slider button using wpf. have code create circle , move when clicked. <window x:class="wpfapplication1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <border background="lightgray" margin="167,63,224,190" cornerradius="20,20,20,20" height="40" width="80"> <path fill="red"> <path.data> <ellipsegeometry center="20,20" radiusx="20" radiusy="20"/> </path.data> <path.effect> <dropshadoweffect direction="270" shadowdepth="2" color="gray"></dropshadoweffect> </path.effect> <path.tr...

OpenStack Mitaka: command line client takes a long time to respond -

i've been using openstack on , off while now. after year installed mitaka (with keystone+swift) , noticed openstack command (cli client), swift command taking long time respond - 5 or 7 seconds. didn't use that. has there been significant change in design causing issue? maybe wrong setup? or thoughts debug this? thanks i think best way debug using curl check if it's on keystone(?), swift, machine or openstack client. since didn't authentication method using, recommend awesome post swiftstack authenticate: https://www.swiftstack.com/docs/cookbooks/swift_usage/auth.html if more info, it's going easy find bottleneck.

vb.net - How can I remove the repeated lines in my output? -

if arrysentence.contains(inputstring) dim index integer = array.indexof(arrysentence, inputstring) until >= arrysentence.getupperbound(0) + 1 dim position integer = index + 1 index = array.indexof(arrysentence, inputstring, position) console.writeline("the word ""{0}"" @ position {1}.", inputstring, position) = + 1 loop it's done problem output repeats of lines like: please enter sentence apple fall apple tree word apple @ position 2 word apple @ position 6 word apple @ position 2 word apple @ position 6 help! i not understand reasoning behind loops. want following: search word in array. if exists, print position. otherwise exit. start over. here how it: dim index integer = array.indexof(arrysentence, inputstring) while index >= 0 'while word has been found 'output occurrence console.writeline("the word ""{0}"" @ position {1}.", ...

https - TLSv1.2 protocol on android 4.* < -

Image
i'm using okhttp v 2.4.0 retrofit v1.9.0 make https request server uses protocol tlsv1.2 only, , i'm getting error: javax.net.ssl.sslhandshakeexception: javax.net.ssl.sslprotocolexception: ssl handshake aborted: ssl=0xb8e6cf68: failure in ssl library, protocol error error:14077410:ssl routines:ssl23_get_server_hello:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x971fb990:0x00000000) @ com.android.org.conscrypt.opensslsocketimpl.starthandshake(opensslsocketimpl.java:448) @ com.squareup.okhttp.internal.http.socketconnector.connecttls(socketconnector.java:103) @ com.squareup.okhttp.connection.connect(connection.java:143) @ com.squareup.okhttp.connection.connectandsetowner(connection.java:185) @ com.squareup.okhttp.okhttpclient$1.connectandsetowner(okhttpclient.java:128) @ com.squareup.okhttp.internal.http.httpengine.nextconnection(httpengine.java:341) @ com.squareup.okhttp.internal.http.httpengine.connect(httpengine.java:330) @ com.squar...

c# - WPF DataGrid Strange Header Padding Behaviour -

Image
in following window, why header have padding of 2/3 though explicitly set 0 using following code? (and can see 0 in snoop): <datagridtemplatecolumn.headerstyle> <style targettype="datagridcolumnheader"> <setter property="padding" value="0" /> <setter property="margin" value="0" /> </style> </datagridtemplatecolumn.headerstyle> this gives me following (header has padding): but change other 0, e.g.: <datagridtemplatecolumn.headerstyle> <style targettype="datagridcolumnheader"> <setter property="padding" value="0,1" /> <setter property="margin" value="0" /> </style> </datagridtemplatecolumn.headerstyle> the padding doesn't set default. assuming there code somewhere in wpf library? has come across before , figured out why before spend afternoon findi...

max - Will an integer overflow in Python? -

this question has answer here: python integer ranges 2 answers in languages such java, integer value overflow once larger integer.max_value or when less integer.min_value. have seen posts using long datatype suggested replacement int data type. will integer ever overflow in python? if yes, please list such cases. found answer here. https://www.daniweb.com/programming/software-development/threads/71008/comparing-python-and-c-part-1-integer-variables very versions of python had limit later removed. limits set amount of memory have in computer. automatically manages integer object, set 32 bits speed. if exceeds 32 bits, python increases size needed ram limit.

javascript - How does this JWPlayer setup syntax work? -

This summary is not available. Please click here to view the post.

AngularFire / Firebase - How Do You Delete Key That is More Than One Level Deep? -

i have synced object initialized this: var sync = $firebase(ref); var syncobject = sync.$asobject(); syncobject.$bindto($scope, 'data'); the synced object has following structure: { levelone: { leveltwo: { valueone: 1 valuetwo: 2 } } } i remove 1 of values $remove() , not able delete other entire object method. the following delete entire object: syncobject.$remove('levelone.leveltwo.valueone'); i not want use $save() overwrite entire synced object. is there anyway remove nested key $remove() ? there no way drill through multiple layers $remove() function. ended using vanilla firebase js library methods delete. var ref = new firebase(myfirebaseurl); // child() method (from vanilla js library) allows target keys // more 1 level deep ref.child('levelone/leveltwo/valueone').remove(); var sync = $firebase(ref); you can chain child() function off of original js firebase class objec...

Perl nested hash of dependency for programs -

i need create hash of dependency in perl. program1 depends program2 program4 program10 program5 program7 program6 etc. data randomly generated example: #!/usr/bin/env perl use strict; use warnings; use data::dumper; use english qw( -no_match_vars ); $dependsorder = {}; while (my $line = <data>) { chomp $line; ( $component, $depends ) = split /:/, $line; if ( exists $dependsorder->{$component} , $dependsorder->{$component} == 1 ) { $dependsorder->{$component} = {}; } if ( $depends ) { $depends =~ s/^\s+|\s+$// if $depends; @depends = split /\s+/, $depends; $dependency ( @depends ) { if ( not exists $dependsorder->{$dependency} ) { # default value $dependsorder->{$dependency} = 1; } $dependsorder->{$component}->{$dependency} = $dependsorder->{$dependency}; } } else { $dependsorder->{$component} = 1; }...

jenkins - How to set a Views description in Groovy -

i'm dynamically creating view via groovy with.. jenkins.instance.getitem('my_folder').addview(new listview('mynewview') this works great; , add filter view via.. jenkins.instance.getitem('my_folder').getview('mynewview').setincluderegex('.*newview.*' which works wonderfully. how programmatically set views description? assume there's combination can dosubmitdescription(...?) but haven't been able sus out.. appreciated. my current plan work around posting getview('mynewview').geturl()+"/submitdescription..."; but should cleaner that.. if want update view's description, here line looking for: import org.kohsuke.stapler.staplerrequest import org.kohsuke.stapler.staplerresponse jenkins.instance.getview('mynewview').dosubmitdescription([ getparameter: { return "my description"; }] staplerrequest, [ sendredirect: { return; } ] staplerresponse)

Angular 2 watch component property for changes without @Input or @Output -

in angular 1.x use .$watch watch wanted, in angular 2 have ngonchanges cool , performant watches input , output decorators. time time need watch local properties can emit event when change. remember seeing article explaining how can explicitly tell angular 2 watch single property life of me can't find article anymore , every search tells me use input/output decorators onchanges. how can create watcher @viewchild or other local properties? for example have ngform, when it's validation state changes valid invalid or vise versa want emit state component can react. since ngform @viewchild , not @input or @output ngonchanges doesn't detect change. the equivalent custom angular 1 $watch() in angular 2 implement lifecycle hook ngdocheck() , perform own checking. lifecycle hooks dev guide has an example . note ngdocheck() method called every time change detection runs (just angular 1 watch), sure implemented efficiently possible. try use rxjs (an observable, ...

rust - How to delay destruction of unnamed objects? -

i using tempdir struct create , remove folders on disk. tempdir not referenced in code apart construction. since compiler warns unused objects, tried (un)naming tempdir-struct _ results in struct being destroyed. is there nice solution this? see example code , compare one two : pub struct res; impl drop res { fn drop(&mut self) { println!("dropping self!"); } } fn one() { println!("one"); let r = res; // <--- dropping @ end of function // compiler warns unused object println!("before exit"); } fn two() { println!("two"); let _ = res; // <--- dropping println!("before exit"); } fn main() { one(); two(); } giving variable name prefixing name underscore delays destruction until end of scope not trigger unused variable warning. struct noisy; impl drop noisy { fn drop(&mut self) { println!("dropping"); ...

regex - ANT Script - replaceregexp with non-matching groups -

i trying use replaceregexp search , replace copyright symbol , garbage characters on multiple files ones have date in 2000 range, decided use non-capturing group match number after copyright symbol , replace copyright symbol. reason still replaces symbol , number. for example, match: © 2007 mail services bla bla bla and expected result be: c 2007 mail services bla bla bla but get: c bla bla bla here code: <replaceregexp match="${match.exp}" replace="${replace.str}" byline="true"> <fileset dir="${parent.dir}"> <include name="**/*.js"/> <include name="**/*.jsp"/> <include name="**/*.xml"/> <include name="**/*.properties"/> <include name="**/*.css"/> <include name="**/*.java"/> <!-- excluding files --> <exclude name="**/yu.js"/> ...

oracle - Codeigniter ORA-00001: unique constraint -

this error: message: oci_execute (): ora-00001: unique constraint (schema_name.name constraint) violated i wonder if not how handle error more simply, more generic. because otherwise have work on each function of models check data before adding, no duplications , not give error noted above. does know simple way solve this? thanks. there hint can specified allow statement succeed without inserting duplicated data. can useful replication or bulk data loading job may attempt insert same data multiple times. wouldn't recommend part of user application. "the ignore_row_on_dupkey_index hint applies single-table insert operations. not supported update, delete, merge, or multitable insert operations. ignore_row_on_dupkey_index causes statement ignore unique key violation specified set of columns or specified index. when unique key violation encountered, row-level rollback occurs , execution resumes next input row."

javascript - jQuery UI Sortable and moving elements between lists -

i want grab items lists , drag them other blank lists. this html structure: <div class="structure"> <div id="row1" class="connected"></div> <div id="row2" class="connected"> <div class="item">item 1</div> </div> <div id="row3" class="connected"></div> <div id="row4" class="connected"> <div class="item">item 2a</div> <div class="item">item 2b</div> <div class="item">item 2c</div> </div> <div id="row5" class="connected"></div> <div id="row6" class="connected"> <div class="item">item 3a</div> <div class="item">item 3b</div> </div> <div id="row7" class="connected"></div> ...

r - How to change the title of a legend in heatmap( )? -

in ggplot2 change legend title add + guides(fill=guide_legend(title="new legend title")). how do same thing while using heatmap() function? here heatmap attempting label. please tell me if need other information! (the title change matrix_1 code: heatmap(patric_genomes_amr_2.ris.mat2, row_names_side = "left", row_dend_side = "left", row_names_gp = gpar(cex=fontsize), column_names_gp = gpar(cex=fontsize), ) i think have edit "name" argument. example: heatmap(patric_genomes_amr_2.ris.mat2, row_names_side = "left", row_dend_side = "left", row_names_gp = gpar(cex=fontsize), column_names_gp = gpar(cex=fontsize), name="something else matrix_1") by way, nice give information package using.

Graphing 3 Variable Scatterplot R -

Image
i imported data islander , trying graph 3 variables. i'm thinking of trying graph 2 numeric variables nominal category (gender). plot i'm trying therefore regular scatterplot, color-coded. i looked @ starter tutorial on r: scatterplots, didn't see mention of 3 variable plotting. http://www.laptopmag.com/articles/ssd-upgrade-tutorial can me out? variables hold values pertaining number of balls bounced , minutes of physical activity per week , , gender . picture of data: data since gender binary variable (usually, otherwise ternary), plot 2d scatterplot color encoding gender. dummy data: a = data.frame(x=runif(100), y = runif(100)+2, group = round(runif(100))+1 ) now plot y against x using a$group select color: plot(a$y, a$x, pch = 16, col = c('cornflowerblue', 'springgreen')[a$group]) output: if have missingness add third group color vector. here bunch of other solutions 2d scatter color

security - Android Marshmallow view user certificates and associate cert with private key -

i've created key pair, stored private key in androidkeystore. generated csr using public key key pair exported csr ca, , got generate cert installed cert on phone now, i'm trying associate private key #1 cert installed @ step #4. have looked day, cannot find mechanism it. android documentation suggests using keystore.setkeyentry method. intend use unable read cert installed. i can display certs in androidcastore, , see newly installed cert in "user certificates" section on phone unable read programatically. ideas ? trying pretty same thing. key association signed cert works using keystore.setentry. can't work user cert appear in "ipsec user certificate" listbox when trying add vpn. running on marshmallow 6.0.1 my logic looks keystore = keystore.getinstance("androidkeystore"); keygen = keypairgenerator.getinstance("ec", "androidkeystore"); keygen.initialize( ...