Posts

Showing posts from February, 2013

ios - what triggers itunes sign-in alert -

i want implement new store feature in our app there multiple non-consumables purchase. went ahead , set way want , works. unfortunatly every time app started or becomes active background there alert displayed asking sign in itunes. it's same alert pop if download app. not being sandbox environment. tried find lines of code possibly trigger alert - commented code of new store feature down bare graphical skeleton yet altert remains. tried sign out , in itunes, restarted ipod - nothing helps. if reinstall our current app-version appstore alert vanishes. so question is: triggers alert? there way debug this? in advance already. it sounds @ point maybe transaction didn't completed properly, , every time app launches storekit forwarding incomplete transaction app handled. i've had similar issues before i guess device signed in account different (presumably test) account (or not signed in @ all) transaction in question took place, it's prompting (without pro

node.js - How do you access flags passed in through the command line in Node? -

i know access them in process.argv . ex. ~/code/study-buddies $ node server/app.js --dev [ 'node', '/users/azerner/code/study-buddies/server/app.js', '--dev' ] but best practice? if want access array of flags, not normal command line arguments? "best practice" relative question , i'm not sure mean "the normal command line arguments" stuff can found in other people have done in past. for example, can @ minimist see 1 way arguments handled. initial example pretty simple: pass argv array module , parses receives. var argv = require('minimist')(process.argv.slice(2)); the module loops through argument array, parsing out , building object can used without worrying quite fiddly bits of argv parsing. other modules, node-getopt , commander.js provide ton more functions, in end relying upon argv

Meteor - how to get response from payment REST API -

i'm implementing payu payment module in meteor app. flow works well, shows proper order view , redirects proper continueurl . in payu api there notifyurl , payu can send post request url if there change in order's status. when there is, example completed status should execute update in mongodb , change user's account type. but don't have idea how make it. should make html file on meteor's server side? if it's possible link should pass in notifyurl make payu request pass html file? did try http ? package? this. first add it. meteor add http then create method this. meteor.methods({ somemethodname: function() { return http.call("post", "http://payuirl", { data: { idk "data", stuff: json.stringify(myobject); } }); } }); and on client can create meteor.call on client. meteor.call('somemethodname',function(erro,result){ if(error){ //show error

format - Android DecimalFormat rounding error: Random decimals added -

i'm trying format number. can have 2 6 decimal. if pass number without decimal, results ok. otherwise adds random decimals. float value = ...; decimalformat formatter_currency = new decimalformat(); decimalformatsymbols nf = new decimalformatsymbols(); nf.setdecimalseparator('.'); nf.setgroupingseparator(','); formatter_currency.setdecimalformatsymbols(nf); formatter_currency.setmaximumfractiondigits(8); formatter_currency.setminimumfractiondigits(2); return formatter_currency.format(value); eg: value = 35 -> 35.00 value = 35.6 -> 35.65932558 (expected 35.60) value = 35.659 -> 35.68899918 (expected 35.659) i've read problem float variable. i've try double, result same. how can fix this? thanks i wrote quick test program , seems pass of test cases: import java.text.decimalformat; import java.text.decimalformatsymbols; public class formattest { public static void main(stri

css - moving text over an image, without the image moving -

i have banner trying add text bottom portion of it. got text centered , how want be, when want move text bottom of page, picture moves too. html <div class="col_one art-banner"> <div class="art-banner-text"> <h2>what <span>you</span> want learn?</h2> </div> </div> css .art-banner { background-image: url("graphics/art_banner.jpg"); height: 150px;} .art-banner-text { width: 940px; height: 50px; background-color: rgba(0,0,0,0.5); } .art-banner-text h2 { text-align: center; padding-top: 10px; font-family: "bender";} .art-banner-text span { color: #eb6623; } jsfiddle presuming you're trying use margin-top move art-banner-text down, you're running collapsing margin problem: margin shared between inner div , outer one, meaning outer 1 gets margin too. so solution not use margins, position:relative outer div , position:absolute inner one, botto

javascript - Sweet Alert Yii -

i trying use sweet alert in yii in place on confirmation option. i have ajax button , sweet alert pop up, once user has chosen confirm or cancel can either continue ajax request or stop. 'ajax' => array( 'url'=>ccontroller::createurl('items/delete'), 'type'=>'post', 'async'=>true, 'data'=>array('item'=>$item['item_id']), 'datatype'=>'json', 'enctype'=>'multipart/form-data', 'cache'=>false, 'beforesend'=>'js:function(data) { var x = sweetalertdelete(); if(x){alert("aaaaaaa"); return true;} else {alert("bbbbb"); return false;} }', 'success'=>'function(data) { i using beforesend in order display sweet alert box. issue the box appears, x returned , alerts seen later shown. here sweet alert code: function sweetalertdelete(){ swal({ title: "<

Packaging a Java EE Application -

i have enterprise project (ear) 1 ejb , several web modules, these web modules have lots of classes in common, same each project, if modify 1 of them i'll have manually copy code other projects well. don't want put them in ejb module because use lot of front-end related resources. is there way share these classes between web projects? obs: use classes , resources ejb module. make module commun classes , package jar. add jar dependency other project. maven should tool project.

Getting different output when casting between int and int64 in Go; is it due to processor architecture? -

a small part of application i'm using test expected behavior giving different output, depending on processor run on. here's relevant part of code: b := 0; b < intcounter; b++ { //int64random = rand.int63() int64random = int64(rand.int()) //checking sanity fmt.println("int64random " + strconv.formatint(int64random, 10)) slctestnums = append(slctestnums, int64random) } when run on mac (amd64, darwin) output like: int64random 2991558990735723489 int64random 7893058381743103687 int64random 7672635040537837613 int64random 1557718564618710869 int64random 2107352926413218802 when run on pi (arm, linux) output like: int64random 1251459732 int64random 1316852782 int64random 971786136 int64random 1359359453 int64random 729066469 if on pi change int64random = rand.int63() , recompile, output like: int64random 7160249008355881289 int64random 7184347289772016444 int64random 9201664581141930074 int64random 917219239

qt - QML: Component vs Item as a container -

what difference between component , item in qml ? documentation not absolutely clear here. preferred type use container several widgets? can replacable rectangle ? for example, difference in following declarations: item { id: itemwidget rectangle { id: 1 } rectangle { id: 2 } } and component { id: componentwidget rectangle { id: 1 } rectangle { id: 2 } } why use component when declaring delegate ? the difference between 2 snippets rectangle displayed. written in documentation : notice while rectangle automatically rendered , displayed, not case above rectangle because defined inside component. component encapsulates qml types within, if defined in separate qml file, , not loaded until requested (in case, 2 loader objects). because component not derived item, cannot anchor it. when declaring delegates, component used because there several delegate items must created. single item doesn't work here. can think of component

Intellij Idea hint: Condition is always false - can that be true here? (Java) -

i have following code: public string testexitpoints() { boolean myboolean = false; try { if (getboolean()) { return "exit 1"; } if (getboolean()) { throw new runtimeexception(); } } { myboolean = true; } if (getboolean()) { return "exit 2"; } return "exit 3"; } public static boolean getboolean() { random rand = new random(); return rand.nextint() > 100; } now intellij idea gives me second , third invocation of getboolean() following hint: condition 'getboolean()' 'false' now understanding, not true, since getboolean() can either true or false , depending on generated random value. missing here, or bug in intellij idea? it's not bug. it's feature :) if in ide, tell 2nd , 3rd call getboolean() false, not first one. idea assumes (in case incorrectly) method, being parameterless , called "get&q

Can't add MySql to C# program (reference and "using" already added) -

i'm writing c# program in visual studio 2010 excel macro. i'm attempting connect program mysql database. when try build, errors following: the type or namespace name 'mysql' not found (are missing using directive or assembly reference?) the type or namespace name 'mysqlconnection' not found (are missing using directive or assembly reference?) i have downloaded .net mysql connector , added visual studio reference mysql.data.dll, , have "using mysql.data.mysqlclient;" @ top of program. these 2 things seem hangups else on internet sees these errors. why else getting these errors, , how can resolve them? edit: also, when type using statement, ide not autocomplete mysql me; doesn't seem know what/where is. apart using statement, shown above, errors when trying use mysqlconnection, e.g. below public dictionary <string, mysqlconnection> m_envtocon; i've encountered error , had explicitly remove connectio

javascript - filter array inside object angular -

i'm trying filter results term since it's inside array it's being quite hard reach them filters in angularjs. var test=[ { "title": "random stuff", "path": "/random_stuff.html", "labels": [ { "term": "viewed", "probability": 0.083 }, { "term": "firefox", "probability": 0.083 }, { "term": "cookies", "probability": 0.083 }, { "term": "times", "probability": 0.055 }, ], } ]; html : <input class="looking" type="text" ng-model="data.keywords"/> <li ng-repeat="se in searchctrl.data.pages | orderby : '-views' | filter: ??" > the data.keywords come here: var id=$routeparams.teamid; var context=this; context.data = { pages:[], keywords:id, islogged:false }; because n

c# - Ignore Invalid SSL-Certificate Windows 10 -

i've got following problem: i'm developing windows 10 universal app (uap) in c# , i'm doing network communication via webrequest ... problem want ignore if target server has invalid ssl-certificate. how can this? before windows 10 set property in servicepointmanager , not available in windows 10... do? hope not late you. in similar situation you. here did. var filter = new windows.web.http.filters.httpbaseprotocolfilter(); filter.ignorableservercertificateerrors.add(windows.security.cryptography.certificates.chainvalidationresult.expired); filter.ignorableservercertificateerrors.add(windows.security.cryptography.certificates.chainvalidationresult.untrusted); filter.ignorableservercertificateerrors.add(windows.security.cryptography.certificates.chainvalidationresult.invalidname); using (var client = new windows.web.http.httpclient(filter)) { uri uri = new uri("https://yourwebsite.com"); }

caching - Cache control and Meta cache control -

question how browsers understand cache control , meta cache control tags if have this: cache-control: no-cache, no-store and later have < meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate, max-age=0, s-maxage=0" /> which cache control applied page? work in same way in browsers? thanks

go - build Golang release binaries for Github -

i'm looking ideas on how build binaries common platforms golang project, release on github. i know how manually releases, using github's instructions @ creating releases . , i'm doing releases using aktau/github-release , requires manually logging different machines (osx, linux, windows) , doing release. benedikt lang has blogged using travis-ci (which i'm yet experiment with). presume public travis build binaries linux. any suggestions? you right travis ci building in linux go cross-compilation requires build source , build other go executables. ronindev suggested, suggest setup own cross-compilation build environment following blog post: http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go it quite easy, , takes 10 minutes. after have that, build tool such jenkins give controls kick off build desired platforms (mac, windows, linux, etc) , push out git releases each one.

ios - Initializing object with closure as only parameter in Swift -

i have auto-generated swift class 1 of obj-c pods looks this: typealias blockdomainmappermappingblock = (anyobject!) -> anyobject! class blockdomainmapper : domainmapper { var mappingblock: blockdomainmappermappingblock! { } /*not inherited*/ init!(block: blockdomainmappermappingblock!) } when trying initialize object so: let domainmapper = blockdomainmapper { (objecttomap : anyobject!) -> anyobject! in return logincredentials(token: objecttomap) } i following error: cannot find initializer type 'blockdomainmapper' accepts argument list of type '((anyobject!) -> anyobject!)' this baffles me, using auto-complete in x-code generate of code (except: (objecttomap : anyobject!), starts out anyobject! placeholder.) edit: objective-c code generates swift class: typedef id (^blockdomainmappermappingblock)(id datatomap); @interface blockdomainmapper : gltdomainmapper @property (nonatomic, readonly, copy) blockdomainmappermapping

objective c - TreeView in IOS rearrange following Subviews after adding or removing subviews from Scrollview -

Image
i try create n-dimensional treeview control ios application. use uiviewcontroller uiscrollview , have custom uiview class treenodes. want collapse , expand treenodes, if add or remove subviews scroll view have rearrange other subviews. this tree: if collapse second node , remove childnodes looks that: is there way realise that, without programatically rearrange following subviews? you realized lot of code? because use tableview. as datasource of table can use array of dictionary; , in each dictionary can store rows informations like: row element ;// current element display parent element ;//* parent element generation ; //nsinteger number of parents (you can use indentation) so when delete row, can search in datasource items parent element, , substitute parent of deleted row (if exists); decrement generation them, , recursively children (until find no more children). of course, when populating tableview can use generation number make indentation.

android - Recursion making explorer slow -

this code check mp3 songs (using recursion)is making explorer slow please suggest me way make faster public static boolean getmp3s1(file dir){ int h=0; file[] listfile = dir.listfiles(); if(listfile!=null) for( int i=0; i< listfile.length; i++) { if(listfile[i].isdirectory()==true) getmp3s1(listfile[i]); else { if(listfile[i].getname().endswith(".mp3")==true||listfile[i].getname().endswith(".mp3")==true) h=1; } } if(h==1){ h=0; return true; } else return false; } try break loop after h=1; can speed little. bellow: public static boolean getmp3s1(file dir){ int h=0; file[] listfile = dir.listfiles(); if(listfile!=null) for( int i=0; i< list

php - MySQLi query to loop through array and update multiple rows -

i have array like: $postdata[1] = 'this'; $postdata[2] = 'that'; $postdata[3] = 'the other'; and want loop through array , update of rows id corresponds array key. like: foreach ($postdata $key => $value) { if ($key == 1) { $update = $db->query("update site_email_templates set content='$postdata[1]' id = 1"); } else if ($key == 2) { $update = $db->query("update site_email_templates set content='$postdata[2]' id = 2"); } else if ($key == 3) { $update = $db->query("update site_email_templates set content='$postdata[3]' id = 3"); } } what simplest way this, not particularly knowing how many array keys there are, , keeping in 1 query? my first answer accepted op, have updated answer since 1 thinks previous answer might exposed sql-injection. the code below tested on real environment , served prepared statement preventing sql-injection: $sql = "update

responsive design - WPF panel that can be oriented vertically, but fill parent container -

basically need stackpanel fill parent , children fill panel. i'm using grid designed fill rectangular shape wider tall. want design reactive if rectangular container made taller wide, child elements arranged vertically , still fill container. a wrap panel not work (i don't think) need orientation or nothing; either child elements oriented horizontally, or vertically. i'm thinking should replace grid dockpanel, each item docked either left (for horizontal stacking), or top (for vertical stacking), how achieve stretch on child elements?

node.js - Tile images with imagemagick with NodeJs -

with script can tile (4096x2048) images 32 tiles(512x512). give "x, y, z" cordinate each exported image. for keep z 0 always. example: output-1-0-0.jpg output-1-1-0.jpg var http = require("http"); var im = require("imagemagick"); var server = http.createserver(function(req, res) { im.convert(['img.jpg','-crop','512x512','output.jpg'], function(err) { if(err) { throw err; } res.end("image crop complete"); }); }).listen(8080); and beside that, sorry dumb question im newby nodejs, instead of giving image name script, can call request crop , image service ? thanks in advance i don't think imagemagick can handle requests. can save image coming request local file, , call imagemagick crop image separate tiles. a http request library node.js request . it has pipe() method pipe response file stream: http.createserver(function (req, resp) { if (req.url === '/img.jp

javascript - Check whether top +100px of element is visible -

i'm using jquery visible plugin ( https://github.com/customd/jquery-visible ) check whether element visible onscreen (and fire svg animation). whole element has visible, problem on screens less vertical space. plugin does provide option trigger when part of element visible onscreen if use animation not been seen. how can trigger animation when top of element +100px visible? think understand following script doing @ each stage, can't figure out change make in order achieve goal: (function($){ var $w = $(window); $.fn.visible = function(partial,hidden,direction){ if (this.length < 1) return; var $t = this.length > 1 ? this.eq(0) : this, t = $t.get(0), vpwidth = $w.width(), vpheight = $w.height(), direction = (direction) ? direction : 'both', clientsize = hidden === true ? t.offsetwidth * t.offsetheight : true; if (typeof t.getboundingclientrect === 'function'){ /

php - Not able to clear the variables in codeigniter -

this controller:- public function home() { if($this->session->userdata('id')) { $this->header(); $this->load->model('admincon'); $e = $this->admincon->select(); $data['e'] = $e; $this->load->view('admin/home',$data); } else { $this->index(); } } in view page of function home() there form submitted through function subques() function here:- public function subques() { if($this->session->userdata('id')) { $tp=$this->input->post('box1',true); $s=$this->input->post('box',true); $t=$this->input->post('t',true); $a=$this->input->post('a',true); $b=$this->input->post('b',true); $c=$this->input->post('c',true); $d=$this->input->post('d',true); $n=$this->input->post('n',tr

ruby - Extending a model's class methods via a gem -

i'm trying write gem allow me call class methods on rails models. far, have following: mygem/models/active_record_extension.rb module activerecordextension extend activesupport::concern module classmethods def foo "foo" end end end # include extension activerecord::base.send(:include, activerecordextension) i'm requiring file follows: require "mygem/version" require "mygem/models/active_record_extension" require "mygem/railtie" if defined? rails module mygem # code goes here... end my gemspec file including necessary files: spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.files = dir["{lib}/**/*.rb"] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| file.basename(f) } spec.require_paths = ["lib"] spec.add_development_dependency "bundler", &

Facing an issue in removing duplicate entries in a list of my python Program -

the below program entering values list , print list again after removing duplicate entries... can please have , let me know error in program? print ("enter numbers list \n") list = [] n = int(input("")) while n <= 1000: list.append(n) n = int(input("")) m = len(list) in range (0,m-1): j in range (i+1,m): if list[i] == list[j]: list.remove(j) else: pass print (list) when run program gives below error: file "python", line 23, in <module> valueerror: list.remove(x): x not in list as keep deleting elements length of list keeps decreasing , index accessing might not accessible instead like list(set(t)) and dont name lists "list" keyword

r - Inserting a page break within a code chunk in rmarkdown (converting to pdf) -

i using rmarkdown, pandoc , knitr create pdf including chunks of r code. within code chunk have loop prints number of graphs , statistical output. i insert page break loop (to appear in pdf output). page break occur after each graph printed, ensure each graph printed on 1 page , statistical output on next. i have been unable find way of including page break in r code chunk. have tried cat("\\newpage") , cat("\\pagebreak") in hopes recognized pandoc no avail (it printed verbatim in final pdf). suggestions appreciated. here code have far: ```{r, echo =false, message=false, warning=false, comment=na, results='asis'} library("markdown") library("rmarkdown") library("knitr") library("ggplot2") (v in values){ # read in file testr <- read.csv(file.path, header=t) print(ggplot(testr, aes(x=time, y=value, color=batch)) + geom_point(size = 3) + xlab ("timepoint") + ylab (v) + scale_x_continuous(br

ios - How to add a simple button in a ViewController? -

i have following code. import uikit class viewcontroller: uiviewcontroller { var button : uibutton? override func viewdidload() { super.viewdidload() button = uibutton.buttonwithtype(uibuttontype.system) uibutton? } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } } i following error error: 'anyobject' not convertible 'uibutton?' i know might doing fundamentally wrong. know is. according me: have declared button optional uibutton - think means, value of button can unset or nil therefore, while initialising type mentioned as uibutton? is right way ? you can't cast optional uibutton in way you're doing it. correct way cast optional uibutton is: button = uibutton.buttonwithtype(uibuttontype.system) as? uibutton interpret as: cast can either return nil or uibutton object, resulting in optional uibutton objec

Query run result in Teradata -

i running below query in teradata editor: select 'emp_info_main' table_name, count(1) record_count schema.table1 union select 'emp_sal' table_name, count(1) record_count schema.table2 union select 'department_info' table_name, count(1) record_count schema.table3; the query giving me below result: table_name | record_count ------------|------------- emp_info | 10 emp_sal | 11 departme | 110 the first column not showing complete table name. can please here? this common issue. in teradata first select of union determines resulting data typ , column name, either change order of selects start longest name or add cast in 1st select: select cast('emp_info_main' varchar(20)) table_name, count(1) record_count schema.table1 union select 'emp_sal' table_name, count(1) record_count schema.table2 union select 'department_info' table_name, count(1) record_count schema.table3;

c# - MemoryAppender.GetEvents : Events Null -

can explain why not getting events memoryappender? in other words, events variable null. public void log(string message, category category, priority priority) { memoryappender memoryappender = new memoryappender(); log4net.config.xmlconfigurator.configure(new system.io.fileinfo(@"c:\users\username\documents\github\massspecstudio\massspecstudio 2.0\source\massspecstudio\core\app.config")); bool log4netisconfigured = log4net.logmanager.getrepository().configured; switch(category) { case category.debug: log.debug(message); break; case category.warn: log.warn(message); break; case category.exception: log.error(message); break; case category.info: log.info(message); break; } var events = memoryappender.getevents(); // events null.

python - pandas DataFrame update/combine when indices don't align -

consider 2 dataframes store information on same characteristic of same observation, different time periods: import pandas pd import numpy np df1 = pd.dataframe({"obs":["a","a","b","b"], "year":[1,2,1,2], "val":[3, np.nan, 3, np.nan]}) df1 out: obs val year 0 3 1 1 nan 2 2 b 3 1 3 b nan 2 df2 = pd.dataframe({"obs":["a","a","b","b"], "val":[np.nan, 4, np.nan, 4], "year":[1,2,1,2]}) df2.index = (range(5,9)) df2 out: obs val year 5 nan 1 6 4 2 7 b nan 1 8 b 4 2 now merge or combine these 2 data frames such values collected in single column, nan in df1 replaced corresponding observation-year values df2 . can achieve doing: merged = pd.merge(df1, df2, on=["obs", "year"], how="left") merged.loc[~np.isfinite(merg

php - Prevent mobile format conversion of number to phone number link? -

upon registration, sending user confirmation email activation code. problem, when email opened on mobile device (and possibly other platforms) underlined , treated phone number. here php code sends email: $subject = "website registration"; $body = ' <html> <head> <meta name="format-detection" content="telephone=no" /> <style> .code {margin-bottom: 0; padding: 5px; background-color: #82caff;} .important {font-weight: bold;} </style> </head> <body> <p>we have created account , ready use. before first must activate entering code @ link below.</p> <p class="code">code: '.$act_code.'</p> <p><a href="https://www.website.com">activate account now</a></p> <p class="important">please remember, never ask account information</p> </body> </html> '; $headers = "mime-version: 1.0" . "\r\

java - Jersey jdbc @resource not working -

i'm trying have simple jersey based jaxrs listener, running on existing tomcat 7.0.57. tomcat has global config in context.xml jdbc datasource, want use. my problem can't resource resolve via @resource annotation. heres simple test example @path("/") public class testjersey { @resource(name = "jdbc/default") private datasource dsa; @resource(name = "java:comp/env/jdbc/default") private datasource dsb; @resource(lookup = "java:comp/env/jdbc/default") private datasource dsc; @resource(mappedname="jdbc/default") private datasource dsd; @get @produces("text/plain") public string test() throws namingexception { stringbuffer ret = new stringbuffer(); ret.append("a: " + dsa + "\n"); ret.append("b: " + dsb + "\n"); ret.append("c: " + dsc + "\n"); ret.append("d: "

java - How to enable back press to close nav drawer on fragment only -

i have implemented navigation drawer fragment hence know what's best way implement pressed feature fragments code needs go? i've used pressed code below doesn't work. activity class public class bakerloohdnactivity extends appcompatactivity { //save our header or result private drawer result = null; private int getfactorcolor(int color, float factor) { float[] hsv = new float[3]; color.colortohsv(color, hsv); hsv[2] *= factor; color = color.hsvtocolor(hsv); return color; } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_bakerloo_hdn); localbroadcastmanager.getinstance(this).registerreceiver(onnotice, new intentfilter("backpressed_tag")); final string actionbarcolor = "#b36305"; toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportacti

numpy - Cant fit scikit-neuralnetwork classifier because of tuple index out of range -

i trying classifier working. extension scikit learn dependencies theano. my goal fit neural network list of years , teach know if leap year or not (later increase range). run in error if want test example. my code looks this: leapyear.py import numpy np import calendar sknn.mlp import classifier, layer sklearn.cross_validation import train_test_split # create years in range years = np.arange(1970, 2001) pre_is_leap = [] # test if year leapyear x in years: pre_is_leap.append(calendar.isleap(x)) # convert true, false list 0,1 list is_leap = np.array(pre_is_leap, dtype=bool).astype(int) # split years_train, years_test, is_leap_train, is_leap_test = train_test_split(years, is_leap, test_size=0.33, random_state=42) # test output print(len(years_train)) print(len(is_leap_train)) print(years_train) print(is_leap_train) #neural network nn = classifier( layers=[ layer("maxout", units=100, pieces=2), layer("softmax")], learning_

add labels to non-zero elements in stacked column chart Excel 2013 -

i'm generating stacked column chart out of table this: year 1 2 3 50 0 0 b 50 0 0 c 0 100 0 d 0 50 0 e 0 0 10 f 0 0 15 i want column stacks every year, series labels every non-zero value. if try , add labels 6 labels every series (with 0 values clustered around axis). how generate series labels non-zeroes? happy rearrange data different format table above. using excel 2013. you can throw error replace zeros in data. way won't appear on chart. can use: =na()

jQuery smooth scrolling anchor navigation -

i have list based navigation @ top of site, it's 1 page site hrefs anchors sections on page. i've used code: jquery smooth scroll positioning doesn't work navigation: <nav> <ul class="navigation"> <li class="navigation"><a class="scroll" href="#about-me">about me</a> </li> <li class="navigation"><a class="scroll" href="#my-skills" >my skills</a> </li> <li class="navigation"><a class="scroll" href="#portfolio">portfolio</a> </li> <li class="navigation"><a class="scroll" href="#contact">contact</a> </li> </ul> </nav> section/div: <section id="contact"> <!----> <div class="panel" id="contact"> <h2>

python - Save KeyErrors and IndexErrors to a list/dict -

i'm trying extract data api, , expect receive keyerror , indexerror, use try/except function catch them. first create list of items i'll loop through extract information api responses. create dataframe stores information items had no errors. l= ["a","b","c","d"] def extract_info_from_one_response(response, idx): try: response = response.json() d = { ### codes ## } ## error management except keyerror,e: print idx, l[idx], str(e) return {} except indexerror,e: print idx, l[idx], str(e) return {} dat = pd.dataframe([extract_info_from_one_response(response, idx) idx, response in enumerate(responses)], index=l) when errors occur, python prints out [1]the index of problematic item, [2] name of item , [3]the details on error took place. how save/capture these 3 outputs, save them objects or create dataframe these 3 pieces of information?

git - Efficient mothod to compare two folders under version control -

there 2 folders , b 2 working spaces of version controlled source codes (i.e. git or svn), , have same repo version or close version. there lots of files in working space , take long time compare 2 folder directly using kdiff3 or etc software. it easy generate changed file list of folder , b using git status. can kdiff3 or similar software compare files in list speed comparison process? or there other quick method speed comparison between , b, or keep them synchronized. just use regular diff , if necessary --exclude=.git/

xcode - Remove support for Apple Watch on app store -

i removed embedded app extension watch app, , target dependency app discontinue support apple watch. the app never quite worked, , more app evolves less apple watch user. after removing these things attempted install build on phone. never able so, until deleted it. i tested using testflight. the app won't install. downloads, sits @ 90%. not update how remove support apple watch???? this answer may seem weird not have apple watch @ all, have had issue you've had installs not finishing before. stumped be, looking of extensions doing now. it ended being had placed leading zeros in version number/build number. for example: version 4.01 instead of: version 4.1 for reason caused error described me. can confirm don't have leading zeros?

javascript - JQuery hover doesnt work -

i got jquery hover doesnt show. dimmed-item class, add on kunden-item class. bouth of them allready work if manuely put them in. jquery allready in file there must logic mistake made. here html 1 element: <div class="kunden-item kunde2-item"> <img class="kunde" src="<?php echo $params->get('image2');?>" alt="kunde"> </div> here jquery: $(document).ready(function(){ $("kunden-item") .mouseenter(function() { $(this).addclass("dimmed-item"); }) .mouseleave(function() { $(this).removeclass("dimmed-item"); }); }); kunden-item class, selector needs leading . : $(".kunden-item") .mouseenter(function() { $(this).addclass("dimmed-item"); }) .mouseleave(function() { $(this).removeclass("dimmed-item"); }); }); also note can massively shorten code using hover() , toggleclass() : $("

javascript - Button not toggling colours -

this button working until added toggle functionality, toggle button submits information. it's supposed change colour of page. ideas? i've left previous working button commented out. .hg { background-color: #5b3768; } .hg h1 { color: #fff; } .hg h2 { color: #fff; } .hg h3 { color: #fff; } .hg h4 { color: #fff; } .hg h5 { color: #fff; } .hg h6 { color: #fff; } .hg p { color: #fff; } .hg th {background: #fff; color: #5b3768;} .hg tr {color: #fff;} .normal { background-color: #fff; } .normal h1 { color: #000; } .normal h2 { color: #000; } .normal h3 { color: #000; } .normal h4 { color: #000; } .normal h5 { color: #000; } .normal h6 { color: #000; } .normal p { color: #000; } .normal th {background: #ff9500; color: #fff;} .normal tr {color: #000;} <div> <!-- <button class="btn btn-info" ng-click="colorscheme = 'hg'">hg theme</button> --> <button toggle-button ng-model="eventdata.themehg">

aspose.words - "Failure to find com.aspose:aspose-email:jar:5.3.0.0" when running GroupDocs sample "Java Viewer - Sample Dropwizard" -

i'm trying run sample "groupdocs java viewer - sample dropwizard" download here it need these jar files: aspose-email-5.3.0.0.jar aspose-imaging-2.9.0.jar aspose-words-15.6.0.jar aspose-slides-15.5.1.jar i can not find them here maven.aspose.com i found jars jdk16 still have same error: failed execute goal on project groupdocs-viewer-dropwizard: not resolve dependencies project com.groupdocs.samples:groupdocs-viewer-dropwizard:jar:2.12.0: following artifacts not resolved: com.aspose:aspose-email:jar:5.3.0.0, com.aspose:aspose-imaging:jar:2.9.0, com.aspose:aspose-slides:jar:15.5.1, com.aspose:aspose-words:jar:15.6.0: failure find com.aspose:aspose-email:jar:5.3.0.0 in http://repository.springsource.com/maven/bundles/external cached in local repository, resolution not reattempted until update interval of com.springsource.repository.bundles.external has elapsed or updates forced -> [help 1] you can try use ma

Application error heroku, ruby on rails tutorial -

i following ruby on rails tutorial(recomended here on stack:) ) loved far can't seem deploy application via heroku. can give me light on do? 2015-07-23t23:46:37.387879+00:00 heroku[web.1]: process exited status 1 2015-07-23t23:46:37.390702+00:00 heroku[web.1]: state changed starting crashed 2015-07-23t23:46:38.056116+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/?_c9_id=livepreview7&_c9_host=https://ide.c9.io" host=vast-shore-9845.herokuapp.com request_id=9bc94d44-685f-4554-9940-fe01f5f8acfc fwd="84.81.77.100" dyno= connect= service= status=503 bytes= 2015-07-23t23:47:04.275534+00:00 heroku[slug-compiler]: slug compilation failed: failed compile ruby app 2015-07-23t23:47:04.275511+00:00 heroku[slug-compiler]: slug compilation started 2015-07-23t23:47:34.243854+00:00 heroku[slug-compiler]: slug compilation started 2015-07-23t23:47:34.243873+00:00 heroku[slug-compiler]: slug compilation failed: failed compile ruby

asp.net - Redirect to specific page after session expires (MVC6) -

i have c# mvc6 project , want redirect specific page when session expires. after research tried creating public class sessionexpireattribute : actionfilterattribute httpcontext context = httpcontext.current; but httpcontext.current not exist in asp.net 5. how solve problem? if override 1 of actionfilterattribute methods, can access session enough: public override void onactionexecuting(actionexecutingcontext context) { context.httpcontext.session... } is sufficient?

android - Why is this ListView null? -

i'm completing part of google android tutorial ( this part precise) , i've hit snag. i'm trying set adapter of listview custom arrayadapter. unfortunately, findviewbyid seems returning null (which means can't set adapter). here's relevant code: mainactivityfragment private final string log_tag = mainactivityfragment.class.getsimplename(); private artistitemadapter artistsadapter; public mainactivityfragment() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_main, container, false); artistsadapter = new artistitemadapter(getactivity(), r.layout.list_item_artist, new pager<artist>().items); listview artistslist = (listview) rootview.findviewbyid(r.id.listviewartists); artistslist.setadapter(artistsadapter); return rootview; } @override public void onstart() { edittext searchbar = (edittext) getview().findviewb