Posts

Showing posts from January, 2014

node.js - cordova is not adding android platform -

i using windows 10. have sucessfully installed android studio , java. using latest android studio version 2.3.3. cordova version 7.0.1 nodejs version 7.7.0 npm version 4.1.2 using android api level 25 when using cordova platform add android shows error error: failed fetch platform cordova-android@~6.2.2 either connection problem, or platform spec incorrect. check connection , platform name/version/url. error: cmd: command failed exit code enoent how add android platform . please solve issue. my enviromental variable path missing "c:\windows\system32". after adding path. have sucessfully running. , have installed git on system.

javascript - Replacing all "E" characters in file to "Z" and all "Z" characters to "E" -

i want replace "e" characters in file "z" , "z" characters "e", problem once replace 1 of them, cant replace other, because characters e/z you use function , object replacments. var string = 'eaebzczdz'; string = string.replace(/[ez]/g, s => ({ e: 'z', z: 'e' }[s])); console.log(string);

email - Grab Warning and error messages and cast them in a variable with PHP -

i've got cron job , when run in terminal displays warning: warning: mysql_query() expects parameter 2 resource, boolean given in /dbcon.php on line 116. i grab above text , put them variable can send email. what have done this: //debugging ... if ($this->dbh === false) { //get warning/error type..... $error = error_reporting(e_error | e_warning); //get script name... $file = $_server['php_self']; //get current file name... $class = __file__; //send email if connect() return false... $this->process($error, $file, $class); } however, $error sent email code. i've tried error_log() couldn't make work. had @ other sof 'similar' posts did not have success.

android - Java URIMatcher using query parameters -

i using urimatcher parse pattern scheme. trying use query parameters this myscheme://search/item?id=3&is_visible=true but can't parse id , is_visible value. urimatcher urimatcher = new urimatcher(urimatcher.no_match); urimatcher.adduri("search", "item", 123); and data use uri.getqueryparameter("id"); can value query parameter?

java - Eclipse error : cannot be resolved to a type -

so doing exercise simulates car instruments. there 3 classes in total : fuelgauge , odometer , carinstrumentsimulator (the 1 main method). 2 first ones each have constructor have defined. whenever type in main : public static void main(string[] args) { carinstrumentsimulator carinstrumentsimulator = new carinstrumentsimulator(); fuelgauge fuel = carinstrumentsimulator.new fuelgauge(); odometer odometer = carinstrumentsimulator.new odometer(0, fuel); i carinstrumentsimulator.fuelgauge cannot resolved type error in eclipse(and same odometer), got line of code correction detailed in website got exercise ( https://www.leveluplunch.com/java/exercises/car-instrument-simulator/ ) new java , coding in general, wondering : 1) syntax mean: fuelgauge fuel = carinstrumentsimulator.new fuelgauge(); 2) why there problem syntax? thanks in advance ^^ i think that's typo in source . try instead: fuelgauge fuel = new fuelgauge(); odometer odometer = new o

html - Woocommerce Pre-checkout Form -

i looking setup website running on woocommerce. need have multi-question form needs answered before each product can added cart. if user fails give “correct” answers, product not added. , if registered need answer once each product. apparently gravity forms might option not see documentation me this, can recommend anything? thanks :)

javascript - Canvas drawing takes a lot of time on Safari but not on Chrome or FF -

Image
i making kaleidoscope on website. take image (either via drag & drop or default image on load) , copy 10 times (one each slice of kaleidoscope). on mouse move, rotation , scale of slices adjusted achieve desired effect. on google chrome , firefox, works seamlessly, without lag. however, on safari website unusable slow. missing something? here jsfiddle showing problem. please note tried replacing settimeout(update, 1000 / 60) requestanimationframe, without improvements. jsfiddle: link $(document).ready(function () { //script kaleidoscope base var dragdrop, kaleidoscope, c, dragger, gui, i, image, kaleidoscope, len, onchange, onmousemoved, options, ref, tr, tx, ty, update, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; kaleidoscope = (function() { kaleidoscope.prototype.half_pi = math.pi / 2; kaleidoscope.prototype.two_pi = math.pi * 2; var optimal_radius = window.innerheight; if (

ssl - CSR generation is dependent on system/machine ? -

how generate csr openfire server. openfire documentation has details csr generation . is it(csr) dependent on system openfire server installed or dependent on common name, organizational unit, city, region, country? openfire documentation has line you can generate csr / private key pair using tool of choice . here csr / private key pair means csr same private key pair .

python - Logentries stops showing messages after inactivity -

i trying use logentries python [link] it works fine step in process lasts given time without logging (it seems around 10 minutes not sure), no more logs shown on logentries side. it's logger dead/closed. does has clearer idea on why happen , how prevent it? thank lot in advance.

c++ - how can i print two matrices when i call them as two different input file? -

i tried print 2 matrices, matrix , b. when call 1 text file matrix a, program ok. when call text file of matrix b, program failed, leaving box saying "unhandled exception @ 0x00168a07 in newqr.exe: 0xc00000fd: stack overflow." is wrong call 2 text file this? below code. generating algorithm qr householder method. since failed here, cant continue algorithm. hope know wrong here. here are: test1.in matrix a: 1.00 -6.00 34.00 -1644.00 803.00 -42258.00 15524.00 -831864.00 285061.00 -15355806.00 5153062.00 -278046852.00 test2.in matrix b: -1875.00 17976.00 485714.00 -501810.00 5370.00 409584.00 -973084.00 559740.00 291495.00 9193128.00 -64643018.00 55199850.00 6351060.00 175638624.00 -1430791544.00 1249618200.00 120491745.00 3213894936.00 -27252104806.00 23932788870.00 2200175790.00 58033455

How to update key of dictionary in Swift 3 -

if (userfollowingarray[indexpath.row]["watcher_following"] as! bool) == false { let dict : nsmutabledictionary = userfollowingarray[indexpath.row] as! nsmutabledictionary print(dict) dict["watcher_following"] = 1 self.userfollowingarray[indexpath.row] = dict as! dictionary<string, any> } i want update watcher_following key true/false throws exception. [_ttgcs26_swiftdeferrednsdictionaryssp__ _swift_setobject:forkeyedsubscript:]: unrecognized selector sent instance do not use nsmutable... collection types in swift declare userfollowingarray swift array var userfollowingarray = [[string:any]]() get dictionary var iable var dict = userfollowingarray[indexpath.row] check value if dict["watcher_following"] as! bool == false { update if necessary , assign dictionary array. dict["watcher_following"] = true userfollowingarray[indexpath.row] = dict } the last step necessary due v

ruby on rails - CRUD action of one controller in another -

is bad practice create 1 of crud action of 1 controller in another? example have 2 models user , post , following controller: class userscontroller < applicationcontroller def show @user = user.find(params[:id]) end def update_post #update action of postscontroller post.find(params[:post_id]).uppdate_attributes(params[:post]) end def create_post #create action of postscontroller @user = user.find(params[:id]) @user.posts.create(params[:post]) end end can/should or there better way ? reason why actions not in own controller want manipulate posts @ users page. it bad practice , impractical if have association already. can use user form , fields_for create/update `posts. you need instantiate post build , add user model accepts_nested_attributes_for , use fields_for in view , user crud save/update posts #user controller class userscontroller < applicationcontroller d

php - Fpdf and PDF_LABEL -

i trying set labeling printing system in php , on each label add logo on top of , can't manage work it, because on fpdf images treated cell doesn't work edit: the code follows: for($i=1;$i<=$nolabels;$i++) { $text = sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s%s%s", "", "","","", "$destination", "$label", "use by: $date", "$i", '/', "$nolabels"); $pdf->add_label($text);} for($i=1;$i<=$nolabels2;$i++) { $text = sprintf("%s\n%s\n%s\n%s%s%s", "$destination", "$label2", "use by: $date", "$i", '/', "$nolabels2"); $pdf->add_label($text); you can make additional "addheader" , call on each page. here 1 example using x , y coordinates public function addheader($pdf, $addpagenum) { // header if ($addpagenum) { $pdf->setfont('arial', '', 10);

python - thrift timeout for long run call: thrift.transport.TTransport.TTransportException: TSocket read 0 bytes -

i've build rpc service using thrift. may run long time (minutes hours) each call. i've set thrift timeout 2 days. transport = tsocket.tsocket(self.__host, self.__port) transport.settimeout(2 * 24 * 60 * 60 * 1000) but thrift closes connection after 600s, following exception: thrift.transport.ttransport.ttransportexception: tsocket read 0 bytes is there's other timeout should set? (python, thrift server: windows; client: ubuntu) the thrift transport connection being disconnected. due network issues or remote service restart or time out issues. whenever call made after disconnect results in ttransportexception. problem can solved reconnecting remote service. try using this, invoking before making remote service call. def repoen_transport(): try: if not transport.isopen(): transport.open() except exception, msg: print >> sys.stderr.write("error reopening transport {}".format(msg))

mysql - PlyQL(Plywood): can't fetch the tables via workbench -

i use plyql provide sql-like interface druid via plywood . the data loaded druid represented tables in plyql/mysql. the problem can't fetch tables via workbench, syncfusion data source , other mysql clients. i can see tables via mysql using terminal. is there way solve problem?

Cannot write dictionary to file in python using json.dumps() -

i'm getting response json dumps, , i'm trying load in log.txt file, doesn't print out my function def get_customer_last_action_executed(self): """ customer last action executed inputing customerid :return: """ payload ={'customerid': self.customerid} if not self.customerid: customer_id = raw_input("please provide customer id:") self.customerid = customer_id # raise exception('no customerid provided') response = self.send_request(self.get_customer_last_action_executed_url + self.customerid, json.dumps(payload), "get") print response.url, response.status_code print response, response.text, response.reason if response: print self.sucessful_msg else: print self.error_msg open('log.txt', 'w') f: json.dumps(payload, f)

java - Compare and sort String which have number and special characters -

i have list of string need sort (see below). "< 5 ha" ">= 10 ha < 20 ha" ">= 20 ha < 50 ha" ">= 5 ha < 10 ha" ">= 50 ha" looks simple until now, didn't find easy way it. element class have property of type string named code. java code below, idea ? public class sortinglistcomparator { private static list<element> testlist; public static void main(string[] args) { initlist(); collections.sort(testlist, new elementcomparator()); (element elem : testlist) { system.out.println("code of element : " + elem.getcode()); } } private static void initlist() { testlist = new arraylist<element>(); element elem1 = new element("< 5 ha"); element elem2 = new element(">= 10 ha < 20 ha"); element elem3 = new element(">= 20 ha < 50 ha");

php - Add query param to url in the Laravel Controller -

is possible add parameter url route controller? for example url is: myshop.com/order-finished and method controller is: getorderfinished() { // want add param myshop.com/order-finished?order_number=w00034335 } i want final url myshop.com/order-finished?order_number=w00034335 , must add parameter order_number controller method. edit: no redirections please yes: redirect('order-finished?order_number=w00034335');

c# - ASP.Net mvc 5 - Save Parent and child records together -

i getting started asp.net mvc 5 , got stuck 1 problem have explained below: i have user , history models. , user can have more 1 history. user model: public class user { public int id { get; set; } public string tickettype { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string gender { get; set; } public virtual icollection<history> histories { get; set; } } history model: public class history { public int id { get; set; } public int year { get; set; } public int month { get; set; } public int day { get; set; } public virtual user user { get; set; } } usercontroller : public class userscontroller : controller { private mydbcontext db = new mydbcontext(); public actionresult create() { var user = new user(); user.histories = new list<history>(); user.histories.add(new history { }); return view(); } [httppost

javascript - HTML5 animated image error: "Error in parsing value for ‘animation’. Declaration dropped." -

only in firefox message: "error in parsing value ‘animation’. declaration dropped." other browser wont return message after pressing of d key nothing happens. this html5 code: <!doctype html> <html> <head> <meta charset="utf-8"> <style type="text/css"> @keyframes face-forward { 100% { background-position: 0px 0px; } } @keyframes walk-right { 0% { background-position: 0px -180px; } 100% { background-position: -960px -180px; } } @keyframes walk-left { 0% { background-position: 0px -583px; } 100% { background-position: -960px -583px; } } </style> <script> var sprite1; var spritesheet = new image(); // spritesheet.src = "./images/adam_sprite_sheet_a.png"; spritesheet.src = "http://s4.postimg.org/g92rbk2r1/adam_sprite_sheet_a.png"; function docready() { sprite1 = document.createelement("div"); sprite1.id = "sprite_1"; sprite1.style.width = "

mongodb - Mongo:. How to get unique rows -

i have following object , record has keyword , deviceid. there multiple object same deviceid. last entry each device id { search:{ keyword:"_" }, datecreated:"", device:[{ deviceid:"_" }], } example { search:{ keyword:"fl" }, datecreated:"01/01/2017", device:[{ deviceid:"1" }], } { search:{ keyword:"atl" }, datecreated:"01/02/2017", device:[{ deviceid:"1" }], } { search:{ keyword:"ga" }, datecreated:"01/03/2017", device:[{ deviceid:"2" }], } the query should return { search:{ keyword:"atl" }, datecreated:"01/02/2017", device:[{ deviceid:"1" }], } { search:{ keyword:"ga" }, datecreated:"01/03/2017", device:[{ deviceid:"2" }], } you can not achieve using "d

python - Tips on generating Pete Frame-style Rock Family Tree in Graphviz -

Image
i've written simple python program (my first!) takes 3 csv files - people, bands, links - , generates graphviz dot file shows "rock family tree", people show in different bands, , bands go through different lineups. i'm trying close pete frame's wonderful rock family trees (although they'll never good, or detailed). the code generated far looks this: digraph family_tree { graph [style="solid", ranksep="0.6", fontname="berthold akzidenz grotesk", fontsize=24, label="those post-rock", labelloc="tl", bgcolor="white", fontcolor="black", penwidth="1", color="black", margin=0, nodesep="0.1", splines="polyline"]; edge [fontname="berthold akzidenz grotesk", fontsize=10, arrowhead="none", penwidth="1", minlen="1" ]; node [style="solid", margin="0", fontname="berthold akzidenz grotesk"

model view controller - Getting Sharepoint Context in SPWebApp Hosted on Azure -

i have sharepoint (365) application (mvc) hosted on azure. application works if debug in localhost, when go azure, can't retrieve in anyway sharepoint context... null. why? me! var spcontext = sharepointcontextprovider.current.getsharepointcontext(httpcontext.current);

jquery - JavaScript modify CSS for multiple divs -

i have function tied anchor , on click, modifies display of div display none block. in div have anchor want use hide parent div. see mock-up below: <a href="#" onclick = "showtext(); return false;" id="btnews">click</a> this modifies allsources div display block: <div id="essentialsourcestab"></div> <div id="allsourcestab"> <a href="#" class="inline_link allsourceslink" id="showbottom" onclick = "hidetext(); return false;"> </div> i managed first function work, modifies css allsourcestab display block , hides essentialsourcestab, however, cannot other anchor(showbottom) work. basically, want use hide allsourcestab , display essentialsourcestab function showtext() { document.getelementbyid("allsourcestab").style.display = "block"; document.getelementbyid("essentialsourcestab").styl

c++ - how to run Clock-gettime correctly in Vxworks to get accurate time -

i trying measure time take processes in c++ program linux , vxworks. have noticed clock_gettime(clock_realtime, timespec ) accurate enough (resolution 1 ns) job on many oses. portability matter using function , running on both vxworks 6.2 , linux 3.7. ve tried measure time taken simple print: #define <timers.h< #define <iostream> #define billion 1000000000l int main(){ struct timespec start, end; uint32_t diff; for(int i=0; i<1000; i++){ clock_gettime(clock_realtme, &start); std::cout<<"do stuff"<<std::endl; clock_gettime(clock_realtme, &end); diff = billion*(end.tv_sec-start.tv_sec)+(end.tv_nsec-start.tv_nsec); std::cout<<diff<<std::endl; } return 0; } i compiled on linux , vxworks. linux results seemed logic (average 20 µs). vxworks, ve got lot of zeros , 5000000 ns , lot of zeros... ps , vxwroks, runned app on arm-cortex a8, ,

php - wordpress posts search when located in subdirectory -

we have strange behaviour in our wordpress when try posts search or change password. the wordpress located @ http://oursubmodaine.ourwebsite.com , users access trough following subdirectory : https://ourwebsite.com/blog . search in post url : https://ourwebsite.com/blog/wp-admin/edit.php?s=test&post_status=all&post_type=post&_wpnonce=02c8e376c9&_wp_http_referer=%2fwp-admin%2fedit.php&action=-1&m=0&cat=0&seo_filter=&paged=1&action2=-1 there redirect 302 code , user redirected : https://ourwebsite.com/wp-admin/edit.php?s=test&post_status=all&post_type=post&action=-1&m=0&cat=0&seo_filter&paged=1&action2=-1 but don't have problem when save new posts. our proxy pass in our nginx server : location ^~ /blog/ { proxy_pass http://oursubmodaine.ourwebsite.com/; proxy_redirect off; } did had same issue ?

javascript - How to prevent onclick event on a div while clicking on body click? -

i functionality body,html elements while clicking on anywhere on document , there div tag onclick event there. both clashing each other how prevent while clicking on div. tried both event stop propagation , event prevent defaul example: jd nothing jquery $jd = jquery the below event should triggered particular div. t event clashing body onclick. $jd('.menu-left a').click(function(){ $jd('.menu-left a').removeclass('active'); if($jd(this).hasclass('add_item_team')) self.team.create(); if($jd(this).hasclass('add_item_qrcode')) self.qrcode.open(); $jd(this).addclass('active'); jquery("#text-lock").trigger("click"); }); jquery(document).on('click','body',function(event){ /*console.log("adsfasddfs"); var finding_span; finding_span = $jd(".design-area").find('.content-inner span.drag-

angular - Angular2 app public URL without port number -

what have config access angular2 app remote server without port number. example: server wakanda running www.myserver.com , angular2 app reachable via localhost:8000. i'll use www.myserver.com/myapp/ see angular2 app. i've found webpack.config.js, no idea whether right place or config set. no idea wakanda is, point have mind baseurl, localhost seems "/" , want "/myapp" in production. you'll need set in index.html inside head tag this: <head> <base href="/myapp"> ... </head> and in webpack config output: { publicpath: '/myapp', ... },

Send an XML EPP request via TCP in PHP -

i'm using code connect registrar via tcp. stream_socket_client('tcp://registrarwebsite:700', $errno, $errstr, 10, stream_client_connect, $fc) connection successful, $fc, using stream_context_create pass ssl certificate , key. @ point, works fine. $fc = stream_context_create(array( 'ssl' => array('allow_self_signed' => true, 'local_cert' => 'ma_registrar_cert.pem', 'local_pk' => 'ma_registrar_key.pem' ))); i want add xml request stream_context_create , send xml epp requests distant server. how that? edit this example of xml request want send server along stream context. <?xml version="1.0" encoding="utf-8" standalone="no" ?> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <command> <create> <domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0&qu

go - How to use a file as stdin when exec a command -

i have simple code: cmd := exec.command("cat") cmd.stdout = os.stdout stdin, _ := cmd.stdinpipe() file, _ := os.open("file") io.copy(stdin, file) _ = cmd.run() it works. problem cmd.run() never returns. seems after writing file stdin, cat still waits more content. i'm trying cat <file does, in case cat exit after reading file. i wonder how achieve in go? it's because you don't close stdin. add stdin.close() after io.copy . cat terminate. also, know it's example there absolutely no error checking. assume that's illustration purposes. :-)

mongodb - Slow query when iterating for ID's over documents with binary data -

we required iterate on id's of documents in specific collection, these documents contain binary data field. when query projection returns _id field, query takes approximately 80 seconds return 200000 results. is there faster way cursor contains _id fields , doesn't degrade the size of binary data field? if remove data field of documents, query returns in few hundred milliseconds. steps reproduce in mongo shell: function randomstring() { var chars = "0123456789abcdefghijklmnopqrstuvwxtzabcdefghiklmnopqrstuvwxyz"; var randomstring = ''; var string_length = 64000; (var i=0; i<string_length; i++) { var rnum = math.floor(math.random() * chars.length); randomstring += chars.substring(rnum,rnum+1); } return randomstring; } var data = randomstring() (var = 1; <= 200000; i++) { db.testdata.insert({data: new bindata(0, data)}) } var cursor = db.testdata.find({}, {_id: true}) cursor.foreach(printjson)

java - Dependency Injection of EJBs in SwitchYard ServiceTask -

i have spent lot of time on finding way dependency injection of java enterprise beans in switchyard service. in general want have 2 different ears, 1 database services , 1 contains different switchyard projects. i want inject remote service stateless enterprise bean in switchyardservicetask class, part of bpmn process. shouldn't big task switchyard there troubles that. switchyard project packaged within jar, bundled in ear deployed @ same wildfly instance other ear. as application server use wildfly 10. deployed services work correctly cannot inject service in switchyard service task. when deploy database services deployment section of service looks that: 2017-07-25 08:42:21,053 info [org.jboss.as.ejb3.deployment] (msc service thread 1-8) wflyejb0473: jndi bindings session bean named 'transportationorderservice' in deployment unit 'subdeployment "shipping-rest-1.0.war" of deployment "shipping-application-1.0.ear"' follows: java:glob

java - How to pass a model property to a javascript function in JSP which itself returns a value -

i have format date have received controller [spring] in jsp page itself. here's jsp file : <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <!doctype html> <html lang="en"> <head> <script src="${pagecontext.request.contextpath}/static/js/custom/customer.js">/script> </head> <body> <table id="success-story"> <thead> <tr> <th width="

SQL/VBA - if/then/else for day of year when recordset has Leap Years and non Leap Years -

good morning, here issue. have form user selects date want work with. there, in vba, store entered date in variable (ytddate) , day of year date stored variable (dayofyear). these variable values used in following sql statement: sqlytdcounts = "select count(x.event_unique_id) total, year(occurrence_date) year " & _ "from (select distinct event_unique_id, occurrence_date events datepart('y',occurrence_date) <=" & dayofyear & _ ") x group year(occurrence_date) having (((year([occurrence_date]))>='" & _ datepart("yyyy", ytddate) - 10 & "') )" so happening recordset retrieved day of year each [occurrence_date] <= day of year date user selected on form. the sql works great, non leap years, leap years getting day of year before user selected

linux - Bash redirect vs. pipe -

i have following bash script: #!/bin/bash trap "trap - sigterm && kill -- -$$" sigint sigterm proxy_list="${1}" url="google.com" pool=5 timeout=2 check_proxy() { local socks_proxy="${1}" retry in {0..2}; time_connect="$(curl ${url} --socks5 ${socks_proxy} -m${timeout} -o /dev/null -s -w %{time_connect})" if [ $? -eq 0 ]; echo "${socks_proxy} (${time_connect}s) retries=${retry}" break fi done } while read proxy; while true; if [ "$(jobs -rp | wc -l)" -lt "${pool}" ]; check_proxy "${proxy}" & break fi wait -n done done < "${proxy_list:-/dev/stdin}" wait the script either use filename ( ${1} ) input, or stdin if no positional parameter provided. (pipe) if run script follows , try kill ctrl+c during runtime: cut -f1 -d' ' data/socks_teste

tensorflow - Tensorboard scalars and graphs duplicated -

Image
i'm using tensorboard visualize network metrics , graph. i create session sess = tf.interactivesession() , build graph in jupyter notebook. in graph, include 2 summary scalars: with tf.variable_scope('summary') scope: loss_summary = tf.summary.scalar('loss', cross_entropy) train_accuracy_summary = tf.summary.scalar('train_accuracy', accuracy) i create summary_writer = tf.summary.filewriter(logdir, sess.graph) , run: _,loss_sum,train_accuracy_sum=sess.run([...],feed_dict=feed_dict) i write metrics: summary_writer.add_summary(loss_sum, i) summary_writer.add_summary(train_accuracy_sum, i) i run code 3 times. each time run, re-import tf , create new interactive session. but, in tensorboard, separate scalar window created each run: also, graph appears duplicated if check data last run: how prevent duplication of graph , scalar window each time run? i want data appear in same scalar plots (with multiple series / plot

android - Can't get the editText integer value right -

i'm new programming don't know how fix or why it's happening. i'm making app , in main2activity it's suppose user insert value in edittext , then, after user presses button, value turn integer , used in mathematical operation. the thing is, when try out, when press button in mainactivity take me main2activity, app crashes. i narrowed problem coding have in button main2activity don't know what's wrong. this main2activity code. can me? thanks. package com.example.cabr.teste; import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class main2activity extends appcompatactivity { public double valorhorasponta = 0; public double valorhorascheias = 0; public double valorhorasvazio = 0; @override protected void oncreate(bundle savedinstancestate) {