Posts

Showing posts from April, 2010

How do I go from io.ReadCloser to io.ReadSeeker? -

i'm trying download file s3 , upload file bucket in s3. copy api won't work here because i've been told not use it. getting object s3 has response.body that's io.readcloser , upload file, payload takes body that's io.readseeker . the way can figure out saving response.body file passing file io.readseeker . require writing entire file disk first reading entire file disk sounds pretty wrong. what is: resp, _ := conn.getobject(&s3.getobjectinput{key: "bla"}) conn.putobject(&s3.putobjectinput{body: resp.body}) // resp.body io.readcloser , field type expects io.readseeker question is, how go io.readcloser io.readseeker in efficient way possible? io.readseeker interface groups basic read() , seek() methods. definition of seek() method: seek(offset int64, whence int) (int64, error) an implementation of seek() method requires able seek anywhere in source, requires all source available or reproducible. file perfect

r - cbind a vector of different length to a dataframe -

i have dataframe consisting of 2 samples. 1 sample has answered questionnaire state anxiety. case, have calculated vector somatic state anxiety following function "rowsums": som_lp <- rowsums(sample1[,c(1, 7, 8, 10 )+108], na.rm = true) now add existing dataframe "data", function "cbind" doesn't work here, because of different lengths (dataframe 88, som_lp 59). data <- cbind(data, som_lp) can me , there option calculate "som_lp" avoid different lengths? we can use cbind.fill rowr library(rowr) cbind.fill(data, som_lp, fill = na)

delphi - Form OnDeactivate - need to determine which is the new Activated control -

i have code shows search form specific dbgrid placed in another form (the caller form of tsearchgridform ): procedure tsearchgridform.formdeactivate(sender: tobject); begin // pseudo if newactivecontrol <> callerform.dbgrid close; end; the tsearchgridform activated caller form .show (not modal) , when deactivated want close/hide if new active control <> callerform.dbgrid . only if user clicked on dbgrid on caller form search form should remain visible, otherwise need close it. how can this? delphi's tscreen object has events onactivecontrolchange , onactiveformchange. can set event handlers these monitor changes , react them. see d7 online more info. there delphi vcl code examples of using both events.

machine learning - Ground-truth and feature extraction for predictive modelling -

i have dataset of users, each user has has daily information activities (numerical values representing measurements of physical activities). in addition, each user in each day has boolean value represents if he/she took particular action. the dataset looks follow +------+----------+----------+----------+-------+ |userid| date| activity1| activity2| action| +------+----------+----------+----------+-------+ | user1|2016-06-05| 5.3| 6| false| | user1|2016-06-04| 3.1| 8| true| | user1|2016-06-03| 2.0| 13| false| | user1|2016-06-02| 4.7| 1| false| | user1|2016-06-01| 1.3| 9| false| | user1| ...ect.| ...| ...| ...| | user2|2016-06-05| 0.6| 5| true| | user2|2016-06-04| 3.0| 5| false| | user2|2016-06-03| 0.0| 0| false| | user2|2016-06-02| 2.1| 3| false| | user2|2016-06-01| 6.3| 9| false| | user2| ...ect.|

android - Disable central item overlap in RecyclerView -

Image
i have horizontal recyclerview images. when scroll left, have image order this. when scroll right, have order this. i need set central image on top, above left , right ones. how it? i overrided getchilddrawingorder method: @override protected int getchilddrawingorder(int childcount, int i) { int centerchild; //find center row if ((childcount % 2) == 0) { //even childcount number centerchild = childcount / 2; // if childcount 8 (actualy 0 - 7), 4 , 4-1 = 3 in centre. int othercenterchild = centerchild - 1; //which more in center? view child = this.getchildat(centerchild); final int left = child.getleft(); final int right = child.getright(); //if row goes through center final int absparentcenterx = getleft() + getwidth() / 2; //log.i("even", + " " + (childcount - 1) + ", while centerchild = " + centerchil

ASP.NET Core MVC controllers in separate assembly -

i'm using asp.net mvc core rc-2. have web project targeting full .net framework. have separate class library in solution, targeting full framework. in class library, have controller, marked route attribute. have referenced class library web project. assembly references nuget package microsoft.aspnetcore.mvc v. 1.0.0-rc2-final . it understanding external controller discovered automatically, e.g. http://www.strathweb.com/2015/04/asp-net-mvc-6-discovers-controllers/ however doesn't work me- browse url of route , blank page , doesn't hit controller breakpoint. any ideas how working? interestingly, seem work web projects targeting .net core framework, referencing class library targeting .net core. not web project targeting full framework, referencing standard .net class library. note: mvc core supposed support kind of scenario without mvc<=4 routing overrides . i believe hitting following known issue in rc2. https://github.com/aspnet/mvc/issues/4674

android - XWalk (Crosswalk) CookieManager crashes app in NDK -

i'm doing following: in launcher activity, after oncreate i'm initializing default cookiemanager so: cookiemanager cookiemanager = cookiemanager.getinstance(); if (build.version.sdk_int < build.version_codes.lollipop) { cookiesyncmanager.createinstance(ctx); } cookiemanager.setacceptcookie(true); cookiemanager.setacceptfileschemecookies(true); after i'm doing this... cookiehandler.setdefault(new webkitcookiemanagerproxy()); ...where i'm extending cookiemanager , doing this: public class webkitcookiemanagerproxy extends cookiemanager { private static final string tag = webkitcookiemanagerproxy.class.getname(); private xwalkcookiemanager crosswalkcookiemanager; public webkitcookiemanagerproxy() { this(null, null); } /* package */ webkitcookiemanagerproxy(cookiestore store, cookiepolicy cookiepolicy) { super(null, cookiepolicy); this.crosswalkcookiemanager = new xwalkcookiemanager(); } // java.net.cookiemanager overrides @overri

elegant way to switch from python to python3 automatically -

i have python code want stick python3. forget python3 code , run that: $ python foo.py i adopt strategy this: #!/usr/bin/python3 # -*- coding: utf-8 -*- import sys,os,warnings if sys.version_info < (3,0): sys.argv.insert(0,__file__) warnings.warn("switch python3 automatically") os.execv("/usr/bin/python3",sys.argv) is there elegant way same thing? if don't want make executable, can create small script run_foo.sh #!/bin/sh python3 foo.py then ./run_foo.sh i think it's still better execv in code personal convenience.

asp.net mvc - Align contents to right in MvcRazorToPdf library -

Image
i have below view generates pdf invoice using mvcrazortopdf library <table border="0"> <tr> <td> <h1>company name </h1> </td> <td> <div style="text-align:right;margin-right:0px;"> invoice </div> </td> </tr> </table> <hr/> <div> @model.invoicenum </div> above code generates below view in pdf but how ever style above div within td invoice , not able move invoice text right side of pdf . i've tried adding link bootstrap.css doesn't work either. have solution this? has worked on styling pdf mvcrazortopdf librabry? your text alignment being respected, default, table , cells collapsed fit content (easy check using browser tools inspect elements). give table (or cells width), example <table style="width:100%;"> however, using <

bash - Getting the first paragraph of Wikipedia, and storing it into a text file -

i wanted make system in give search onto terminal of raspberry pi , pi gives voice output. i've solved text-to-speech conversion problem using pico tts. wanted go wikipedia page of term searched, , store first paragraph of page text file. for example, result input tiger in simple english should make text file containing - the tiger (panthera tigris) carnivorous mammal. largest living member of cat family, felidae. lives in asia, india, bhutan, china , siberia. i tried using this didn't seem work. error message for $ pip install wikipedia ... command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-qdtizy/wikipedia/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9cpd6d-record/install-record.txt --single-version-externally-managed --compile failed error code 1 in /tmp/pip-build-qdtizy/wikipedi

javascript - Embed html class into my page -

the landing page of reliefweb has 'latest disasters' section want embed onto website (see screenshot ). i told need use iframe , javascript element class=“latest-disasters”. this way, when block updated, reflect on website. as have no background in javascript, can show me how this? thank helping. you haven't provided enough information. how it's done iframe <iframe src="http://www.latest-disasters-api.com" class = "latest-disasters"></iframe> about javascript part don't have enough information need kind of sdk or javascript plugin hope help

java - No logs created unless it tests -

i'm using log4j2 logging in app. it's logging uncatched exceptions (error.log) , logging changes of data @ service layer (journal.log; journaljson.log). and here's thing, when i'm starting service layer tests every log appears in file , console, when i'm using application deployed in tomcat they're in console. what's happening? <?xml version="1.0" encoding="utf-8"?> <configuration status="warn"> <appenders> <console name="console" target="system_out"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </console> <file name="error" filename="logs/error.log" immediateflush="true" append="true"> <patternlayout pattern=" \n\n %d{yyyy-mm-dd hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </file> <randomaccessfil

android - Achieve react native app layout for landscape and portrait -

i creating react native app , quite new this. in app, creating image slider, want image slider adjust it's view on both portrait , landscape automatically. this orientation plugin checks either device in landscape or in portrait view. shall need write layout/view landscape , portrait independently? or there way can follow requirement. react native uses flexbox layout rendering. using flexbox ui same both landscape , portrait mode.

powershell - Not able to use curl on HDInsight cluster -

i'm attempting run spark job on hdinsight cluster curl. curl -k --user "admin:password" -v -h 'content-type: application/json' -x post -d '{ "file":" https://storage.blob.core.windows.net/spark-container/sparkjob-jar-with-dependencies.jar ", "classname":"io.spark.driver" }' " https://cluster-spark.azurehdinsight.net/livy/batches " error: cannot bind parameter 'headers'. cannot convert "content-type: application/json" value of type "system.string" type "system.collections.idictionary".

java - How does Tomcat sets cipher suite to entire JVM and not just specific connector? -

i've noticed when configure in server.xml of tomcat specific cipher suite ssl connector influences entire jvm. meaning, when create socket sslsocketfactory contains specific cipher. can please explain me how done? how tomcat enables configured cipher affect new socket? i'm using tomcat 8 , jdk 1.8.0_91 . here server.xml section: <connector protocol="org.apache.coyote.http11.http11nioprotocol" address="$ip" port="443" enablelookups="false" disableuploadtimeout="true" acceptcount="100" scheme="https" secure="true" sslenabled="true" clientauth="false" keystorefile="..." keystorepass="xxx" truststorefile="..." truststorepass="xxx" sslprotocol="tls" sslenabledprotocols="tlsv1, tlsv1.1, tlsv1.2" ciphers="$cipher_suites" />

android - org.json.JSONException:Value of type java.lang.String cannot be converted to JSONArray -

Image
i'm building application in i'm receiving jsonarray server , i'm using volley library send , receive response server when click on button send i'm getting value of type java.lang.string cannot converted jsonarray in toast jsonarray [{"username":"ude","password":"hello"}] login.java public class login extends activity { button log; edittext username, passsword; string user, pass; string tag_json_arry = "jarray_req"; private string jsonresponse; private static string tag = login.class.getsimplename(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.login); username = (edittext) findviewbyid(r.id.username); passsword = (edittext) findviewbyid(r.id.password); log = (button) findviewbyid(r.id.login); log.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { use

Initializing value to views in ActionBar Tab framents in android while onCreate of Tab Activity -

my app uses actionbar tab fragments create/modify device details. device properties of categorized different fragments. want initialize each fragments in oncreate of tab activity. in each tab fragment has setvalues method initializes values view in fragment. noticed fragment created when clicked on particular tab. tab activity public class cameradetails extends activity { private cameradata camera = new cameradata(); fragment network = new networkfragment(); fragment remoteuser = new remoteuserfragment(); private g.interface mnetworkinterface = null; private g.interface mremoteuserinterface = null; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.cameradetails); actionbar actionbar = getactionbar(); actionbar.setdisplayshowhomeenabled(false); actionbar.setdisplayshowtitleenabled(false); actionbar.setnavigationmode(actionbar

javascript - JS Object transformation based on values of object properties -

i've seen lots of other questions related js object sorting, of tend suggest using .map method sort object or array of objects based on value of property, i'm trying achieve different. i'm trying turn object format: { "commits": [ { "repository": "example-repo-1", "commit_hash": "example-hash-1" }, { "repository": "example-repo-1", "commit_hash": "example-hash-1.2" }, { "repository": "example-repo-2", "commit_hash": "example-hash-2" } ] } into object formatted using value of 'repository' this: { "example-repo-1": [ { "repository": "example-repo-1", "commit_hash": "example-hash-1" }, { &quo

android - How to set the Dynamic height to list view in fragment activity..? -

i need implement list view inside scroll view. knw it's not idea using listview inside scroll view it's requirenment of app need implement it. in app im using tablayout 3 type of tabs categories 1,categories 2 , again categories 3 filter data. in first tab categories 1 need add 2 list view 1 fix items , second dynamic. fist list view fixed can give fixed height it. second list view dynamic need give height according total number of values in list view. im try many ways give dynamic height not getting task done. here method alredy try :- -------------------first ------------------------------- first question android: how measure total height of listview public static void gettotalheightoflistview(listview listview) { listadapter madapter = listview.getadapter(); int totalheight = 0; (int = 0; < madapter.getcount(); i++) { view mview = madapter.getview(i, null, listview); mview.measure( view.measurespec.makemeasu

javascript - ol3Cesium map not loading, giving error ''olcs is not defined" -

i unable load ol3cesium map in ionic 2. my index.html (code within body tag): <ion-app></ion-app> <script src="http://openlayers.org/en/v3.16.0/build/ol.js" <script src="../ol3-cesium-v1.17/ol3cesium.js"></script> <script src="../ol3-cesium-v1.17/cesium/cesium.js"></script> my home.ts: inside constructor, below code added -- var view = new ol.view({ projection: 'epsg:4326', center: [-100, 35], zoom: 3 }); var layer = new ol.layer.tile({ source: new ol.source.tilewms({ url: 'http://demo.boundlessgeo.com/geoserver/wms', params: { 'layers': 'ne:ne1_hr_lc_sr_w_dr' } }) }); var overlay = new ol.layer.tile({ opacity: 0.7, extent: [-124.74, 24.96, -66.

unix - Linux - Handle process termination -

i need watch process known pid in linux. once terminated want execute command reason of termination. questions how subscribe process health rather polling (e.g. watch command)? where inject event handler in os' user space? how detect termination/failure reason inside handler? note the process intend keep tab on not forked child process of parent through can monitored. the process type generic (good number of them daemons) the way kind of control on process, use ptrace(2) trace target process. use ptrace(ptrace_attach, pid) attach process, after become target process's parent (and can use wait or more ptrace calls figure out process doing).

angular - Ensuring components are properly initialized -

i have started guarding components initializing <my-component*ngif="someinput" [input]="someinput"><my-component> is there better way ensure input exists before initializing component? is there performance reason allow component initialize without input , perfom check within component? the biggest consideration design choice , how these components interact. how child component relate parent? parent toggle input between true or false? ngif destroys component when false can performance if component heavy not necessary if lightweight. the performance reason rendering component before data initializes , displays on screen faster. if input async , takes while load, component not display @ on page until input ready. rather might better user experience render child component first , displaying loading symbol until input arrives.

html - Smooth Scrolling JavaScript work on all A tags -

i have following javascript code smoothing scrolling: $(document).on('click', 'a', function(event){ event.preventdefault(); $('html, body').animate({ scrolltop: $( $.attr(this, 'href') ).offset().top }, 500); }); now can't use other links on website. when this: link nothing happened. my website: http://www.be-virtual.org/schnittchen currently targets <a> tag. change selector correctly target start # : $(document).on('click', 'a[href^="#"]', function(event){ event.preventdefault(); $('html, body').animate({ scrolltop: $( $.attr(this, 'href') ).offset().top }, 500); });

Android Studio sudden lag spikes when editing .xml layout files -

when i'm editing xml files in android studio, reason lags when scrolling, typing or anything. when edit .java files isn't problem. any ideas on how can prevent these sudden spikes? annoying when takes 30 seconds scroll through 500 line xml file 10 seconds on twice big java file.... point, there way stabilize this? i using android studio 2.0.0 to clairify, i'm talking xml file's source code not rendered output in case else encounters in future, i've found if click on little man hat @ bottom right, enable "power saving mode" , switch down highlighting level "none", reduces xml editing lag in complex layouts. once make edit, can disable power saving , slide highlighting see changes in preview. not ideal, prevents constant pauses between keypresses whilst editing.

Angular 2 ng2-bootstrap datepicker systemjs 404 error -

i using datepicker ng2-bootstrap. https://valor-software.com/ng2-bootstrap/#/datepicker i have imported datepicker_directives in component import { datepicker_directives } './../../../node_modules/ng2-bootstrap/components/datepicker'; added directives list directives: [datepicker_directives], and in template using this: <datepicker [(ngmodel)]="dt" [mindate]="mindate" [showweeks]="true"></datepicker> my systemjs configuration looks this: var map = { 'app': 'content/app', 'rxjs': 'node_modules/rxjs', '@angular': 'node_modules/@angular', "angular2-masonry": "node_modules/angular2-masonry", 'datepicker': 'node_modules/ng2-bootstrap/components/datepicker' }; var paths = { "masonry-layout": "node_modules/masonry-layout/dist/masonry.pkgd.js", 'datepicker&

Which Effective C++ Items can be implemented better via C++11? How? -

since book effective c++ seems still worth reading , the best start effective c++ series , wonder suggested solutions/implementations need not understand in detail/memorize because there better solutions in c++11 or later. so: which effective c++ items can implemented simpler or better via c++11 or later? how can implemented now, , in way better? details: since there many c++ idioms deprecated in c++11 , guess influences solutions in effective c++ book. example, looking @ its table of contents , guess (since have not yet read book) item 6 (explicitly disallow use of compiler-generated functions not want) becomes simpler via =delete item 17 (store newed objects in smart pointers in standalone statements) becomes simpler via make_shared (and c++14's make_unique ) item 21 (don't try return reference when must return object) becomes simpler , more efficient via move semantics item 55 (familiarize boost) has fewer examples because many boost features part of c

javascript - $ionicHistory.goBack() not working correctly -

i jump page not tab tab page. on tab page,i want go-back when item clicked. use $ionichistory.goback() go back. i found strange situation, firsttime $ionichistory.goback() working, second time not working。 my ionic version : 1.3.1 i have created a codepen demo to reproduce bug: click go dashpage button -> click select button -> click item -> click select button -> click item ionic maintains history stack of tabs , menus separately. updated answer insted of <ion-item ng-click="onitemclick()">item 1</ion-item> try <ion-item ui-sref="dash-page">item 1</ion-item> let me know if helps old answer create own mygoback() funtion put in view <ion-nav-buttons> <button class="button" ng-click="mygoback()"><i class="ion-chevron-left"></i> </button> </ion-nav-buttons> and in controller $scope.mygoback = function () {

agent - How do I profile using jprofiler on remote linux server while my GUI in on windows OS? -

i trying profile remote linux server using jprofiler. trying seek line of code need maybe implement inside startup.sh script of app. any great! erez in local jprofiler gui, invoke session->integration wizards->new remote integration and follow steps in wizard.

sql server - committed inserted data not immediately available for select involving full text search -

i have 2 stored procedures - simplified/pseudo code: create procedure [someschema].[sproc1] begin set nocount on; begin try begin transaction x; -- insert lots of data commit transaction x; end try begin catch select @errornumber = error_number() , @errorseverity = error_severity() , @errorstate = error_state() , @errorprocedure = error_procedure() , @errorline = error_line() , @errormessage = error_message(); rollback transaction x; end catch; end; create procedure [someschema].[sproc2] begin set nocount on; begin try begin transaction x; -- perform full text search on old , inserted data , return commit transaction x; end try begin catch select @errornumber = error_number() , @errorseverity = error_severity() , @errorstate = error_state() ,

javascript - Get current route name on handlebar template in Ember.js 2 -

i needed know current route name can show or hide global component created on application.hbs . this component should hidden in 1 route template, looks easier solution me. getting current route name , if equal "posts" not show header-bar component. something this: {{#if currentroute != 'login'}} {{header-bar}} {{/if}} {{outlet}} any idea on achieve or similar solves problem? applicatiion controller has property names currentroutename . can use it. if want use in template need define in controller. test.js (controller) init(){ this._super(...arguments); let appctrl = ember.getowner(this).lookup('controller:application'); this.set('appctrl', appctrl); } test.hbs {{appctrl.currentroutename}}

jquery - Pinch or mousewheel to zoom -

i need functionality demo: http://preview.codecanyon.net/item/pinch-zoomer-jquery-plugin/full_screen_preview/6623080 in desktops, image can zoomed in/out mouse wheel , on touch screen devices, 2 fingers gestures can used zoom in/out. i use library mentioned, $6 seems bit much. did find other open-source libraries don't have both features. i building static site dynamically (using javascript) loads single image. to achieve desired result can use onmousewheel event and, when triggered, set change transform: scale(1, 1) of image based on the: e.wheeldelta (all browsers except firefox , opera) and e.detail (for firefox , opera). when scroll down e.wheeldelta , e.detail negative valuesand when scroll positive. example : var image = image id; image.onmousewheel = function(e) { var delta = e.detail || e.wheeldelta; image.style.transform = (delta > 0) ? "scale(2, 2)" : "scale(0.5, 0.5)"; } you can of course create more co

python - How to convert a list of tuples into list of dictionaries with plus values? -

i have list of tuples, e.g: list_of_tuples = [('company_name', 56, 'green'), ('other_company', 43, 'blue')] i have convert list of dictionaries in python. key should company_name, , values should in list, , have add more values, like: [{'company_name' : [56, 'green', 'more_value'}, {'other_company' : [43, 'blue', 'more_value'} ] how can this? you can use list comprehension so >>> [{i[0] : list(i[1:])} in list_of_tuples] [{'company_name': [56, 'green']}, {'other_company': [43, 'blue']}]

java - Understanding Apache Spark filter transformation behavior -

i have list of items in javardd, every item date (java calendar). now, want filter dates less given date. that's code: main public static void main(string[] args) { sparkconf conf = new sparkconf().setappname("date comparison test") .setmaster("local[4]").set("spark.executor.memory", "1g"); javasparkcontext sc = new javasparkcontext(conf); // initializes filter date 01/01/2016 @ 10:00:00 calendar filterdate = calendar.getinstace(); filterdate.clear(); filterdate.settimeinmillis(1451642400000l); // initializes array of 40 calendars, in every date // 1 hour later previous, starting // 01/01/2016 @ 08:00:00 arraylist<calendar> calendararray = new arraylist<>(); // milliseconds corresponding 01/01/2016 @ 08:00:00 long initial = 1451635200000l; for(int i=0; < 40; ++i) { calendar 1 = calendar.g

r - Making one variable be shapes of different colors (ggplot2) -

so right i've got plot: my plot (sorry it's not inline image, first time on stack overflow , wouldn't let me post images) the plot produced code: ggplot(potassium.data, aes(x=experiment,y=value, colour=pedigree))+geom_jitter()+labs(title=element) the problem is, there 31 different maize pedigrees being plotted here, it's difficult distinguish colors each other. wondering if it's possible make color , shape of point used uniquely identify pedigree, example 1 pedigree red squares, red circles, third 1 blue squares, fourth blue circles, , on. make far easier distinguish points. know how this? i don't think thats possible, if shaping pedigree end many categories of shapes have colors now. geom_label() , geom_text() let plot cultivar id directly onto plot, maybe build separate column equivalent genus, cultivars grouped somehow (maybe a, b, ph, etc). color "genus" column, make plot better: ggplot(potassium.data,

html - AngularJS remove the # in url link -

i try remove hastag url in website, don't know how.. i researched on internet, , find it's neccesary insert location providers in controller, but...where? here si controller code: 'use strict'; (function() { var app = angular.module('store', ['store-products']); app.controller('storecontroller', ['$log', function($log) { this.products = gems; $log.info('dependency info'); }]); app.controller('panelcontroller', function() { this.tab = 1; this.selecttab = function(settab) { this.tab = settab; }; this.isselected = function(checktab) { return this.tab === checktab; }; }); app.controller('reviewcontroller', function() { this.review = {}; this.addreview = function(product) { product.reviews.push(this.review); this.review = {}; }; }); var gems = [ { name: 'dodecahedron', price: 2.95, descrip

ios - Swift: Why isn't my -1 button working properly? -

Image
i have +1 button , -1 button , label starts @ 0. +1 button working great, reason, -1 button isn't working. can help? var sales = 0 @iboutlet weak var numberofsaleslabel: uilabel! @iboutlet weak var minusonesaleoutlet: uibutton! @ibaction func plusonesale(sender: anyobject) { sales += 1 numberofsaleslabel.text = "\(sales)" if sales >= 1 { minusonesaleoutlet.hidden = false } } override func viewdidload() { } @ibaction func minusonesale(sender: anyobject) { sales -= 1 numberofsaleslabel.text = "\(sales)" if sales == 0 { minusonesaleoutlet.hidden = true } } anybody got ideas why minus button isn't working? i'm thinking might have me calling outlet , action, i'm not sure. thanks! p.s.-i'm not sure if normal. using connections inspector you'll need make sure connections correct. if @ point delete @ibaction code, create connection, old 1 still remain until remove conne

c++ - cannot find Boost headers version -

in windows, when ./configure command in mysys terminal mingw installed within project error: configure: error: cannot find boost headers version >= 1.60.0 . have checked version of boost suggested another thread , have same version (1.60.0). have installed recent version of cmake (3.6.0-rc2). configuring on linux , mac works. boost installed in root of drive (c:\boost_1_60_0). including , linking library within projects works fine. i bit new makefiles , os compatible libraries. ideas on how make detect boost library? terminal screenshot of error

classloader - How to include a spring-boot-maven-plugin generated jar to a third application -

i create application depends on a.jar , generated spring-boot-maven-plugin. a.jar depends on b.jar , located lib\ folder. when start application, following error: exception in thread "main" java.lang.noclassdeffounderror: some_class_located_in_b.jar it possible add spring-boot-maven-plugin generated jar classpath of third application? if yes, how? the repackaged jar "final" artifact , represents application: shouldn't have module dependency on it. default behaviour of repackage replace regular jar 1 holds application. if code of project a meant shared module, please make sure specify classifier repackaged jar. way can use regular jar file module dependency there an example in documentation

c++ - Modless CMFCPropertySheet with PropSheetLook_OutlookBar parented to a CFrameWnd -

when create modless cmfcpropertysheet set propsheetlook_outlookbar , parent cframewnd window created correctly mfc asserts when close window. here assert from gathered, crash happens in docking manager (the outlook bar "docked" rest of propertysheet) , it’s because parent window of cmfcpropertysheet derived cframewnd instead of cframewndex cannot change parent window cframewndex because breaks rest of application. also bug happens when propsheetlook_outlookbar used. my question is: there way use propsheetlook_outlookbar when parent window derived cframewnd? or doing wrong somewhere? thanks you

python - masking for keras BLSTM -

i'm running blstm based off of imdb example , version not classification, rather sequence prediction labels. simplicity, can treat pos tagging model. inputs sentences of words, outputs tags. syntax used in example differs in syntax other keras examples in doesn't use model.add initiates sequence. can't figure out how add masking layer in different syntax. i've run model , tested it, , works fine it's predicting , evaluating accuracy of 0's, padding. here's code: from __future__ import print_function import numpy np keras.preprocessing import sequence keras.models import model keras.layers.core import masking keras.layers import timedistributed, dense keras.layers import dropout, embedding, lstm, input, merge prep_nn import prep_scan keras.utils import np_utils, generic_utils np.random.seed(1337) # reproducibility nb_words = 20000 # max. size of vocab nb_classes = 10 # number of labels hidden = 500 # 500 gives best results far batch_size = 10