Posts

Showing posts from June, 2012

How to check if a SQL SELECT query is a subset of other query -

i trying find way determine whether or not sql select query a prone return subset of results returned query b . furthermore, needs acomplished queries alone, without having access respective result sets. for example, query select * employee salary >= 1000 return subset of results of query select * employee . need find automated way perform validation 2 queries a , b , without accessing database stores data. if unfeasable achieve without aid of rdbms, can assume have access local, empty rdbms, data stored somewhere else. in addition, check must done in code, either using algorithm or library. language using java, other language do. many in advance. i don't know how deep want parsing queries, can there 2 general ways of making subset of query (given source table , projection(select) staying same): using clause add condition row values using having clause add conditions aggregated values so can if have 2 objects represent queries , close this: {

c++ - Memory leak in this situation with DirectX COM objects? -

if have class or struct this: bool localscopefunc() { bool result; idxgifactory* pfactory; idxgiadapter* padapter; result = //do here objects if (!result) return false; result = //do here objects if (!result) return false; result = //do here objects if (!result) return false; // , on...... //___do cleanup here___// pfactory->release(); pfactory = nullptr; padapter->release(); padapter = nullptr; return true; // if passes } if @ point during function fails , returns false, doesn't cleanup @ end, not calling ->release() on objects. mean memory leak? if so, can't figure out feasible way it, i'll have list of function calls, @ each stage initialising new, , if had clean in reverse this: int main() { if (!inittime()) {return -1;} if (!initd3d()) {shutdowntime(); return -2;} if (!initcamera()) {shutdownd3d(); shutdowntime(); return -3;} if (!initsound()) {s

pagination - Wordpress hardcode <!--nextpage--> in php -

in wordpress can split post <!--nextpage--> , if put in code version of post-editor. working me. is, if want hardcode in themes loop file? how can work? assume have in loop file: <?php the_excerpt(); ?> <?php the_content(); ?> <?php wp_link_pages(foobarbaz); ?> obviously following solution won't work: <?php the_excerpt(); ?> <!--nextpage--> <?php the_content(); ?> <?php wp_link_pages(foobarbaz); ?> i have no clue find right php function executed when <!--nextpage--> gets parsed in code editor. solution can think of creating new post <!--nextpage--> in , somehow try hardcode specific post inside loop file. there has better , cleaner way of doing it... any suggestions? not sure you're trying can control number of posts appear on archive page on settings->reading tab. if want split content in individual posts, think best way hook 'the_content' filter. i'm not sure if have criter

d3.js - d3 updating multiple svgs -

Image
i create multiple (2) svgs on page , trying update them. $('#records li ').click(function() { var id = event.target.id; var idparts = id.split("_"); var numrec = idparts[1]; $.get('php/connection2.php', { numrecs: numrec}, function(data) { var obj = json.parse(data); var numericarray = createdata(obj); var length = numericarray.length; var svgs = d3.selectall('svg'); (var = 0; < length; i++) { svgs[0][i].attr("_data_",numericarray[i]); } return false; }); }); i know isnt correct: svgs[0][i].attr("_data_",numericarray[i]); attached ss entering loop edit:this part of loop create each svg. var svg = d3.select("#content").append("div").attr("class","datadiv").attr("id",mydata[i]+"_div").style("float","left")

web applications - Limit on webgl objects in different browsers -

when opening html file 16 webgl objects in chrome warning there many webgl objects. 15 objects works fine. haven't got problem edge 20 objects. wondering limits on number of webgl objects different browsers? it's not defined , if knew limit today particular browser there's no guarantee wouldn't change tomorrow. the better question trying do? if need lots of webgl on same page there several solutions. performant one using raw-ish webgl multiple webgl models on same page using three.js is possible enable unbounded number of renderers in three.js?

ruby on rails - delayed_job undefined method `to_datetime' for false:FalseClass -

i using delayed job following versions of dependent packages /var/lib/gems/2.3.0/gems/delayed_job-4.0.6 /var/lib/gems/2.3.0/gems/delayed_job_active_record-4.0.1 /var/lib/gems/2.3.0/gems/activerecord-3.2.13 /var/lib/gems/2.3.0/gems/activesupport-3.2.13 when article.delay.create get undefined method `to_datetime' false:falseclass same versions on production server works fine here entire trace http://snippi.com/s/unswxld the issue rails 3.2.13. not sure how working on production server. upgraded version of rails 3.2.22 in gem file gem 'rails', '3.2.22' it worked fine

scala - How to Parallel Prims Algorithm in Graphx -

so i'm trying write parallel algorithm prims algorithm cant quite figure out how using spark graphx. i've looked pretty hard resources there aren't lot of examples of implementing shortest path algorithms in graphx. think need use divide , conquer , split graph sub graphs , merge msts. graphx resource: http://ampcamp.berkeley.edu/big-data-mini-course/graph-analytics-with-graphx.html#the-property-graph parallel prims resource: https://www8.cs.umu.se/kurser/5dv050/vt10/handouts/f10.pdf code: import org.apache.spark._ import org.apache.log4j.logger import org.apache.log4j.level import org.apache.spark.sparkcontext import org.apache.spark.sparkcontext._ import org.apache.spark.sparkconf import org.apache.spark.graphx._ import org.apache.spark.rdd.rdd import org.apache.spark.graphx.util._ object parallelprims { logger.getlogger("org").setlevel(level.off) logger.getlogger("akka").setlevel(level.off) def main(args: array[string]) { val co

css - everything going into flex-container -

really new coding , i've been playing flex container project i'm working on. problem i'm having put code after container style seems end in container. im wondering how can stop or start new container. heres code im looking at: <style> .flex-container { display: -webkit-flex; display: flex; width: 100%; height: 500px; background-color: lightgreen; margin: 0px; } .flex-right{ float: right; background-color: none; width: 700px; height: 100%; margin: auto; } .flex-left{ background-color: none; width: 800px height: 100%; margin: 15px 90px; float: left } </style> <body> <div class="flex-container"> <div class="flex-left"><img src="sample trainer.png" width="400" height="475" alt="" border="0"></div> <div class="flex-right"> <h1><span style="font-family: arial; font-weight: bold;

qevent - pyqt mouse held down eventfilter -

i new pyqt , can't figure out. trying install eventfilter when qpushbutton pressed , held down, system increments value @ rate (this qtimer). have second qpushbutton on same page when pressed , held, should decrememt value. system needs differentiate between single click , press , hold.here's have far, not bad confident there's more efficient way of doing this. class app(qtgui.qmainwindow, app_ui_mainwindow): def __init__(self, parent=none): super(app, self).__init__(parent) qtgui.qmainwindow.__init__(self) app_ui_mainwindow.__init__(self) self.setupui(self) #set mouse , install event filter. self.mouse_state = app.mousebuttons() self.mouse_state == qtcore.qt.leftbutton self.increment_button.installeventfilter(self) self.decrement_button.installeventfilter(self) self.hoveringover = 'null' #timer when mouse held down. self.mouseheld = qtcore.qtimer() s

web - What is the fastest engine for drawing large numbers of semitransparent trianges? -

i enjoy computer graphics. i wondering fastest engine following functionality: draws triangles 4 color channels rgba , allows drawing of point , directional lights. texturing cool additional feature, again looking fastest engine, not functional. camera animation , object animation imperative. finally there 2 answers question, 1 general development , 1 web, if can speak 1 or other contributions appreciated! there quite lot of engines job. 1 of known example unity, have tons of other features in performance. but think not looking engine api. examples opengl or directx (already mentioned). opengl has specific web content (webgl). there 1 more problem: triangles should semitransparent. missing in other answer question if triangles ordered. opengl example in rendering objects not matter triangle nearest viewer. "searches" 1 on fly , shows triangle visible. semitransparent triangles possible see different triangles overlapping each other , therefore not ne

memory - Bring control from application to java frame -

i use java program communication between arduino board , scratch file. communication happen well. use user interface start communication have buttons called connect close , minimize when user clicks connect button code check value in combo box , accordingly opens scratch file. once connect button clicked control moves scratch application. after completing work when tried closing scratch. scratch application closes expected control not return user interface because of not able close application , close in net beans forcefully. in output screen don't see build successful , instead build stopped. process works until give connect once button pressed hanged where. i tried making jar file , running in different machine @ time use end task in task manager close application. private void jbutton1actionperformed(java.awt.event.actionevent evt) { if("disconnect".equals(jbutton1.gettext())) { system.exit(0); } if(jc

linux - Python startup script using STDOUT for outputs, using init.d method -

my environment debian jesse on embedded arm display. i using bash script automatically launch app using init.d method. launches second python script daemon handles application on startup , reboot. because run way best of knowledge daemon background process, , disconnects stdout , stdin python script. the system , application single purpose, spamming console outputs background process not not problem, desired. outputs can ssh or serial console display , see live debug outputs or exceptions. i have looked possible ways force process foreground, or redirect outputs stdout have not found definite answer when script run @ startup. my logging file working perfect , otherwise app works in state in. when need debug stop application , run manually outputs. i have considered using sockets redirect outputs app, , running separate script listening print console... seems less ideal , better solution might exist. is there methods achieve or should accept this. edit 1 (additional

mysql - UPDATE ORDER BY RAND() LIMIT 100 -

i want set text different field trying kind of code set @rand = 100; update mytable set name = 'a' order rand() limit @rand; update mytable set name = 'b' order rand() limit @rand; update mytable set name = 'c' order rand() limit @rand; i getting error 1221 - incorrect usage of update , order by thanks helping why updating rand(). slow down update? order indexed column primary key. performance killer. what's point of setting @rand = 100 when know how many records want update in 1 go? i assuming have primary key called id update mytable set name = 'a' order id desc limit 100; update mytable set name = 'b' order id desc limit 100; update mytable set name = 'c' order id desc limit 100;

python - Reset User Prompt After Timeout -

i'm working on issue need execute following scenario: i prompt user input screen (console window). when prompt displayed basic y/n question, need either a) accept user input response prompt , move on or b) wait preset time , reset prompt previous value, whichever comes first. think of kiosk needs reset if user walks off , you've got idea. it seems logic (pseudo python below) adds time delay user input after sits there waiting on user reply rather giving on user after time , resetting. userinput = input("prompt. y/n?") if userinput == "y": move on elif userinput != "y": time.sleep(dwell) reset if user actively paying attention, i've got works should. but, have feeling hinging on "enter" key being pressed submit input, , don't know how force override input or have watchdog timeout , move along. also, seems no user input accepted during sleep time. true? if running on unix use "signal.alarm&quo

sockets - I want to send some data and image when client send request to server in c# using TCP/IP -

i new in socket programming. did simple message transfer 1 process another, want send image + data when client sends request server. able send data or image, not both of them in single request. how accomplish this?. as mentioned in comments, in context of tcp/ip sending \ receiving process based on streaming array of bytes. can use following algorithm (it not copy-paste solution) : create custom type contains data : may string , i recommend store path string origin image. class streamdata {string datapath {get;set;} string imagepath {get;set;} } add abstraction level class convert data (image, music) byte array , path of data convert. class streamconverter{ //some awesome method(string path)} . and send data client. don't forget how client deserialize/encode data.

javascript - Should I create a single file app? -

i have website , creating app using phonegap? far have have been updating files , build app every time want minor change. my question: downside create single html page js (angular is) check app version , download pages needed? note pages cached long time (month- year) if version not updated. thanks there no problem in doing that, in fact, more safe in case have calls apis dont want visible users, major apps in cases.

ios - Split a single NSMutableArray into two so that I can set each in each of the section in UITableView -

i want use multiple sections feature uitableview . have single nsmutablearray consists of data in dictionary format. in dictionary there key has values '0' , '1'. want create 2 separate nsmutablearray out of can assign them accordingly in different sections. for example : if (indexpath.section==0) { nsdictionary *data = [roomlist1 objectatindex:indexpath.row]; } else { nsdictionary *data = [roomlist2 objectatindex:indexpath.row]; } assuming value in dictionary set like: nsmutablearray *firstarray = [nsmutablearray new]; nsmutablearray *secondarray = [nsmutablearray new]; (nsdictionary *dictionary in yourarray) { if ([dictionary objectforkey:@"yourvalue"] isequaltostring: @"0") { [firstarray addobject:dictionary]; } else if ([dictionary objectforkey:@"yourvalue"]isequaltostring: @"1") { [secondarray addobject:dictionary]; } }

javascript - How can I get object key in a json-file with handlebars -

in following json file: { "students":[ { "timestamp": "1,45198e+12", "personnummer": 1234567891011, "fornavn": "some name" } ] } i'm using handlebars make table out of information, how can go geting "timestamp","personnummer" , forth in <th> tag. have tried : index: {{@index}} value = {{this}} and: key: {{@key}} value = {{this}} get: "index: 0 value = [object object]" can shed light on this? if var obj = { "students":[ { "timestamp": "1,45198e+12", "personnummer": 1234567891011, "fornavn": "some name" } ] } then handlebar should loop: <ul class="student_list"> {{#each students.[0]}} <li>{{@key}}</li> {{/each}} </ul> http://jsfiddle.net/vduqnhsb/

operating system - Semaphore under uCOS-III -

i use ucos-iii under arm cortex m4 , have following problem: if ossempend() executed twice within same task), like timeout = 100; /* 0.1 s */ ossempend(rtos_sem_p, timeout, os_opt_pend_blocking, null, &err); ... ossempend(rtos_sem_p, timeout, os_opt_pend_blocking, null, &err); ... (without issuing ossempost()) not run timeout @ second call block infinitely. i checked can, still cannot find problem... can explain me happens here? many thanks, michael

Mouse cursor is invisible in unity -

i's designing first person shooting game in unity. used fps controller control player. hence, mouse cursor remains invisible of time , when press escape, becomes visible. but, problem when load new scene scene uses fps controller, mouse cursor remains invisible although new scene not use fps controller. moreover, pressing escape not show mouse cursor in new scene. you can deal in few ways, here core of problem: changing cursor.visible field not scene dependent, , not reset when new scene loaded. because of that, need set cursor.visible = true; on level load. i suggest making simple script cursorvisibility read this: public class cursorvisibility : monobehaviour { void onlevelwasloaded(int level) { if (findobjectoftype<firstpersoncontroller>() != null) { cursor.visible = false; } else { cursor.visible = true; } } } place on empty game object in every scene , have cursor vi

javascript - jquery resizable() not working (with example) -

please see work in progress: http://rawgit.com/jfix/cover-image-position/master/index.html my goal allow drag , drop desktop onto page, , following drag image around resize it. should able drop image onto page , drag around. however, what doesn't work resizing of image . there no handle displayed @ frame around image , it's impossible resize it. no errors in console. the relevant code here: hdl.resizable({ aspectratio: true, autohide: true, alsoresize: "#coverimage", handles: 'all', resize: function(event, ui) { cvr .css('left', ui.position.left) .css('top', ui.position.top); } }); where hdl short form $('#handler') in assets/script.js file. should note has been copied verbatim jsfiddle: http://jsfiddle.net/nl5ew/ works fine, obviously. i can't seem find problem code. thank eagle-eyed insights may have. having inspected @rrr's jsfiddle, , comparing line

php - Replacing a DOM node with text -

parsing , editing html in php can done using domdocument , domnode classes. answered in questions how turn <div>text <p>test</p> more text</div> into: <div>text <a>test</a> more text</div> or turn ( php domdocument question: how replace text of node? ) <div>text <p>and</p> more text</div> but, how replace node text, , turn this? <div>text , more text</div> it took me searching find generic method. the clue text consists of nodes. default, when loading document, each continguous block of text replaced single 'text node' representing it. example html contains 3 nodes; a text node a <p> node (containing text node) another text node to replace p node, create text node. list of 3 text nodes. finally, merge 1 text node (matching newly loaded document formatting of replaced one) there function 'normalize' recursively 'clean up' after edits,

javascript - A button to show the chosen option -

according code choose game games table, trying have button called show show chosen game. like: <input type ="submit" value= "show" name="show"> i tried `<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script> $(document).ready(function(){ $("#hide").click(function(){ $("p").hide(); }); $("#show").click(function(){ $("p").show(); }); }); </script>` but somehow missing or did not work. here code: <div id="content"> <article> <h2> games</h2> <form action='games.php' method='post'> <p>show</p> <select size= "1" name='gameid' > <option value ="show"> choose game </option> here code <?php include('dbaccess.php')

java - Post Data in Android with Retrofit 2 Not WORKING -

hello need have tried post data using retrofit2 when post data not sent database using api have created. 1.i created class inside class did create interface posting data class called config.java following codes. public class config { public static final string base_url = "http://p.eass.cloudapp.azre.com/"; public interface registerapi{ @formurlencoded @post("register") call<responsebody> register(@fieldmap map<string,string> params); } } 2.i created pik_join.java class handle user registration when user clicks register following code inside have implemented retrofit. public class pik_join extends appcompatactivity { private edittext pik, mphonenumber, piksiri, piknsiri; context ctx = this; /*network query assistance*/ private retrofit retrofit; public string base_url = config.base_url; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity

php - Create Unique LicenseIDs and Password for each loop -

i'm making webpage admin on page can generate specific amount of new users (depending on order). right function add new users, 1-many, working. although when create new members, not have unique "random"-licenses. users created under same generate have same. admin.php (the code form , functions) <head> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <meta charset="utf-8"> <title>generera licenser</title> <meta http-equiv="content-type" content="text/html" charset="iso-8859-1" /> </head> <?php include('template.php'); if(isset($_post['email'])) //inkluderar template och hämtar inlogg// { $characters = "012

snmp - Finding mail queue using snmpwalk in php -

i want write script in php , same snmpwalk command in linux . want find queue mail using that. inputs host ip address , mib value. the command in linux: snmpwalk -v2c -cmta@rel@y 10.234.125.250 .1.3.6.1.4.1.9999.44.1 the result is: iso.3.6.1.4.1.9999.44.1.4.1.2.9.47.98.105.110.47.98.97.115.104.1 = string: "45" i want queue value result (that 45 in above example) i read snmprealwalk , snmpget functions, didn't want. basically, snmp walk implementation in php looks this: <?php $a = snmpwalk("10.234.125.250", "mta@rel@y", ".1.3.6.1.4.1.9999.44.1"); foreach ($a $val) { echo "$val\n"; } ?>

r - Portfolio Optimisation under weight constraints -

with lot of contributors stackoverflow have managed put function derive weights of 2-asset portfolio maximises sharpe ratio. no short sales allowed , sum of weights add 1. constrain asset not being more or less 10% user defined weight. example constrain weight of asset no less 54% or more 66% (i.e 60% +/- 10%). on below example end weights of (0.54,0.66) instead of unsconstrained (0.243,0.7570) .i assume can done tweaking bvect not sure how go it. appreciated. asset_a <- c(0.034320510,-0.001209628,0.031900161,0.023163947,-0.001872938,-0.010322489,0.006090395,-0.003270854,0.017778990,0.017204915) asset_b <- c(0.047103261,0.055175057,0.021019816,0.020602347,0.007281368,-0.006547404,0.019155238,0.005494798,0.025429958,0.014929124) require(quadprog) hr_solve <- function(asset_a,asset_b) { vol_a <- sd(asset_a) vol_b <- sd(asset_b) cor_ab <- cor(cbind(asset_a,asset_b),method="pearson") ret_a_b <- as.ma

How to use spring:eval expression inside $.each jQuery -

after ajax call response received json string. able list data wondering if feasible use spring:eval inside jquery $.each? if has example appreciate. line in question ends "??" response received json: {"listofdata":[{"id":"xx","somevalue":"james bond"}]} the rest of code: var obj = jquery.parsejson(json_string) $.each(obj.listofdata, function (index, data) { "<tr>" + "<td style=\"padding: 3px;\">" + (index + 1) + "</td>" + "<td style=\"padding: 3px;\">" + <spring:eval expression="data.somevalue" /> ?? "</td>" + "</tr>" + } depending on code is, <td style=\"padding: 3px;\"><spring:eval expression=\"data.somevalue\" /></td> might work. if doesn't, "eval

python - Group vertices in clusters using NetworkX -

i trying represent graphically graphs, , need group in clusters nodes have common characteristics. i using networkx, , need similar graph this tutorial , slide 44, left figure. i want draw delimiting line around each cluster. current code that: vec = self.colors colors = (linspace(0,1, len (set (vec)))* 20 + 10) nx.draw_circular(g, node_color=array([colors[x] x in vec])) show () i wish find example , see how can use networkx cluster graph. i'm not positive question is. think you're asking "how networkx put nodes close together" before launch answer, drawing documentation networkx here: http://networkx.lanl.gov/reference/drawing.html so figure you're asking has 4 different communities clustered based on having lots of edges within each community , not many outside. if don't want put effort it, spring_layout putting tightly knit communities together. basic algorithm of spring_layout acts if edges springs (and nodes r

Excel VBA - Split cell with multiple lines into rows -

Image
i have workbook full cells have linebreaks (entered via alt + enter) in them, have them separated individual rows again... cells in column a. each line in cell has bullet point (eg. "* ") front, serve beacon excel script break line @ point. have code me that? have no clue how go this... sample picture attached. thanks you can use split chr(10) or vblf dim cell_value variant dim counter integer 'row counter counter = 1 'looping trough column define max value = 1 10 'take cell @ time cell_value = thisworkbook.activesheet.cells(i, 1).value 'split cell contents dim wrdarray() string wrdarray() = split(cell_value, vblf) 'place values b column each item in wrdarray thisworkbook.activesheet.cells(counter, 2).value = item counter = counter + 1 next item next no have array place each row different cell

typescript - Checking validity of string literal union type at runtime? -

i have simple union type of string literals , need check it's validity because of ffi calls "normal" javascript. there way ensure variable instance of of literal strings at runtime ? along lines of type mystrings = "a" | "b" | "c"; mystrings.isassignable("a"); // true mystrings.isassignable("d"); // false since typescript 2.1, can other way around with keyof operator . the idea follows. since string literal type information isn't available in runtime, define plain object keys strings literals, , make type of keys of object. as follows: // values of dictionary irrelevant const mystrings = { a: "", b: "" } type mystrings = keyof typeof mystrings; ismystrings(x: string): x mystrings { mystrings.hasownproperty(x); } const a: string = "a"; if(ismystrings(a)){ // ... use if typed mystring assignment within block: typescript compiler trusts our duck typing! }

iphone - Need help presenting a view controller -

i have class has extension of uibutton shows uialertview under circumstance. @interface cellbutton : uibutton {} uialertview *alert = [[uialertview alloc] initwithtitle:@"you lose!" message:@"play again?" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:@"cancel", nil]; [alert show]; this works fine, need present view controller when user presses ok.but may know cannot present view controller extension of uibutton . so wondering if can put code below in viewcontroller , allow work uialert in cellbutton class. - (void)alertview:(uialertview *)alertview diddismisswithbuttonindex:(nsinteger)buttonindex { if (buttonindex == 0) { // , clicked ok. gamecontroller*mynewvc = [[gamecontroller alloc] init]; [self prese

How can i perform auto close in firefox when download is complete -

any idea close firefox when download finished, imacros script or other firefox addon/extension? tried search on google , got answer related shutdown pc when download finished method, script or extension out there? add @ end of imacro code: tab closeallothers tab close

IndexError: index is out of bounds for axis 0 python numpy -

i know python thinks there number. have know idea how fix this. advice appreciated. import numpy test = numpy.array([9,1,3,4,8,7,2,5,6,5,-10,12,-15,19,-20,22,-53,45,43,43,23,-65,-23,46,44,67,79,5,-34,32,-56,-3,1,15,22,3]) n = 0 n1 = 3 while n < len(test): low = numpy.amin(test[n:n1]) close = test[n1] high = numpy.amax(test[n:n1]) stochastic = float(close-low)/(high-low)*100.00 print stochastic n1=n1+1 n=n+1 error: indexerror: index 36 out of bounds axis 0 size 36 your need put stop condition on n1 instead of n : while n1 < len(test):

ios - How to add login api using nsjsonserilization.? -

i have api http://qa.networc.in:1336/api/users/app/login , want fire api on login button click. need match email , password. - (void)viewdidload { [super viewdidload]; name = [nsmutablearray new]; [uiapplication sharedapplication].networkactivityindicatorvisible = yes; nsurl *url = [nsurl urlwithstring:@"http://qa.networc.in:1336/api/users/app/login"]; nsurlrequest *request= [nsurlrequest requestwithurl:url]; [nsurlconnection connectionwithrequest:request delegate:self]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; } -(void)connection:(nsurlconnection *)connection didreceiveresponse: (nonnull nsurlresponse *)response { data = [[nsmutabledata alloc] init]; nslog(@"did receive response"); } -(void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)theta { [data appenddata:thedata]; nslog(@"daata"); } -(void)connectiondidfinishloading:(nsurlconnection *)connection {

python - xticks ends placement of numbers on x-axis prematurely, i.e. the ticks do not reach the right end -

Image
i have simple script graphs tpr/sp tradeoff. it produces pdf (note placement of x-axis numbers): the relevant code likely: xticks(range(len(sp_list)), [i/10.0 in range(len(sp_list))], size='small') the whole code is: sn_list = [0.89451476793248941, 0.83544303797468356, 0.77215189873417722, 0.70042194092827004, 0.63291139240506333, 0.57805907172995785, 0.5527426160337553, 0.5527426160337553, 0.53586497890295359, 0.52742616033755274, 0.50632911392405067, 0.48101265822784811, 0.45569620253164556, 0.43459915611814348, 0.40084388185654007, 0.3628691983122363, 0.31223628691983124, 0.25738396624472576, 0.20253164556962025, 0.12658227848101267, 0.054852320675105488, 0.012658227848101266] sp_list = [0.24256292906178489, 0.24780976220275344, 0.25523012552301255, 0.25382262996941896, 0.25684931506849318, 0.36533333333333334, 0.4548611111111111, 0.51778656126482214, 0.54978354978354982, 0.59241706161137442, 0.63492063492063489, 0.80851063829787229, 0.81203007518796988, 0.8512

android - Is it possible for content (size) to match parent? -

if have text in button has match_parent , possible make textsize big possible without cropping text? preferably in xml , maximum setting doesn't become big. in other words i'd make fit if split long word, otherwise stick preset size. this way , not in opinion should try change design avoid requirement

asp.net mvc - Get checkbox value placed in partial view table -

i new mvc convept. have 2 model class 1 many relation. find below code. role: public partial class approle { public approle() { apppermissions = new hashset<apppermission>(); appusers = new hashset<appuser>(); } public int approleid { get; set; } [required] public string rolename { get; set; } public string roledescription { get; set; } public bool issysadmin { get; set; } public virtual icollection<apppermission> apppermissions { get; set; } public virtual icollection<appuser> appusers { get; set; } } permission: public partial class apppermission { public apppermission() { } public int apppermissionid { get; set; } [required] public string name { get; set; } public bool enable { get; set; } [required] [stringlength(50)] public string permissiondescription { get; set; } public guid approleid { get; set; } public approle approle { ge

prolog - An infinite success tree, or not? -

i'm given following program: edge(a,b). edge(b,c). edge(a,d). path(n,m):- path(n,new),edge(new,m). path(n,m):- edge(n,m). and asked if when applying proof tree algorithm following query: ?- path(a,x). the proof tree infinite success tree, or infinite failure tree? now see it, during building of tree, stuck in applying rule 1 of path on , on again, creating infinite tree , never getting rule 2 of path.. thus creating infinite failure tree. solution have says infinite success tree, question is: right or professor right? :] i call infinite loop. @ trace: ?- trace, path(a,x). call: (7) path(a, _g394) ? call: (8) path(a, _g511) ? call: (9) path(a, _g511) ? call: (10) path(a, _g511) ? ... call: (147) path(a, _g511) ? call: (148) path(a, _g511) ? ... error: out of local stack i'm not familiar these terms, might able wing it. no solutions produced, hard me argue infinite success tree. given infinite time , space never produce successful solution. @

Microsoft Android Face API Error -

when debug face api throw below error. unknownhostexception@830035410936} "java.net.unknownhostexception: unable resolve host "api.projectoxford.ai": no address associated hostname" i recommend try use latest version of client library android . there have been api url changes when project oxford became cognitive services (not hostname, though). you can want check app can access internet altogether (i.e. allowed application manifest).

amazon web services - Upload to S3 bucket subfolder PHP -

i'm using following upload files amazon s3 bucket using php: $s3 = new s3(awsaccesskey, awssecretkey); $s3->putbucket("example", s3::acl_public_read); $s3->putobjectfile($filetempname, "example", $filename, s3::acl_public_read); how can upload example/subfolder? this not duplicate - answer not clear , question different.

java - Hazelcast durable message queue -

could explain me, can use hazelcast broker durable message queue? in words, hazelcast guarantee message durability putted queue in case when cluster nodes crashed? thanks lot. by default hazelcast works in memory. if need persist data, can refer official docs . if need persistent messaging queue suggest using rabbitmq.

android - SwipeMenuListView new Row added is showing First time data -

i've read many of previous posts on topic, i'm not getting right. i have adapter has private values of items in list. when update values(add new items), watch value in debugger , "getview" func , see value correct. but actual rowview see first item in list. i have no clue may cause this. this listview on same activity while show different layout , hide listview add new item. can there connection while listview visibility "gone"? when remove items it updates listview fine(that done when listview visible). private void updateadapter() { this.values.clear(); this.values.addall(staticlistindifferentclass); notifydatasetchanged(); } ~~~~update~~~~ ok, discovered cause of problem, though i'm not sure why is. code fine way with regular listview bug on: com.baoyz.swipemenulistview.swipemenulistview try use listview.invalidateviews this should cause views rebuilding

PHP - finfo_file returns incorrect MIME type -

i have application can upload/download files different format. when upload have correct mime type, when download same file, finfo_file of php returns me incorrect mime type. here values got : code : $finfo = finfo_open(fileinfo_mime_type); $mime_type = finfo_file($finfo, $filename); echo $mime_type; output : application/msword // test0.pot incorrect should application/vnd.ms-powerpoint text/plain // test1.csv icnorrect should text/csv application/vnd.ms-powerpoint // test2.pptx incorrect should application/vnd.openxmlformats-officedocument.presentationml.presentation application/msword // test3.pps incorrect should application/vnd.ms-powerpoint application/msword // test4.docx incorrect should application/vnd.openxmlformats-officedocument.wordprocessingml.document application/msword // test5.doc correct application/vnd.ms-excel // test6.xls correct application/vnd.ms-excel // test7.xlsx incorrect should application/vnd.openxmlformats-officedocument.spreadsheetml.sheet appli

android - how to display data on View after fetching from Json in react native -

i have json output fetch method, in format { "example": { "id": "301", "example_n": "example", "exampleid": "12", "thumbnail": "some url", "examplearry": [ { "example_id": "9", "exampletitle": "exampletitle ", }, { "example_id": "10", "exampletitle": "exampletitle", }, { "example_id": "7", "exampletitle": "exampletitle", }, "example_api": "6vvdncv99hbnbscm" } now want access example_id , exampletitle. how use in react native? you can see how here . implement fetchdata method have: fetchdata() { fetch(request_url) .then((response) => response.json()) .then((responsedata) => { this.setstate({ examplearry: responsedata.examplearry, }); })

java - Data Insertion error while trying to insert a json array? -

Image
i trying send json array mysql data base using google's volley library. following type of data sending:- [{"vatno":"","area":"testing bay","status":"0","cstno":"","dbname":"webappdb","name":"anup borde","emp_role":"manager","password":"1223","key":"","city":"pune","shop_name":"test shop","mobile":"8600931386"}] i data insertion error :- data insertion erroryou have error in sql syntax; check manual corresponds mysql server version right syntax use near 'key,dbname,status,role)values( '', 'anup borde', '8600931386', '1223', 'test sho' @ line 1 i trying run php script. <?php include "config.php"; $dbname ="goldmine"; $con = mysqli_con

ssl - android does not trust a certificate -

Image
i run openssl s_client -connect mywishboard.com:443 | openssl x509 -noout -subject -issuer , following information certificate (setted client developer) depth=2 c = il, o = startcom ltd., ou = secure digital certificate signing, cn = startcom certification authority verify return:1 depth=1 c = il, o = startcom ltd., ou = startcom certification authority, cn = startcom class 1 dv server ca verify return:1 depth=0 cn = mywishboard.com verify return:1 subject= /cn=mywishboard.com issuer= /c=il/o=startcom ltd./ou=startcom certification authority/cn=startcom class 1 dv server ca then check go settings/system/trusted certificats , see startcom ltd among them however, when tring make https requests, throws javax.net.ssl.sslhandshakeexception: java.security.cert.certpathvalidatorexception: trust anchor certification path not found if use curl -i https://mywishboard.com/xxx , returns curl: (60) server certificate verification failed. cafile: /etc/ssl /certs/ca-certificates.cr

filter - JQgrid empty field search -

empty field search i have grid holds data json file. want filter particular column may have empty value too.see image packagename has empty fields. need filter rows on clicking button. posting filters postdata empty value "". grid fetching data it. need filter on grid. ??

r - Error (invalid length argument) while calling a function -

i writing function check mean of numeric columns in data frame. below code have written. means_func <- function(x) { nc <- ncol(sapply(x,is.numeric)) #selecting numeric columns means <- numeric(nc) #assigning result (i in nc) { means[i] <- mean(x[i]) } means } means_func(airquality) #calling function but when call function, error error in numeric(nc) : invalid 'length' argument

database - Symfony 2 override entity field property -

i want override entity field property. need data database table (mapped id). should combination of "artikelnummer" , field called "name" database table. $builder->add('schlauch', 'entity', array( 'class' => 'schlauchbundle:artikelspezifikation', 'property' => 'artikelnummer', 'attr' => array( 'class' => 'extended-select' ), 'data_class' => null )); the field "artikelnummer" outputs "12345" need add name (from database table called "schlauch"), should "12345 articlename". tried query in entity file, dont't want manipulate output everywhere. is possible use query property , override it? you can simple solve adding new getter entity: class artikelspezifikation { //… /** * @var schlauch * * @orm\manytoone(targetentity="schlauch", inversedby=&quo

python auto install modules and pygame window -

i have 2 questions pygame , python: one: using pygame in fullscreen mode , wondering how can other windows (google chrome, safari, mail, thunderbird, itunes) go on top of fullscreen window. two: can make python install modules custom desktop need without user having go , install them themselves just make borderless screen size of desktop excluding start menu etc. second question, compile user doesn't need python. have done quite py2exe, assuming running windows, have heard py2app mac, py2exe cant used on linux wine programs seem run fine.

php - Stripe token error -

i'm trying setup section on site collects card details (using stripe), save customer, , charge @ later date. looked through several tutorials , still getting error, in particular: undefined variable: token in /applications/xampp/xamppfiles/htdocs/love-deals/admin/billing.php on line 21 failed save customer id db. want able save customer id users table in database (user created) used @ later date payments, life of me cant seem past error! appreciated. thanks in advance kaylee here code far: payment page, form: <?php $userid = (int) $_get['id']; require('../inc/connect/config.php'); ?> <header> <!-- css --> <link href="admin.css" rel="stylesheet"> <link href="bootstrap.min.css" rel="stylesheet"> <script type="text/javascript" src="https://js.stripe.com/v2/"></script> <?php echo '<script type="text/javascript"> stripe.setpublisha