Posts

Showing posts from 2013

video.js - VolumeSlider not initialized correctly when player loads -

when load video player first time, volume slider set @ 0 volume controls shows @ level 3 (the volume on volume button correct, slider not). once touch volume slider or volume button, issue corrects itself. how can slider , volume button synchronized first time? thanks in advance! by default volume set max. tell me version of video.js use? although check if following commands useful or not // current volume of media var howloudisit = myplayer.volume(); // set volume new value myplayer.volume(0.5); // 0 off (muted), 1.0 way up, 0.5 half way.

Android native webrtc: add video after already connected -

i have been running webrtc in android app while, using libjingle.so , peerconnectionclient.java, etc., google's code library. however, running problem user starts connection audio (i.e., audio call), toggles video on. augmented existing setvideoenabled() in peerconnectionclient such: public void setvideoenabled(final boolean enable) { executor.execute(new runnable() { @override public void run() { rendervideo = enable; if (localvideotrack != null) { localvideotrack.setenabled(rendervideo); } else { if (rendervideo) { //ac: create video track string cameradevicename = videocapturerandroid.getdevicename(0); string frontcameradevicename = videocapturerandroid.getnameoffrontfacingdevice(); if (numberofcameras > 1 && frontcameradevicename != null) { cameradevicename = frontcameradevicename; } log.i(tag, "opening camera: " + cameradevicenam

uicollectionview - Custom UICollectionViewLayout With Equal Inter-Item Spacing -

Image
i'm having difficult time figuring out how designing feels should straightforward layout collection view. heights of each cell equal. widths vary. inter-item spacing should always equal. distance between rows should equal. more items added, width of collection view increase "intelligently." let me give example. when insert new item, calculate movement of items rows (maybe first item of row 1 moves row 0, maybe first item of row 2 moves row 1. move , collection view grows wider. i feel should reasonably straightforward i'm struggling. have sample code help? have tried using uicollectionviewflowlayout? http://skeuo.com/uicollectionview-custom-layout-tutorial https://developer.apple.com/library/ios/documentation/uikit/reference/uicollectionviewflowlayout_class/

MySQL UNION is changing data format -

i'm little bit confused one. have similar tables bunch of different companies, trying union them combined data. however, union changes format of data 1 of columns, breaks php code utilizes column. the column in each table is: branch tinyint(2) unsigned zerofill here happens selecting first company (this example, actual select doing way more complex): select distinct branch company1 +--------+ | branch | +--------+ | 01 | | 02 | | 03 | | 04 | | 40 | | 90 | +--------+ and second company: select distinct branch company2 +--------+ | branch | +--------+ | 01 | | 02 | | 03 | | 04 | | 05 | | 40 | | 90 | +--------+ and union: select distinct branch company1 union select distinct branch company2 +--------+ | branch | +--------+ | 1 | | 2 | | 3 | | 4 | | 40 | | 90 | | 5 | +--------+ you can see lose leading 0s on union. suggestions? from mysql documentation : the zer

linux - makefile recompile with -fPIC -

so, i'm trying build in make. produced files via cmake, went appropriate folder build file, and: make scanning dependencies of target spenvis [ 33%] building cxx object source/cmakefiles/spenvis.dir/pyspenviscsv.cc.o [ 66%] building cxx object source/cmakefiles/spenvis.dir/spenviscsv.cc.o [100%] building cxx object source/cmakefiles/spenvis.dir/spenviscsvcollection.cc.o linking cxx shared library libspenvis.so /usr/bin/ld: /usr/local/lib64/libpython2.7.a(abstract.o): relocation r_x86_64_32 against `.rodata.str1.8' can not used when making shared object; recompile -fpic /usr/local/lib64/libpython2.7.a: not read symbols: bad value collect2: ld returned 1 exit status make[2]: *** [source/libspenvis.so] error 1 make[1]: *** [source/cmakefiles/spenvis.dir/all] error 2 make: *** [all] error 2 i'm bit of novice far make/cmake goes. i'm uncertain go here. i've looked @ several suggestions, i'm uncertain relevant particular problem , how implement suggested fixe

postgresql - Knex.js SQL syntax error near 'select' -

i'm getting odd error: { __cid: '__cid9', method: 'insert', options: undefined, bindings: [ 500, 'dinner', '10/02/2015 7:57 pm', '09/29/2015 8:00 pm', 'grand plaza', 1 ], sql: 'insert "expense" ("amount", "description", "due_date", "payment_date", "vendor_id") values ($1, $2, $3, $4, select "vendor_id" "vendor" "name" = $5 limit $6)', returning: undefined } error: syntax error @ or near "select" @ [object object].connection.parsee (/.../node_modules/pg/lib/connection.js:534:11) @ [object object].connection.parsemessage (/.../node_modules/pg/lib/connection.js:361:17) @ socket.<anonymous> (/.../node_modules/pg/lib/connection.js:105:22) @ socket.emit (events.js:107:17) @ readableaddchunk (_stream_readable.js:163:16) @ socket.readable.push (_stream_readable.js:126:10) @

python - Convert Procedural to Object Oriented: Python3.4 -

in interest of being more "pythonic" (and being more modular), want convert procedural code class . object of interest here idea of marriage of husband , wife , referred here lastname , shared , unique attributes among each spouse. these attributes being filled in file generator object via yield . part of me wants perform these 2 parsing functions get_husband , get_wife (and maybe final zip function) class function still uses iterator object fill in attributes of marriage.firstname , marriage.husbandscore , marriage.wifescore , etc. create methods perform further analysis on information each marriage object spit out generator. but part of me unsure whether parsing definitions best kept methods, since returning self not generator need downstream work... from itertools import izip def get_husband(husbandfile): lastname, firstname, husbandscore = '', '', '' line in husbandfile.readlines(): # parse files fill out names,

javascript - tinymce no value when c# button is clicked -

i content of tinymce in backend i'm ending no values returned. this have: html markup: <asp:content id="content1" contentplaceholderid="maincontent" runat="server"> <script type="text/javascript" src="/tinymce/js/tinymce/tinymce.min.js"></script> <div style="margin-top: 50px;"> <span>set content left side content</span> <script type="text/javascript"> tinymce.init({ selector: "textarea", theme: "modern", image_advtab: true, templates: [ {title: 'test template 1', content: 'test 1'}, {title: 'test template 2', content: 'test 2'} ] }); </script> <textarea id="leftcontent" runat="server" name="content" style="width:100%"></textarea> </div> <div style="margin-top: 50px;&quo

asynchronous - Trouble to synchronise promises in Node.js using Q -

i doing api in node.js framework sails.js. using promises first time , have troubles sync promises want. my main function following : createcard: function(req, res) { checkifuserhasstripeaccount(req.user) .then(addcreditcardtostripeaccount()) .then(function cardcreated() { res.send(200, { msg: 'card created' }); }) .catch(function handleerror(err) { res.send(err.httpcode, err.msg); }) }, obviously can't add credit card stripe account if user doesn't have one. the function checkifuserhasstripeaccount() checks if account exists , if not, create it. here code part : function checkifuserhasstripeaccount(user) { var deferred = q.defer(); if (!user.idstripe) { createstripeaccounttouser(user) .then(function(saveduser) { deferred.resolve(saveduser); }) .catch(function(err) { deferred.

c# - Civilization 1 like tilemap generation -

okay so, have looked @ lot of question people self beginners in programming. , of time questions hard answer or understand question is. best specific possible problems above mentioned doesn't happen. first off have been following tutorials on @ http://xnagpa.net/xna4rpg.php . , tile engine based off 1 jamie mcmahon makes in rpg tutorial series. know general structure of tile engine like. secondly try explain i'm trying inside tile engine. found article how original civilization generated maps. http://forums.civfanatics.com/showthread.php?t=498630 , rather approach generating "world" style map if will. ie: oceans, continents, islands ect. decided try take , implement tile engine. works part. parts added tile engine supposed randomly pick location in specified map layer (y,x) , location generate chunk of land(or tiles) , replace tiles in map layer tiles created in chunk of land. (ill show code in minute) , desired amount of either number of landmasses(chunks)

javascript - Node.js - mysql query inside foreach -

i have structure of code: connection.query(query1,function(err,rows) { var response = []; //doing rows rows.foreach(function(item) { connection.query(queryitem,function(err,rows) { //doing result = rows[0].field; //and want push array response.push(result); }); }); console.log(response); //empty }); i know foreach blocking query non-blocking. tried use promises: connection.query(query1,function(err,rows) { var response = []; //doing rows rows.foreach(function(item) { var promise = new promise(function(resolve,reject) { connection.query(queryitem,function(err,rows) { //doing result = rows[0].field; //and want push array resolve(result); }); }); promise.then(function(result) { console.log(result); //ok response.push(result) //not ok, result empty

php - symfony2 model with custom primary key name (different than "id") -

can paste example definition of symfony2 / doctrine model has primary key different id (the name, e.g. primary key customer_id )? i've been searching web , i've scanned entire cheatsheet ( http://ormcheatsheet.com/ ) couldn't find one. for example, having following schema: author: type: entity fields: id: id: true type: integer generator: strategy: auto what should change replace id author_id preserving remains primary key? something this? author: type: entity id: author_id: type: integer generator: strategy: auto fields: name: type: string length: 50 reference

Can a Crystal library be statically linked to from C? -

i've read through "c bindings" in tutorial i'm novice @ c stuff. could please let me know if crystal program can built static library link to, , if please provide simple example? yes, not recommended so. crystal depends on gc makes less desirable produce shared (or static) libraries. there no syntax level constructs aid in creation of such nor simple compiler invocation so. c bindings section in documentation making libraries written in c available crystal programs. here's simple example anyhow: logger.cr fun init = crystal_init : void # need initialize gc gc.init # need invoke crystal's "main" function, 1 initializes # constants , runs top-level code (none in case, without # constants stdout , others last line crash). # pass 0 , null argc , argv. libcrystalmain.__crystal_main(0, pointer(pointer(uint8)).null) end fun log = crystal_log(text: uint8*): void puts string.new(text) end logger.h #ifndef _crystal_lo

Connect to an Oracle Database in Swift -

i using xcode 7, swift, , new ui automation announced @ wwdc 15. want test things in oracle database after of ui automation tests have run. can done? if how do it? can't seem find sort of documentation on subject. the mobile phone doesn't guarantee permanent , stable network connection , big problem direct connection db. mobile platforms need create web service on server work between database , mobile application. not recommended connect directly databases, except when local databases(sqlite).

reactjs - React.Children.map recursively? -

i'm building react component rendering html form , i'm finding need recursively iterate through children of parent form component in order add props children components of type. an example (in jsx): <form> <p>personal information</p> <input name="first_name" /> <input name="last_name" /> <input name="email" /> <label> enter birthday <input name="birthday" type="date" /> </label> </form> in example, i'm using react.children.map inside form component, , inside map function i'm checking child's "type" , child's "type.displayname" determine element i'm dealing (either native html element or reactelement): var newchildren = react.children.map(this.props.children, function(child) { if (is.inarray(child.type.displayname, supportedinputtypes)) { var extrachildprops = {

How to instruct irregular course in Enumerable in C#? -

panagiotis kanavos introduced following clever solution produce letternumbernumber pattern in sof question: for loop when values of loop variable string of pattern letternumbernumber? var maxletters=3; // take 26 letters var maxnumbers=3; // take 99 required numbers var values=from char c in enumerable.range('a',maxletters).select(c=>(char)c) int in enumerable.range(1,maxnumbers) select string.format("{0}{1:d2}",(char)c,i); foreach(var value in values) { console.writeline(value); } a01 a02 a03 b01 b02 b03 c01 c02 c03 d01 d02 d03 is there way instruct irregular course in enumerable stuff? "enumerable.range(1, maxnumbers)" leads 01, 02, ...,99 (for maxnumbers 99). restriction examples: 1. restrict (01,02,...,99) (01,03,05,07,09,11,13) 2. restrict (01,02,...,99) (02,04,06,08,10) 3. restrict (01,02,...,99) (01,04,09,10) what did: worked "enumarable", tried methods like: enume

angularjs - Can I add another condition into the Angular.js synchronization -

protractor wait angular.js process finish before continuing execution flow. in every step (after every click() call, etc.). i'm testing application has lot of "loaders" reason not caught synchronization , i'm getting lot of errors. i can manually put wait after each instruction execute wait after each instruction. is there way add condition protractor synchronization mechanism? ok, bit hackerish, found way. protractor uses waitforangular() after each webdriver command. https://github.com/angular/protractor/blob/f034e010156a85cf1826b95eb7f41f50ef5a1791/lib/protractor.js#l319 you can alter function in example onprepare: browser.waitforangular = function(opt_description) { var description = opt_description ? ' - ' + opt_description : ''; var self = this; waituntilloaderdissapears(); if (this.ignoresynchronization) { return self.driver.controlflow().execute(function () { re

sql - Fetching records which have either of two values in an array column in postgres -

i have array_agg column in postgresql has values these: "{metabolic/endocrinology}" "{cardiovascular}" "{oncology}" "{autoimmune/inflammation}" basically string variable being array_agg id. now want fetch records table either of oncology or autoimmune/inflammation present. i doing not sure why throwing error. select * table id = any('{oncology,autoimmune/inflammation}') it throws following error. error: operator not exist: text[] = text sql state: 42883 hint: no operator matches given name , argument type(s). may need add explicit type casts. character: 67 please note have used ::text [] , still gives error. you want use array-overlaps operator && . see array operators . e.g. select * ( values (array['oncology','pediatrics']), (array['autoimmune/inflammation','oncology']), (array['autoimmune/inflammation']), (array['pediatrics']), (array

python 2.7 - How can you structure a script to identify like algebraic terms? -

i'm trying write script in way represents algebraic expressions, , i'm trying make general possible can accommodate, eventually, things multivariable expressions, e.g. xy^2 = z , other things trig functions. however, need script able simplify expressions, e.g. simplifying x^2 + 2x^2 = 3x^2 , in order need recognize terms. however, in order recognize terms need able tell me when 2 expressions identical, if don't same. instance need == defined in such way computer know (x^2)^2 x^4 . now far, way can see make computer know when 2 algebraic expressions identical this, try create kind of "normal form" expressions, , compare normal forms. instance, if distribute exponents on multiplication, multiply powers of sums, distribute multiplication on addition, , calculate simple expressions of numbers, might @ least close normal form. example normal form of (x^2)^2 x^4 , normal form of x^4 x^4 . since have same normal form, computer can tell me they're equ

python 2.7 - I need help writing this program. I have no idea how to do it to be honest. Here's the prompt -

write program prompts user radius , height of 3-dimensional cone , calculates , prints surface area , volume of cone. calculation of surface area , volume done in functions, gathering of inputs import math def surfaceareaofcone(radius, height): return math.pi * radius * (radius + math.sqrt(height * height + radius * radius)) def volumeofcone(radius, height): return math.pi * (radius * radius) * height/3 radius = float(raw_input("enter radius: ")) height = float(raw_input("enter height: ")) print("surface area:" + repr(surfaceareaofcone(radius, height))) print("volume: " + repr(volumeofcone(radius, height)))

Can I have a Java method have params but doesn't require an arguement to be passed in? -

so have program need call method 2 items in object. thought, if have if user passes in nothing arguement... x.getitem(); it work , return 1 of 2 items. but if wanted specific item... x.getitem(0); or x.getitem(1); is possible in java? didn't want 0 random , 1 , 2 default...because confusing read later. it sounds want 2 methods: private a[] = new a[2]; public getitem() { return a[new random().nextint(1)]; } public getitem(int index) { return a[index]; } given parameters different 2 methods, can use same name (because compiler can distinguish 1 calling depending on actual parameters). if implement fakey optional parameter, single method more complex - have both ways of looking return value plus logic decide parameter had been omitted. 2 methods nice, clean solution.

javascript - login with social.js failed to get the Request Token -

i using social.js ( https://gist.github.com/rampicos/4320296 ) authenticate user in appcelerator mobile app. getting error: [error] : social.js: failed getrequesttoken! [error] :oauth_parameters_absent=oauth_consumer_key&oauth_problem=parameter_absent [error] : 2015-10-02 22:15:06.628 example[78076:253765] simulator user has requested new graphics quality: 100 the linkedin developer web site announced server maintenance on october 2nd. related problem? linkedin developer website

c# - how to get connectionaborted immediately in Asynchronous Programming? -

i doing asynchronous programming in c# when came across question,when network aborted. my program can exception of connectionaborted 15 seconds after send invaild message client server. my question if want exception after network doesn't work,what need do. namespace _10_tcp模块化编程 { class objectstate { public socket client; public mytcp obj; public const int buffersize = 256; // receive buffer. public byte[] buffer = new byte[buffersize]; // received data string. public stringbuilder sb = new stringbuilder(); } class mytcp { public delegate void dreceiver(object sender, string b); public event dreceiver receive; public socket webhabor; //private bool connected; public mytcp(ipendpoint iep, dreceiver deventcall) { //接收消息的委托; receive += deventcall; //创建socket连接; webhabor = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); objectstate obs = new ob

r - In knitting Rmd file, print 2 plots in same row, but create separate pdfs -

i have 2 plots in rmd file plot side-by-side in knitted output. save individual plots separate pdfs. when had 1 plot per device, dev.copy2pdf worked avoid replotting, @ costs. however, following code yields 2 pdfs, neither of desired output. first pdf first plot on left half of page; second pdf plots side-by-side. understand why happening - after all, copying directly current device, i'm not sure how modify code achieve result want. data(cars) par(mfrow=c(1,2)) plot(cars$price,cars$mileage) dev.copy2pdf(file = "price-mileage.pdf") plot(cars$price,cars$doors) dev.copy2pdf(file = "price-doors.pdf") i can't see way can asking in 1 step. can without replotting in knitr if mean. ```{r} data(iris) ``` create side side plots in knitr: ```{r fig.width=7, fig.height=6} par(mfrow=c(1,2)) plot(iris$sepal.length,iris$sepal.width) plot(iris$sepal.length,iris$petal.length) ``` ```{r include=f} #this write plots individual files. #it not appear in

Setting Linux Permissions to Prevent other users from Deleting/Modifying files -

i know noob question... on centos6, want allow view directories , read files in path while owner can modify or delete. cannot understand whu not work. here single file example of did: # user1: vim x chmod 744 x -rwxr--r-- 1 user1 user1 6 oct 2 20:55 x # user2: rm x rm: remove write-protected regular file `x'? yes removing file changes containing directory, need prevent user 2 changing directory x lives in. i.e. if path x /home/a/b/c/x chmod go-w /home/a/b/c

regex - Use grep to find strings with consecutive same letters -

how use grep -ie find strings 2 groups of consecutive same letters. 2 groups not overlap. grep e allowed. already found answer: grep -ie '([a-z])\1.*([a-z])\2'

jquery - Javascript function to add to or splice array -

i have 2 buttons, each button adds array array orderarray. works fine , array displayed html table. when table output button created. buttons purpose remove array associated it, , hence remove line table. this works fine, after removing part of array .splice not possible add more array, throws "cannot read property length". you can see in console array spliced , length value correct error still persists. not getting here, thought loop calls myarray.length right length every time. here js: var orderarray = []; var ordernumber = 0; var theorder = []; var total = 0; function orderupdate(item,price){ theorder = [item, price]; orderarray[ordernumber] = theorder; ordernumber++; } function maketable(myarray) { var result = "<table border=2 id=ordertable>"; console.log(myarray.length); for(var = 0; < myarray.length; i++) { result += "<tr id='row" + + "'>"; for(var j = 0; j <

c++ - Delay Loading DWMAPI on Windows XP and CodeBlocks -

i have project i'm been fighting build windows (xp) month solid now. project uses gtkmm-3, c++, , latest gcc-tdm compiler. ide codeblocks 13.14. i'm making progress, however, getting hung on error message... ld.exe cannot find -ldwmapi now, dwmapi dll available on windows vista , above. according research, can delay loading of dlls in cases present on some systems, not on others. the problem is, have no clue how on codeblocks. -z lazy option not accomplish this. if delay loading impossible, how around dwmapi dependency. there has way! full build command: (errors @ bottom) -------------- clean: debug in infiltrator (compiler: gnu gcc compiler)--------------- cleaned "infiltrator - debug" -------------- build: debug in infiltrator (compiler: gnu gcc compiler)--------------- mingw32-g++-dw2.exe -std=c++11 -wall -mms-bitfields -pthread -ic:/dev/mingw/include/glibmm-2.4 -ic:/dev/mingw/lib/glibmm-2.4/include -ic:/dev/mingw/include/sigc++-2.0 -ic:/dev

c# - How Task.WaitAll() Behave? -

i have created list of task , this: public void a() { } public void b() { } public void c() { } public void ex() { task.waitall(task.factory.startnew(a), task.factory.startnew(b), task.factory.startnew(c)); var p=true; } now question that. tasks inside list execute 1 one or execute in parallel. p=true "p" set when tasks done or before done? for first question: will tasks execute 1 one or asynchronously. (here, imagine meant concurrently , not same) using startnew run task in current taskscheduler . default means use threadpool and, if there available slots in thread pool, run in parallel. if slots taken in task pool, may throttle execution of tasks in order avoid cpu overwhelmed, , tasks may not executed @ same concurrently: there no guarantees. this simplified explanation , more complete , detailed explanation on scheduling strategy explained on taskscheduler documentation . as side note. documentation starttask mention

java - Why pointers are shown instead of string in my inorder traversal of BST? -

here code printing inorder traversal of binary search tree: public class bstprint { public void printinorder(bstnode root){ if (root!=null){ printinorder(root.getleftnode()); system.out.println(root.getnodevalue()); printinorder(root.getrightnode()); } } public static void main(string[] argc){ bstprint bstprint = new bstprint(); bstnode<string> root=new bstnode<string>(); root.setnodevalue("5"); bstnode<string> rootleft= new bstnode<string>(); rootleft.setnodevalue("3"); root.setleftnode(rootleft); bstnode<string> rootright= new bstnode<string>(); rootright.setnodevalue("8"); root.setrightnode(rootright); bstprint.printinorder(root); } } here's bstnode class: public class bstnode<e> { private e value; private bstnode<e> leftnode=null; private bstnode<e> rightnode=null; public bstnode getleftnode(

opengl - WebGL 3d Cylinder and 3d Cone ontop of each other -

i in middle of making webgl program , need create cylinder using triangle strips , cone ontop of using triangle fans create tree simple game type program. any tips or methods use this, understand how make rectangular prisms @ moment. im beginner in webgl appreciated :) // block class creates rectangular prism............used steps/obstacles player avoid // constructor function block when created // arguments: vec3 location, floating-point angle (degrees) , vec3 scales function block(location, angle, scales) { var rs = mult(rotate(angle, [0,0,1]), scalem(scales)); this.trs = mult(translate(location), rs); } // block's render function // arguments: // offset - offset of vertices current vertex attribute array // worldview - current worldview transformation block.prototype.render = function(offset, worldview) { gl.uniformmatrix4fv(mvloc, false, flatten(mult(worldview, this.trs))); gl.drawarrays(gl.triangles, offset, block.nv); }; // number of vertices rep

php - Any tag closed after span does not let span do it's required work -

whenever have span tag colors text green , there tag closing after span like: </strong> or </i> or </b>, the span tag not color text green. example code is: newly written <span style="color: green;"> <br /> <br /></span> <strong> ab <span style="color: green;"> </strong> <ol> <li> marium </li> <li> <strong> malik </strong> </li> <li> <strong> new </strong> </strong> </li> </ol></span> this code auto generated function, finds newly added strings , colors them green, cannot change html. there solution it?? know problem of tag closing after span , have mentioned cannot change html, want know whether there solution or not. can php whenever tag closing after span tag, should switch places? newly written <span style="color: green;"> if had text here , not empty spaces<

c++ - Passing a pointer to a function expecting a vector -

there function can not edit has following declaration: void foo(std::vector<uchar>& vector_to_filled_with_data); i want call function want fill pointer instead: void method_that_would_called_from_another_place(){ uchar* to_be_filled =/*new uchar[n]*/; foo(to_be_filled); } p.s. commented part optional.. can erase or leave it. know totally bad behavior. however, native-manged wrapper have deal raw pointers. edit: want data live out of scope getting 'vec.data' not option. want thread-safe you need create vector, create array , copy data vector: std::vector<uchar> to_be_filled; foo(to_be_filled); uchar* ptr = new uchar[to_be_filled.size()]; std::copy(to_be_filled.begin(), to_be_filled.end(), ptr);

sending MQTT messages from a webpage written in python with Flask -

i trying send mqtt message web page built using flask. i have established connection in main loop , able send message before starting flask when call: client.publish('all/camera/'+path, 'all') nothing happens. no error no message sent. best guess scope problem. ie. object 'client' not visible function. have tried initiate client outside of main function , have tried declare 'client' global inside capture() function the code flask app below: #!/usr/bin/env python flask import flask, render_template, request import paho.mqtt.client mqtt datetime import datetime app = flask(__name__) @app.route('/', methods = ['post', 'get']) def capture(): timestring=datetime.now().strftime("%y%m%d-%h%m%s") if 'sessionname' in request.form: sessionname = request.form['sessionname'] path = sessionname + "_" + timestring return render_template ('capture.html'

Exception in parsing json object in android -

i making connection url inorder retrieve json data , later parsing it. here code protected string doinbackground(object... params) { int responsecode = -1; try { url headingurl = new url("http://blog.teamtreehouse.com/api/get_recent_summary/?count=10"); // create url object httpurlconnection connection = (httpurlconnection) headingurl.openconnection(); //we make connection object connect url connection.connect(); // connection required url & may throw io exception responsecode = connection.getresponsecode(); if (responsecode == httpurlconnection.http_ok) { inputstream inputstream = connection.getinputstream(); // catching data in input stream can of type reader reader = new inputstreamreader(inputstream); //reading inputstream byte byte int contentlength = connection.getcontentlength(); // creating size store data character character char[] chararray = new char[cont

execution api - Why does my apps script deployed as API executable return Permission Denied? -

i created script in script editor, published "deploy api executable". inside script, provided doc_id sheet , defined function data sheet. i went https://developers.google.com/apps-script/execution/rest/v1/scripts/run test execution api. added scopes, authorized app , tried it. getting following error message: "error": { "code": 403, "message": "the caller not have permission", "status": "permission_denied" } can tell me doing wrong? make sure app script associated correct dev console project. the script should associated dev console project id corresponds oauth 2.0 client id used (this dev console project should have "apps script execution api" enabled). to change developer console project app script select following menu item: resources > developer console project... on screen enter project number dev console.

angularjs | form validation | ngMessages not displaying error message -

i able error, field becoming red, showing character count becoming red. error messages not showing . no error found in console. have added angular-1.3.4 ngmessages dependency also. please help. <div class="col-md-3 col-sm-6 col-xs-12"> <md-input-container flex> <label>{{field.field_title}}</label> <input ng-model="field.field_value" name="username" type="text" placeholder="placeholder text" ng-required="field.field_required" md-maxlength="field.max" > <div ng-messages="userform.username.$error"> <p ng-message="maxlength">your name long.</p> <p ng-message="required">your name required.</p> </div> </md-input-container> </div> keep these attributes of input field simple : ng-minlength=3 ng-maxlength=20 required this working code val

ios - Swift owned to guaranteed -

Image
i found 5 crash reports inside xcode organizer. when open them stacktrace (marked area name of app): this error occurs on ios8.4 on ios9, , on iphone 5 , iphone 6 devices likewise. it hard me track down because cannot reproduce neither on iphone5(8.4) nor on iphone6(9.0.1). 1./2. somewhere here: override func onbuttontableviewcellclick(button: bfpaperbutton) {} 3. var button: bfpaperbutton = bfpaperbutton.newautolayoutview() func onclick() { delegate?.onbuttontableviewcellclick(button) // 3 } i use swift 2, xcode 7 , ios9. me understand error. first line red image mean? why has error swift.string @ all?? i found thread: https://forums.developer.apple.com/thread/6078 extracted information: one case i've seen of kind of crash when obj-c-based object calls delegate method that's swift-based, , parameter value nil swift method signature isn't optional type. in case saw, error in bridged delegate method signature — supposed optional.

asp.net - How to avoid page reload after inserting data into the gridview -

i have gridview in asp.net page. when insert data gridview whole page reload. how avoid this? here code protected void addnewcustomer(object sender, eventargs e) { control control = null; if (gridview1.footerrow != null) { control = gridview1.footerrow; } else { control = gridview1.controls[0].controls[0]; } string slno = (control.findcontrol("txtslno") textbox).text; string code = (control.findcontrol("txtcode") textbox).text; string details = (control.findcontrol("txtdetails") textbox).text; using (sqlconnection con = new sqlconnection("")) { using (sqlcommand cmd = new sqlcommand()) { cmd.connection = con; cmd.commandtype = commandtype.text; cmd.commandtext = "insert [qtattemp] values(@code,@details,@slno)"; cmd.parameters.addwithvalue("@slno", slno); cmd.parameters.addwithvalue

python 2.7 - Joining many callisto images -

c1 = callistospectrogram.read('bir_20110922_101500_01.fit') c2 = callistospectrogram.read('bir_20110922_103000_01.fit') d = callistospectrogram.join_many([c1, c2]) if want join approximately 40 files this, throwing following error valueerror: large gap. is there limit in number? this error internal error of sunpy package using. question not python package. need tag that. but can see what's going on looking @ source, eg here . shows valueerror thrown when 2 adjacent spectra separated more maxgap parameter defaults zero. so 1 fix might pass in maxgap = none d = callistospectrogram.join_many([c1, c2],maxgap = none) that assumes don't mind gaps, of course.

c# - Why is ASP.NET WEB API not returning 200 Ok as my response in ajax -

i have asp.net web api checks if user logged in.when debug 200 ok response api controller when inspect in fiddler 2 200 ok response. 1 empty without object suppose return , other response contain response object. controller code [httppost] [route("api/bts_admin/login")] public httpresponsemessage adminlogin(admin admin) { admin response = admin.logincheck(); if (response != null) { return request.createresponse(httpstatuscode.ok, response); } else { return request.createerrorresponse(httpstatuscode.notfound, "login failed"); } } also when suppose success response ajax response returned in error section of ajax call ajax call code $('#btnlogin').click(function () { $.ajax({ url: 'http://localhost:61468/api/bts_admin/login', method: 'post', datatype: json,

angular - How can I decrease the Ionic Cordova Project Start duration ? -

i made ionic cordova project after publishing android mobile phone. duration of our program around 10-20 sec respec mobile phone types. when search problem, people because of splash screen duration ( ionic splash screen not loading , ionic2 performance issue ) path problem of image 3rd party libraries external cdn script libraries lazy loading of pages i try solve regarding above problems e.g. removed 3rd party libraries or cdn based scripts , check image paths etc.. i think ionic wrong choice mobile programming. is there solution decrease opening duration of mobile application ? thanks ionic perfect solution mobile app development.you need use right cli that. use below one: debug mode: cli supports aot ionic cordova run android --prod --device release mode: ionic cordova build android --prod --release you can see cli list here