Posts

Showing posts from August, 2014

java - How exactly works this Spring Security example? -

i pretty new in spring security , have doubt related configuration found tutorial. this spring-security.xml file used spring security configuration project: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemalocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <security:http> <security:intercept-url pattern="/springlogin" access="permitall"/> <security:intercept-url pattern="/dospringlogin" access="permitall"/> <security:intercept-url pattern="

Sendgrid Web API set multiple users in reply_to field with C# -

i´m using sendgrid email service library c# , trying set multiple users in replyto field. this code sends e-mail var msg = new sendgridmessage() { subject = somesubject, = new mailaddress("from@mail.com", "from name"), = new mailaddress[] {new mailaddress("destination@mail.com","destinationname")}, bcc = new mailaddress[] { new mailaddress("bccdestination@mail.com", "bccdestinationname"), }, replyto = new mailaddress[]{ new mailaddress("someone@email.com", "jhon doe"), new mailaddress("jsmith@email.com", "jhon smith"), }, html = somehtml }; when check email sended, , try answer it, appears first mail address (someone@email.com) added , there no trace of second 1 (jsmith@email.com). can do?

libgdx - Java / box2DLights - Wrong light position -

Image
i'm using libgdx project , more precisely box2dlights. my problem following 1 : when want put new "pointlight" it's on center of screen. , if change coordinates, doesn't work. inside "show()" method : box2d.init(); world = new world(new vector2(0, 0), true); rh = new rayhandler(world); rh.setambientlight(1.2f, 0.2f, 0.2f, 0.1f); pl = new pointlight(rh, 100, new color(1,1,1,1),(float) 0.5,0,0); inside "render()" method : gdx.gl.glclearcolor(0f, 0f, 0f, 1f); gdx.gl.glclear(gl20.gl_color_buffer_bit); world.step(delta, 8, 3); renderer.begin(shapetype.filled); (solarsystem ss : solarsystemlist) { if(ss.getcolor() <= 15) colorss = color.yellow; else if(ss.getcolor() > 15 && ss.getcolor() < 31) colorss = color.orange; else if(ss.getcolor() > 30 && ss.getcolor() < 46) colorss = color.red; else if(ss.getcolor() > 45) colorss = c

html - Making a div fade in and out on link hover -

what i'm trying on hovering on link want invisible image fade in. when user stops hovering fades out again. works on hover image appears not work not fade in or out, image appears or disappears. my html: <div class="hover_img"><a href="#">action menu<span><img src="img/screenshot/actionmenu.jpg" alt="image" height="50" /></span></a></div> my css: .hover_img { display:inline } .hover_img { position:static; } .hover_img span { position:fixed; bottom: 40%; right: 0; display:none; z-index:99; opacity: 0.0; transition: opacity 1s ease-in-out; -moz-transition: opacity 1s ease-in-out; -webkit-transition: opacity 1s ease-in-out; } .hover_img a:hover span { display:block; opacity: 1.0; transition: opacity .55s ease-in-out; -moz-transition: opacity .55s ease-in-out; -webkit-transition: opacity .55s ease-in-out; } remove display:none; , display:block; . transition opacity work

osx - Failed with running subprocess from Python launcher without terminal window on Mac -

my ultimate goal run python script (the code need call subprocess ) without terminal. i tried python launcher on mac. code works correctly when "run in terminal window" checked. (notice shell=false default here.) however, won't run subprocess correctly when uncheck option. i tried run in mac os automator ( run shell script ) — negative too. here small sample code. import subprocess open("record","w") f: subprocess.call(["which","ipython"], stdout = f) # line fails subprocess.call(["open","."]) # line works if run terminal, creates record file, shows ipython path. when run automator or python launcher without terminal window, creates empty file.

Rock Paper Scissors javascript using matrix -

hello new here , taking javascript course @ university software development degree. running issue in rock paper scissors lizard spock final project. professor has given qunit tests can check our code not @ understanding how errors show me whats wrong don't understand how code work. far have created objects , gave them properties , methods. created matrix capture , retain variations of win conditions. don't understand how create final method need: getwinner. in our rubric states following: "method evaluate won game. should update wins, losses, , rate of each player. should set "winner" property name of winning player." here game.js file working on. @ bottom stumped how start getwinner function. have started not responding unit tests. can post code if need well. other file object. var game = function(){ this.running = false; this.name = "rpsls"; this.players = []; this.addplayer = function(name){ var player = new player(name);

c++ - invalid conversion from 'int' to int* [-fpermissive] -

previously had implemented , worked: int *train_x = (int *)mxgetdata(in_a);// pointer 6th argument matrix train_x (int = 0; < 6; i++) { (int j = 0; j < 6; j++) { cout << train_x[6 * + j] << endl; } } int sizetrain_x1 = mxgetm(in_a); int sizetrain_x2 = mxgetn(in_a); i manage check if correct sizes following , good. cout <<"training input numofcollum:\n"<< sizetrain_x1 << endl; cout << "training input numofrows:\n"<<sizetrain_x2 << endl; but when trying entire program following initialization compilation error: for (int epoch = 0; epoch<training_epochs; epoch++) { (int = 0; i<train_s; i++) { rbm.contrastive_divergence(train_x[i], learning_rate, k); } } here error message: rbm.cpp: in function ‘void mexfunction(int, mxarray**, int, const mxarray**)’: rbm.cpp:570:64: error: invalid conversion ‘int’ ‘int*’ [-fpermissive] rbm.cpp:81:6

javascript - html selection enable disable attribute -

i have 3 selection boxes in 1 of web page. set 2 of dependent on value of first 1 when value of select 1 other 2 enabled , did problem lies after press submit because after cannot clicked other 2 if value of first s still selected 1. here select boxes: <form action="<?php echo htmlentities($_server['php_self']);?>"> <label>department</label> <select class="field" id="cmbdept" name="dept" onchange="handleselect()"> <option value=""></option> <?php try{ $query1 = $con->prepare("select * departments"); $query1->execute(); } catch(pdoexception $e){ echo $e->getmessage(); exit(); } while($r = $query1->fetch()) { extract($r); echo <<<eol <option value='

python - pexpect - how to match a lot of blocks in large output strings -

i using pexpect login remote devices query metrics. the output of command large (about 15k bytes) , need extract many metrics output. use big pattern string "key1:([0-9a-za-z]*).*key2:([0-9a-za-z]*).*key3......" to match metrics. when pattern long, expect block , never terminate. i've set maxread 20k doesn't work. have ideas on how resolve issue? add code snippet: session.sendline(command_info["text"]) ret = session.expect([cmd_prompt, pexpect.eof, pexpect.timeout]) if ret == 1: logger.error("eof error.") return if ret == 2: logger.error("timeout") return result = re.match(getexpectedgroupstr(command_info, logger), session.before, re.s) if use big pattern string instead of cmd_prompt, session.expect hang , never terminate if timeout reached.

java - mocking an autowired object in a test -

i have class has field gets set through spring bean , annotated @autowired so: public class foo { .... @autowired private bar bar; .... } i want setup junit test tests functionality @ point create foo object. not in control of when foo object generated. easiest way mock object anytime foo gets instantiated, object populated mocked item? using 3rd party library mock bar object nicely, prefer of in java test class without using xml files. everything have found online seems either involve creating xml file or mocking specific instance of class. thank help! i following: public class test { private bar mockedbar = createbar(); // somehow set 'mockedbar' foo object // created contains mockedbar } i have written uch test of jmockit , please read might you. you need create object overriding required methods. then use deencapsulation.setfield(fixture,new bar(){ //@override methods }); fixture object in want bar

java - Ways of increasing memory usage of Android app programmatically -

i have android app tested memory usage. test case, need increase memory usage(ram) programmatically. possible ways? increasing thread.sleep time in app increase memory usage? bytearrayinputstream bais = new bytearrayinputstream(new byte[1000]); creates object in memory 1000 bytes. 1000000 bytes 1mb

stanford nlp - Stemming option in stanfordcorenlp -

problem: there option stem words using stanford-core-nlp ? not able find one! using stanford-corenlp-3.5.2.jar. code: public class stanfordnlptester { public static void main (string args[]){ string paragraph = "a long paragraph here"; properties properties = new properties(); properties.put("annotators","tokenize,ssplit,pos,lemma,ner,depparse"); stanfordcorenlp pipeline = new stanfordcorenlp(properties); annotation annotation = new annotation (paragraph); pipeline.annotate(annotation); pipeline.prettyprint(annotation,system.out); } } you'll need github: https://github.com/stanfordnlp/corenlp this class provide want: https://github.com/stanfordnlp/corenlp/blob/master/src/edu/stanford/nlp/process/stemmer.java the main() method of class shows example usage of stemmer. you can continue use stanford-corenlp-3.5.2.jar , include 1 class, since class depends on in jar.

vector - Mean of fields in a structure using structfun, Matlab -

i have structure in following format: a.l1.data = <1000x3 double> a.l2.data = <1000x3 double> a.l3.data = <1000x3 double> i obtain mean of first column of fields, i.e. 1 vector of 1000 rows mean of l1, l2 , l3. i have tried using structfun following code: foo = structfun(@(x) mean(x.data(:,1)), a, 'uniformoutput', false) however, gives me mean (single value) of each first column rather mean of fields. if do: foo = structfun(@(x) mean(x.data), a, 'uniformoutput', false) i obtain mean of each column each field. how should modify code? you can access data of struct struct2array . get struct firstcolumnsofdata fields l1 l2 l3 first columns of data : firstcolumnsofdata = structfun(@(x) x.data(:,1), a, 'uniformoutput', false) get mean of each element of l1 l2 l3 : ml123 = mean(struct2array(firstcolumnsofdata')) % transpose not mean of each field

Run as TestNG Suite not working in eclipse -

Image
i learning testng , working on parameterization. created new java class , created new testng.xml file. included class name in xml file. tried run testng.xml file testng suite nothing work. please see java class, public class test1 { @test public void test_firefox() { system.out.println("test_firefox method.."); } } testng.xml file, <!doctype suite system "http://testng.org/testng-1.0.dtd" > <suite name="suite1" verbose="1" > <test name="test" > <classes> <class name="com.multibrowser.test1" /> </classes> </test> </suite> folder structure, please me in this. not sure why did created suite file under "referenced libraries" create under "com.multibrowser" package. or under folder. take @ screenshot below, testng-suite.xml. right click suite file, click run -> run configurations. thing below, rig

MySQL group by date, force to return null value if does not exists -

i built query, let me return average ranking of apps. but of them, month, don't have data, cause app new 1 (let's say, app out since month, , collecting data since month) select date_format(date, '%y-%m'), app_id, avg(rank) wadstats.applestore_ranking app_id in (100, 2, 3, 4, 5, 6) group month(date), app_id order case when app_id = 100 1 else 2 end, date asc i in need show first app_id = 100 but app_id = 8, don't have data august exemple. then results looks like '2015-07', '100', '3.9355' '2015-04', '100', '49.5000' '2015-08', '100', '5.2258' '2015-05', '100', '16.3333' '2015-09', '100', '6.1333' '2015-06', '100', '7.5667' '2015-10', '100', '5.7727' '2015-04', '2', '6.0000' '2015-08', '2', '

angularjs - My controller.js file breaks when I try to add another controller in it -

i trying work on project , build angular controllers hold data 2 different pages. the code on first page is... <div ng-app="app"> <div ng-controller="shopitemcontroller"> <div class="itm" ng-repeat="shopitem in shopitems"> <div class="imag"></div> <h2>{{ shopitems.name }}</h2> <div class="hf">buy it: {{ shopitems.price }}</div> <div class="hff">earn it: {{ shopitems.altprice }}</div> <div class="desc"><div>{{ shopitems.desc }}</div></div> <div class="prog"><div>{{ shopitems.progress }}</div></div> </div> </div> </div> ...and second page here. <div ng-app="app"> <div ng-controller="trophyearnscontroller"> <div class="itm" ng-repeat="trophyearn in trophyearns"> <div class="imag"></d

javascript - Response not getting using ajax -

when send email , password , method. time email pass username=userabig%40bizchatbox.org. have faced issue response. please me how can fix @ when sending email response using ajax. <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script type="text/javascript"> $("document").ready(function(){ $.ajax({ type: "post", url: "http://108.161.137.197:8088", data: { "method": "getauthtoken", "username": "userabig@bizchatbox.org", "password": "pass" }, mimetype:"multipart/form-data", contenttype: false, cache: false, success: function(data) { alert(data); } }); return false; }); </script> thanks in advance getting below response ajax. { "error":"no rest method found" } which means server not able find method url .

javascript - Avoiding whitespace between tags in Jade template output when pretty printing -

i have print out input tag , label without space between end of 1 tag , start of next... want pretty-print rest of document. by default — pretty printing turned on in jade — following: <input ...></input> <label ...></label> i want: <input ...><label ...></label> or <input ...></input><label ...></label> the idea jade - controlling line-breaks in html output doesn't work because input self-closing tag. update 1: have created obvious solution using mixin , literal html, avoid if possible. in razor, addressed wrapping whitespace multi-line comment: <div> <span>no trailing</span><!-- --><span>space</span> </div>

ios - Facebook login through Safari not using installed App -

i have used facebook sdk facebook developer portal , completed steps written during login through facebook app default uses safari login procedure. why doesn't use installed app purpose? try code -(ibaction)clk_connectwithfb:(id)sender { fbsdkloginmanager *login = [[fbsdkloginmanager alloc] init]; // if facebook app not installed on device, falls \c fbsdkloginbehaviorbrowser. default behavior. login.loginbehavior = fbsdkloginbehaviornative; [login loginwithreadpermissions:@[@"email", @"user_friends",@"user_posts"] handler:^(fbsdkloginmanagerloginresult *result, nserror *error) { if (error) { // process error nslog(@"error :%@",error); } else if (result.iscancelled) { // handle cancellations nslog(@"error :%@",error); } else { if ([result.grantedpermissions contai

angularjs - AngularUI Router - scroll to element on state change -

i have searched on stackoverflow last 5 hours , none of related answers quite solve problem. have ui-router state loads long list of messages generated custom directive. page linked in many places pointing different message. want scroll selected message. i can work using $anchorscroll if surround call $timeout. $timeout(function(){$anchorscroll()};) if $timeout not there call $anchorscroll nothing since view has not loaded. here of relevant code. <message id='message{{message.id}}' ng-repeat='message in messages' message='message' ng-class="{'current':current == 'message{{message.id}}'}" > </message> in controller set current $scope.current = $location.hash() . works. if load page #/messages#message100 directly page correctly scroll. however, if different view use link such this: <button ui-sref="message-state({'#':'message{{message.id}}'})> go message {{message.id}} &

javascript - Bootstrap Tabs nested inside wordpress loop won't toggle -

i stuck. can't find answer anywhere. have tabs generated wordpress loop. each title title of post. when click on tab have sub-tabs titles "overview", "floorplan" , "spec". these work on first post type tab, if click on post tab , click on floorplan tab, not change within tab, when go first tab opened on load find has changed floorplan tab. (i hope makes sense) tl:dr nested tabs change first tab, none of others. here code. <ul class="nav nav-tabs" id="siteplan"> <h3>site plan key</h3> <ul class="key-layout list-unstyled"> <li class="key-house lantana"><a href="#lantana" role="tab" data-toggle="tab">lantana</a></li> <li class="key-house lavender"><a href="#lavender" role="tab" data-toggle="tab">lavender</a></li> <li clas

javascript - Sum object of array by same element -

var data = [ {id: 1, quantity: 10, category: 'a'}, {id: 2, quantity: 20, category: 'b'}, {id: 1, quantity: 30, category: 'a'}, {id: 1, quantity: 30, category: 'z'}, {id: 2, quantity: 40, category: 'd'} ]; var totalpertype = {}; (var = 0, len = data.length; < len; ++i) { totalpertype[data[i].id] = totalpertype[data[i].id] || 0; totalpertype[data[i].id] += data[i].quantity; } var out = _.map(totalpertype, function (id, quantity) { return {'id': id, 'quantity': quantity}; }); console.log(out); my code sums quantity objects same id. returns [ {id:1, quantity:70}, {id:2, quantity:60} ] how sum objects based on both id , category? for example, need output this: [ {id:1, quantity:40, category:a}, {id:1, quantity:30, category:z}, {id:2, quantity:20, category:b}, {id:, quantity:40, category:d} ] i'd answer both plain javascript , underscore. using vanilla

getting error while executing sqoop job using oozie -

i'm getting error when submit sqoop job using oozie details below. please help? my workflow.xml file <workflow-app xmlns="uri:oozie:workflow:0.4" name="oozie-wf"> <start to="sqoop-wf1"/> <action name="sqoop-wf1"> <sqoop xmlns="uri:oozie:sqoop-action:0.2"> <job-tracker>${jobtracker}</job-tracker> <name-node>${namenode}</name-node> <command>import --username hadoop --password bigdata --connect jdbc:db2://<host string>:50000/msrc --driver com.ibm.db2.jcc.db2driver -- query 'select * student.sales (1=0 or $conditions)' --target-dir /user/${wf:user()}/${examplesroot}/apps/sqoop -m 1</command> </sqoop> <ok to="end"/> <error to="kill"/> </action> <kill name="kill"> <message>action failed</message> </kill> <end name="end"/> </workflow-app> my job.prop

java - Get raw HTTP response with Retrofit -

i want raw http response api rest. have tried interface: @post("/login") @formurlencoded call<retrofit.response> login(@field("username") string login, @field("password") string pass, @field("appname") string appname, @field("appkey") string appkey); but get: java.lang.illegalargumentexception: unable create call adapter retrofit.call method api.login i create retrofit way: retrofit.builder retrofitbuilder = new retrofit.builder(); retrofitbuilder.addconverterfactory(jacksonconverterfactory.create()); retrofit retrofitadapter = retrofitbuilder.baseurl(baseurl).build(); return retrofitadapter.create(apiclass); to access raw response, use responsebody okhttp call type. call<responsebody> login(...) in callback, can check response code code method of response. applies retrofit 2 return type, because callback gets response parameterized actual return type. asynchr

Uppercase for variable on PHP, good or not? -

is recommended write code in uppercase ? like: $variable = "johndoe"; require_once 'class.username.php'; $_username = new username(); $_username->add($variable); thanks. you free use whatever case want. historically there have been several conventions. preferred uppercase, lowercase, , yet preferred mixed case. used depended on how wrote html, , background came (some programming languages encouraged/required use uppercase, instance, , because php not picky case use easy continue using knew). now-a-days there couple conventions. following see when reading other people's code: most people use lowercase variable , function names: $name = "some name"; function age(person $person) { return $person->age; } as names contain more 1 word there tends 2 camps: prefer camelcase, , prefer under_score: $personname = "some name"; function getage(person $person) { return $person->age; } // or... $person_name =

objective c - NSWindow setFrame very laggy -

my application video window follows application window. i'm capturing screen, find location of other application , moves mine accordingly. have tracking thread capturing , tracking right position , if has been changed dispatches call updating position on main thread: void tracingthread() { while(true) { captureandtrack(); if(positionchanged) { dispatch_async(dispatch_get_main_queue(), ^{ setwindowpos(); }); } } } void setwindowpos() { [window setframe:_newframe display:yes]; } everything works fine except fact setframe laggy when dragging other app. guess because amount of events being dispatched. maybe there else. ideas how can improve performance?

c - Allocating Memory for a whole line of input of variable length stored as a single string -

i'm learning c , reading around best way take in input line line. basically want create strings hold whole line of input. question below doesn't answer how should handle memory allocation string. how can scan strings spaces in them using scanf()? should first detect how space needed? how? should realloc every time need more space? please show example input file or stdin(both possible not @ same time) the following repeatedly allocates buffer storage until input has been read (malloc/realloc checks omitted): char *mygetline(file *in) { char *buffer= null; int c, i, j; i= 0; j= 0; { c= fgetc(in); if (i==j) { j += 1024; buffer= realloc(buffer, j); } if (c==eof) break; buffer[i++]= c; } while (1); buffer[i]= '\0'; return buffer; }

ios - UICollectionView Cards like view -

Image
i trying make cards view(not tinder) similar safari not same. have started something, , wonder how continue doing simple collection view, views moving first, how should scroll go 1 4): how can achieve using collection view ? moving cells cover each other

stack on integrating parse cloud code in android app -

here main.js: parse.cloud.define("averagestats", function(request, response) { var rating = parse.object.extend("statobject"); var query = new parse.query("rating"); query.equalto("location", request.params.location); query.find({ success: function(results) { var sum = 0; (var = 0; < results.length; ++i) { sum += results[i].get("rating"); } response.success(sum / results.length); }, error: function() { response.error("location lookup failed"); } }); }); in mainactivity.java: location = (edittext) findviewbyid(r.id.fldlocation); string loc = location.gettext().tostring(); hashmap<string, object> params = new hashmap<string, object>(); params.put("location", loc); parsecloud.callfunctioninbackground("averagestats", params, new functioncallback <float> () { @override public void done(float curentrating, com.p

eror when parsing json android no data when run -

this code how use load data json.. client.get(url, new jsonhttpresponsehandler() { @override public void onsuccess(int statuscode, header[] headers, jsonobject obj) { try { if (!obj.getboolean("error")) { jsonarray cest = obj.getjsonarray("list"); string z = ""; if (cest != null) { int array = cest.length(); mdetail = new arraylist<orderitem>(); simpledateformat formatter = new simpledateformat("yyyy-mm-dd hh:mm:ss"); date dateorder = new date(); (int = 0; < array; i++) { try { dateorder = formatter.parse(cest.getjsonobject(i).getstring("orderdate"));

tsql - SQL get max date and join on other table -

sorry duplicate i've been through other answers has helped me sql below can't figure out how manage join subquery gets max date. select mo_number, -- systems_test_status, else combiner_test_data cdt.test_index, cdt.datetime, lumina_current_1, power_reading_1, lumina_current_2, power_reading_2, lumina_current_3, power_reading_3, lumina_current_4, power_reading_4 most_recent, step_pass_status combiner_test_data cdt inner join systems_test_status on cdt.test_index = systems_test_status.test_index --join(select -- test_index, -- max(datetime) most_recent_time -- combiner_test_data subcdt -- group test_index) joincdt on cdt.test_index = joincdt.test_index -- , cdt.datetime = joincdt.most_recent_time lumina_current_2 > 12 the join , subquery work fine separately output few rows whereas i'd expect few thousand. i've commented out subquery in example above. reason need inner join return systems_test_status.mo_number joining on test_index. running without s

c - Compare multi-dynamic structure of pointers in memory? -

basically, want achieve follows; i want able compare pointer-pointer structure block in memory without having iterate through of values dynamically. working api-hook, crucial use little "for loop iteration" possible, better-yet, use none. basically, assume have structure typedef struct mystruct { ushort age; pchar username; } _mystruct, *__mystruct; then initialize so __mystruct *pointer; zeromemory(&pointer, null); now assume structure filled group of values in each variable. let's have defined number 'x', , given 'y' given index in pointer structure. for (int y = 0; y < sizeofstructure; ++y) if (x == pointer[y]->age) // do_something(); so, in case, 'y' iteration variable for-loop, how can along line of: if (memcmp(&pointer, x) == 0) // do_something(); so in case not iterating structure, , instead comparing of elements in memory @ once? for-loop operation with-in critical_section either way still

html - Android - why are colors, font sizes in extra files -

i new in android designing, need advice. in html can insert necessary settings (font size, colors, padding, margin ...) css. prefer work styles, dont understand why in android development use files colors, font sizes. there meaning / advantage of it? example? thanx. in android, recommended use res/values/colors.xml colors, res/values/styles.xml styling of layout elements , res/values/themes.xml themes of used in app. the #1 reason of doing going use same colors in lots of different places of app. , placing them res/values/colors.xml let change color , automatically changed on app (as opposed changing every occurrence of color manually) for example, add color colors.xml <color name="grey">#eeeeee</color> and use in xml android:textcolor="@color/grey" then, if need change grey color shade or yet different color, don't need in in every resource file use color. just change in colors.xml.

javascript - Uncaught TypeError rendering <Router> using React Router in ES6: type.toUpperCase is not a function -

i upgraded react v. 0.14.0, reactdom v. 0.14.0 , react router v. 1.0.0-rc3 , i'm struggling following error. i've read , tried solutions in this , this post, cannot work code, uses es6. the error occurs in client-side app.js when calling reactdom.render method. import react 'react'; import reactdom 'react-dom'; import router 'react-router'; import routes './routes'; import createbrowserhistory 'history/lib/createbrowserhistory'; let app = document.getelementbyid('app'); let history = createbrowserhistory(); reactdom.render(<router routes={routes} history={history} />, app); and routes.js . import react 'react'; import {route, indexroute} 'react-router'; import app './components/app'; import home './components/home'; export default ( <route path="/" component={app}> <indexroute component={home} /> </route> ); and completeness, s

jsf - Spring Security with PrimeFaces Dialog Framework -

i have web project uses spring security , primefaces. i trying use primefaces dialog framework call xhtml file dialog .. problem when add line on web.xml: <filter> <filter-name>springsecurityfilterchain</filter-name> <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class> </filter> <filter-mapping> <filter-name>springsecurityfilterchain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> the dialog box doesn't appear , if remove line above , dialog box being displayed .. if remove lines above , loose spring security feature .. configuration missed? yes, spring security blocking frame generated primefaces. can make work adding following directive spring security configuration http // ... .headers().frameoptions().sameorigin(); source: http://docs.spring.io/spring-security/site/docs/current/reference/html/headers.html#headers-frame

ios - Call a method from another UIViewController in swift 2.0 -

i have app plays song, have external class has playsound func , variables needed: class song: nsobject { var audioplayer: avaudioplayer! var devicecurrenttime: nstimeinterval! func playsong() { let sound = nsbundle.mainbundle().pathforresource("song", oftype: "mp3") let sounddata = nsdata(contentsoffile: sound!) // self.audioplayer = avaudioplayer(data: sounddata!) throws self.audioplayer = nil { self.audioplayer = try avaudioplayer(data: sounddata!) } catch { print("handle \(error) here") } let delay:nstimeinterval = 0.0//100ms var playtime:nstimeinterval playtime = audioplayer.devicecurrenttime + delay self.audioplayer?.playattime(playtime) self.audioplayer?.play() } and in viewdidload of mainviewcontroller play song acces method song object: super.viewdidload() let vc: nsobject = song