Posts

Showing posts from February, 2013

php - Laravel 5 keep redirecting me to `/auth/login` when go to an route post? -

i'm new laravel 5. have route post /subscribe . //subcribe route::post('/subscribe','subscribecontroller@postsubscribe'); when goto it, laravel application auto redirecting me : /auth/login i notice, in i have : /app/http/routes.php route::controllers([ 'auth' => 'auth\authcontroller', 'password' => 'auth\passwordcontroller', ]); auth controller <?php namespace app\http\controllers\auth; use app\http\controllers\controller; use illuminate\contracts\auth\guard; use illuminate\contracts\auth\registrar; use illuminate\foundation\auth\authenticatesandregistersusers; class authcontroller extends controller { /* |-------------------------------------------------------------------------- | registration & login controller |-------------------------------------------------------------------------- | | controller handles registration of new users, | authentication of existing u...

Position :before pseudoclass in-between parent and child CSS -

Image
(basically i'm trying style text field beyond normal capabilities, including filler text doesn't interact directly cursor.) i wonder if it's possible position (using z-index if possible) :before element behind child elements of container element, in front of container background. (maybe you'd understand in bit) html: <div class="field" data-title="john"> <input type="text" name="firstname"> </div> css: .field{ background-color:white; border:1px solid gray; } .field:before{ content:attr(data-title); } input[type="text"]{ background-color:transparent; border:none; outline:none; } this displays correctly: however, i'm concerned because cannot focus text field if cursor on :before content (in case, word "john"). i understand :before can styled pointer-events:none , however, "pointer-events" tag not yet entirely cross-browser compati...

java - Bad operand types error -

i getting error when trying add input validation program working on: bad operand types binary operator '||' first type: boolean; second type: java.lang.string here's code: string x = scan.nextline(); while (!x.tolowercase().equals("buy lamborghini")||("donate")||("do know am")||("go sailing")||("drink fine wine")||("invest")||("gamble")) { system.out.println("please choose valid option"); } the error highlighted around "donate" portion of while condition the problem trying use or operand string , boolean what want this: while (!(x.tolowercase().equals("buy lamborghini") || x.tolowercase().equals("donate") || x.tolowercase().equals("do know am") || x.tolowercase().equals("go sailing") || x.tolowercase().equals("drink fine wine") || x.tolowercase().equals("invest") || x...

java - Error with console.readLine(); but everything looks correct in code? -

when try run says there problem console.readline(); . import java.io.console; public class pingpong { public static void main(string[] args) { system.out.println("give me number, honey?"); string stringyournumber = console.readline(); integer yournumber = integer.parseint(stringyournumber); system.out.println("here ya go:"); ( integer i=1; <=yournumber; i++){ if( % 5==0 && % 3==0){ system.out.println("pingpong"); } else { if (i % 5==0){ system.out.println("pong"); } else { if ( % 3==0){ system.out.println("ping"); } } } } } you have declare , intialize variable called console console console = system.console(); if (console != null) { str = console.readline (); }

Append text to all files in a directory using batch -

i'm complete batch beginner.. i'm trying add 'exit' last line of every text file in folder. i it's combination of , echo can't work after doing lot of searching. my current attempt; for %%i in (*.*) echo exit >> %cd% %%i :( any appreciated! it if explained why think “can't work”; i'm guessing want: for %%i in (*.txt) echo exit>> %%i don't put space after text want echo . don't know why have %cd% in redirection; try send text local directory, makes no sense. if you're trying send file in different directory need separate them window’s directory separator: ... echo whatever>> \other\directory\%%i you don't need %cd%

c - GCC inline assembly constants (ARM) -

is there way give constants inline assembly code "parameters"? i'm trying make co-processor access functions. tried 2 approaches: macro-replacement , extensions. the use this: unsigned int read_id_pfr1() { read_cp15(0, 0, 1, 1); return cp_reg_val; } the macro approach: #define read_cp15(opc, crn, crm, opc2) \ asm volatile (\ "push {r0, r1}\n\t"\ "mrc p15, opc, r0, crn, crm, opc2\n\t"\ "ldr r1, =cp_reg_val\n\t"\ "str r0, [r1]\n\t"\ "pop {r0, r1}\n\t"\ ) i think parameters (opc, crn, ...) not expanded because used within quotation marks. the extension approach looks this: #define write_cp15(opc, crn, crm, opc2) \ asm volatile (\ "push {r0, r1}\n\t"\ "ldr r1, =cp_reg_val\n\t"\ "ldr r0, [r1]\n\t"\ "mcr p15, %[op], r0, c%[rn], c%[rm], %[op2]\n\t"\ "pop {r0, r1}\n\t"\ ::[op]...

callback - C++ Java Handler equivilent -

i'm coming java/c# background , new c++. writing library , trying accomplish same functionality handler in java. scenario follows: i building winrt library user put mobile/desktop app. @ point, after network communication happens, piece of data come in want pass along user. in java, declare public static handler (but not initialize it) user can initialize. when data comes in, send message through handler, , end user's declaration within app gets called, receiving message , grabbing data it. i can't seem find way same in c++. have looked @ kinds of posts/documentation on delegates/function pointers, utilizing mighty google keywords "callback", "handler", , "delegate". think have half-formed understanding work differently in c++, nothing bearing fruit. could kindly point me in right direction? pretty same you'd in java. in library, define pure virtual class (more-or-less analogous java interface ) of handler. class somet...

push - What does this git output (forced update) mean? -

in following scenario working on private feature branch, push in order make available between own different machines. both develop , master, 1 might expect, shared branches, , integrity important. when saw output, i'm different see, sort of terrified. did somehow force changes pushed other 2 branches (in case need notify others quickly), , not branch working in? , if not, output meant indicate? maurice@debian:~/a_project$ git push -f [...] + e3d41a7...e71be58 feature/policies-redesign -> feature/policies-redesign (forced update) + 3fa3bf8...9142dea master -> master (forced update) + a01ab9a...8403461 release -> release (forced update) as @miqid mentioned in comments, documentation git-push says: note --force applies refs pushed, hence using push.default set matching or multiple push destinations configured remote.*.push may overwrite refs other current branch (including local refs strictly behind remote counterpart). force push 1 branch,...

Parsing text file lines into numbers using std::iter::Iterator map -

i'm trying read , parse text file in rust. each line signed integer. i'm able using for line in lines iteration i'm unable iter().map(|l| ...) one-liner. i'm getting a expected `&core::result::result<collections::string::string, std::io::error::error>`, found `core::result::result<_, _>` when try pattern match ok(s) => match s.parse() i'm unable bottom of doing wrong. whole example below. code on bottom code producing error. can tell doing wrong? use std::error::error; use std::fs::file; use std::io::bufreader; use std::io::prelude::*; use std::path::path; fn main() { // create path desired file let path = path::new("input/numbers.txt"); let display = path.display(); // open path in read-only mode, returns `io::result<file>` let file = match file::open(&path) { // `description` method of `io::error` returns string describes error err(why) => panic!("couldn't open ...

C++ Optimization breaking OLE Automation program (non-MFC) -

i'm writing program parse word document , export data out excel workbook using ole automation (the non-mfc way guess). works fine in debug, not in release (specifically if optimization enabled). error idispatch::invoke call failed, specifically: 0x80020004 disp_e_paramnotfound parameter not found i checked stackoverflow suggestions , main 1 seems uninitialized variables. might what's going on, still don't understand specific case. i've narrowed down single function in program automation::dispatch::invoke responsible calling idispatch::invoke . arguments being passed automation::dispatch::invoke correct problem somewhere in code. looking @ base code (from msdn) adapted from, able working , narrow down exact problem line. below shows code not work, comments indicate line moved working (look 2 lines <--- problem line comment). in debug mode, location of line not matter , works in either spot. my question fix, , why issue start with? thank , let me know ...

user interface - TypeError Missing Positional Arguments? What is going on? --Python and Tkinter -

im trying code simple tkinter program returns reddit information user. in doing so, i'm receiving error message: traceback (most recent call last): file "redditscraper4.py", line 111, in <module> app = redditscraper() file "redditscraper4.py", line 23, in __init__ frame = f(container, self) file "redditscraper4.py", line 93, in __init__ get_user_entry_string = get_user_entry.addbrackets() file "redditscraper4.py", line 62, in addbrackets user_entry = startpage() typeerror: __init__() missing 2 required positional arguments: 'parent' , 'controller' i have absolutely no clue i've done wrong code. im lost, , on web seems have coherent answer problem. here code: import tkinter tk functools import partial webbrowser import open datetime import date import praw '''initialising applicaiton''' class redditscraper(tk.tk): def __init__(self, *args, **kwargs): ...

asp.net - use iis 8 to remove a section of a URL whilst keeping all other sections -

the input url http://www.mywebsite.com/en-us/lookingtobuy/propertiesforsale.aspx?ppid=md19863 , need url redirst http://www.mywebsite.com/lookingtobuy/propertiesforsale.aspx?ppid=md19863 so need remove en-us/ everything following ?ppid/ variable , rule written need allow match ever input is this rule should work : <rule name="remove en-us"> <match url="^/en-us/(.*)" /> <action type="rewrite" url="http://{http_host}/{r:1}" /> </rule> and if need allow other culture <rule name="remove culture"> <match url="^/(\w{2}-\w{2})/(.*)" /> <action type="rewrite" url="http://{http_host}/{r:2}" /> </rule> {r:x} reference rule pattern. second rule {r:0} /en-us/lookingtobuy/propertiesforsale.aspx?ppid=md19863 {r:1} en-us {r:2} lookingtobuy/propertiesforsale.aspx?ppid=md19863

python - Changes in import statement python3 -

i don't understand following pep-0404 in python 3, implicit relative imports within packages no longer available - absolute imports , explicit relative imports supported. in addition, star imports (e.g. x import *) permitted in module level code. what relative import? in other places star import allowed in python2? please explain examples. relative import happens whenever importing package relative current script/package. consider following tree example: mypkg ├── base.py └── derived.py now, derived.py requires base.py . in python 2, (in derived.py ): from base import basething python 3 no longer supports since it's not explicit whether want 'relative' or 'absolute' base . in other words, if there python package named base installed in system, you'd wrong one. instead requires use explicit imports explicitly specify location of module on path-alike basis. derived.py like: from .base import basething the leading ...

language lawyer - Does MISRA C 2012 say not to use bool -

i in stages of framing stuff out on new project. i defined function return type of "bool" i got output pc-lint including file sockets.h (hdr) bool sock_close(uint8_t socket_id); ^ "lint: sockets.h (52, 1) note 970: use of modifier or type '_bool' outside of typedef [misra 2012 directive 4.6, advisory]" i went ahead , defined in header shut lint up: typedef bool bool_t; then started wondering why had , why changed anything. turned misra 2012 dir 4.6. concerned width of primitive types short, int, , long, width, , how signed. the standard not give amplification, rational, exception, or example bool. bool explicitly defined _bool in stdbool.h in c99. criteria apply bool? i thought _bool explicitly "smallest standard unsigned integer type large enough store values 0 , 1" according section 6.2.5 of c99. know bool unsigned. matter of fact _bool not fixed width , subject being promoted somehow that's issue? because rational s...

javascript - adding callback on colorbox to skip the first image of slideshow -

weird requirement, want skip first slide on slideshow (made colorbox). basically, want first slide doesn't show , slideshow opens second slide. the way can think of achieving through doing "go next" on "onload" function not sure how make go next first image. this have done:- $(".element").colorbox({ onload:function(){ $.colorbox.next(); } }); unfortunately, "next()" not working. not sure how achieve that. idea how achieve through or may other way? thanks. disclaimer: rob's idea $.remove element more idea below if heart set on not mucking cms' dom... i'm not sure may scope thing: you try binding event dom: $(document).on('cbox_complete', function(){ $.colorbox.next(); }); (i try complete event first , experiment there)

javascript - Add a directive in the link function of another directive -

i'm writing full suite of web controls in angularjs. now, have created first basic directive button, looks following: officewebcontrols.directive('officebutton', ['$q', 'stylesheetinjectorservice', function($q, stylesheetinjectorservice) { return { restrict: 'e', replace: false, scope: { isdefault: '@', isdisabled: '@', api: '=', label: '@' }, template: office_button_template, /** * @description * provides controller 'officebutton' directive. in controller required methods * being stored. */ controller: ['$scope', function($scope) { }], /** * @kind directive caller * * @param scope scope passed directive. * @param element element on directive being applied. * @p...

web services - What is the lifecyle of a Webservice? -

i asked in interview , have not been able find answer. not know whether refers soap or rest, or whether refers development or execution lifecycle. given ambiguity, can give answers of these possibilities? thank , sorry not being more specific. it not can straight answer easily; better reading document full understanding. web service management: service life cycle

jquery - .val() returning value ATTRIBUTE not content of <option> -

i'm adding own jquery code site built , hosted third party (so can't edit html remove attributes, etc). i'm trying return value of selected item of drop down box (for example 1 goes 100 500 in steps of 100), html: <select name="ctl00$cpmainbody$optioncalc$quantities" onchange="javascript:settimeout('__dopostback(\'ctl00$cpmainbody$optioncalc$quantities\',\'\')', 0)" id="ctl00_cpmainbody_optioncalc_quantities" class="form-control"> <option selected="selected" value="234">100</option> <option value="235">200</option> <option value="236">300</option> <option value="237">400</option> <option value="238">500</option> </select> and jquery: function displayvals() { var dropdowns = $( "#ctl00_cpmainbody_optioncalc_quantities" ).val(); $( "#displaying...

python - Object of type int is not iterable -

here code: num = 3 = [1,5,6,2,8,4,3,2,5] b = [] m = [] check = false summ=0 n = len(a) / num while check == false: in a: if a.index(i) >= n: b.append(m) m = [] n *= 2 m.append(i) b.append(m) j in b: s1=(sum(b[0])) s2=(sum(b[1])) s3=(sum(b[2])) print(b) if s1==s2==s3: summ=s1 check = true else: b = [0] * len(a) ilg = len(a) b[0]=a[ilg-1] in range(len(a)-1): b[i+1] = a[i] in range(len(a)): a[i]=b[i] what trying split list 3 lists , if sum of numbers in lists equal print sum out, if not print 'false'. example: [1,2,3,4,5,6,7,8,9] , after split: [1,2,3],[4,5,6],[7,8,9] getting error: s1=[sum(b[0])] typeerror: 'int' object not iterable doing wrong? edit: here have more, part after else should change list [1,5,6,2,8,4,3,2,5] [5,1,5,6,2,8,4,3,2] , on. your pr...

Objective c access another ios app -

i have 2 apps written objective c. have ios 8 jailbroken device. can information view of application? can access self.view of other app? want send clicks command (touch inside) button in other applications? possible? i have, ios 8, jailbreak device, xcode 6.3. i'm sorry bad english. no need jailbrake. here quick can try open , click button in 2nd app. use url schemes open app app. in 2nd app in plist in url types\item\url schemes\item0 add string my2ndapp to open 2nd app 1st app use: [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"my2ndapp://somedata"]]; so url: my2ndapp://somestring - open 2nd app , run method in appdelegate: (bool)application:(uiapplication *)application handleopenurl:(nsurl *)url { //do url if need to, can use tell yuor 2nd app different things openedfromurl=yes;//set bool flag, add bool var in .h of appdelegate return yes; } then in same appdelegate in method -(void)applicationdidbecomeactive:(ui...

debugging - Working with TreeMaps (21.9- Intro to Java, Liang, 10th Edition) -

i'm supposed write program returns capital of given state in u.s. using treemaps. however, program returns null when run it, before chance input anything. can tell me what's wrong? public class map { private treemap<string, string> pairs; public map() { pairs = new treemap<string, string>(); } public void readfrom(string filename) { scanner input = null; try { input = new scanner(new file(filename)); } catch (exception ex) { ex.printstacktrace(); system.exit(-1); } while (input.hasnext(" , ")) { pairs.put(input.next(), input.next()); } } public string get(string key) { return pairs.get(key); } } public static void main(string[] args) { map usa = new map(); usa.readfrom("states_and_capitals.txt"); system.out.print("enter state: "); scanner input = new scanner(system.in); system.out.println(usa.get(input.tostring())); } the t...

javascript - callback inside of socket io -

i having problem socket when executing data takes long time. example: socket.on('start', function(input){ var output = foo(input); //taking long time data, networking etc. console.log("this ending", output); socket.emit('end',output); }); it seems if takes long time foo(input) execute, nodejs emit output first while still null. how can make sure finish executing first before emit? i modified socket.on('several',function(meteridarray){ console.log("i have receiever meteridarray",meteridarray); meterids = meteridarray.meterids; foo(meterids,function(datasets){ console.log("this datasets",datasets); socket.emit('datasets',datasets); }); }); and modified foo this function foo(meterids,callback){ //this meant long call. var datasets = []; (var = meterids.length - 1; >= 0; i--) { datapoint.setmeterid(meterids[i],function(err, results){ d...

How to show an image on a table in Android -

Image
i'm trying show image (of snake) on android application, can appear on board table (which tablelayout ). how can rather image being shown above table? package com.example.test; import android.app.activity; import android.graphics.color; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.imageview; import android.widget.tablelayout; import android.widget.tablerow; import android.widget.toast; public class mainactivity extends activity { tablelayout table; imageview image; private static final int table_width = 12; private static final int table_height = 10; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); table = (tablelayout) findviewbyid(r.id.view_root); image = (imageview) findviewbyid(r.id.imageview1); // populate table stuff (int y = 0; y < table_h...

css - jquery datepicker needs one last tweak -

Image
last 1 today, promise! :o) does know css tag causing both words (prev, next) , buttons appear? want rid of words , show arrows prev/next. i think on class ui-icon there should style text-indent: -99999px;

Spark AggregateByKey From pySpark to Scala -

i transferring code on scala , had function in pyspark have little clue on how translate on scala. can , provide explanation? pyspark looks this: .aggregatebykey((0.0, 0.0, 0.0), lambda (sum, sum2, count), value: (sum + value, sum2 + value**2, count+1.0), lambda (suma, sum2a, counta), (sumb, sum2b, countb): (suma + sumb, sum2a + sum2b, counta + countb)) edit: have far is: val datasusrdd = numfilterrdd.aggregatebykey((0,0,0), (sum, sum2, count) => but having trouble understanding how write in scala because of group of functions being designating value group of actions (sum + value, etc). second aggregating functions proper syntax. hard coherently state troubles in scenario. more not understanding of scala , when use brackets, vs parentheses, vs, comma as @paul suggests using named functions might make understanding whats going on bit simpler. val initialvalue = (0.0,0.0,0.0) def seqop(u: (double, double, double)...

mysql - SQL select rows where at least one value is something per id -

i've looked @ other answers these questions , haven't seen 1 fits want. so have table ids , states , multiple records per id different state values. how return table records @ least 1 record id value? example, if have id|state 1|ca 1|zz 1|zz 2|ny 2|ca 3|ny 4|il 4|zz and ones had record of being in ny id|state 2|ny 2|ca 3|ny you can try this: select * tablename id in (select id tablename state = 'ny');

http - Making put/post from Tornado doesent work -

i trying make put method (or post ) dropbox api, doesent work, get instead? import tornado.ioloop import tornado.web tornado.httputil import httpheaders tornado.httpclient import httpclient, httprequest url = "https://api-content.dropbox.com/1/files_put/sandbox/world.txt" class mainhandler(tornado.web.requesthandler): def post(self): headers = httpheaders({'authorization': 'bearer token_for_dropbox'}) httpclient().fetch( httprequest(url, 'put', body="hello there", headers=headers)) application = tornado.web.application([ (r"/", mainhandler), ]) if __name__ == "__main__": application.listen(8888) tornado.ioloop.ioloop.current().start() update: using get makes error: httperror: http 400: bad request here new code: import tornado.ioloop import tornado.web tornado.httpclient import httpclient, httprequest url = "https://api-content.dropbox.com/1/files_put/sandbox/wor...

spring - jsr303 and Freemarker, Valid example -

please make validation jsr 303 pages freemarker. there're class course, controller, file messages.properties, created bean id = "messagesource"> need make page in freemarker create new course. when filling empty fields or incorrect range output error message. public class course { @notempty private string name; @notempty private string category; @range(min = 20, max = 25) int age; //get , set } notempty.course.name = name required! notempty.course.category= categoryis required! range.course.age = age value must between 20 , 25 @controller @requestmapping("/customer") public class signupcontroller { @requestmapping(value = "/signup", method = requestmethod.post) public string addcustomer(@valid course course, bindingresult result) { if (result.haserrors()) { return "signupform"; } else { return "done"; } } @requestmapping(method = requestmethod.get) public string displaycustome...

SSRS Combine multiple group instances SQL Server Reporting Services-Grouping -

Image
i have following sql server report: bananas --- green --- 5 --- yellow --- 10 --- brown --- 1 apples --- red --- 5 --- gold --- 7 --- green --- 2 carrots --- orange --- 4 --- brown --- 8 potatoes --- white --- 3 --- brown --- 11 how go this: fruit --- green ----7 --- yellow ---10 --- brown------1 --- red--- ----5 --- gold - - - 7 vegetables ---orange---4 ---brown---19 ---white---3 do need create parent group(in tablix) group expression such =iif([fields!fruittype].value "bananas" "apples", "fruit", "vegetables")? so... creating the input data select type = 'bananas' ,color = 'green' ,total= 5 union select 'bananas' , 'yellow', 10 union select 'bananas' , 'brown' , 1 union select 'apples' , 'red' , 5 uni...

parse.com - Can't do mutation.destroy after query on component -

i use parse-react library. first query retrieve data, in other component same query equalto("user","user connected") queries works fine after second query when try mutation.destroy on item got error. updatechannel.js:146 uncaught error: object attached nonexistant subscription short sample code : appwrapper.react.js : var parse = require('parse').parse; var parsereact = require('parse-react'); var react = require('react'); var wall = require('./wall.react.js'); var gallery = require('./gallery.react.js'); var contents = [ <wall/>, <gallery/> ]; var appwrapper = react.createclass({ getinitialstate: function() { return { current_page:0 }; }, changepage:function(pageidx){ this.setstate({ current_page:pageidx }); }, change:function(){ if(this.state.current_page == 0){ this.setstate({ current_page:1 }); }else{ this.setstate({ ...

ajax - how to get the list values in jquery sortable -

html- <div class="tab_boxes"> <ul id="sortable"> <li class="ui-state-default sortable1"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>item 1</li> <li class="ui-state-default sortable1"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>item 2</li> <li class="ui-state-default sortable1"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>item 3</li> </ul> </div> jquery script: <script> $(function() { $( "#sortable" ).sortable({ items: "> li" }); }); </script> , <style> #sortable { list-style-type: none; margin: 0; padding: 0; width: 100%; } #sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 300px; width:300px; } #sortable li span { position...

r - Opencpu simple function json parsing not working -

hi want have simple function local opencpu development server. getlinearinterpolatedestimatequantil <- function(x, type, probs){ result = quantile(data, type, probs) result #print simpler debug } example debug input {"type":1,"x":[1,2,3,4,5,6,7,8,9,10],"probs":[0.05,0.25,0.75,0.95]} but there problem: when supplied manually sample data like: debuginput = fromjson(file("debuginput.json")) the code compiles. but when try access via http like: opencpu$browse("library/mylibrary") curl http://localhost:3469/ocpu/library/predictr/r/getlinearinterpolatedestimatequantil/json -d '{"type":1,"x":[1,2,3,4,5,6,7,8,9,10],"probs":[0.05,0.25,0.75,0.95]} ' -h "content-type: application/json" i receive output: unused arguments (type = 1, probs = probs) in call: getlinearinterpolatedestimatequantil(type = 1l, x = x, probs = probs) so expect parsing has issues arrays? ...

web services - Spring Integration WS: mock Endpoint to return response -

i have setup spring integration flow configuration send messages external web service , unmarshalling response , doing post processing based on response object type. i have following outbound-gateway configuration: <int:channel id="sendrequestchannel"/> <ws:outbound-gateway request-channel="sendrequestchannel" uri="${send.ws.uri}" reply-channel="responsetransformer" > <ws:request-handler-advice-chain> <ref bean="retryadviceuserupdatews" /> </ws:request-handler-advice-chain> </ws:outbound-gateway> now, want test flow , check correct post processing triggered based on response object. is there anyway in integration test mock endpoint response based on message i'm sending? actually should understand part of flow better mock , return desired response. you can inject channelinterceptor sendrequestchannel presend returns null , prevent further process , send ...

python - Use matplotlib Axes autoscaling without plotting anything -

Image
matplotlib job of picking axis limits based on data throw @ it. for example: import matplotlib.pyplot plt import numpy np #%matplotlib inline np.random.seed(0) y = np.random.normal(size=37, loc=2, scale=1.5) fig, (ax1, ax2) = plt.subplots(ncols=2) ax1.plot(y) ax2.plot(y * 328) fig.tight_layout() results in: both axes scaled in sane matter based on both range , order of magnitude of data. question how learn limits be, or apply them existing axes object without drawing on it? ax.update_datalim seemed promising, doesn't seem hoped: x = np.array([0] * y.shape[0]) fig, ax = plt.subplots() ax.update_datalim(list(zip(x, y)), updatex=false) i think might looking for? unsure if wanting update x-axis or not or y-axis limits without plotting. np.random.seed(0) y = np.random.normal(size=37, loc=2, scale=1.5) fig, (ax1, ax2) = plt.subplots(ncols=2) x = np.array([0] * y.shape[0]) ax1_lim = ((0, min(y)), (len(x), max(y))) ax2_lim = ((0, min(y) * 328), (len(x), m...

javascript - Ajax post in Wordpress contact form -

i'm using wordpress , ninja form plugin. want when submit form, post service datas. html: <input type="submit" name="_ninja_forms_field_7" class="ninja-forms-field popup-submit" id="ninja_forms_field_7" value="" rel="7"> js: $('#ninja_forms_field_7').click(function () { var name = $('#ninja_forms_field_6').val(); var surname = $('#ninja_forms_field_6').val(); var emailaddress = $('#ninja_forms_field_8').val(); var ecommercesiteurl = $('#ninja_forms_field_9').val(); var post_datas = emailaddress = +emailaddress & name = +name & surname = +surname & ecommercesiteurl = +ecommercesiteurl; $.ajax({ type: 'post', url: 'myserviceaddress', data: post_datas, success: function (answer) { console.log(answer); } }); }); but not working. how can fix it? var ...

javascript - Displaying a table's row in a div element using AngularJS -

i have database table many rows, each 5 fields each. have <div> element i'd display 1 row's fields in. best way retrieve row table , have div display row's fields? currently have service retrieves rows table, controller calls aforementioned service, , within controller have each of row's fields. here's mean: // service ... gettablerows: function(callback) { $http.post('../php/gettablerows.php') .success(function(data, status, headers, config) { callback(data); }) .error(function(errordata) { console.log("error: " + errordata); }); } // controller ... myservice.php.gettablerows(function(gettablerowsresponse){ // gettablerowsresponse contains of rows in table in array //gettablerowsresponse[0].name; //gettablerowsresponse[0].id; //gettablerowsresponse[0].age; //gettablerowsresponse[0].department; //gettablerwosresponse[0].imageu...

Reset variables back to zero in do-while loop Java -

i working on example using do-while loop , switch statement. need accumulate numbers , depending on user input either add, substract, multiply or divide (mini calculator type). the problem when ask user go main menu program not reset value before loop. result previous result. here code, explain better. import java.util.scanner; public class switchloopnumbers{ public static void main(string[] args){ scanner scan = new scanner(system.in); int numbers=0; int result=0; int option; boolean quit = true; string done=""; do{ system.out.println("calculator menu"); system.out.println("********** ****"); system.out.println("\n1. add"); system.out.println("2. substract"); system.out.println("3. multiply"); system.out.println("4. divide"); system.out.println(); system.out.print("enter option >> "); option = scan.nextint(); while(quit){ ...

android - Kotlin library 'classes.jar' has an unsupported format. Please update the library or the plugin -

this message appears on project sync. i've tried clean , rebuild project, no success. i'm using latest plugin version 0.12.275, "org.jetbrains.kotlin:kotlin-gradle-plugin:0.12.213" , "org.jetbrains.kotlin:kotlin-stdlib:0.12.213" i've tried stable version 0.12.200 both plugin , library, same error. i'm using android studio ai-141.1972460 (canary channel). looks problem in *.aar lib, included in project - compiled old version of kotlin. i've upgraded libary latest kotlin version , works now.

java - JPA/Spring returning JSON from 2 MySQL tables as nested Objects -

jpa/spring returning json 2 mysql tables nested objects i'm brand new jpa/spring if atleast point me in right direction extremely helpful!! cheers! here get: [{"conid":1,"phone1":"test","tblpeople": {"pepid":1,"pepaccountidfk":1,"firstname":"testfirst","lastname":"last","title":"title","notes":"notes"}}] what want is: [{"conid":1,"phone1":"test", "pepid":1,"pepaccountidfk":1,"firstname":"testfirst","lastname":"last","title":"title","notes":"notes"}] java class tblpeoplecontactinfo: package cms; @entity public class tblpeoplecontactinfo implements serializable{ private static final long serialversionuid = 1l; @id private int conid; @column(name="con_phone_1") private string phone...

Jscript String.split on csv file, Ignores leading empty fields -

hey guys need figuring out how write jscript includes empty fields separated commas @ beginning , puts them in array. temp = new array; string = ",,field3,field4,,field6"; temp = string.split(regexp, -1); i have regexp pick out commas. know split ignores empty fields. need fields since working reading csv file. need array contain empty strings there empty data field. what want temp[0] = "", temp[1] = "", temp[3] = field 3 what is temp[0] = field3 like that, ideas or workarounds? the workaround jscript's rather peculiar behavior* use string (not regexp) separator: var s = ",,field3,field4,,field6"; var = s.split(","); wscript.echo("a:", a.length, "[" + a.join(",") + "]"); var b = s.split(/,{1,1}/); wscript.echo("b:", b.length, "[" + b.join(",") + "]"); output: cscript 30603770.js a: 6 [,,field3,field4,,field6]...

javascript - Yepnope is not working as expected -

i using yepnope in project .i want load needed js , css files in page .but yep nope not working expected. my codes are $(document).ready(function(){ yepnope([{ // load jquery 3rd party cdn load: 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', callback: function (url, result, key) { if (!window.jquery) { yepnope('3rdparty/js/jquery2.1.4.js'); } } }]); }) but not load can possible solution? i believe trying use jquery before load yepnope, try putting script @ end of dom, before closing body tag follows: yepnope([{ // load jquery 3rd party cdn load: 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', callback: function (url, result, key) { if (!window.jquery) { yepnope('3rdparty/js/jquery2.1.4.js'); } } }]); if see, i've removed document ready event because it's done jquery, , loading jquery within yepnope. thi...

c# - Uploading Image to Server from NameValueCollection -

i using asp.net 4.5 vb.net this testpage.aspx code <%@ page language="vb" masterpagefile="~/master.master" autoeventwireup="false" codefile="testpage.aspx.vb" inherits="testpage" %> <asp:content id="content1" contentplaceholderid="contentplaceholdermaster" runat="server"> <form role="form" method="post" id="test_form" action="testpageload.aspx" <div class="form-group"> <input class="form-control" type="text" id="headline" name="headline" /> </div> <div class="form-group"> <div class="fileupload btn btn-default"> <span>upload ar...