Posts

Showing posts from April, 2015

java - How to update files in a project and on other computers -

i have several jar dependency files in workspace. make these jars updated recent version in both workspace , several virtual machine nodes have scattered on network. for workspace believe can use maven accomplish this, not sure how can make files on nodes update along side ones in workspace. does know of way done automatically? thanks hints. side note: i'm asking general question, in case there needs more specifics let me know. working selenium nodes , hubs.

c - Dynamic array of Strings inside a Struct realloc -

i have array of strings inside struct looks this #define id_len 20 struct person{ char name[id_len]; int num_items; char **items; }; int main(){ int num_persons = 10; struct person *ptr[num_persons]; i start array of 10 persons. persons have 0 items list of items malloc(0). for(int = 0; < num_persons; i++){ ptr[i] = (struct person *) malloc(sizeof(struct person) + 1); ptr[i]->num_items = 0; ptr[i]->items = malloc(0 * sizeof(char*)); } at point want name persons , add them items this. strcpy(ptr[0]->name, "john"); ptr[0]->num_items = 1; ptr[0]->items = (char **)realloc(ptr[0]->items, ptr[0]->num_items * sizeof(char*)); strcpy(ptr[0]->items[0], "pencil"); printf("name: %s\n", ptr[0]->name); printf("number of items: %d\n", ptr[0]->num_items); for(int = 0; < ptr[0]->num_items; i++){ printf("item %d %s\n", i, ptr[0]->items[i]); } i'm getting segment...

c - LCD only showing black blocks when built - *** simulation on Proteus works fine *** -

i coding program displays time on lcd. i'm using lm016l (16x2 lcd display) simulations works fine in proteus when build it not work , on powering lcd shows black blocks across whole top row. using mcc18 complier. using pic18f2620 have tried pic18f4520 still having same issues. using ds1307 real time clock , crystal real time clock (not sure if matters). assuming pic working correctly because when press button in circuit led lights lcd still remains nothing display black blocks. have tried adjusting manual contrast of lcd no luck. here frame.c lcd initialised , used #include <xlcd.h> #include <delays.h> #include "frame.h" #include "misc.h" #include "i2c.h" #include "eeprom.h" void initlcd() { openxlcd(four_bit & lines_5x7); while (busyxlcd()); writecmdxlcd(0x06); // entry mode (increment ddraam loc) writecmdxlcd(0b00001100); } void splash(int* frame) { int c; ...

c# - PRogrammaticaly Add ContentTemplate to TabControl -

Image
while may seem trivial, i'm having hard time it. i have tabcontrol <tabcontrol x:name="tcprovince" margin="2" itemssource="{binding path=workingentity.rates.codebyprovincecollection, mode=oneway}" selectionchanged="tcprovince_selectionchanged" > <tabcontrol.contenttemplate> <datatemplate> <max:maxgrid> <max:maxgrid.rowdefinitions> </max:maxgrid.rowdefinitions> <max:maxgrid.columndefinitions> </max:maxgrid.columndefinitions> </max:maxgrid> </datatemplate> </tabcontrol.contenttemplate> </tabcontrol> this generate tab : then inside of each tab want create dynamic grid : +-------+-------+--------+-------+ | 2016 | 2017 | 2018 | 2019 | +-------+-------+--------+-------+ | xxx | xxxx| xxx...

javascript - How do I hide a opt-in script from logged in users? -

i run membership site , have script shows opt-in pop form after visitors on page more 10 seconds. however, pop-up shows public uses our paid members. how can wrap pop-up <script> in custom javascript code detect presence of "logged-in" body class? if found, script should not fire. if (document.queryselectorall('.logged-in').length) { // worst (here) } you can use queryselectorall function search dom object on page. , if exists run code. might better though have backend handle part , load js logged in users when user actually logged in

Rails LIKE query using mysql -

i'm trying query matching substrings. used this: products = product.where("title ? or description ?", "%#{params[:s_term]}%", "%#{params[:s_term]}%") which worked great sqlite3 (not worried sql injection right now). however, switched mysql, , when perform query whines encoding::undefinedconversionerror ("\xc2" ascii-8bit utf-8): because of '%' in query. there way me escape or differently in query? after odesy of encoding "adventures", problem turned out file "importing" database contained strings not utf8 , ascii compatible (the problem character: Â). in function using add strings database, used keep these characters entering db: thestring.gsub(/\p{ascii}/, '').encode('utf-8') now can sure in database encoded correctly , searches not return results rails cannot handle encoding reasons! an alternative may : thestring.delete!("^\u{0000}-\u{007f}").encode('utf-8...

sql - Any way to distinguish the cases of 0 affected row of MYSQL update? -

suppose have table named 't' --------------- | key | value | --------------- | 1 | abc | | 2 | def | --------------- consider 2 mysql queries update t set value='abc' key=1 update t set value='abc' key=3 executing both queries give 'affected rows' 0 (that is, not update row) because first query non-updating update , second non-matching update. is there way distinguish these 2 cases? if want number of 'matched' rows (and no longer number of 'changed' rows), can set client_found_rows described here: http://dev.mysql.com/doc/refman/5.5/en/mysql-affected-rows.html for update statements, affected-rows value default number of rows changed. if specify client_found_rows flag mysql_real_connect() when connecting mysqld, affected-rows value number of rows “found”; is, matched clause.

html - CSS Image Slider not working after adding 6 photos -

i using responsive css image slider from: https://codepen.io/dudleystorey/pen/ehkpi it worked fine when used 2, 4, or 5 pics. however, when tried using 6 photos first , last photo stack together, last slide blank, , slides between have white space under them. the following css code after revised it: @keyframes slidy{ 0% { left: 0%; } 9.09% { left: 0%; } 18.18% { left: -100%; } 27.27% { left: -100%; } 36.36% { left: -200%; } 45.45% { left: -200%; } 54.54% { left: -300%; } 63.63% { left: -300%; } 72.72% { left: -400%; } 81.81% { left: -400%; } 90.90% { left: -500%; } 100% { left: -500%; } } .slide { margin: 0 auto ; max-width: 700px; overflow: hidden; border-style: solid; border-width: 5px; border-color: #f6a51c; } .slide figure { position: relative; width: 500%; margin: 0 auto; animation: 30s slidy infinite; } .slide figure img { width: 20%; float: left; } the following html code after revised it: <div class="slide"> <figure> <img src="http:...

Implementing MiniMax Algorithm IN JAVA plus random heuristic -

i trying implement minimax algorithm scratch in java. general point known all, through tree try find best possible move. dont have crucial code show now, first give me general approach can start project , update post code. in addition going implement random heuristic game, in random choose next move , pass game, added later on. i adding bounty on question. p.s. this not duplicate, dont want copy else's code, have whole code on own. so main thinking follow following: calculate best move given game field , rating mechanism field input field calculate ratingmechanisms mechanism rate move , return best move. in more in depth analysis: key minimax algorithm , forth between 2 players, player "turn is" desires pick move maximum score. in turn, scores each of available moves determined opposing player deciding of available moves has minimum score. , scores opposing players moves again determined turn-taking player trying maximize score , on way down move...

jquery - Hamburger menu to close upon clicking links -

i have created simple hamburger menu close when click on 1 of links not know how this. html is: <nav> <div class="nav_top"> <div class="nav_logo"> <img src="images/nav_logo.png"> </div> <!-- end of nav_logo --> </div> <!-- end of nav_top --> <div class="hamburger" id="hamburger"> <img src="images/hamburger.svg"> </div> <div class="list-items"> <ul> <li><a href="#welcome">welcome</a></li> <li><a href="#venue">venue</a></li> <li><a href="#accommodation">accommodation</a></li> <li><a href=...

windows - Search multiple folder to check if they are empty using powershell -

i have bunch of directories c:\ri1 c:\ri2 c:\ri3 ... c:\ri21 how can check if empty? want go further script if 1 or more of them have files. if not, want exit. tried searching folder names , giving me 21 answer $directoryinfo = get-childitem c:\ri* | measure-object $directoryinfo.count if ($directoryinfo.count -eq 0) { write-host "empty" } else { write-host "not empty" } when run get-childitem c:\ri* child items in c:\ , filter results items begin "ri". answer 21 since there 21 folders in c:\ starts "ri". i suggest run through folders using foreach loop. $folders = @("ri1", "ri2", "ri3") foreach ($folder in $folders) { $path = "c:\$folder" $directoryinfo = get-childitem $path if ($directoryinfo.count -eq 0) { write-host "empty" } else { write-host "not empty" } }

java - Converting an image to byte[] by using PDFBox -

i using pdfbox 2.0. while parsing pdf document, want first page image , store hbase using in search results(i going create search list page search page of amazon.com). hbase accepts byte[] variable store(index) value. need convert image byte[], store hbase. have implemented image render, how can convert byte[]? pddocument document = pddocument.load(file, ""); bufferedimage image = null; try { pdfrenderer pdfrenderer = new pdfrenderer(document); if (document.isencrypted()) { try { system.out.println("trying decrypt...); document.setallsecuritytoberemoved(true); system.out.println("the file has been decrypted in ."); } catch (exception e) { throw new exception("cannot decrypted. ", e); } } pdpage firstpage = (pdpage) document.getdocu...

javascript - How to bind foreign key kendo ui dropdownlist (with angular) -

i working kendo ui , angular grid application. grid populated json data (separate file) , use angular service: my json data: [ { "id": 1, "accountno": "10236", "postingdate": "20.01.2015", "maturitydate": "24.01.2015", "description": "description1", "documenttypeid": 1 }, { "id": 2, "accountno": "10648", "postingdate": "26.01.2015", "maturitydate": "28.01.2015", "description": "description2", "documenttypeid": 2 }, { "id": 3, "accountno": "10700", "postingdate": "22.01.2015", "maturitydate": "25.01.2015", "description": "description3", "documenttypeid": 3 }, { "id": 4, "accountno": "10810", "postingdate": "24.01.2015", "mat...

How can I wrap a line at 80 characters in Markdown? -

i'm writing basic readme.md documentation @ company. i'd wrap each line of text @ 80 characters, don't know how. @ present, extends way right of page. do need table? i'd ideally not modify each separate line. there way wrap entire paragraph? according this , need type double space followed carriage return. modern text editors let know column you're on. the quickest, easiest way use notepad++. select text wish wrap , use menu option textfx -> textfx edit -> rewrap text (clipboard or 72) width .

sql server - PHP/MSSQL Connection -

i have following code doesn't seem make connection mssql db: <?php $servername = "sever_name\sqlexpress"; //servername\instancename $connectioninfo = array( "database"=>"testdb", "uid"=>"server_name\administrator", "pwd"=>"password123"); $conn = sqlsrv_connect( $servername, $connectioninfo); if( $conn ) { echo "connection established.<br />"; } else{ echo "connection not established.<br />"; die( print_r( sqlsrv_errors(), true)); } ?> the message reads login failed user server_name\administrator, that's see in sql server management studio when check db properties. appreciated. the login name looks suspiciously sql server using windows authentication. if script , sql server on same machine, try omitting uid , pwd entirely, per documentation . if values uid , pwd keys not...

javascript - Jasmine spyOn on ReactTestUtils.Simulate.click test is failed -

trying test react component, using karma+jasmine, i'm trying check function onclick handler invoked, test return false result: `expected spy reportloginwithemail have been called.` here component: <a classname="sign-in-with-email" onclick={this.signinwithemail}> or sign in email </a> signinwithemail handler: signinwithemail = (event) => { event.preventdefault(); this.setstate({ isemailsignin: true }); biactions.reportloginwithemail(); }; test: describe('signin', () => { let component, biactions; beforeeach(() => { component = testutils.renderintodocument(<signin/>); biactions = require('../../../actions/biactions'); spyon(biactions, 'reportloginwithemail'); }); it('test clicking on login email call function', () => { let signinemail = testutils.findrendereddomcomponentwithclass(component, 'sign-in-with-email'); testutils.simulate....

R: ggplot does not work if it is inside a for loop although it works outside of it -

this question has answer here: can't print pdf ggplot charts [duplicate] 2 answers i'm using simple ggplot function works fine outside loop not inside if iterative value not interfere ggplot function. why ? here code x=1:7 y=1:7 df = data.frame(x=x,y=y) ggplot(df,aes(x,y))+geom_point() it works ! if ggplot inside loop ... for (i in 1:5) { ggplot(df,aes(x,y))+geom_point() } ... doesn't work anymore ! missing ? thank you when in for loop, have explicitly print  your resulting ggplot object : for (i in 1:5) { print(ggplot(df,aes(x,y))+geom_point()) }

Upgrading to latest Createjs version from May 2013 version -

this standard boiler plate using: var stage = new createjs.stage("canvas1"); createjs.ticker.addeventlistener("tick",stage); stage.enablemouseover(); ... createjs.ticker.setfps(12); createjs.ticker.addlistener(stage,false); apparently createjs.ticker.addlistener no longer supported. how should above code changed? your example shows both correct , deprecated usage. // old createjs.ticker.addlistener(stage,false); // new createjs.ticker.addeventlistener("tick", stage); the changes make ticker use same event dispatcher pattern rest of createjs does. additionally, framerate method has changed setter: // old createjs.ticker.setfps(12); // new createjs.ticker.framerate = 12; it depend on version use of easeljs. updated demo posted latest version using changes: http://jsfiddle.net/lannymcnie/aprdf/80/ unfortunately there still demos out there out-of-date code. let me know if have other questions.

java - How to detect whitespace of operator -

i have problem code. i want detect whitespace of operator " + " , " +" , "+ " or "+" . i want output whitespace of operator "a" how can modify code? my code here. scanner input = new scanner (new file(path file)); int plus1; int plus2; int plus3; int plus4; string splus = ""; while (in.hasnext()) { string line = in.nextline(); in.hasnextline(); loc++; if (line.length() > 0) { plus1 = -1; plus2 = -1; plus3 = -1; plus4 = -1; while (true) { plus1 = line.indexof(" + ", plus1 + 1); plus2 = line.indexof(" +", plus2 + 1); plus3 = line.indexof("+ ", plus3 + 1); plus4 = line.indexof("+", plus4 + 1); if (plus1 > 0) { splus = "a"; } if (plus2 > 0) { splus = "b"; } ...

java - Async and Google Maps -

here: async , listview android i asked async , listview. have problem async , maps. want set marker json returns async. unfortunately, set default values , not want to. can help public class markerinfo extends fragmentactivity implements onmapreadycallback { private googlemap mmap; private latlng sydney; private string longituide; private string latitude; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_marker_info); supportmapfragment mapfragment = (supportmapfragment) getsupportfragmentmanager() .findfragmentbyid(r.id.map); mapfragment.getmapasync(this); bundle bundle_list = getintent().getextras(); final string name_item = bundle_list.getstring("name"); jsonobject tosend = new jsonobject(); try { tosend.put("action", "getallmarkers"); } catch (jsonexception e) { e.printstacktrace(); } json...

java - Can I Create Object For Interface? -

is possible creating object interface, if yes how can we? according view following code says can: runnable r= new runnable(){ // implementation } this not creating instance of interface, creating class implements interface. when write runnable runnable = new runnable() { @override public void run() { // todo auto-generated method stub } }; you creating class implementing runnable interface. need follow rules here, here, overriding run method runnable there similar thing abstract class also. can test using example public abstract class abstractclass { public void somemethod(){ system.out.println("abstract class"); } } and class i.e. testclass public class testclass { public static void main(string[] args) { abstractclass abstractclass = new abstractclass() { public void somemethod() { system.out.println("concrete class method"); ...

sharing - Apps crashed when sending an image android ShareCompat and FileProvider -

the relevant apps appear on screen share when select 1 of them, selected app crashes. whatsapp says "file format not supported". file imagefile = new file(imagepath); // image path mediastore uri contenturi = fileprovider.geturiforfile( this, "my.app.fileprovider", imagefile); intent shareintent = sharecompat.intentbuilder.from(this) .settype(getcontentresolver().gettype(contenturi)) .setstream(contenturi) .getintent(); shareintent.setdata(contenturi); shareintent.setflags( intent.flag_grant_read_uri_permission); if (shareintent.resolveactivity(getpackagemanager()) != null) { startactivity(intent.createchooser(shareintent, "select app")); }

database - postgresql won't accept a specific key -

so i'm using postgresql 9.5 store bunch of data in table named ids. data stored : id1 (unique, not null) | bool1 | bool2 | bool3 | id2 (not unique) id1 , id2 text variables. when try insert new data database use query : "insert ids (id1, bool2, id2) values (%s, true, %s) on conflict (id1) update set interaction = true, id2 = %s;" now when try insert specific id1 : c1316a6a-3bdd-4aeb-a1b6-b3044851880a__19 unique (i double checked that) database hangs. while using python , psycopg2 call query, if try insert key database hand (by connecting database via cli or gui) database still hangs. however, if create similar database , use exact same command, works fine. any ideas why hangs , how fix ? edit : thank you, a_horse_with_no_name it indeed waiting transaction. killed pid , worked fine afterwards. thanks again

gcc - g++ in red hat devtoolset-3 cannot find -lelf -

hi i'm running devtoolset-3 on centos 6.5. when run g++, ld fails because can't find -lelf i compiled -v flag find library path g++ using find libraries, , have moved libelf.so each of these folders still not working. i wondering if had ideas? -lelf not libelf.so? should file in place else besides library paths? thanks! finding package provides libelf.so : # yum provides libelf.so # yum install elfutils-libelf-devel

Java Spring MVC: After controller forwards, browser shows url from old controller, not url of controller to which it forwards -

after successful login, controller method below forwards controller serve model , view. works fines -- browser's url shows " http://localhost:8080/appname/loginsuccessforward " after forward completes, though it's displaying view forwarded controller. is there way browser show forwarded controller's url? if it's working i'd like, user either see " http://localhost:8080/appname/l/l/profile " or " http://localhost:8080/appname/t/t/profile " in browser, depending on class of user or is. @requestmapping("/loginsuccessforward") public string loginforward(principal principal){ if (principal == null){ return "/"; } else { if (user1service.getuser(principal.getname()) != null){ return "forward:/t/t/profile"; } else if (user2service.getuser(principal.getname()) != null){ return "forward:/l/l/profile"; } else { return "...

twitter bootstrap - jQuery is not working with Chaplin -

i working in backbone framework - chaplin using following list of files: following of code block in main.js: paths: { jquery: 'vendors/jquery/jquery', underscore: 'vendors/underscore/underscore', backbone: 'vendors/backbone/backbone', chaplin: 'vendors/chaplin-0.9.0', bootstrap: 'vendors/bootstrap/js/bootstrap.min', jqtriggers: 'lib/jquery-triggers' }, shim: { underscore: { exports: '_' }, backbone: { deps: ['jquery','underscore'], exports: 'backbone' }, bootstrap: { deps: ['jquery'] }, jqtriggers: { deps: ['jquery'] } } following contents in jquery-triggers.js define(['jquery'], function($) { $('.dropdown-toggle').dropdown(); }); following code block of...

ios - Can I bypass UIActivityViewController but still somehow use its target-specific share logic? -

i've got app sharing fine through uiactivityviewcontroller, want instead add explicit facebook, twitter, etc. share buttons interface. want bypass uiactivityviewcontroller popover allows pick share target, facebook, , instead go straight same share mechanism uiactivityviewcontoller goes when hit facebook button. don't see documentation how that. i understand can recreate mechanism entirely, don't want that. i'm sharing video , using charles (network traffic monitoring tool) see there no less 11 graph api calls during entire process. not mention existing behavior if you're not logged fb app, don't have fb app installed logged in in ios settings, etc. i'd prefer not recreate working purposes. i have 2 reasons wanting bypass uiactivityviewcontroller. first make share buttons more accessible. secondly efficiency: i've captured camera frames , share them animated gif targets movie facebook (since fb can't handle animated gif). process of making mo...

c# - Rotating object breaks limitations/Bounds -

i use following logic rotate object around object , set conditions not exceed 90 degrees or under 1. protected void rotationbounds(){ brotatedown = true; brotateup = true; if (_cannontube.transform.rotation.eulerangles.z >= 90) brotateup = false; if (_cannontube.transform.rotation.eulerangles.z <= 1) brotatedown = false; } this allows me stop the rotation in direction once condition hit. apply rotation following mouse movement controls: protected void rotatecannonmouse(){ if (input.getkey ("mouse 0")) { if (input.getaxis ("mouse y") > 0 && brotateup == true && brotatedown == true || input.getaxis ("mouse y") > 0 && brotateup == false && brotatedown == true) { transform.rotatearound (_spherebase.position, -transform.forward, input.getaxis ("mouse y") * 15); } if (input.getaxis ("mouse y") <...

angularjs - Good framework for text editing in web app (Angular/Rails web app) -

first of all, sorry not having programming related questions, stackoverflow website ask these! im building web app. using angular front-end , rails backend. put front-end inside of rails app, in same project now. i looking & simple text editor web app now. functionalities i'm looking for: retrieve template letter project file system(meaning have default template letter in web app) text-editor in front-end. edit template letter using text-editor , save change. saved changes should saved in new word file format in file system. means there 2 files: default template letter , newly edited letter file). all files should saved in word file. i'm not looking text-editor rich functionalities minimum level (making text bold, aligning text, making list etc, change font color) is there framework out there purposes? found bunch of text editors not purpose! i suggest gem 'ckeditor'.

What login name to use for Spring LDAP authentication -

Image
i created local ldap server , added user "djiao" password "123456 trying implement authentication spring security spring boot. webconfig class follows: @configuration @enablewebsecurity public class websecurityconfig extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http .authorizerequests() .anyrequest() .authenticated() .and() .formlogin(); } @bean public activedirectoryldapauthenticationprovider activedirectoryldapauthenticationprovider() { activedirectoryldapauthenticationprovider provider = new activedirectoryldapauthenticationprovider("", "ldap://localhost:10389"); provider.setconvertsuberrorcodestoexceptions(true); provider.setconvertsuberrorcodestoexceptions(true); provider.setuseauthenticationrequestcredentials(true); return provider;...

BigQuery Reddit Comment Data Analysis -

bigquery - newbie trying pair of users have both commented on top 10 subreddits , count of common subreddits on have commented using bigquery reddit data i have started bq , beginner @ sql , finding hard query. can give me pointers started ? never had real needs in playing reddit data below throwing @ least start seems noone willing. quick logic: step - 1: identify top 10 commented subreddits select subreddit [fh-bigquery:reddit_comments.subr_rank_201505] order comments desc limit 10 step - 2: each subreddit identify [solid] users (with more 50 comments) select author, subreddit, count(1) comments [fh-bigquery:reddit_comments.2016_01] subreddit in ( select subreddit [fh-bigquery:reddit_comments.subr_rank_201505] order comments desc limit 10) , author not in ('automoderator', '[deleted]') group author, subreddit having comments > 50 step - 3: each subreddit identify pair of common users (via join) step ...

mysql - Log-in page php redirect and cookie deletion -

i've fixed login page create user entry insert statement , logout button on next page delete user issue when click log-in user becomes registers page not redirect next page automatically, have refresh page leads next page because user seen logged in. code: <head> <?php if(isset($_post["logout"])){ $saveuser = $_cookie["user"]; $savepass = $_cookie["password"]; $hostname='localhost'; $username='root'; $password=''; try { $dbh = new pdo("mysql:host=$hostname;dbname=cs266db_db1",$username,$password); $dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); // <== add line $sql3 = "delete userid user='".$saveuser."' , password='".$savepass."'"; if ($dbh->query($sql3)) { echo "<script type= 'text/javascript'>alert('logged out');</script>"; ...

javascript - Socket io connects to multiple sockets on reconnect -

i have 1 application have implemented notification using using node js , socket io , redis. there have configured publisher , subscriber in node js. using socket io can show messages on client realtime. my design 1 publisher publishes many channels , every user listening own channel. i publishes channel1 , channel2 , users listening channels only, getting respective messages 1 time. till worked fine, smoothly. but here problem starts. when internet goes offline tries reconnect , when again establishes connection, on every single publish starts subscribe twice , result of messeges showing twice. my code on server subscriber side io.sockets.on('connection', function (socket) { var channelname = "channel"+socket.handshake.query.ch; console.log("======================================================================="); console.log("connected client - ["+socket.id+"] ["+channelname+"]"); console....

Javascript Parent Directory -

ok, let me explain this. site layout (for example) localhost/mydomain/ -localhost/mydomain/pics -localhost/mydomain/somepages/arandompage.php so on page localhost/mydomain/index.php //(thumbnail rotator)// <img id='4' src='pics/somepic.1.jpg'> the mouseover snippet { $('#'+someid).attr('src', 'pics/somepic.'+num+'.jpg'); //no need me include rest since works. works on localhost/mydomain/index.php when go localhost/mydomain/somepages/arandompage.php doesn't work, no longer relative. <img id='4' src='../pics/somepic.1.jpg'> ok here that'll fix display image...but have tried searched everywhere javascript go 1 directory.. { $('#'+videoid).attr('src', '../pics/somepic.'+num+'.jpg'); //doesn't work i don't know here, yes need javascript 1 folder img src. thats all... after 8+ hours damn near given because seems simple not fin...

java - Getting FATAL runtime error from LogCat -

this question has answer here: how avoid arrayindexoutofboundsexception or indexoutofboundsexception? [duplicate] 2 answers unable figure out why error being produced @ runtime: 04-19 18:39:06.310 1741-1741/com.example.aaaaaj.studybuddy3 e/androidruntime: fatal exception: main process: com.example.aaaaaj.studybuddy3, pid: 1741 java.lang.runtimeexception: unable start activity componentinfo{com.example.uuj.benstudybuddy3/com.example.uuj.benstudybuddy3.lectureractivity}: java.lang.arrayindexoutofboundsexception: length=1; index=1 @ android.app.activitythread.performlaunchactivity(activitythread.java:2184) ...

function - Combining lambdas in Java? -

i have lambda (a, b) -> { a.dosomething(); a.doanotherthing(); return b.dosomething(); } right now, gets used parameter in single method. however, create similar lambda (a) -> { a.dosomething(); a.doanotherthing(); return } is there way reuse code? like (a, b) -> { partial(a) return b.dosomething(); } (a) -> { partial(a) return a; } if understood correctly want call lambda lambda? you give them name , use them other function function<x,y> partial = (a) -> { a.dosomething(); a.doanotherthing(); return a; } bifunction<x,y,z> lam = (a, b) -> { partial.apply(a); return b.dosomething(); }

sql - Select a value that has a greater number of values -

let's have table one: table t: b ------- 1 x | o 2 x | o 3 x | p 4 y | o 5 y | p 6 y | p 7 z | o 8 z | o 9 z | p i want select values in column have greater number of values in column b. for example, want select x, y, or z if have more o's p's. i've made several attempts, can't figure out how this. so, how can write query retrieve want? edit: expected output be: - 1 x 2 z this sounds aggregation. this: select t group having sum(b = 'o') > sum(b = 'p');

ios - Why AFNetworking always go into Failure block? -

i have integrated afnetworking here in project. when request using afnetworking, go failure block. below code. please let me know, doing wrong here? nsstring *baseurl = @"http://www.nactem.ac.uk/software/acromine/dictionary.py?sf=eta"; afhttpsessionmanager *manager = [afhttpsessionmanager manager]; [manager get:baseurl parameters:nil progress:^(nsprogress * _nonnull downloadprogress) { } success:^(nsurlsessiondatatask * _nonnull task, id _nullable responseobject) { nslog(@"%@",responseobject); //always invoke failure block }failure:^(nsurlsessiondatatask * _nullable task, nserror * _nonnull error) { nshttpurlresponse *response = error.userinfo[afnetworkingoperationfailingurlresponseerrorkey]; nsinteger statuscode = response.statuscode; nslog(@"error code=%ld",statuscode); nslog(@"desc=%@",response.description); }]; note:- valid url. http://www.nactem.ac.uk/software/acromine...

swift - NSTableView animation inconsistant -

i have nstableview intermittently stop animating , updating correctly, leading terrible user experience. let oldrows = filtereddocuments let newrows = newfiltereddocuments let diff = oldrows.diff(newrows) filtereddocuments = newfiltereddocuments if (diff.results.count > 0) { let deletionindexpaths = nsmutableindexset() diff.deletions.foreach { deletionindexpaths.addindex($0.idx) } let insertionindexpaths = nsmutableindexset() diff.insertions.foreach { insertionindexpaths.addindex($0.idx) } self.tableview?.beginupdates() self.tableview?.removerowsatindexes(deletionindexpaths, withanimation: nstableviewanimationoptions.effectfade) self.tableview?.insertrowsatindexes(insertionindexpaths, withanimation: nstableviewanimationoptions.slideleft) self.tableview?.endupdates() } there seems no logic when stops animating, , in many tests i've done feels it's build related. interestingly never stops animating when profiling... it's if on m...

Excel VBA xlMarkerStyle not plotting -

the following excel vba module designed change color of various line segments based on condition. works great except not plot individual line markers. problem apparently exists in each of xlmarkerstylecircle, marketsize, markerbackgroundcolor, , markerforegroundcolor lines. i'm not sure if problem related improper object naming or improper sequencing of object references. or suggestions appreciated. likewise, if sees more efficient way of coding same objective, please feel free share. thanks kindly... cheers, john sub tropical_cyclone_track_format() activesheet set r = .range("e24:e31") = 1 .shapes("chart 3").chart.seriescollection(1).points.count - 1 if r(i) = "1" .shapes("chart 3").chart.seriescollection(1).points(i + 1).markerstyle = xlmarkerstylecircle if r(i) = "1" .shapes("chart 3").chart.seriescollection(1).points(i + 1).markersize = 2 if r(i) = "1" .shapes("chart 3").char...

java - If the result of a double is divisible by another double is accurate? -

i know float , double not accurate.i have question this. double a=4.0/2.0; system.out.println(a); the output 2.0. whether result accurate or not. question comes when read book java programming language. shows me method set scale of output this. system.out.println((int)(area*100)/100.0); the statement set output 2 decimal places.and know floating-point arithmetic not accurate.so can statement work? in first case, result 2.0. reason 4.0 , 2.0 both representable java doubles. divide operator returns closest double real number division result, 2.0. in second case, whether exact result or not depend on value of area. representable 2 decimal place doubles end in .00, .25, .50, or .75. remaining 2 decimal place doubles can approximated. the cast int causes inaccuracies, , should replaced math.round. problem positive double less integer casts next integer down, rounds closest integer. here program illustrating issue: import java.math.bigdecimal; public class test...