Posts

Showing posts from May, 2010

javascript - Internet Explorer throwing SecurityError when I call window.history.pushState() -

i getting "securityerror" thrown when call history api in internet explorer , won't continue running. here code: if(window.history.pushstate) { window.history.pushstate({name: 'initial'}, 'initial', ''); } that right breaks , can't figure out how around it, internet explorer 10+ supports history api. any appreciated.

python - Joining multiple columns in PySpark -

i join 2 dataframes have column names in common. my dataframes follows: >>> sample3 dataframe[uid1: string, count1: bigint] >>> sample4 dataframe[uid1: string, count1: bigint] sample3 uid1 count1 0 john 3 1 paul 4 2 george 5 sample4 uid1 count1 0 john 3 1 paul 4 2 george 5 (i using same dataframe different name on purpose) i looked @ jira issue 7197 spark , address how perform join (this inconsistent pyspark documentation). however, method propose produces duplicate columns: >>> cond = (sample3.uid1 == sample4.uid1) & (sample3.count1 == sample4.count1) >>> sample3.join(sample4, cond) dataframe[uid1: string, count1: bigint, uid1: string, count1: bigint] i result keys not appear twice. i can 1 column: >>>sample3.join(sample4, 'uid1') dataframe[uid1: string, count1: bigint, count1: bigint] however, same syntax not apply method of joining , throws...

ZIP: Include parent directory (PHP) -

i need help, have code zipping folder, problem not include target or parent folder in zip file. test -- 1 -- 2 only 1 , 2 in zip file, want include test directory. this code $source='/testing'; $destination='/test'; $img_dir = array("1", "2"); $arrlength = count($img_dir); foreach ($img_dir $k => $v) { zipdata($destination.'/'.$v, $destination.'/img_'.$v.'.zip'); } function zipdata($source, $destination) { if (extension_loaded('zip')) { if (file_exists($source)) { $zip = new ziparchive(); if ($zip->open($destination, ziparchive::create)) { $source = realpath($source); if (is_dir($source)) { $files = new recursiveiteratoriterator(new recursivedirectoryiterator($source), recursiveiteratoriterator::self_first); foreach ($files $file) { $file = realpath($...

c++ - Switch statement only works for some cases -

for(int i=0; i<3; i++){ switch(i) case 0: layout[i].x=i; layout[i].y=i; case 1: layout[i].x=funcx(i); layout[i].y=funcy(i); case 2: layout[i].x=2*i; layout[i].y=4*i;} this simplified code having problem with. want code is, when i=0, whats in case 0, when i=1, whats in case 1 , on. but here problem.. example when i=1, calculates correct .x (case 1) value .y calculates different such 0 or 2. tried put {} around code inside each case, made no difference. tried 1 3 instead.. ofstream zone1h; zone1h.open("test.txt"); for(int l=0; l<5; l++) zone1h<<layout[i].x<<" "<<layout[i].y<<endl; could saving part issue? never had problem part though.. you're missing break @ end of each case . it's falling through cases , last 1 taking effect. for(int i=0; i<3; i++){ switch(i){ case 0: layout[i].x=i; layout[i].y=i; break; // <...

Going one directory behind using OS in Python -

i have file sample.py in bin folder. path of bin - /username/packagename/bin so when doing, dir = os.getcwd(), gives me path of bin(mentioned above). so, there way can go 1 directory behind, /username/packagename ?? if want path of directory, 1 directory behind current working directory, can use os.path.join() relative paths , convert them absolute path (if necessary) using os.path.abspath . example - one_dir_up_path = os.path.abspath(os.path.join(os.getcwd(),'..'))

ruby on rails - How can I cut only necessary part of string in RoR? -

for exsmple: i have: new.string-@22/4576/:thisneedtoo.ffgfhha.pdf?7765trimsaskellyo2212 and need only: string-@22/4576/:thisneedtoo.ffgfhha.pdf? if string starts "new.", , want after , including question mark, simple ruby regular expression pull out: match_data = /\anew\.([^?]+\?).+\z/.match(s) match_data[1] => "string-@22/4576/:thisneedtoo.ffgfhha.pdf?" i start easy-to-understand regular expression , once working, refine , optimize expression , add error checking.

angularjs - Angular ng-repeat handlebars and <br /> tag -

what proper way of doing this: <tr ng-repeat="i in controller.model"> <td>{{i.var1}}<br />{{i.var2}}<br />{{i.var3}}</td> </tr> when renders, <br/> displayed plain text. do have define variables each line has <br/> in , use $sce set trusted? seems awfully silly. if find same question, please let me know search phrase used. edit when page rendered in dev tools, html looks this: <td><p class="ng-binding">approved.&lt;br&gt;.&lt;br&gt;<br><br></p></td> it written in page: <td><p>{{i.programinitiation}}<br>{{i.rejectreasoninitiation}}<br>{{i.rejectreasonotherinitiation}}</p></td> strange. i'll play around works in plunkr. looks fine me. tried on plunker. <table> <tr ng-repeat="i in obj"> <td>{{i.name}}<br/>{{i.lastname}}<br/>{{i.lastname}}...

javascript - Bidirectional sub/resource relationships in Angular ui-router -

so there's nifty thing can resource classes in jax-rs: @path("/clubs") class clubsresource { @path("/") @get public response getclubs() { // return list of clubs } @path("/{id}") @get public response getclub(@pathparam("id") long id) { // return club given id } //lots of other club endpoints } @path("/people") class peopleresource { @path("/") @get public response getpeople() { // return list of people } @path("/{id}") @get public response getperson(@pathparam("id") long id) { // return person id } //this nifty part @path("/{id}/clubs") public clubsresource getclubstuffforperson(@pathparam("id") long personid) { return new clubsresource(personid); } } what's nifty allows me "ex...

javascript - Using XMLHttpRequest with username and password -

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <head> <script> jquery.noconflict(); jquery(document).ready(function() { alert("hello world, part 2!"); callotherdomain(); }); function callotherdomain() { var invocation = new xmlhttprequest(); var username = "testuser"; var password = "testpass"; var url = 'http://someurl'; invocation.withcredentials = true; invocation.open('get', url, true); invocation.send(); } </script> </head> i need pass username , password access link. not sure how it. glad if here can help! the same doing using ajax, need use xhttprequest implement cors. function getcontacts () { jquery.ajax({ type: "get...

javascript - Getting checked checkboxes with jQuery -

i have function supposed catch changes checkboxes. works when boxes clicked manually, not work when toggleall() function triggers them. anyway correct this? $(function() { $(":checkbox").change(function(){ if ( this.checked ) { alert(this.id+' checked'); } else { alert(this.id+' not checked'); } }); }); function toggleall() { var selectallcheckbox = $("#selectallcheckbox"); if ( selectallcheckbox.prop('checked') ) { // uncheck them $("[id^=friendrequestcheckbox]").attr('checked', false); } else { // check them $("[id^=friendrequestcheckbox]").attr('checked', true); } } i running old version of jquery , have not updated new version including prop , in case that's relevant. when changing elements programmatically, have trigger event programmatically. try : $("[id^=friendrequestcheckbox]").t...

javascript - One controller and more than one template with ui-router? -

i'm trying figure out if need register 3 states 1 controller. i have errors templates: 404.template.html, 505.template.html , feature.template.html currently i'm registering ui-router feature.template.html, , associating controller him. other two? should register , associate same controller? for example: $stareprovider .state({ url: '/error', templateurl: '/admin/error/feature.template.html', controller: 'errorcontroller', controlleras: 'ctrl' }); what other two: 404.template.html , 505.template.html? thanks. you can assign same controllers different states or directives. if remember correctly, instantiated separately scope variable not shared among each other.

navigation - CSS Dropdown Menu not showing child elements -

i working on getting css menu setup, have followed tutorials got myself stuck after hiding secondary menu items. want items show right below parents. (not side tutorials i've seen) my code here http://codepen.io/anon/pen/pjmdqv html <nav> <ul> <li><a href="#">home</a></li> <li><a href="#">lessons</a></li> <ul> <li><a href="#">lesson 1</a></li> <li><a href="#">lesson 2</a></li> </ul> <li><a href="#">dictionary</a></li> <ul> <li><a href="#">phrases</a></li> <li><a href="#">onomatopoeia</a></li> </ul> <li><a href="#">sentences</a></li> <ul>...

ios - Multiple AVPlayers ducking? -

i have relatively simple setup involving 1 avplayer looping ambient audio in background , second player playing shorter sound @ points. what i've observed when short sound played, hear ambient clip cut out second while there staticy pop. proceeds continue playing while short sound played @ same time. happens on device - it's not noticeable on sim, seems point potential performance issue. i can't quite figure out why first avplayer has blip. here code ambient player: nsstring *path = [[nsbundle mainbundle] pathforresource:kambienttrack oftype:@"mp3"]; _ambientplayer = [avplayer playerwithurl:[nsurl fileurlwithpath:path]]; [self.ambientplayer play]; it's more complex, listen notification when ends , restart it, issue happens during initial play before looping occurs. so while going in background, play clip so: self.announcementplayer = [[avplayer alloc] initwithurl:[myobject audiopathurl]]; [self.announcementplayer play]; so nothing uniq...

java - Getting PowerMockito to mock a static method on an Interface? -

i have library trying mock testing... there java 8 interface static method implementation this: public interface router { public static router router(object param) { return new routerimpl(param); } } and trying mock returned value: powermockito.mockstatic(router.class); powermockito.doreturn(mockrouter).when(router.router(any())); but when run tests through debugger, mock instance not returned. i've tried number of different permutations of static mocking, cannot static method return mock value. thoughts? you doing right, have wait when mocking static interface method implemented/fixed in powermock. watch pull request: https://github.com/jayway/powermock/issues/510 note: news issue in javassist fixed: https://github.com/jboss-javassist/javassist/pull/11

mongoose schema field associate array -

my schema looks like: var article = new mongoose.schema({ sentencearray: {} }); the purpose of having sentenceaudioarray: {} can add {sentid,senttext} tuples article. can achieved through standard array ( sentencearray: [] ), retrieval not o(1) (ie, id know sentid, cannot call sentencearray[sentid] retrieve). in createarticle methods, have newarticle.sentencearray = {}; this doesnt seems create field in mongo. when @ database, field sentencearray not created. consequently, when anarticle.sentencearray[sentid] = "some sentence" i error sentencearray undefined. any suggestions on how use associative array within mongoose schema. edit: please note objective able add multiple sentences sentencearray. expect call anarticle.sentencearray["firstsent"] = "some sentence"; anarticle.sentencearray["secondsent"] = "another sentence"; anarticle.sentencearray["thirdsent"] = "yet sentence"; and l...

Azure Vnet Peering -

can let me know when microsoft azure introduced vnet peering? i'm working company has introduced number of vnets (8 vnets) security. i'm trying suggest creating number of vnets unnecessary. i know if there other benefits vnet peering , when first introduced azure? cheers carlton i know if there other benefits vnet peering , when first introduced azure? virtual network peering enables connect 2 virtual networks in same region through azure backbone network. once peered, 2 virtual networks appear one, connectivity purposes. 2 virtual networks still managed separate resources, virtual machines in peered virtual networks can communicate each other directly, using private ip addresses. more information please refer link . i'm trying suggest creating number of vnets unnecessary. it depends on company's need. if want connect 2 vnets, must create peering tunnel. vnet peering between 2 virtual networks, , there no derived transitive relatio...

python - Django URL regex matches correctly with GET but not POST -

i'm working on webapp let's poll django backend irc logs on given date. url structure is: example.tld/weblogs/<example channel>/dl/<example date>.<example format> users able query following url scheme: example.tld/weblogs/<example channel>/ to last 100 lines of irc data well. my url matching file correctly routes proper view ( views.download ) when request explicit get, unable post on example.tld/weblogs/<example channel>/dl/ , have post'ed form data sent same view explicit will. for example, if user types explicit url example.tld/weblogs/foo/dl/2015-01-01.json request routed right view. however, if form submits post example.tld/weblogs/foo/dl/ , post request sent view handles requests example.tld/weblogs/foo (in case). project urls.py : from django.conf.urls import include, url django.contrib import admin log import views urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^weblog/'...

excel vba - How to assign value to rows according to sheet order in VBA -

since i'm new vba , got issue order of sheet name not in place expected. say: in workbook have sheet1 cell a7= name of sheet1 a8= name of sheet2, a9= name of sheet3. beside sheet1, 2, 3 have other sheets on workbook i write loop fill value of sheet name sheet 1 @ b7,b8,b9 sheet().name function, thing if change order of sheets moving them, order of cell a1, a2, a2 not matching sheet name anymore please fix code make order of sheet name in right place accordingly private sub worksheet_activate() dim lrow long dim i, j integer dim sh worksheet dim result string dim shname string dim sname long sheets("sheet1").range("b7:b9").clear = 1 sheets.count thisworkbook set sh = .sheets(i) shname = .sheets(i).name ' msgbox .sheets(i).name end sh lrow = .range("r" & .rows.count).end(xlup).row end select case shname case shname '7 starting row @ sheet 1 j = 7 lrow ...

java - URL Encoding with Volley -

does android volley url encoding? i trying request , on server side, seems url being sent through not encoded correctly. i have been fiddling customrequest class not able working, if encoding. customrequest.java: package com.bidorbuy.app.network; import com.android.volley.authfailureerror; import com.android.volley.networkresponse; import com.android.volley.parseerror; import com.android.volley.request; import com.android.volley.response; import com.android.volley.toolbox.httpheaderparser; import org.json.jsonexception; import org.json.jsonobject; import java.io.unsupportedencodingexception; import java.net.urlencoder; import java.util.map; public class customrequest extends request<jsonobject> { private response.listener<jsonobject> listener; private map<string, string> params; private map<string, string> headers; priority priority; public customrequest(string url, map<string, string> params, m...

javascript - Jquery/CSS: Unable to set position of an element using offset() value of another element? -

i trying align numeric values in straight line below respective headers. reading x coordinate value of headers , using values set position of numeric values accordingly. please take @ this. in example x axis co ordinates of headings are: 96, 299, 455, 618 name, price, quantity, extendedprice, saving i have set <span class="lotextendedprice" style=" position: absolute;left:455px;">0</span> still extended price value not in line heading. how can solve this. assume table not option. want same effect in scenario. thinking of finding x co-ordinate of header , setting position of values same value. why can't use css table display? in case cannot depend on offset, if browser size changes, ruin view.. table values there whole set of display values force non-table elements behave table-elements, if need happen. it's rare-ish, allows "more semantic" code while utilizing unique positioning powers of tables. div { di...

css - Is it possible to apply css3 transition to floated elements? -

i have grid of left floated (float:left) images , user can drag image , drop in 'droppable', images after dragged image fills vacated space, it's abrupt, ease movement of images bit. is possible css transition ? html <section id="basket"> <!--a sortable widget -jquery.ui--> <ul id="sortable"> </ul> </section> <!--main content - image grid--> <section class="col s12"> <figure class="left draggable"> <img src="imges/1.jpg' ?>"> </figure> <figure class="left draggable"> <img src="imges/1.jpg' ?>"> </figure> <figure class="left draggable"> <img src="imges/1.jpg' ?>"> </figure> <figure class="left draggable"> <img src="imges/1.jpg' ?>"> </figure> <figure class="left dragga...

sockets - Is there a connection limitation using LWIP? -

i'm writing tcp server using lwip protocol, server can connect multiple tcp clients. have problem , server can't connect more 3 active connections. 4th or more clients not connect unknown reasons. looked around forums , tried increasing number limit memp_num_tcp_pcb in opt.h (lwip-x86_64\include\lwip\opt.h) didn't help. following code, , questions whether there max connection limitation using lwip ? maximum number of connections 3 or more? //server code #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define myport 1234 // port users connecting #define backlog 2// how many pending connections queue hold #define buf_size 1024 int fd_a[backlog]; // accepted connection fd int conn_amount; // current connection amount void showclient() { int i; printf(...

Git Merge Branches Conflict -

i tried merge branch let's branch-good master branch branch-good 1 upto date changes whilst on branch-good did following git merge --strategy=ours master git checkout master git merge branch-good now after made last commit changed 2 files forgot commit before performing above task. has cause merge conflict , i'm not able got branch-good can add files last commit git gives me cannot save current index or need resolve current index first errors. how out of ? you need fix merge conflicts. first, run git status to see errors , files have them. then, see here: https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/ , fix conflicts on files git status showed. after resolving conflicts, can continue working.

java - How to For Each RDD Spark Streaming -

i have 1 csv file queries.txt , reading file this: javardd<string> distfile = sc.textfile("queries.txt"); schema of queries.txt file is: uniq_id,,,...some numeric values in csv... i need each line - create hashmap, key first column of queries.txt file(uniq_id) , value other columns in file hashmap. example. (this not real , not working example, want convey essence) hashmap totalmap = new hashmap<integer, numericvalues>(); for(int i=0;i<distfile.size();i++) { string line = distfile[i].getcolumns(); for(int y=0;y<line.size();y++) { totalmap.put(line.getfirstcolumn,line.getremainingcolumns); } } here numericvalues custom class have variables mapping columns in file. any other suggestions helpful. i guess looking for, example doesn't parses csv line itself. javardd<string> distfile = sc.textfile("queries.txt"); hashmap totalmap = new hashmap<integer, numericvalues>(); distfile.foreac...

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 the same problem occurs when delay in running function caused using event listeners: var buttons = document.getelementsbytagname("button"); (var = 0; < buttons.length; i++) { // let's create 3 functions buttons[i].addeventlistener("click", function() { // event listeners console.log("my value: " + i); // each should log value. }); } <button>0</button><br> <button>1</button><br> <button>2</button>...

java - JBPM RuntimeManager is null for Old Task after Tomcat Restart or Application Redployed -

after successful setup of jbpm spring rest application, deployed on tomcat 8, deployed , started process, complete 1 task, redeployed application without modification (clean redeployed) , can see old task when try complete task, apparently not give error process remain on same stage, while debugging noticed runtime manager null i.e. getruntimemanager(usertaskinstancedesc task) method taskservice return null, possible reason? other information jbpm 6.2 application using mysql database deployed on tomcat server 8 please note deployed , started same process again,everything work fine new process, been able complete task, still not been able complete old task. any idea?

python - i dont understand why my "if" command don't work as it should -

import random cde = random.random() print(cde) tst = input("whats code?\n") if tst == cde: print("welcome") else: print("imposter!!!") when run code , after i've typed in "cde" thing keeps saying imposter should welcome random returns float comparing string user input - never equal... you try: import random cde = str(round(random.random(), 3)) print(cde) tst = input("whats code?\n") # <- python3 # tst = raw_input("whats code?\n") # <- python2 if tst == cde: print("welcome") else: print("imposter!!!") and in order avoid rounding effects may consider rounding result random.random() . note different ways of getting user input depending on python version using.

javascript - Sorting a list by data-attribute -

i have list of people job titles sorted persons’ first names, this: <ul> <li data-azsort="smithjohn"> <a href="#"> <span class="list-name">john smith</span> </a> <span class="list-desc">professor</span> </li> .. <li data-azsort="barnestom"> <a href="#"> <span class="list-name">tom barnes</span> </a> <span class="list-desc">lecturer</span> </li> </ul> i’ve added data-azsort attribute <li> element, , i’d pop these list elements array, , sort based on data-* attribute (using plain javascript). what best way sort list data-azsort (a-z), returning same code? javascript only, no jquery, etc. this works number of lists: gathers li s in ul s have attribute, sorts them according attribute value , re-appends them parent. array.prot...

c# - DocumentDb cannot handle hyphen (-) in column names -

i saving following xml documentdb: <documentdbtest_countries> <country>c25103657983</country> <language>c25103657983</language> <countrycode>383388823</countrycode> <version>2015-08-25t08:36:59:982.3552</version> <integrity> <hash-algorithm>sha1</hash-algorithm> <hash /> </integrity> <context-info> <created-by>unittestuser</created-by> <created-on>2015/08/25 08:36:59</created-on> <created-time-zone>utc</created-time-zone> <modified-by>unittestuser</modified-by> <modified-on>2015/08/25 08:36:59</modified-on> <modified-time-zone>utc</modified-time-zone> </context-info> </documentdbtest_countries> which gets saved fine documentdb following: { "documentdbtest_countries": { "integrity": { "hash-algorithm": "s...

javascript - Basic Auth not working in jquery but working in other languages -

i trying authenticate user using basic authentication protocol in jquery keeps giving error:"xmlhttprequest cannot load https://api.credly.com/v1.1/authenticate . request header field authorization not allowed access-control-allow-headers." but when check api using postman client, works fine. jquery code: var settings = { "async": true, "crossdomain": true, "url": "https://api.credly.com/v1.1/authenticate", "method": "post", "headers": { "x-api-key": "myapikey", "x-api-secret": "mysecret", "authorization": "basic "+btoa(<email> + ":" + <password>) } } $.ajax(settings).done(function (response) { console.log(response); }); the api working postman client there should no issue in not working in jquery. please help. use datatype : 'jsonp' cross domian request, see also ...

java - Compiling any JavaFX project in NetBeans returns Unsupported major.minor version 52.0 -

i see number of similar questions netbeans 8.0 unsupported major.minor version 52.0 error unsupported major.minor version 52.0 error (duplicate) running jar compiled: unsupported major.minor version 52.0 can't fix unsupported major.minor version 52.0 after fixing compatibility but none same circumstances mine. i've tried solutions anyway (when relevant) , haven't helped. i had created javafx fxml application in netbeans 8.0.2 , had manually upgrade jdk 1.7 1.8 features wanted. believe using 1.8.0_52 both jre , jdk , project compiling fine. computer notified me of update java 8. now: mc@mc-desktop:~$ java -version java version "1.8.0_60" java(tm) se runtime environment (build 1.8.0_60-b27) java hotspot(tm) 64-bit server vm (build 25.60-b23, mixed mode) mc@mc-desktop:~$ javac -version javac 1.8.0_60 and java 8 fxml project gets above error message during compile-time, standard basic javafx fxml application comes netbeans. java 7 fxml compile ...

Spring Boot with multiple database using hibernate and JpaRepository -

how implement multiple database configurations in spring boot ??? how create spring boot mvc application 2 different databases using hibernate ??? application.properties(db1=core,db2=staging) server.port=8772 spring.core.driverclassname=com.mysql.jdbc.driver spring.core.url=jdbc:mysql://ip:port/coredb spring.core.username=uname spring.core.password=pwd spring.staging.driverclassname=com.mysql.jdbc.driver spring.staging.url=jdbc:mysql://ip:port/stagingdb spring.staging.username=uname spring.staging.password=pwd repository : public interface istagingentitydao extends jparepository<stagingemployee, integer>{ query("select e stagingemployee e") public list<stagingemployee> getentitydata(); } dbconfig : public class dbconfig { @bean(name="stagingdatasource") @primary @configurationproperties(prefix="spring.staging") public datasource stagingdatasource() { return datasourcebuilder.cr...

android - createContext failed: EGL_SUCCESS -

the log says java.lang.runtimeexception: createcontext failed: egl_success @ android.opengl.glsurfaceview$eglhelper.throweglexception(glsurfaceview.java:1193) @ android.opengl.glsurfaceview$eglhelper.throweglexception(glsurfaceview.java:1184) @ android.opengl.glsurfaceview$eglhelper.start(glsurfaceview.java:1034) @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1401) @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240) when try use rajawali library on android studio. found out problem must device-capability-specific, because app runs on other devices (samsung galaxy tab 4, nexus) not on sony xperia lt30p. have looked around , have found this thread talking same problem. thought might problem of ram or overflowing, disabled background processes , uninstalled apps. still, error persists. know why happens , if there exists way around it? maybe because config call order wrong.. seteglconfi...

java, two 2D arrays and their interactions, ArrayIndexOutOfBounds Exception -

2nd question! (followup first) i'm trying list first array (namesarray) , match each index user-defined amount of hours in hoursarray. asks how many people worked week, asks names, asks hours each of people worked (while displaying names side improved quality). i keep getting indexoutofbounds exception whenever try enter first amount of hours worked first person, how fix take amount of hours worked each person correctly? import java.util.scanner; import java.util.arrays; class tips_calc { public static void main(string[] args) { scanner scan = new scanner(system.in); system.out.print("how many employees week?: "); int numberofemps = scan.nextint(); int numberofhours = 0; system.out.println("\nenter names of workers entered amount (" + numberofemps + "):"); string[] namesarray = new string[numberofemps]; for(int = 0; < numberofemps; i++) { namesarray[i] = scan.next(); } system.out.prin...

matlab - reading images from VideoReader gets progressively slower -

i've been trying to read mp4 file using videoreader. matlab able read images, further frame along video, more time takes. tic;i=read(v,1);toc elapsed time 0.264011 seconds. tic;i=read(v,2000);toc elapsed time 32.859614 seconds. also, i'm not sure if related, matlab cannot determine number of frames in file: v=videoreader('s1140007 (~200 cubes, large).mp4'); warning: unable determine number of frames in file. i've tried using 2 versions r2012b , r2015a, , problem persists. on different machine, however, number of frames can determined , reading times don't longer, there's configured wrong on machine. there known solution problem (can related codecs somehow?), or maybe alternative method of reading 1 image @ time (readframe not relevant needs). any appreciated, aviram ok, not answer, workaround... seems set numberofframes property in videoreader object created video undetermined number of frames, 1 needs read last frame using followin...

jquery - How to change pagers width when window size changes? -

i have html code bx-slider pager <div id="bx-custom-pager"> <a data-slide-index="0" href="" style=""><div class="bx-item" style="" id="i1"></div></a> <a data-slide-index="1" href="" style=""><div class="bx-item" style="" id="i2"></div></a> <a data-slide-index="2" href="" style=""><div class="bx-item" style="" id="i3"></div></a> <a data-slide-index="3" href="" style=""><div class="bx-item" style="" id="i4"></div></a> <a data-slide-index="4" href="" style=""><div class="bx-item" style="" id="i5"></div></a> ...

c++ - Finding a static pointer to a object? -

hey i'm implementing plugin system application (but them able draw etc need window classes , of that) like this: cwindow* window = new cwindow(); this done on startup, if did this: std::cout << window << std::endl; the pointer change every time application ran again. how can find static pointer (that doesn't change) can have in plugin sdk like: cwindow* getwindow() { return (cwindow*)addres; } you not need address same on every run of program: need know can reliably find address. as quick , dirty solution (example), store address returned new cwindow() in global variable declared in header that include in plugin : variable accessible plugin, giving plugin access window's address. actual value of address accident.

php - Wordpress shortcode rendering -

i made basic shordcode function map_test(){ $map_render = '<p>test</p>'; return $map_render; } add_shortcode( 'map_shortcode', 'map_test' ); and shortcode created , works fine until if ( shortcode_exists( 'map_shortcode' ) ) { echo do_shortcode('[map_shortcode]'); } i test rendered after element there number 1 double quotes so wondering why "1" there , made render, how remove it? try following check short code existence , remove same: function shortcode_exists( $tag ) { global $shortcode_tags; return array_key_exists( $tag, $shortcode_tags ); }

Openstack Failed to launch Instances [Error: No Valid Host was found] -

i have tried install openstack on centos 7. below configurations: neutron node (vm 2 vcpu, 2 gb ram , 3 nics) controller node(vm 2 vcpu, 8 gb ram, 1 nic) compute node(physical machine 24 cpu, 64 gb ram, 2 nic) # egrep -c '(vmx|svm)' /proc/cpuinfo gives output of 24 i have followed online documentation: openstack installation guide red hat enterprise linux 7, centos 7, , fedora 20 - juno (install , configure network node) line line , verified configurations 3 times. now whenever try launch instances using horizon dashboard, error no valid host found!! nova-compute log gives me error nova-compute.log 2015-08-21 22:55:00.391 41235 trace nova.compute.manager [instance: d9bfa207->6e85-4ca8-a385-52d90818a49b] _("unexpected vif_type=%s") % vif_type) 2015-08-21 22:55:00.391 41235 trace nova.compute.manager [instance: d9bfa207->6e85-4ca8-a385-52d90818a49b] novaexception: unexpected vif_type=binding_failed these neutron , compute node ...

inheritance - C# executing function in inheriting classes from main class array -

sorry in advance english. i'm doing scripts in unity , want achieve is: i have multiple classes (b1, b2, b3) , every 1 of them inherit class. in code have container objects, contain b classes. class , b classes have function called myfunction() , there problem: when want call function on object of class i.e. b2, when in vector class objects, when call myfunction(), there executed version a, not b2. tried solve problem in best way could, ended "if b1, ... else if b2, ..." type of solution not want. as example of ugly solution (used in immaded() ), link scripts, without every line not needed in example: http://pastebin.com/4by0rkbn thank effort in advance. as per this msdn page, need declare myfunction method virtual : the virtual keyword used modify method, property, indexer, or event declaration , allow overridden in derived class. example, method can overridden class inherits it. public class { public virtual void myfunction() ...

java - How can individual item colors be changed upon addition in a listview based on variables in a void function? -

i'm working on app interacts bluetooth device. bluetooth device sends string of data includes signal strength, pass/fall test results, , device id, separated spaces. have void function decodes string of data , adds decoded string arraylist, puts decoded data appropriate variables, , puts recent data different textview. want change textview color depending on results of "passed" variable decoded bluetooth string. want change listview items' colors according pass/fail results, every method i've tried changes of items in listview, or causes app crash. how individually change listview colors of items based on decoded data different void function? these chunks of code inside java activity: onviewcreated: mreadinglog = (listview) view.findviewbyid(r.id.scanlogview); adapter = new arrayadapter<string>(getactivity(), r.layout.listview_layout, r.id.testresults, listitems) { @override public view getview(int position, v...

properties - read a property from another property(multiple levels) in java -

my situation this i having property file url.dev.a=devlocalhost url.qa.a=qalocalhost env=dev totalurl=${url.${env}.a} here expecting totalurl devlocalhost how can in property file. the following class cleaned open source project work with. if can't used is, can atleast starting point exploration. package snippet; import java.util.enumeration; import java.util.properties; import java.util.regex.matcher; import java.util.regex.pattern; public class propertyreplace { /** * replaces java properties in properties of form %&lt;java * property&gt; java property value. * * @param properties * , properties replacement takes place */ public static void replaceenviron(properties properties) { enumeration<object> enumeration = properties.keys(); while (enumeration.hasmoreelements()) { string key = (string) enumeration.nextelement(); string value = properties.g...