Posts

Showing posts from May, 2011

android - libffmpeg.so Not Executing ffmpeg 2.8.4 Commands -

libffmpeg.so not working command line arguments i have compiles ffmpeg , static libffmpeg.so library. i installed using android.mk , installed but unable execute ffmpeg command. *my build.sh follows function build_r8b_test { bash configure --target-os=linux \ --arch=arm \ --cpu=cortex-a8 \ --enable-runtime-cpudetect \ --prefix=$prefix \ --enable-pic \ --disable-shared \ --enable-static \ --enable-cross-compile \ --cc=$prebuilt/bin/arm-linux-androideabi-gcc \ --cross-prefix=$prebuilt/bin/arm-linux-androideabi- \ --sysroot="$platform" \ --extra-cflags="-i../x264 -mfloat-abi=softfp -mfpu=neon -fpie -pie -fpic -dandroid -marm -march=armv7-" \ --extra-ldflags="-l../x264 -l$prebuilt/lib/gcc/arm-linux-androideabi/4.9" \ --extra-libs="-lgcc" \ --enable-gpl \ --enable-version3 \ --enable-nonfree \ --disable-doc \ --enable-yasm \ --enable-decoders \ --enable-encoders \ --enable-muxers \ --enable-demuxers \ --enable-parsers \ --enable-protocols \...

python - assert JSON response -

i have python api call, , server response coming me json output. how can assert "status" output 0 example: def test_case_connection(): req = requests.get_simple(url=server.my_server, params=my_vars) assert req["status"]="0" is i've tried. the response looking like: {"status" : 0, ......} error got is: typeerror: 'response' object has no attribute '__getitem__' if need check request successful, using request.status_code trick: def test_case_connection(): req = requests.get_simple(url=server.my_server, params=my_vars) assert req.status_code == 200 if want instead check presence pf specific key-value pair in response, need convert response payload json dict: import json def test_case_connection(): req = requests.get_simple(url=server.my_server, params=my_vars) data = json.loads(req.content) assert data["status"] == "0" if using requests library c...

How to draw star in java swing using fillPolygon -

i'm having trouble setting coordinate of star there better solution this. cannot the correct shape. can me on this? public void star(graphics shapes) { shapes.setcolor(color); int[] x = {42,52,72,52,60,40,15,28,9,32,42}; int [] y = {38,62,68,80,105,85,102,75,58,20,38}; shapes.fillpolygon(x, y, 5); } sun's implementation provides custom java 2d shapes rectangle , oval , polygon etc. it's not enough. there guis require more custom shapes regular polygon , star , regular polygon rounded corners. project provides more shapes used. classes implements shape interface allows user use usual methods of graphics2d fill() , draw() , , create own shapes combining them. regular polygon star edit: link

c# - Winforms button properties -

i using windows forms application in visual studio. want change button , textbox properties programmatically , not use the properties tab. how do this? there way access code of ui of button/textbox after changed in properties tab? of course can change programmatically. if have example button called btnstart , have in form access properties: btnstart.text = "start"; have at: change properties of programmatically created buttons edit: if change programmatically after initializecomponent(); override changed properties set manually in properties tab.

php - Page id without '?' in URL -

i have seen websites different pages accessed via page id isn't passed through via method.. so this: http://www.website.com/sitefolder/pageid/ @ other websites see: http://www.website.com/index.php?id=12 i know different pages of example 1 stored in db , not in different folders suggest.. normally if have forward slash mean you're going through different folders.. can explain me how can create forward slash page id indicator without havering make hundreds of different folders different pages? so 1 php page in 'sitefolder' adapts content page id or page name or url alias passed through url without using '?id=12' method. you accomplish using .htaccess rule mod_rewrite enabled, so: rewriteengine on rewriterule ^/([^/]+)$ index.php?id=$1 this rewrite example.com/12 example.com/index.php?id=12 . edit : regex, broken down: ^ match start of line / match slash ([^/]+) match , save first group of characters aren't slash $ m...

java - How to return to the class from a jframe in netbeans -

i'm new netbeans. below scenario : i have created normal java file in i'm calling jframe. jframe have textbox , submit button. want after calling jframe java file, jframe opens up. after typing text in textbox, when click on submit button should return java file (to line after called jframe) text typed. so, can use text in java file further. but happening when call jframe below command, jframe opens , after rest of code in java file gets executed. java not waiting jframe return data. new frame1(new javax.swing.jframe(), false).setvisible(true); and below code in jframe. don't know how return , use in java file private void jbutton1actionperformed(java.awt.event.actionevent evt) { string s1 = jtextfield1.gettext(); arga[0] = s1; } so, please let me know how can ? thanks in advance make 2 methods, first 1 main method create frame. second 1 things when jframe done work. and case string s1 = ...

java - disabling edittext android using if else in view holder -

please me in succeeding nightmare regarding on how disable editext using viewholder or way on how using if , else statement i have recycler view , lists names , messages. (messenger like). somehow recycler view consists of name ,message , small tag textview “customer closed” if going click recycler view consist of tag “customer closed” not able send messages because closed. otherwise recycler view consist of tag “customer closed” it’s editext set in false. public void bind(final account account, final firebasechat chat) { itemview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { context context = itemview.getcontext(); if (context instanceof navigationactivity) { final activity activity = (activity) context; final intent intent = new intent(itemview.getcontext(), mychat.class); intent.putextra(chatactivity.key_new, false); inten...

javascript - How to get current route in react-router 2.0.0-rc5 -

i have router below: <router history={hashhistory}> <route path="/" component={app}> <indexroute component={index}/> <route path="login" component={login}/> </route> </router> here's want achieve : redirect user /login if not logged in if user tried access /login when logged in, redirect them root / so i'm trying check user's state in app 's componentdidmount , like: if (!user.isloggedin) { this.context.router.push('login') } else if(currentroute == 'login') { this.context.router.push('/') } the problem here can't find api current route. i found this closed issue suggested using router.activestate mixin , route handlers, looks these 2 solutions deprecated. after reading more document, found solution: https://github.com/reacttraining/react-router/blob/master/packages/react-router/docs/api/location.md i need access inject...

php - How to select one result from same multiple database results -

Image
i creating inbox page echoed out rows of user inbox database user appears multiple times appeared on database table if know mean, here image of mean: so name kanayo great appears times appeared in table. want name appear once when clicked on display message body. here code: $mymsg = mysql_query("select msg_from, msg_to message msg_from='$my_id' or msg_to='$my_id' order msg_id desc limit $start, $per_page"); while($run_msg = mysql_fetch_array($mymsg)){ $msg_from = $run_msg['msg_from']; $msg_to = $run_msg['msg_to']; if($msg_from == $my_id){ $users = $msg_to; } else { $users = $msg_from; } $firsts = getuser($users, 'first'); $nicks = getuser($users, 'nick'); $lasts = getuser($users, 'last'); echo "<div align='left'><a href='message.php?user=$users' style='text-decoration:none;><<b><font color='blue'>$fi...

c# - Entity Framework Code First Many to Many relationship(s) in single table -

i've been lurking around quite time, here's first question ;) i've been playing entity framework 5.0 code first , want following: i have 2 entities , want every entity have relation address entity in following way: i have 1 address entity stores address values, doesn't have relation entities has values, instead there's entity addressbook has reference address entity , coresponding entities ( person , company , others in future) here's code: public partial class address : baseentity { [key] public int id { get; set; } public string street { get; set; } public string cityname { get; set; } public int? postalcode { get; set; } public virtual icollection<person> persons { get; set; } public virtual icollection<company> companies{ get; set; } } public partial class person : baseentity { [key] public int id { get; set; } public virtual icollection<address> addresses { get; set; } } publ...

how to convert datetime in C#, please Convert this format 27/01/2016 08:00:17 to T,270116,040017 -

how convert datetime in c#? please convert format 27/01/2016 08:00:17 t,270116,040017 , expected output - t,270116,040017 , datetime - 27/01/2016 08:00:17 use datetime.parseexact addhours , create custom formatting: string dtstr = "27/01/2016 08:00:17"; datetime dt = datetime.parseexact(dtstr, "d/m/yyyy hh:mm:ss", cultureinfo.invariantculture); dt = dt.addhours(-4); string dtresult = dt.tostring("t,ddmmyy,hhmmss"); result: t,270116,040017 note: datetime string format looks rather unusual. check this more info.

java ee - Security Multi-user Client: Bad remote CallerPrincipal when connecting 2 users from my client -

i have annoying issue secured glassfish 3.1.2. when connect 2 (or more) users stand-alone client, having last connected user when try caller principal ejb: sessioncontext.getcallerprincipal().getname(); could please give me on issue? here client: <pre> public static void main(string[] args) { new thread(new runnable() { @override public void run() { connectuser("usera", "pwdb"); } }).start(); new thread(new runnable() { @override public void run() { connectuser("userb", "pwdb"); } }).start(); } public static void connectuser(string username, string password) { try { programmaticlogin login = new programmaticlogin(); login.login(username, password.tochararray()); context context = new initialcontext(); myserviceremote myservice = (myservic...

json - Gatling request based on Webservice response -

i'm new scala. i'm using gatling stress testing. i'm able make gatling test makes request ws, save json response in session variable. response json array contains several links images provided backend. specifically, first request retrieves points in map, each point has image assigned, each image must fetched accessing link provided response of first ws. i have following code: class basicsimulation extends simulation { object points { val jsonfilefeeder = jsonfile("input.json").circular val points=exec(http("r1").get("/")) .feed(jsonfilefeeder) .exec(http("r2") .post("/ws/getpoints") .check(bodystring.saveas("points")) ) } object images { val images=exec(session=>{ val respmap = session("points").as[string]...

4th order RUNGE KUTTA METHOD for more that 3 coupled equations in MATLAB -

can please tell me how implement 4th order runge kutta method more 3 coupled equations in matlab. regards faiz if have version vector valued ode 1 dimension, have dimensions. (syntax may have corrected errors, works under scilab, close, not idential matlab) function [t, y] = rk4(odefunc, y0, t0, tf, n) t = tf-t0; h=t/n; time=t0; state=y0; t = zeros(n+1); y = zeros(n+1,length(y0)); t(1) = t0; y(1,:) = y0; i=2:n+1 k1 = odefunc(time , state ); k2 = odefunc(time + 0.5*h, state + 0.5*h*k1); k3 = odefunc(time + 0.5*h, state + 0.5*h*k2); k4 = odefunc(time + h, state + h*k3); state = state + (h/6)*(k1+2*k2+2*k3+k4); time = time + h; t(i) = time; y(i,:) = state; end endfunction function doty = lorenz(t, y, params) a=params(1); b=params(2); c=params(3); doty = [ * ( y(2) - y(1) ) -b * y(1) + y(1) * y(3) -c * y(1) - b * y(3) ]' e...

python - Jira API Created New fixVerisons value -

trying use jira api set/add fixversions field i'm running error if fixversions value has not been created. i've tried set , add following error response. note able create new fixversions via ui via api. {"errormessages":[],"errors":{"fixversions":"version name '1.0.0.1' not valid"}} here sample python working if fixversion exists. import requests import json header = {'content-type': 'application/json','charset':'utf-8'} # add works if fixversion exists #payload = {"update":{"fixversions":[{"add":{"name":"1.0.0.0"}}]}} payload = {"update": {"fixversions" : [{"set":[{"name":"1.0.0.1"}]}]}} url = 'https://domain.atlassian.net/rest/api/latest/issue/blah-1111' r = requests.put(url,headers=header,json=payload,auth=('user', 'pass')) print ...

passing HTML radio button value to a javascript variable -

this question has answer here: how can check whether radio button selected javascript? 23 answers i wonder if can me out, i'm stuck need write little code goes this. question : did training? <input type="radio" name="q4" value="yes">yes <input type="radio" name="q4" value="no">no whatever checked want pass javascript variable. i think this: var ch = document.getelementsbyname('q4'); (var = ch.length; i--;) { ch[i].onchange = function() { alert(this.value); } } http://jsfiddle.net/euerp/ so subscribe to change event , can use selected value somehow. alternatively can use queryselector ( queryselectorall ) methods. here example of how can checked element value: var checked = document.queryselector('[name="q4"]:checked'); http...

javascript - Alexa/similarWeb traffic tracking on single-page application? -

we have single-page application build in angularjs, , facing dilemma on how can alexa/similarweb track traffic , user engagement within our classifieds sites. figured out how handle seo , track ga, not tools alexa. since these tools track page views among other things, take dive in reported traffic when changing spa seem lack kind of dynamic js tracking google analytics provide. are there practices/tricks make alexa/similarweb report correct traffic on angularjs spa? i work @ similarweb , think workaround enable estimate application's traffic accurately use our google analytics verification option. can either publicly or anonymously, check links on our site's footer more info.

wordpress - PHP Execution wrong order -

i hoping can point me in right direction... i have following script in php global $post; $url = "".get_post_meta($post->id, "syndication_permalink", true).""; $wpws_get_content1 = wpws_get_content($url, true).'"', "#doccontent"); the above code not work... global $post; url = "http://example.com"; $wpws_get_content1 = wpws_get_content($url, true).'"', "#doccontent"); if code above , manually enter url in $url works if echo $url in top example works, dynamically use code wpws_get_content($url, true) it not work.... i not sure error is, seems problem execution time in script above... if have ideas how solve this, appreciated if can point me right direction....

cakephp - Multiple databases running different sites - same database structure - how to update all? -

there multiple, ever-increasing number of sites run off single instance of cms (built in cakephp) on single server array. cms has set database structure, need updating regularly - new fields, changing names of fields, new tables ...etc. i can't wrap head around way 1) keep sites having own databases (seemingly ideal), two, basing them off same, regularly-updated database structure. so far thought keep single "template" database, , update that, write script compare , update - then, how know if field changed, or if new field, , previous field deleted...etc etc etc. i'm sure haven't thought of problems cause. advice appreciated. you use migrations tool https://github.com/cakedc/migrations . basic idea behind migrations have kind of version control database schema, each migration representing "commit" describing changes (like add table, rename field, etc.) should applied database schema.

Spring with spring.config.location -

i trying point @ path external configuration file this: --spring.config.location=file: c:/users/some_user/workspace/repository1/payment-api/payment.yml and doesn't work. idea why? the proper prefix file:// . on windows need "/" in file url if absolute drive prefix try file:///c:/users/some_user/workspace/repository1/payment-api/payment.yml instead.

php - Create Random image slideshow -

i have website live @ moment , images desplay in sequence want add little dynamics slider , make randomly displays images instead basic code: <div class="container slideshowcontainer" style="width: 100%;"> <!-- begin revolution slider --> <div class="fullwidthbanner-container slider-main margin-bottom-10"> <div class="fullwidthabnner"> <ul id="revolutionul" style="display:none;"> <!-- output slides --> <?php foreach($slides $d){ ?> <li data-transition="fade" data-slotamount="8" data-masterspeed="700" data-delay="9400" data-thumb="assets/img/sliders/revolution/thumbs/thumb2.jpg"> ...

binaryfiles - How can I read binary file in java which is written in c# -

i have read binary file written in c#. , know file format. want learn if possible. , how can if possible. your question ambiguous, i'll assume you're asking "how read binary file?" in case, answer use fileinputstream read bytes. if know filepath, can use code below read bytes file: byte[] readbytes(string filepath) { file file = new file(filepath); fileinputstream stream = new fileinputstream(file); // create buffer of correct size byte[] buffer = new byte[file.length()]; // read in data stream.read(buffer); return buffer; }

Perl SOAP::Lite XML Parser encoding value -

i calling web service soap::lite. gives following error: not well-formed (invalid token) @ line 7, column 16, byte 281 @ /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/xml/parser.pm line 187 at line 7 of output, there turkish character think caused problem. can see output terminal. starting following line : <?xml version="1.0" ?> there no encoding parameter. how can set output encoding value utf-8? tried following when calling web service did not work: my $soap = soap::lite -> on_action( sub { join '/', @_ } ) -> readable(1) -> uri('xxx') -> proxy("http://xxx") -> ns("http://schemas.xmlsoap.org/soap/envelope/","soapenv") -> ns("xxx","yyy"); $soap->serializer()->encodingstyle("utf-8");

javascript - Plotting the below json in a HighChart -

following json object in json format 1.1 {    "jsonversion":1.1,    "databehaviour":"timebased",    "measurementunit":"mb",    "error":"",    "dataseries":[       {          "name":"availablembytes",          "data":[             {                "x":1396602300000,                "y":"1156"             },             {                "x":1396605900000,                "y":"1137.05"             }          ]       }    ] } is possible plot data in high chart? code this, doesn't show output. $(document).ready(function() { var options = { chart: { renderto: 'container', type: 'spline' }, series: [{}] }; $.getjson('data.json', function(data1) { ...

c++ - More information from std::exception -

i'm writting qt-application arm-processor. use gcc-linaro-arm-linux-gnueabihf compiller. i try caught std::exception try { ----code here---- } catch(qexception e) { qcritical() << e.what(); } catch(std::exception e) { qcritical() << e.what(); } as output have: ----- dev started ----- std::exception ----- dev finished ----- there no detailed information exception. ho can see kind of std::excpetpion occured? the problem, it's qt application. makefile generated qmake. can't directly pass options gcc compiller. the problem you're slicing exception object—you're catching value, subclass information lost. catch const & instead keep type & data alive: catch(const std::exception &e) { qcritical() << e.what(); } additionally, if want special handling more specific types (classes derived std::exception ), can add it: catch (const std::invalid_argument &e) { qcritical() << ...

Android error APK -

hi have error: \app\build\intermediates\res\merged\debug\values-v23\values-v23.xml error:execution failed task ':app:processdebugresources'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command appdata\local\android\sdk\build-tools\23.0.1\aapt.exe'' finished non-zero exit value 1 error:(24) error retrieving parent item: no resource found matches given name 'android:widget.material.button.colored'. error:(3) error retrieving parent item: no resource found matches given name 'android:textappearance.material.widget.button.inverse'.` make sure use compiling version 23 of sdk , support library latest. seems using materialdesign components, trying build app older sdk.

vb.net - Visual Studio 2013: Cannot update textbox with event handler -

i building application using 1 of our vendors interfaces, required keep status message box updated. i have events have handled testing using message box, come pass these messages display box nothing. public shared sub pageairhandler(channelnum integer, index integer, channeltype claritycomlib.channeltype, pagename string) handles status1.airstatuschanged messagebox.show(pagename) controlpanel.airstatusbox.text = pagename end sub the messagebox dutifully displays pagename string, textbox nothing... if replace pagename string variable "test" controlpanel.airstatusbox.text = "test" i no activity, no errors, nada. have googled around, every example can find seems show same code. i have recreated textbox, tried buttons, labels , other objects same result. setting button click handler update of these works expected. apologies if noob blunder, it's driving me nuts! using dlg new form2 dlg.showdialog() end using things like: ...

How to merge four videos on one screen with ffmpeg -

Image
this question has answer here: video grid vstack , hstack 1 answer i have video test.mp4, , need make appear 4 times @ once on screen. here found command makes 2 videos appear @ time ffmpeg -i input0.avi -vf "movie=input1.avi [in1]; [in]pad=640*2:352[in0]; [in0][in1] overlay=640:0 [out]" out.avi but doesn't work mp4 videos, , need 4 videos @ time. thank in advance four different inputs ffmpeg -i input0 -i input1 -i input2 -i input3 -filter_complex \ "[0:v][1:v]hstack[top]; \ [2:v][3:v]hstack[bottom]; \ [top][bottom]vstack,format=yuv420p[v]; \ [0:a][1:a][2:a][3:a]amerge=inputs=4[a]" \ -map "[v]" -map "[a]" -ac 2 output.mp4 two hstack instances make top , bottom, vstack combines those. amerge combines audio streams, -ac 2 downmixes them stereo. same input ffmpeg -i input \ -filter_complex ...

http - Hubot Basic Authentication REST Call -

with hubot trying access specific issues through jira rest api. url = http://myserver.com/jira/rest/api/2/search?jql=status="open"+and+assignee=null robot.http(url).get() (err, res, body) -> # code hubot fails reach server. proxies set properly. rest api works expected through browser once logged in . thus need specify authentication. what tried far (plain basic authentication): robot.http(url).auth('user', 'pass'). ... robot.http(url).header('authentication', 'user:password'). ... robot.http('http://user:password@someurl'). ... hubot keeps telling me server not found. how pass authentication through http? this snippet hubot-confluence plugin should same authenticating jira. basic access authentication. can btoa method convert binary base64 encoded ascii. far know there lots of scripts connecting jira hubot. make_headers = -> user = nconf.get("hubot_confluence_user") password = nconf....

html - Do % in CSS flow into each other? -

i'm trying turn fixed site fluid site , have quick question on how %'s work. <div class=wrap> <div class=box> <div class=text> <div class=box> <div=class=wrap> .wrap{ width: 100%; } .box{ width: 50% } .text{ width: 25% } now given code happens? wrap fits entire screen. box fill 50% of screen, text fills 25% of 50%. doesn't fill 25% of entire screen, fills percentage of containing div. correct? it's because div calculating dimension it's parent . div having class .wrap calculating it's dimension parent i.e body that's why takes entire body width. have in box model

php - Aligning rectangles around the inside of a circle and rotate -

Image
i have program generates image. it places x images around circle x circumference. see below output of current implementation. i need of rectangles inside of circle , evenly placed. note on image above, current implementation, of rectangles on inside , on outside. i'm unsure wrong calculation, please see below code placing rectangles. /** * draw points around circle * @param $count * @param $circumference */ public function drawwheel($count, $circumference) { /** * starting angle */ $angle = 0; /** * starting step between rectangles */ $step = (2 * pi()) / $count; /** * center x of canvas */ $startx = ($this->canvas['width'] / 2); /** * center y of canvas */ $starty = ($this->canvas['height'] / 2); ($i = 0; $i < $count; $i++) { /** * width of rectangle */ $width = 85; /** * height of rectangle ...

Can not start MongoDB 3.2.1 on CentOS 7 -

i followed doc install mongodb 3.2.1 on centos 7. after installing, change owner , group of var/lib/mongo , var/log/mongodb/mongod.log root:root . when start mongodb service mongod start , shows starting mongod (via systemctl): job mongod.service failed. see 'systemctl status mongod.service' , 'journalctl -xn' details.[failed] i have run 2 commands show details. systemctl status mongod.service shows mongod.service - sysv: mongo scalable, document-oriented database. loaded: loaded (/etc/rc.d/init.d/mongod) active: failed (result: exit-code) since wen 2016-01-27 18:32:46 cst; 14s ago process: 24913 execstart=/etc/rc.d/init.d/mongod start (code=exited, status=1/failure) main pid: 23711 (code=exited, status=0/success) 1月 27 18:32:45 server1 systemd[1]: starting sysv: mongo scalable, document-oriented database.... 1月 27 18:32:45 server1 runuser[24920]: pam_unix(runuser:session): session opened user mongod (uid=0) 1月 27 18:32:46 server1 mongod[2491...

search - Elasticsearch. Range query for strings with dashes -

i'm using elasticsearch data have string-field date values, this: "2016-01-25 18:40:18.933" i'm trying use range filter getting values date date. example: "query" : { "filtered" : { "query" : { "range" : { "createddate" : { "gte": "2015-11-01", "lte": "2016-01-25" } } } } } } but results doesn't contain values "createddate": "2015-12-14 20:28:23.557" if use "gte": "2015" or "gte": "2014-12-31" , values "createddate": "2015-12-14" included in results. what's wrong in query? if want able run range queries on dates, need map field date field , otherwise won't work expect. in mapping shared...

angularjs - Redirecting to profile page before login in node.js using passport.js -

i have 2 pages http://localhost:3000/pages/auth/login , http://localhost:3000/pages/profile . when give login details goes profile page in address bar directly give /pages/profile. i want comes login page. authentication using passport-local authentication. all passport store session on server side. on front-end need make calls end see if session still active. front-end knows nothing on back-end unless type of response back-end. this assuming using expressjs passport.js you need create function handle login checks function isloggedin(req, res, next) { // if user authenticated in session, carry on if (req.isauthenticated()) return next(); // if aren't redirect them home page res.redirect('/pages/auth/login'); } your backend route should handle frontend when sends check request app.get('/pages/profile', isloggedin, function(req, res) { // send them profile page });

python - twisted ordered DeferredList -

is possible create deferredlist (or similar) runs deferred in defined order ? i need run list of deferred, ideally deferred should wait on previous one, can alter next deferred result: #!/usr/bin/env python # -*- coding: utf-8 -*- """ """ __future__ import division, absolute_import, \ print_function, unicode_literals twisted.internet import defer, reactor def multiply(n): if n == 3: import time time.sleep(1) print(n * 10) return n * 10 def stopifresultisabove20(n): if n > 20: print('result above 20, stop following deferreds') raise exception('the result above 20, cancelling other deferreds') return n def onsuccess(result): print(result) return result def onerror(failure): print('failed !') pass requests = [] n in range(0, 6): d = defer.deferred() d.addcallback(multiply) d.addcallback(stopifresultisabove20) if n == 3: ...

gunicorn - how to serve index page from django instead of nginx static index page option -

i trying deploy webapp using nginx-gunicorn-djngo.the problem when open root url(eg. www.xyz.com) in browser shows default welcome page of nginx want serve index page through django using proxy_pass. when opening www.xyz.com// works fine url matches location block wiht pattern "/".please suggest how can make nginx redirect www.xyz.com gunicorn server. find below nginx.conf user ec2-user; worker_processes auto; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for...

asp.net mvc - Authenticate using SAML and Okta from MVC -

i need replace windows auth in intranet site saml against okta. i'm having little luck finding example not require phd understand. can point me dummies guide or samples this? thanks try mvc4musicstore sample use okta instead of ad: https://github.com/okta/okta-music-store you need modify code use okta membership , role providers.

php - Ajax form not being submitted -

i attempting send simple login form jquery modal form. $( "#dialog-form" ).dialog({ var url = "../scripts/sign_up.php"; $.ajax({ type: "post", url: url, data: $("#dialog-form").serialize(), success: function(data){ alert("it works") } }); }); this first real shot @ trying ajax , having issues getting success method go through. have checked script in right place , dialog_form has right id. am sending information incorrectly? there way troubleshoot ajax requests? right trying info go through and, question, removed other code form. first, might reccommend adding error function ajax request - may error handling: error: function (jqxhr, textstatus, errorthrown) { alert(textstatus); alert(errorthrown); } second, how sending data script ajax request? if you're not echoing data script, request not going know script ran sucessfully. therefo...

Change json.dumps dictionary values in python -

so have following dict: my_dict{'key1': 'value1', 'key2': 'value2', 'key3': json.dumps([ {"**subkey1**": "subvalue1", "**subkey2**": "subvalue2",}, {"**subkey1**": "other_subvalue", "**subkey2**":"other_subvalue2"}]) } what need somehow made def have check , each subkey2 change value def itself and subkey1 check if value same second subkey1 please note talking subkey1 have twice. i don't want set them manually. mean have dict global, , calling many def, need make these changes , check inside each def what tried is: def recurse_keys(my_dict, indent = ''): print(indent+str(key)) if isinstance(my_dict[key], dict): recurse_keys(my_dict[key], indent+' ') recurse_keys(my_dict) and printing of params, not sure how proceed example: my_dict{'name': 'georgi',...

php - Reading specific xml data using SimpleXMLElement -

i have challenges reading value of "cmbdestinosv" , each of "chk_xxxxx" in "coberdata" using simplexmlelement in below code snippet. code snippet xml response. i have tried $xml->coberdata->chk_c0000; $xml->riskdata->cmbdestinosv->option->cd[1]; nothing returned. please help. <root> <riskdata label="risk details"> <cmbdestinosv afectaalprecio="true" dataname="cmbdestinosv" id="cmbdestinosv" name="cmbdestinosv" type="5" style="width:120" label="destination" visible="true" maxlength="2" readonly="false" obligatorio="true" size="3" newline="false" etiquetaencima="false" value="-1">-1 <option> <cd>-1</cd> <ds/> </option> <option> <cd>7</cd> <ds...

javascript - add values from select box to URL dynamically in HTML5 -

i have simple html5 code opens new tab when click on button url depending on value client value of select box, wonder how can include values name , language components url parameters in selectbox, building (using jquery notation) value="http://localhost:1010/?lan=$('#lang').val()&name=$('#name').val()" <script type="text/javascript"> window.open = function(){ location.href=document.getelementbyid("selectbox").value; } </script> <link href='http://fonts.googleapis.com/css?family=open+sans:400,300,300italic,400italic,600' rel='stylesheet' type='text/css'> <link href="http://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.css" rel="stylesheet"> <link rel="stylesheet" href="style.css" /> <body> <div class="testbox"> <h1>portal</h1> </br> </br> <form action...

Exaction of rows based on value using awk -

i have tab limited file this gi nz 99.54 438 2 0 1 438 18559 18122 0.0 798 gi nz 99.77 438 1 0 1 438 1787 2224 0.0 804 gi nz 99.32 438 3 0 1 438 82769 83206 0.0 253 gi nz 100.00 438 0 0 1 438 19698 20135 0.0 809 from above file want extract rows based on value of 3rd row (<100). how possible desirable output gi nz 99.54 438 2 0 1 438 18559 18122 0.0 798 gi nz 99.77 438 1 0 1 438 1787 2224 0.0 804 gi nz 99.32 438 3 0 1 438 82769 83206 0.0 253 just this: awk '$3<100' file

css3 - Glitches with cross-browser CSS support for 100% transform translate animation movement -

i've dug out old piece of js code wrote thought i'd put online free use, , i've found 1 css animation rendering issue stumped me 3 years ago still acting today. it involves animating element left:100% / transform: translatex(100%) or top:100% / translatey(100%) 0 , from off right or bottom of parent element origin . i've been testing in google chrome on mac os x (47.0.2526.111) , glitchy rendering occurring, visible in example: https://jsfiddle.net/lvl99/g29o0005/ the glitch shifts transitioning element origin position, animates off screen jump origin position. back when debugging issue posted question here , working solution change 100% value 92.5% in css. works left / translatex values, not top / translatey values. one interesting aspect glitch rendering negative values origin has no issue, i.e. left:-100% / transform:translatex(-100%) , top:-100% / transform:translatey(-100%) seem render ( from off top or left of parent element origin no jump...

deferred - AngularJS : Where to use promises? -

i saw examples of facebook login services using promises access fb graph api. example #1 : this.api = function(item) { var deferred = $q.defer(); if (item) { facebook.fb.api('/' + item, function (result) { $rootscope.$apply(function () { if (angular.isundefined(result.error)) { deferred.resolve(result); } else { deferred.reject(result.error); } }); }); } return deferred.promise; } and services used "$scope.$digest() // manual scope evaluation" when got response example #2 : angular.module('homepagemodule', []).factory('facebookconnect', function() { return new function() { this.askfacebookforauthentication = function(fail, success) { fb.login(function(response) { if (response.authresponse) { fb.api('/me', success); } else { fail('user cancelled login or did no...

math - Converting very small numbers -

how can convert small numbers in lua? example 1.75245e-09 or 7.73411e-08 works e-04 from lua interpreter: 1> 1.75245e-05 1.75245e-05 1> 1.75245e-04 0.000175245 what want string.format works c print-into-string function sprintf . thus string.format("%f",7.73411e-08) should yield desired output. if useful have many leading zeros question. did not test this, default length might limited. if use string.format("%20f",7.73411e-08) to provide sufficient space.

entity framework - Multiple level of inheritance in EF Code First Configuration -

i have abstract base class few entities i'm defining. 1 of derived entities non-abstract base class entity. following code: public abstract class basereportentry { public int reportentryid { get; set;} public int reportbundleid { get; set; } //fk public virtual reportbundle reportbunde { get; set; } } //a few different simple pocos 1 public performancereportentry : basereportentry { public int performanceabsolute { get; set; } public double performancerelative { get; set; } } //and 1 second level of inheritance public byperiodperformancereportentry : performancereportentry { public string period { get; set; } } i'm using base entitytypeconfiguration : public class basereportentrymap<treportentry> : entitytypeconfiguration<treportentry> treportentry : basereportentry { public basereportentrymap() { this.haskey(e => e.reportentryid); this.hasrequired(e => e.reportsbundle) ...