Posts

java - Why is there a "deadbranch" in my code? -

below code working fine until last if-else. appears i've done wrong boolean variables cangraduate , onprobation. perhaps i'm reassigning them incorrectly in prior if-else statements. deadbranch occurs @ else half of last if-else. package lab5; import java.util.scanner; public class lab5 { public static void main(string[] args) { //creates scanner object scanner scanner = new scanner(system.in); //part ii //creating variables double gpa; int totalcreditstaken; int mathsciencecredits; int liberalartscredits; int electivecredits; boolean cangraduate = true; boolean onprobation = false; //prompts user imput system.out.println("what gpa?"); gpa = scanner.nextdouble(); system.out.println("what's total amount of credits you've taken?"); totalcreditstaken = scanner.nextint(); system.out.println("how many math , science credits have taken?"); mathsciencecre...

c - Calling close() on a valid file descriptor for a COM port blocks forever if the device has been powered off on Mac OS X -

i'm writing application in c on mac os x communicates bluetooth device using com ports. if bluetooth device powered off after connection has been made, subsequent calls close block indefinitely. note using aio_read , aio_write read , write device. if device left powered on, close succeeds expected. example: /* open com port */ int fd = open (g_comname, o_rdwr | o_noctty | o_async ); /* ensure fd valid, work, power off bluetooth device */ /* wait until aysnc io complete */ while (aio_cancel(fd, null) == aio_notcanceled) {} /* application hang here */ close(fd); what doing wrong? guess os waiting confirmation device, never gets anything. there anyway force close connection? edit: as suggested, setting o_nonblock did trick: fcntl(fd, f_setfl, o_async)

permissions - PhpStorm 9: Why doesn't the remote path's directories/files display when connected via FTP -

Image
i trying connect remote host in phpstorm 9 via ftp , connects host not display files/directories. i able ftp , see files/directories fine via filezilla same ftp profile/settings used in phpstorm 9. why not able see files/directories via ftp in phpstorm 9? try switching between active ans passive ftp modes (option located in advanced options dialog of deployment settings/preferences page.

php - Why is APCu segfaulting inside a Docker container? -

i'm trying run php 5.5 (with fpm) apcu inside docker container. i'm using boot2docker on osx. when try run php-fpm -i , segfaults. running in gdb , following backtrace: (gdb) run -i starting program: /usr/local/sbin/php-fpm -i [thread debugging using libthread_db enabled] using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". program received signal sigsegv, segmentation fault. 0x00007ffff542474c in __pthread_rwlock_init (rwlock=rwlock@entry=0xffffffffffffffff, attr=attr@entry=0x7ffff1bda988 <apc_lock_attr>) @ pthread_rwlock_init.c:40 40 pthread_rwlock_init.c: no such file or directory. (gdb) bt #0 0x00007ffff542474c in __pthread_rwlock_init (rwlock=rwlock@entry=0xffffffffffffffff, attr=attr@entry=0x7ffff1bda988 <apc_lock_attr>) @ pthread_rwlock_init.c:40 #1 0x00007ffff19ca9d0 in apc_lock_create (lock=lock@entry=0xffffffffffffffff) @ /tmp/pear/temp/apcu/apc_lock.c:180 #2 0x00007ffff19d0135 in apc_sma_api_init (sma=0x7fff...

java - Having trouble removing from a queue and adding to another -

i have input file containing many strings , ints. ex. blah 40 hello 10 asdf 20 etc... i have read them queue hold them. need take them out of queue , add priority queue whenever int equals ints in data file. this have far.. for(int = 0; i<=50; i++) { object x = normalqueue.dequeue(); //this makes x equal line of data file dequeued. if(i == x.secondint) //secondint objects method gets integer in data file { pqueue.insert(x); //inserts x pqueue if = second int in data file } else { normalqueue.enqueue(x); //adds x queue1 normalqueue.switchends(); //swaps 1st , last node } } the problem having is printing out 2 files of data file. i'm not quite sure intend happen when running code, happen this: given following input: blah 40 hello 10 asdf 20 (i'm assuming add elements of queue when reading file, ordering data-file retained) in first 40 iterations of loop taking "blah 40" out o...

unity3d - Why is my Object not filled -

i trying create select object script in unity. what should when hover on object colors red (and does) , when press "1" gameobject's targethighlighted filled object hovering on @ moment. in debug.log works fine, targethighlighted is filled. when press "1" targethighlighted object still left empty. doesn't matter if press while hovering on object or away it. my full code more extensive this. section of code contains problem, reduced this. can explain me how come when press "1" the debug.log doesn't show targethighlighted or targetselected ? basically why mouseenter , mouseexit log right object, settarget function doesn't? using unityengine; using system.collections; public class targetselectionscript: monobehaviour { // store current selected gameobject gameobject targethighlighted; renderer rend; color initialcolor = color.white; color selectedcolor = color.red; public gamecontrollerscript gam...

java - maven 3.3 support for Websphere 8.5.5 - pom.xml -

i not find way deploy war file in websphere 8.5.5 using maven's pom.xml. see there plugin called was6-maven-plugin-1.2.1. , can support 6+, 7+, 8+ seems. but not deploy war file using plugin. throws following error. [error] failed execute goal org.codehaus.mojo:was6-maven-plugin:1.2.1:installapp (default-cli) on project test: bad archive: c:\test.war -> [help 1] please comment on... my pom.xml configuration fyr: <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>was6-maven-plugin</artifactid> <version>1.2.1</version> <executions> <execution> <id>integration-test</id> <phase>integration-test</phase> <goals> <goal>installapp</goal> </goals> </execution> </executions> <configuratio...

javascript - Same Height DIV's using NG-Repeat -

i'm having issue trying 2 divs side side same height when content each of divs generated using ng-repeat. flex box stops site being responsive , can't work out when suitable time call jquery function views nested , page doesn't load when new html displayed. have tried ng-repeat-start , end no avail. ideally once content has loaded div on right same height div on left. appreciate problem. cheers edit - code included <div class="row"> <div class="nospacing col-xs-6"> <div class="col-xs-12 nospacing rottnestgreen"> <div ng-repeat="bh in bikehire" class="row"> <p class="col-xs-6">{{bh.type}}</p> <select class="inline col-xs-3 nospacing np" ng-model="bikehire[$index].quantity" ng-options="ddl ddl in ddlnumbers" ng-change="addops(bh.type, bikehire[$index].q...

javascript - When shall one make a function return a promise? -

i'm getting generators , promises , i've kind of gotten handle of how work. it's time make own functions utilize these. there guides out there explaining how make them , discuss appropriate times when 1 should used. i know has lie promises generators code writing synchronous (among other things). so question is: when should , when should not promisify function have? from understanding if cpu being utilized 100% function should not promisify there no point. if cpu being blocked , waiting external such waiting download guess should promisify function. promises should used when have asynchronous operations want execute in sequence. operations costly, writing file/db, making request service, forth, have asynchronous api, since doing synchronously block single-threaded javascript application. in cases, either use promises cleaner code, use named functions , explicitly call them 1 after other callbacks or don't use , have pyramid of doom full of callbac...

ios - No 750x1334 Launch Image option available in Xamarin for iPhone 6s? -

title pretty explains itself. under info.plist have options add 320x480, 640x960, , 640x1136 launch images, developing iphone 6s....is 640x1136 1 want or there kind of bug no 750x1334 option showing? you need set of launch images in info.plist, should use new storyboard or xib launch screen option: https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/ to set images need use asset catalog: https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/#managing_launch_screens_with_asset_catalogs or can specify in info.plist manually: http://conceptdev.blogspot.com/2014/09/iphone-6-and-6-plus-launch-images-for.html

html - How to create new top headers for weebly -

on weebly.com same 4 headers landing page, no header, small header, large header... how go summing of them 1 header of own similar website? https://www.revivalgame.com/ they have 1 overall header , navigated pages show beneath it. weebly capable of through it's html/css? a quick google search revealed weebly indeed have html/css editor. for example, header image css rule similar this: .wsite-header { background: transparent url(%%headerimg%%) no-repeat center top; width:750px; height:250px; } check out link: weebly custom editor

parsing - java.text.ParseException: Unparseable date "yyyy-MM-dd'T'HH:mm:ss.SSSZ" - SimpleDateFormat -

i appreciate finding bug exception: java.text.parseexception: unparseable date: "2007-09-25t15:40:51.0000000z" and following code: simpledateformat sdf = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sssz"); date date = sdf.parse(timevalue); long mills = date.gettime(); this.point.time = string.valueof(mills); it throws expcetion date date = sdf.parse(timevalue); . timevalue = "2007-09-25t15:40:51.0000000z"; , in exception. thanks. z represents timezone character. needs quoted: simpledateformat sdf = new simpledateformat("yyyy-mm-dd't'hh:mm:ss.sss'z'");

windows - How to fill the page and adjust text position according to resize -

i'm new xaml , windows 10 gui programming. want design page textblock, listbox , button, centered in page. want textblock , button reside @ top , bottom of page no matter how users resize window. listbox should stretch fill gap between textblock , listbox automatically. have tried set verticalalignment different value, doesn't seem anything. <page x:class="firstwin10.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:firstwin10" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d"> <stackpanel background="{themeresource applicationpagebackgroundthemebrush}" orientation="vertical"> <textblock x:name="textblock" horizontalalignment="center" margin="1...

multithreading - My message loop in thread is not getting any messages -

i have created thread, want listen mouse messages app receives. however peekmessage never returning true. tried min , max filter of 0. here message loop: peekmessage(lmessage, null, 0, 0, pm_noremove); while (true) { var rez = peekmessage(lmessage, null, 0, 0, pm_remove) if (rez) { // console.log('peekmessage true'); } sleep 1000; } // console.log('message loop eneded'); as hwnd null thought should receive messages window in app, im not getting though. know whats up? i tried getmessage approach: var rez = getmessage(lmessage, null, 0, 0); console.log('rez:', rez); however hangs , never gets console.log . thanks the documentation peekmessage says: if hwnd null, peekmessage retrieves messages window belongs current thread , , messages on current thread's message queue hwnd value null. [emphasis added] a similar note in getmessage documentation. the call getmessage stalls because the...

c# - How do you reference the executing assembly in DNX Core 5.0 (ASP.NET 5)? -

i porting code .net 3.5 - 4.5. inside of assembly, have code reads resource executing assembly. however, getexecutingassembly() isn't method on assembly type in dnx core 5.0. var xsdstream = assembly.getexecutingassembly().getmanifestresourcestream(xsdpath); what equivalent of assembly.getexecutingassembly() in dnx core 5.0? or if need namespace method (an extension method perhaps?), namespace? typeof(<a type in assembly>).gettypeinfo().assembly

android - Calling stopService in onActivityResult() is not effective -

in onactivityresult, wanted stop , restart service. i'm not able stop service code below. if (requestcode == device_selection) { if(resultcode == result_ok) { intent = new intent(this, myservice.class); stopservice(i); } } in debugging mode, able reach stopservice() line, app never calls ondestroy() of myservice class (which extends service class) , service not destroyed. does have idea why case? my service can started , able destroy service when stopservice() called in ondestroy() method of activity indicates me service class implemented correctly. you need cache intent have started service use same intent stop service, work for example lets intent = new intent(this, myservice.class); intent used start service startservice(i) , use same intent stop it. don't create new intent.

c++ - read string into array -

i want read string integers , whitespaces array. example have string looks 1 2 3 4 5, , want convert integer array arr[5]={1, 2, 3, 4, 5}. how should that? i tried delete whitespaces, assign whole 12345 every array element. if don't element assigned 1. for (int = 0; < str.length(); i++){ if (str[i] == ' ') str.erase(i, 1); } (int j = 0; j < size; j++){ // size given arr[j] = atoi(str.c_str()); } a couple of notes: use std::vector . never know size of input @ compile time. if do, use std::array . if have c++11 available you, maybe think stoi or stol , throw upon failed conversion you accomplish task std::stringstream allow treat std::string std::istream std::cin . recommend way alternatively, go hard route , attempt tokenize std::string based on ' ' delimiter, appears trying do. finally, why reinvent wheel if go tokenization route? use boost's split function. stri...

java - Android app won't build - Fails with an exception -

in android studio, when try build app nothing base activity in it, i'm presented error says: execution failed task ':app:packagedebug'. > implementing class someone told me give them stack trace, later didn't respond. when used --stacktrace when building, i'm presented this: * exception is: org.gradle.api.tasks.taskexecutionexception: execution failed task ':app:packagedebug'. @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:69) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:46) @ org.gradle.api.internal.tasks.execution.postexecutionanalysistaskexecuter.execute(postexecutionanalysistaskexecuter.java:35) @ org.gradle.api.internal.tasks.execution.skipuptodatetaskexecuter.execute(skipuptodatetaskexecuter.java:64) @ org.gradle.api.internal.tasks.execution.validatingtaskexecuter.execute(validatingtaskexecuter.java:58) @ org...

java - Data does not appear in javafx Table View -

im trying make gui program using javafx. program supposed take data csv file, store in public list , display in javafx tableview in gui controller class. here controller code package controllers; import java.io.ioexception; import java.net.url; import java.util.resourcebundle; import javafx.collections.fxcollections; import javafx.collections.observablelist; import javafx.event.actionevent; import javafx.fxml.fxml; import javafx.fxml.fxmlloader; import javafx.fxml.initializable; import javafx.scene.parent; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.tablecolumn; import javafx.scene.control.tableview; import javafx.scene.control.cell.propertyvaluefactory; import javafx.stage.stage; import application.main; import application.tablaest; public class controllerver1 implements initializable { public stage stage = new stage(); private observablelist<tablaest> data = fxcollections.observablearraylist(); @fxml ...

android - Converting Facebook ProfilePictureView to bitmap to use in ImageView -

i trying convert profile image returned facebook , change bitmap can use in method requires bitmap. i'm able profile picture using code below , put profilepictureview. created 2 other views testing...a circleimageview , imageview. far profilepictureview shows image. here example of code tried, although have tried several methods i've found on web create bitmap , none have worked. suggestions/solutions appreciated! profilepictureview profilepictureview; profilepictureview = (profilepictureview) findviewbyid(r.id.facebookpictureview); profilepictureview.setprofileid(userid); //this works , set profile pic standardimageview = (imageview) findviewbyid(r.id.imageview); circleimageview = (circleimageview) findviewbyid(r.id.profimage); asynctask<void, void, bitmap> t = new asynctask<void, void, bitmap>() { protected bitmap doinbackground(void... p) { bitmap bmp = null; try { url aurl = ne...