Posts

Showing posts from July, 2014

prompt jumped only for the first time- javascript -

i have pretty easy assignment doesnt work. prompt jumped first time , nothing work anymore. appreciate help! thank you assignment : shopkeeper gives discount of 10 percent when customer buys more 1000 items. 1. write function take total item purchased(prompt) , price per item(fixed) parameters.and calculate total amount payable customer. <!doctype html> <html> <head> <meta charset="utf-8"> <script src = "8.js"></script> </head> <body> <button onclick="check()">check</button> </body> </html> function check(){ var totalitem = parseint(prompt('please enter total item purchased:')); var priceperitem = 15.5; if (totalitem > 1000){ function topay(totalitem, priceperitem){ var topay = (totalitem * priceperitem) * 0.9; console.log(topay); document.write ('total amount payable ' + topay); };

php - Silex controller not found -

Image
i'm new user of silex framework , have little (huge me) problem registering route controller. controller can not found silex. here tree of files: my composer.json file: { "require": { "silex/silex": "~1.3", "twig/twig": "^1.24", "doctrine/dbal": "~2.2" }, "autoload": { "psr-4": { "controller\\": "web/" } } } my index.php file in web directory: <?php // web/index.php require_once __dir__.'/../vendor/autoload.php'; use symfony\component\httpfoundation\response; use silex\provider\urlgeneratorserviceprovider; use silex\provider\validatorserviceprovider; use silex\provider\servicecontrollerserviceprovider; use silex\provider\httpfragmentserviceprovider; $app = new silex\application(); $app['debug']=true; $app->get('/','homecontroller::index'); $app->

c++ - How to manipulate dates/datetimes in c++11? -

this embarrassing, having hard time doing simple manipulation of datetimes. this c# version of try achive using c++11; datetime date1=new datetime(4,5,2012); datetime date2=new datetime(7,8,2013); int day1=date1.days; timespan ts=d2-d1; int diffdays=ts.days; what did try? std::tm tm; tm.tm_year=113; tm.tm_mon=0; tm.tm_wday=0; std::time_t tt=mktime(&tm); std::chrono::system_clock::time_point = std::chrono::system_clock::from_time_t(tt); std::chrono::system_clock::time_point = std::chrono::system_clock::now(); auto e1 = std::chrono::duration_cast<std::chrono::hours>(now - then).count(); the value of e1 (379218) makes no sense ever. i took @ chrono, presented c++11 standard library datetime not find example of how create date having int year=2012, int month=2, int day=14. ps:is chrono sufficient handling date/times/timezones in c++11? there need time.h? you need initialize fields tm , start with std::tm tm = {0,0,0,0,

git: 'credential-osxkeychainit' is not a git command. See 'git --help' -

when try push committed changes repo command line on mac os x git push i following message: git: 'credential-osxkeychainit' not git command. see 'git --help'. this irrespective of if date or not. any ideas can messed up? this post (from 2011...) explain why not work under windows. this git-credential-cache doesn’t work windows systems git-credential-cache communicates through unix socket. try might solve problem: git config --global credential.helper wincred

java - How to call a MySQL stored procedure with multiple OUT parameters using JPA and Hibernate? -

i have following mysql stored procedure out parameters, how can call stored procedure through hibernate in out parameters? create procedure dbname.getstatistics (out bigint unsigned, out b bigint unsigned, out c bigint unsigned) begin select count(*) dbname.table1 id =0; select count(*) b dbname.table2 id>0 , id<4; select count(*) c dbname.table3 id>4; end edit following code used in java test call of mysql stored procedure (with out parameters) through hibernate(java): session session = hibernateutil.getsessionfactory().opensession(); connection connection = session.connection(); callablestatement callable = null; try { callable = connection.preparecall("{call dbname.getstatistics(?,?,?)}"); // 3 ?,?,? means 3 out parameter. // if parameters in type of // lets first 1 use : callable.setint(1, 10); callable.registeroutparameter(1, types.bigint); callable.registeroutparameter(2, types.bigint); call

wordpress - Is it ok to build an entire site with Advanced Custom Fields? -

i'm creating new site in wordpress , found out plugin powerfull , ended creating customs fields every part of website, i've placed wysiwyg editors instead of built in ones because it's easier me code templates. is ok build entire site advanced custom fields or may become issue in future? since webpage based on static products data, wp or plugins updates needed. is ok build entire site advanced custom fields imo it "ok" build entire site plugin, recommend it? not. the reason because never know might happen site, if install "bad" plugin breaks acf plugin. or let odd reason stop providing support acf or updating whatever reason. i've seen lot of apps have support system die out or bought conglomerate companies , stop public development , support. wp or plugins updates needed. regardless should keep updating wordpress current versions, never know security exploits people find, wordpress core dev push out new versions battle ex

New to java 1.8.0_73 - Javac command not recognized -

when try compile .java file, says "command javac not found." i've done fresh install of java using installer downloaded website. i've tried solution on of other posts says check path, includes "c:\program files (x86)\java\jre1.8.0_73\bin;" contains looks ton of utilities - except, there's no javac executable. i searched c drive file explorer, , couldn't find anywhere. i've installed , reinstalled, think might looking wrong thing compile programs. please help! you have installed java jre . need install jdk . the jre (java runtime environment) contains files needed run java. the jdk (java development kit) includes jre , development utilities. go the download page , , select jdk .

android - How to draw relative to the position of another view -

i'm trying draw line under textview (creating rubber bridge score sheet, lines in question mirror dotted lines here ). can't figure out how position of bottommost textview , use numbers create line in proper position. line far below textview should below, i.e.: 40 ——— <---- want (close number) 40 ——— <---- (farther number) the line change position depending on vertical position of bottommost textview, think retrieving position, somehow i'm not using draw line. here's code getting position of textview , sending line drawing method: findviewbyid(r.id.main).getviewtreeobserver().addongloballayoutlistener( new viewtreeobserver.ongloballayoutlistener() { @override public void ongloballayout() { //remove listener if( build.version.sdk_int >= build.version_codes.jelly_bean ) findviewbyid(r.id.main).getviewtreeobserver()

php - how to replace text with another similar to mail merge? -

i working in magento, , have developed module send text messages customers. in settings of module, admin can set message sent customer. i'm trying add features allow replacement of texts data database. for example, have following code fetches saved settings body of text message: $body = $settings['sms_notification_message']; the message fetched looks this: dear {{firstname}}, order ({{ordernumber}}) has been shipped. tracking#: {(trackingnumber}} business! {{storename}} the goal have module replace variables in "{{ }}" customer , store information. unfortunately, i'm unable figure out how make replace information before sending message. being send is. the easiest way use str_replace , so: // set message $message = <<< message dear {{firstname}}, order ({{ordernumber}}) has been shipped. tracking#: {{trackingnumber}} business! {{storename}} message; // assign values in associative array $values = [ 'firstname'

r - Importing option chain data from Bloomberg -

i import bloomberg r specified day entire option chain particular stock, i.e. expiries , strikes exchange traded options. able import option chain non-specified day (today): bbgdata <- bds(connection,sec,"opt_chain") where connection valid bloomberg connection , sec bloomberg security ticker such "tls au equity" however, if add fields doesn't work, i.e. bbgdata <- bds(connection, sec,"opt_chain", testdate, "opt_strike_px", "maturity", "px_bid", "px_ask") bbgdata <- bds(connection, sec,"opt_chain", "opt_strike_px", "maturity", "px_bid", "px_ask") similarly, if switch using historical data function doesn't work bbgdata <- datedatahist <- bdh(connection,sec,"opt_chain","20160201") i need data 1 day, specified day, , including additional fields hint: think issue every field following "opt_chain" dep

webbrowser control - BAck to external browser closed app -

my application opened in external browser. there possibility when person returns application automatically close? thank you, no. browsers "sandboxes". can't detect when return application. the best can in javascript, ask window close when think user doing working in tab (but users can decline close in browsers): function closewin() { mywindow.close(); // closes new window }

c - selection sort algorithm for 2d char array -

i trying make selection sort algorithm 2d array in c (as title says), code compiles unfortunately not sort anything. is there can change make work? or have start on together? void sortstrings(char strings[5][32]) { int i, j, min; (i = 0; < sizeof(strings); i++){ min = i; (j = 0; j < sizeof(strings-1); j++){ if (strings[i] < strings[min]){ min = 1; } } if (min != i){ swapstrings(strings[i], strings[min]); } } } also here swapstrings function reference: void swapstrings(char string1[], char string2[]) { char *temp = string1; string1 = string2; string2 = temp; } sizeof returns size taken in memory parameter. in case, size of char isn't size of array. can size of string using strlen function. however, can't size of array strings you need add parameter function.

c# - AutoMapper binding issues -

i having trouble automapper not mapping , viewmodels correctly. primary model has complex property named contact of type contact, have fields on viewmodel named contact[propertyname] example of contactfirst_name. which seems correct far documentation examples can find say, trying flatten/unflatten model not working. did find "fix" in thread on stack overflow meant added following line mapper.initialize(cfg => cfg.recognizeprefixes("contact")); to mappings results in successful 2 way binding. seems wrong me , has thinking misunderstanding way default trappings work? am i? viewmodel public class employeeviewmodel : mvviewmodel { [display(name = "title")] public contacttitleviewmodel contacttitle { get; set; } [display(name = "first name")] public string contactfirst_name { get; set; } public string contactmiddle_names { get; set; } public string contactlast_name { get; set; } public string contact

android - Replace Fragment and remove old Fragment -

Image
this main xml <?xml version="1.0" encoding="utf-8"?><framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_place" android:layout_width="wrap_content" android:layout_height="fill_parent"/> this main activity protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); fragmentmanager fm = getfragmentmanager(); fragmenttransaction fragmenttransaction = fm.begintransaction(); fragmenttransaction.add(r.id.fragment_place, new thirdclass()); fragmenttransaction.commit(); } this thirdclass public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.test_fragment1, container, false); fragmentmanager fm = getfragmentmanager(); fragmenttransaction fragmenttransaction = fm.begintransaction();

c++ - Is it ok to use base class attribute in the initialization list? -

i have class has attribute value depends on attribute base class. base class attribute modified in constructor need value after being modified. tried summarize idea in example: #include <string> #include <iostream> class { public: int att_a; a(int x) : att_a(x) { att_a++; }; // att_a being modified in constructor of }; class b : public { public: std::string att_b; // att_b different type att_a value obtained att_a b(int y) : a(y), att_b(std::to_string(att_a)) {}; }; int main(int argc, char const *argv[]) { b b = b(3); std::cout << b.att_b << std::endl; return 0; } i'm using attribute att_a class a , modified during it's construction, input function initializes att_b of class b . concerns are: is way of accomplishing want? even though compiles , run, can cause undefined behavior under circumstances? can cause undefined behaviour? no. when using member initialization list, order define

ios - Is it possible to use NSKeyedArchiver to store an animated UIImage? -

i loaded image using frames downloaded web server. nsarray* frames = [self fetchframesfromserver]; imageview.image = [uiimage animatedimagewithimages:frames duration:1.0]; whenever try archive these frames, encoding function returns no: bool success = [nskeyedarchiver archiverootobject:(frames) tofile:archivepath]; whenever try archive image, encoding function returns no: bool success = [nskeyedarchiver archiverootobject:(imageview.image) tofile:archivepath]; is possible, or missing caveat of archiverootobject requires uiimage loaded bundle, in png-format, or non-animated? just fyi, archivepath when printed out in debugger is nspathstore2 * @"/var/mobile/containers/data/application/e475e3c1-4e3f-43d6-ad66-0f98320cf279/library/private documents/assets/a/b/c.archive" 0x000000012c555a60 update: i storing individual frames of animation inside for-loop, following: + (void) saveimage:(uiimage*)inputimage withsuffix:(nsstring*)filesuffix { if (inputim

java - Cant inject autowire bean into my class -

i have spring bean defined, when add last 4 lines autowiring restclient rest bean, getting error (if remove last 3 lines, spring container loads fine): @component public class timeseriesserviceimpl { private static logger log = logger.getlogger(timeseriesserviceimpl.class); @postconstruct public void init() { system.out.println("myservice init method called"); } @predestroy public void destory(){ system.out.println("myservice destroy method called"); } @autowired @qualifier("restclient") public restclient rest ; error: 2016-02-07 18:46:41.609 warn 11084 --- [main] ationconfigembeddedwebapplicationcontext : exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.beancreationexception: error creating bean name 'timeseriesserviceimpl': injection of autowired dependencies failed; nested exception org.springframework.bea

Unable to create new Sandbox accounts, i keep getting errors and not found messages -

i have been trying several days. when login paypal developer account can see of sandbox accounts, when try , create new one, either hangs spiny thing there way long, 20 minutes before gave up. i file not found when going dashboard or sandbox > accounts the went wrong errors when trying manually create account i have tried many combinations suggestions others have used... nothing works tested on 2 computers, 1 w10, other w7, using google chrome, firefox , ie/edge any ideas please fix or technical issue on paypal's end? thanks

php - How to show JSON array data by using javascript? -

i have ajax returning json array data this, [{ "username": "john", "total": "45", "correct(%)": "71.1111", "incorrect(%)": "28.8889" }, { "username": "kkk", "total": "42", "correct(%)": "47.6190", "incorrect(%)": "52.3810" }, { "username": "aaa", "total": "54", "correct(%)": "81.4815", "incorrect(%)": "18.5185" }, { "username": "bbb", "total": "39", "correct(%)": "58.9744", "incorrect(%)": "41.0256" }] i want show data using javascript this, username: john total: 45 correct(%): 71.1111 incorrect(%): 28.8889 username: kkk total: 42 correct(%): 47.6190 incorrect(

java - this pointer is shown as a variable name in eclipse while debugging -

Image
below screen shot of eclipse while trying debug program. not understand why variables section in top right corner shows "this" variable name , value of test(class name). thought pointer , not variable. can me this "this" keyword reference current object. used pass instance of object.. for example, these 2 allocations equal: class test{ int i; public test(){ } public void abc(int i){ i++; this.i++; } } and program doesn't make sense me ...

python - uWSGI Emperor Mode Not Working Outside of Virtualenv -

i'm trying run django application through uwsgi using emperor mode , vessels, vessel points correctly ini file , ini file defines home /home/ user /.virtualenvs/myvirtualenv, doesn't work (the log says connection prematurely closed). if run same command while in virtualenv, works perfectly, guess uwsgi ignoring home option. is, however, not useful since need run couple different apps each using own virtualenv (hence why need emperor mode). this mentioned vessel ini: # mysite_uwsgi.ini file [uwsgi] #virtualenv = /home/ariel/.virtualenvs/django-ag-panel/ # django-related settings # base directory (full path) chdir = /home/ariel/desarrollo/django/django-ag-panel/ag_panel # django's wsgi file module = ag_panel.wsgi # virtualenv (full path) home = /home/ariel/.virtualenvs/django-ag-panel/ and command use run emperor (i'm using same user 1 hosts app avoid yet more file permission issues): uwsgi --emperor /etc/uwsgi.d/vas

How to Call back when New Calendar Event added in Phone- Android -

how can create listener calendar events, need calback program when new event or updated existing event in calendar in android. i have created broadcase subclass named "eventreceiver" , added thin manifest too, <receiver android:name=".eventreceiver" android:priority="1000"> <intent-filter> <action android:name="android.intent.action.provider_changed"/> <data android:scheme="content"/> <data android:host="com.android.calendar"/> </intent-filter> </receiver> but, not called when new calendar event created/updated. hope solution. in advance.

javascript - Manipulate JSON tree structure -

Image
i building form builder, allows user have multiple questions, sub questions, , sub questions sub questions, etc. i have method works extracting data, that, data / json tree needs in specific format: u1fsqexd1azmnpl : { subfields : { 2fndvdkaefad6xq : { subfields : { fz0zn6d51tgvqid : { subfields : { 05e1jsfyvhjlgvp : { subfields : {} } } } } } } } and how data starts out: u1fsqexd1azmnpl : { 2fndvdkaefad6xq : { fz0zn6d51tgvqid : { 05e1jsfyvhjlgvp : {} } } } there can multiple items @ each level, such as: u1fsqexd1azmnpl : { 2fhjsnnchsjowl2 : {}, 2fndvdkaefad6xq : { fz0zn6d51tgvqid : { 05e1jsfyvhjlgvp : {}, 03jshvijsondjla : {} } } } my method manipulate data subfields form structure: f

python - Cannot find view : NoReverseMatch error -

i new python , django , working on project build , learning understand adding new views. application uses templateviews , created view other views created. url pattern kind of same urls working fine. new page created not working , giving me error. working urls: urls.py: ** url(r'^aboutxyz/$', templateview.as_view(template_name="aboutxyz.html"), name='about_xyz'), url(r'^contactus/$', templateview.as_view(template_name="contactus.html"), name='contact_us'), ** base.html: ** <li><a href="{% url 'about_xyz' %}">about xyz</a></li> <li><a href="{% url 'contact_us' %}">contact us</a></li> ** these 2 pages working fine. when add this: urls.py: url(r'^aboutxyzsg/$', templateview.as_view(template_name="aboutxyzsg.html"), name='about_xyz_sg'), base.html: " <li><a href="{% url 'abo

javascript - Error with Schema - ReferenceError: Phone is not defined -

i'm having small problem when building crud api node.js , express. when post api "referenceerror: phone not defined" // server.js // base setup // ============================================================================= // call packages need var express = require('express'); // call express var app = express(); // define our app using express var bodyparser = require('body-parser'); var phone = require('./models/phone'); var mongoose = require('mongoose'); mongoose.connect('mongodb://<userid>:<pass>@apollo.modulusmongo.net:27017/ugygy5qe'); // configure app use bodyparser() // let data post app.use(bodyparser.urlencoded({ extended: true })); app.use(bodyparser.json()); var port = process.env.port || 8080; // set our port // routes our api // ============================================================================= var router = express.router();

javascript - Difference between ionic and cordova plugin install -

when working ionic, difference between ionic plugin install ... and cordova plugin install which 1 should used? , why? thx! there difference ionic create files in project, such ionic.project , package.json . each time add plugin ionic using command ionic plugin add ... , ionic updates package.json . ionic cli uses package.json manage cordova app state in terms of platforms , plugins. package.json has 2 sections, cordovaplatforms , cordovaplugins allows ionic state restore cordova environment ready build, run, etc... more explanations here : https://stackoverflow.com/a/30192417/3096087

windows - Issues with spaces in FOR loop variable - batch script -

i'm writing batch script use wmic command list of groups on windows machine, group info using net localgroup <groupname> , , write info output file. here have: for /f "skip=1" %%a in ('"wmic group name"') net localgroup %%a >> "%outputfilepath%" 2> nul && echo. >> "%outputfilepath%" && echo ^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^=^= >> "%outputfilepath%" && echo. >> "%outputfilepath%" the issue having seems getting quotes around %%a variable in do net localgroup %%a because outputs info groups administrators fine when gets group name remote desktop users, fails return info group. in other words, seems happening in loop: net localgroup administrators net localgroup remote desktop administrators the first operation successful. second not. obviously, there need quotes around remote desktop administr

php - How to convert below string to date time -

i have different types of date strings, examples given below. how can convert these strings in date time in php. please me solve problem? examples: 1: 10:12 etaug 31, 2009 2: august 31, 2009, 9:08 et 3: sept. 1, 2009 10:20 a.m. et 4: 9:45 etsep 2, 2009 i had tried code result wrong. <?php date = 'aug. 28, 2009 10:26 a.m. et'; $remove[] = "'"; $remove[] = '.'; $remove[] = ','; $remove[] = 'am'; $remove[] = 'et'; $replace = str_replace($remove, '', $date); $space[] = ' '; $datetime = str_replace($space, '-', $replace); echo $datetime . '<br>'; $date = date_create_from_format('f-d-y', $datetime); echo "format:" . $date->format('y-m-d') . "\n"; ?> i used below method , got answer. $replacechar = str_replace($remove, '', $date); $space[] = ' '; $replacespace

graphics - Create a notebook application in java? -

first of fun project. have idea make notebook software using java. know there many softwares,but knowledge. need following tasks in application, expand typing area when neccessary (like in onenote) draw shapes , edit shapes add code,syntax inside note , can move (can add part jpanel?) add comments line in bubble add simple notes sticky notes in note also need add mini map of note (how copy of working note?) (solved) 07. decided use javafx create interface, javafx project? can of these in java? if can please give me guide. in advance. yeah.. possible write code requirement in javafx. since beginner start documentations. you can download javafx documentation in following link. http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html also recommend download javafx sdk, includes documentations. http://javafx.com/downloads/

javascript - Selenium Webdriver - How to execute Perl command with parameters in selenium-Java framework code -

i working on selenium framework java scripting. need use series of perl commands execute inject data system before validating selenium java scripts. how execute perl scripts inside selenium java code ? runtime.getruntime().exec() function run code through java code. asking parameter passing. understand there variables want pass in script. yes, can using + operator. similer concat string in java using + operator. pass them. posting sample code same. below code execute perl script. use below code:- string myvariable = "data"; process process; try { process = runtime.getruntime().exec("perl c:\\users\\shubham\\desktop\\"+myvariable+"\\rouge-1.5.5.pl"); process.waitfor(); if (process.exitvalue() == 0) { system.out.println("command successful"); } else { system.out.println("command failure"); } } catch (exception e) { system.out.pr

fpga - Entries in Verilog always sensitivity list -

can't find on this, doesn't fit in keywords. somewhere came across statement it's bad practice put things in block sensitivity list. things other clk , other related internal signals within device can, according statement, cause routing inefficiencies. i find convenient when coding relatively slow applications generate subdivided clock signals, , use these in blocks. for example: reg counter [12:0] ; reg slowclk ; @ (posedge clk) begin counter <= counter + 13'h1 ; slowclk <= counter[12] ; end @ (posedge slowclk) note : text entry has 1 statement per line, if lines concatenated in final post, that's due website. is there wrong this? yes indeed bad practice. can different slowclk edge. you can take wire, detect slowclk positive edge. wire got_slowclk_posedge; now detect, slowclk , positive edge, need have it's current , next clock values (current clock value should 0 & next clock value should 1

How to reduce video size before uploading in asp.net C# -

in asp.net application when i'm going upload size of video need decrease(reduce) size of video, 1 have code please me thanks you can not. any reduction in video size either compression or recoding lower resolution etc. this way beyond scope of web browser upload - unless want implement 1 or both of in javascript (!). any size reduction have done separate step - outside of website - before uploading. the whole question begs concept whether have understood how web pages work, in principle. there strong separation of responsibilities between web browser , server. in particular, following answer comment - funny: okay no need instantly decrease size, before save path in database , store file in folder decrease size, save decreasing file in folder ok, lets upload parth. how help? the path local uploaders machine. c:\videos\largevideo.mpg neither video file, nor location asp.net server can access. this totally not solve problem. unless user transcodes

java - Missing leading zeroes of date in Hive partition using Spark Dataframe -

i adding partition column spark dataframe. new column(s) contains year month , day. have timestamp column in dataframe. dataframe dfpartition = df.withcolumn("year", df.col("date").substr(0, 4)); dfpartition = dfpartition.withcolumn("month", dfpartition.col("date").substr(6, 2)); dfpartition = dfpartition.withcolumn("day", dfpartition.col("date").substr(9, 2)); i can see correct values of columns when output dataframe eg : 2016 01 08 but when export dataframe hive table dfpartition.write().partitionby("year", "month","day").mode(savemode.append).saveastable("testdb.testtable"); i see directory structure generated misses leading zeroes. tried cast column string did not work. is there way capture 2 digits date/month in hive partition thanks

swift - how to cancel segue if both UITextFields contain text -

i have 2 uitextfields 1 normal uitextfield other uitextfield connected uipickerview. want 1 of them respond mybutton , perform correct segue viewcontrollera if info inserted in fields correct , matches array of strings, , viewcontrollerb if inserted text not match array. uipickerview entered text correct.. situation if there text inside both of fields how can construct uialert when button pressed action doesn't happen. or hide uibutton if both fields contain text to make segue conditional, need use shouldperformseguewithidentifier:sender: below. override func shouldperformseguewithidentifier(identifier: string, sender: anyobject?) -> bool { if identifier == "segue1identifier"{ //check required conditions //if conditions setisfy : return true //else return false : not allow segue perform, prepareforsegue:sender: not call } }

java - Getting A StackOverFlowError when making a basic calcualator -

i trying make calculator 4 functions , word based. when tried implement selecting of operations, stackoverflow error. class calculator: package us.plexproductions.main; import java.util.scanner; public class calculator { public static int firstnum; public static int secondnum; public static int answer; public static int operation; calculator c = new calculator(); static scanner s = new scanner(system.in); static operations o = new operations(); public static void main(string[] args) { prompt(); start(); } public static void prompt() { system.out.println("########################"); system.out.println("#calculator version 1.0#"); system.out.println("########################"); system.out.println("************************"); system.out.println("this calculator that\ncan add, subtract, multiply, , divide\n" + "multiple numbers @ once."); system.out.println(&qu

javascript - What the different between `new Array(n)` and `Array(n)` -

what different if both of them call constructor "array" , generate object? i know lost this if create object without new : function animal(name) {this.name = name} var duck = animal('duck'); // undefined but how works new array(n) , array(n) ? there no difference. check article : you never need use new object() in javascript. use object literal {} instead. similarly, don’t use new array(), use array literal [] instead. arrays in javascript work nothing arrays in java, , use of java-like syntax confuse you. do not use new number, new string, or new boolean. these forms produce unnecessary object wrappers. use simple literals instead. ............................... so rule simple: time should use new operator invoke pseudoclassical constructor function. when calling constructor function, use of new mandatory.

r - Fix range across choropleths in Shiny when using choroplethr package -

Image
i have simple shiny app, code @ bottom of question. the app allows @ years 2000, , 2001. in both cases, california darkest state, since has highest values (500 , 1000, respectively). my issue set scale colors fixed across both years. notice california has dark blue first year (corresponding value of 1000). notice california has exact same dark blue second year (corresponding value of 500). when looking @ choropleths stand, easy miss fact value dropped in half across years (and occurs in different ways other states, of course). way fix range across plots. how can achieve this? df <- structure(list(region = c("alabama", "alabama", "alaska", "alaska", "arizona", "arizona", "arkansas", "arkansas", "california", "california", "colorado", "colorado", "connecticut", "

when choose Float or Number types in Oracle -

i m reading table in oracle , m looking times using "float" type or "number" practicaly same value create table sensor_a ( sen_id number, sen_rating number, --here m wating 12,9984 sen_mont date, sen_value float(64), -- here im waiting 0,83387 ); so should choose float or number when want save number decimals , there case better use 1 or other? thanks in advance, enrique float alias number datatype in oracle. can choose of them, synonym of each other. see oracle docs : float [(p)] a subtype of number datatype having precision p. float value represented internally number. precision p can range 1 126 binary digits. float value requires 1 22 bytes.

mysql - how to insert values to a table with another table data using case statatement -

Image
have table "test_comparitive_analysis" column fields gender, , value. table "cmparitive_analysis_dup" column fields "boys" , "girls". problem want insert column values of "test_comparitive_analysis" "cmparitive_analysis_dup". condition if gender "f" "value" column data move "girls"column anf if "m" "value" column data move "boys" how can possible "create table if not exists `comparitive_analysis_dup` ( `cmb_id` int(5) not null auto_increment, `class_id` int(10) not null, `division` varchar(3) not null, `boys` varchar(100) not null, `girls` varchar(100) not null, `subject_name` varchar(20) not null, `exam_name` varchar(5) not null, `term_id` int(3) not null, primary key (`cmb_id`) ) engine=innodb default charset=latin1 auto_increment=1 ; " use 2 case (one

Rebus secondlevel retry, specify number of retry for message -

is possible specify / override number of second level retries, specific messages? some messages more important try execute others or need try on longer time period because of nature of message. out of box, there many 2nd level retries there 1st level retries. but you're asking , made me think this, think make more sense not have fixed number of 2nd level retries.... instead i'm thinking 2nd level mechanism should one single attempt of dispatching message handlers failed<tmessage> , , can defer message , count 2nd level delivery attempts in message header if like. what thoughts?

java - JSON Parser recommendation: Is there a JSON Parser which maintains order? -

i know json maintains order no longer json, requirement in use , throw code. have read other hacks replacing hashmap linkedhashmap in jsonobject.java file. wondering if there parser without modifications. you use streaming json parser, e.g. jackson , deliver tags finds it. of course means might have change program logic process json elements on fly.

scala - Write Parquet files from Spark RDD to dynamic folders -

given following snippet (spark version: 1.5.2): rdd.todf().write.mode(savemode.append).parquet(pathtostorage) which saves rdd data flattened parquet files, storage have structure like: country/ year/ yearmonth/ yearmonthday/ the data contains country column , timestamp one, started this method . however, since have timestamp in data, can't partition whole thing year/yearmonth/yearmonthday not columns per se... and this solution seemed pretty nice, except can't adapt parquet files... any idea? i figured out. in order path dynamically linked rdd, 1 first has create tuple rdd: rdd.map(model => (model.country, model)) then, records have parsed, retrieve distinct countries: val countries = rdd.map { case (country, model) => country } .distinct() .collect() now countries known, records can written according distinct country: countries.map { country => { val countryrdd = rdd.filter {

sequelize.js - How to set params in join table via setAssociation options in sequelize? -

i've defined schema of table name labels_association, associated labels , model x follows: 'use strict'; module.exports = { up: function(queryinterface, sequelize) { return queryinterface.createtable('labels_association', { labelid: { allownull: false, type: sequelize.integer }, associationid: { allownull: false, type: sequelize.integer }, associationtype: { allownull: false, type: sequelize.enum('x', 'y') } }); }, down: function(queryinterface) { return queryinterface.droptable('labels_association'); } }; defining has , belongs many relationship of model x labels via labels_association table x.belongstomany(label, { as: 'labels', through: { model: 'labels_association', attributes: ['associationid', 'associationtype'], scope: { associationtype: 'x' } }, foreign

What is the difference between unsing JAVA FX and SWING -

this question has answer here: swing vs javafx desktop applications [closed] 7 answers i using java swing develop application , should finish possible, design bad. found advice tells me should use java fx. difference between java fx , java swing ? there change on line of code? main difference release date... javafx more recent , can considered successor of swing. there many useful features added in javafx. see here key features : https://docs.oracle.com/javase/8/javafx/get-started-tutorial/jfx-overview.htm#a1131418 i can list main features me: styles can set css (something similar to) bindings: easy way bind ui-value, width of text of input, field in class. changing value of field updates ui without boilerplate animations/transitions: easy way make animation, ui components blinks or moves 3d: easy way manipulate model make animated 3d view for

ios - What is the difference between organic and non-organic App installs? -

i've read on different analytics website couldn't understand difference. companies charge non-organic installs i'm worried before using those. an organic install when user finds app interesting or useful , downloads or buys it. non-organic install when company rewards user installing app.

amazon web services - AWS Placement groups -

according aws placement group required able utilize 10gbps network performance. given instances required placed in same availability zone placement group, sounds risky. ex, unavailability of 1 availability zone bring down infrastructure. considering risk, why use placement group? placements groups, documentation states, applications needs fastest possible network speeds between instances, , because of instances can't span availability zones. however, because have of machines in placement group doesn't mean can't have duplicate set of machines in placement group in separate az or separate region dr / redundancy needs.

How to solve this ode equations in R? -

i solve following ordinary differential equations in r runge kutta method. dy1 <- (-51.33) * ((1-y[2]) / y[1]) dy2 <- 1.54 * y[1] * (1-y[2]) - 2.14 * y[2] when y1 becomes zero, dy1 become infinity. avoid this, need write r code stating when y[1] becomes less 0.001, stop y[1] derivative , keeps zero. pasted r code below: yini <- c(1,0) intabs <- function (t, y, parms) { ifelse (y[1] <= 0.01, dy1 <- 0, no) dy1 <- -51.33 * ((1-y[2]) / y[1]) dy2 <- 1.54 * y[1] * (1-y[2]) - 2.14 * y[2] list(c(dy1, dy2)) } times <- seq(from = 0, = 1, = .002) out <- ode (times = times, y=yini, func = intabs, parms = null, method = "rk4") head (out, n=50) i used ifelse statement denote y[1] less or equal 0.001, keep dy1 zero. i'm getting results. seems made error, brings results of dy1 in negative values. i'm new in writing programmes. please if spot error.. such jump in ode function (if correctly encoded) poison step siz

Creating a batch file to look up another file -

i learning batch language , stuck. want create batch file ask directory enter location of hi.txt: once user inputs location check whether location correct or not searching file hi.txt . if finds it echo file found ! , move next block of code however if not find return error hi.txt not found , again ask directory. searched on net results either of searching file or asking simple questions. , if answer, please tell me code in answer can understand , it. edit: least tried set /p pathname=enter key:%=% thanks & regards,

spring - Application properly deployed on Wildfly but showing blank page -

i have deployed application in wildfly v8 , v9 running on modules jsf, webservices. using default class loading sequence , not doing additional configuration. issue facing deployment has success completed when access webpage blank. has experienced before. please assist. thanks.

java - SpagoBI/BIRT JDBC connection -

i made datasource connection in spagobi using jdbc connection [com.mysql.jdbc.driver ( v5.0)] connection succesfull.then start build new data set. see tables in database. when click preview results getting error. error happened while running report: org.eclipse.birt.report.engine.api.engineexception: error happened while running report. @ org.eclipse.birt.report.engine.api.impl.datasetpreviewtask.dorun(datasetpreviewtask.java:135) @ org.eclipse.birt.report.engine.api.impl.datasetpreviewtask.rundataset(datasetpreviewtask.java:97) @ org.eclipse.birt.report.engine.api.impl.datasetpreviewtask.execute(datasetpreviewtask.java:49) @ org.eclipse.birt.report.designer.data.ui.dataset.datasetpreviewer.preview(datasetpreviewer.java:69) @ org.eclipse.birt.report.designer.data.ui.dataset.resultsetpreviewpage$5.run(resultsetpreviewpage.java:336) @ org.eclipse.jface.operation.modalcontext$modalcontextthread.run(modalcontext.java:121) caused by: org.eclipse.birt.data.eng