Posts

Showing posts from August, 2012

ios - SKShapeNode select X amount -

question i'm developing poker software ~ purely fun. now when comes chips, i'm having nightmare. 1 positioning them, 2 denominations , three selecting ones i'll need! seems impossible current design. basically, draw skshapenode give name of denomination , player name. however, chip can drawn 50 times same name. when come animating these chips, can see wall of impossibility.. once i've made function choose right denominations of chips use call or raise etc, how begin write pseudo code? i require 2 large chips, 1 small chip , 2 medium chips { sknode *node = [self childnodewithname:denomination, playername]; runaction.. } baring in mind, i'll need take 2 of 20 there in chip stack.. change ownership of chip.. is possible? or overcomplicating issue..? you need rework solution little bit. this: first, subclass skspritenode (or sk whatever node like) make chip: chip.h @interface chip : skspritenode @property (nonatomic, retain)

java - App crashes when trying to run parse.com push notification application -

my parse push notification app seems crash whenever run it. double checked make sure permissions correct , build.gradle correct. created java class (which added src folder) parse application. here code parse application, android manifest, , build.gradle file. build.gradle file buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.example.anish.parseexample" minsdkversion 19 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') compile 'com.android.suppo

jquery - JavaScript & Checkboxes - More efficient way of storing values of each checkbox? -

is there more efficient way of storing checkbox values? each checkbox has assigned value, wondering if there better way of storing these values (destinationoflink1,2,3,etc)? perhaps store them array , call them?...although unsure html page extract: <form> <label for="checkbox1">link #1</label> <input type="checkbox" id="checkbox1" value="http://www.destinationoflink1.com"> <label for="checkbox2">link #2</label> <input type="checkbox" id="checkbox2" value="http://www.destinationoflink2.com"> <label for="checkbox3">link #3</label> <input type="checkbox" id="checkbox3" value="http://www.destinationoflink3.com"> <input type="button" value="open links" id="open_link"/> </form> javascript file extr

r - calculate average correlation for neighboring pixels through time -

i have stack of 4 rasters. average correlation through time between pixel , each of 8 neighbors. some data: library(raster) r1=raster(matrix(runif(25),nrow=5)) r2=raster(matrix(runif(25),nrow=5)) r3=raster(matrix(runif(25),nrow=5)) r4=raster(matrix(runif(25),nrow=5)) s=stack(r1,r2,r3,r4) so pixel @ position x, has 8 neighbors @ ne, e, se, s etc positions, want average of cor(x,ne) cor(x,e) cor(x,se) cor(x,s) cor(x,sw) cor(x,w) cor(x,nw) cor(x,n) and average value saved @ position x in resulting raster. edge cells na or, if possible flag calculate average correlation cells touches (either 3 or 5 cells). thanks! i don't believe @pascal's suggestion of using focal() work because focal() takes single raster layer argument, not stack. solution easiest understand. made more efficient minimizing number of times extract values each focal cell: library(raster) set.seed(2002) r1 <- raster(matrix(runif(25),nrow=5)) r2 <- raster(matrix(runif(25),nr

php - Ajax limit on post size -

background... i'm using handsontable.js enable user manipulate large number of rows of data. there 4 columns represented in object below 'id' , 'order' ,'no' , , 'name'. when user satisfied edits, click button , data should sent via ajax processing. data looks ... array ( [0] => array ( [id] => 194 [drawing] => array ( [order] => [no] => a0001 [name] => - ) ) ) problem... the data object contains 464 elements (this number vary greatly). 250 received php script. the javascript.... function reorder(){ var stuff = hot1.getdata(); $.ajax({ url: '/php/listorder_processes.php', type: 'post', data: { value: stuff }, success: function(result) { console.log(result);

playframework - Image resource cannot be found after using sbt debian:packageBin -

i have put images path app/assets/images after used command sbt debian:packagebin , deployed server, images couldn't found. can me solve problem? i have sovled problem did not put these images package after used command sbt debian:package put these code build.sbt import nativepackagerhelper._ ... mappings in (compile, packagebin) ++= directory("public")

javascript - How to populate table in Angular with JSON data from a web Service? -

i have link displays json data when first name found. http://localhost:8080/application/names/find?firstname=f_name&lastname&address&status= for example: if replace f_name tim json response. [{"f_name": "tim","address": "road","phone": "1234","status": "busy"}] if replace f_name sue json response. [{"f_name": "sue","address": "street","phone": "4321", "status": "available"}] i want able type tim or sue , corresponding data. here have. $http.get('http://localhost:8080/application/names/find?firstname=f_name&lastname&address&status='). success(function(data) { $scope.jsondata = data; alert("success"); }). error(function(data) { alert("invalid url"); }); $scope.results = []; $scope.clickbutton = function(enteredvalue) { $scope.items = $scope.j

c - Arithmetic on a struct representing a large integer -

i've wrote implementation of murmur3 hash , have defined 128-bit keys hash128_t typedef struct { uint64_t p1; uint64_t p2; } hash128_t; i'm trying write own hashmap using these keys, i'm not sure how arithmetic struct nor number large. need modulo operations, on how treat these 2 blocks of memory 1 integer appreciated. my modulo formula is dividend - ((dividend/divisor) * divisor) the easiest thing can discard half of hash , modulo (simply using % ) on other half. the next simplest thing use existing bignum library. if want use whole hash, though, need long division here. there number of ways this; here's 1 ( completely untested ) method: uint64_t big_modulo(hash128_t hash, uint64_t divisor) { uint64_t accum = hash.p1 % divisor; uint64_t shift_buf = hash.p2; (int = 0; < 64; i++) { accum = accum << 1 | (shift_buf >> 63); shift_buf = shift_buf << 1; if (accum & (~1lu << 63)) a

image - phonegap resolveLocalFileSystemURL does not work for content uri on android -

i want receive share image android image gallery using nexus 4 phone on android version 5.1.1. using phonegap 4.2 , phonegap webintent plugin github link , phonegap file plugin doc link . text , links works fine when tried share image android gallery, uri this: content://com.google.android.apps.photos.contentprovider/0/1/content%3a%2f%2fmedia%2fexternal%2fimages%2fmedia%2f63131/actual instead of file:///.... i tried use window.resolvelocalfilesystemurl function resolve url returns successful fileentry object. however, when try use read file, error code 1000 (see below code , output). interestingly, if display url via img tag, able see image fine. <img src="" id="test_intent_image"> $('#test_intent_image').attr("src",uri); this suggests problem might window.resolvelocalfilesystemurl function can't handle content://... type uris properly? ===== reference info ====== here code i'm using (note: tried other

javascript - Form validates even when validations fail -

hello need one. seems application still gives output if validation fails. have tried many ways edit codes no avail form still allows submissions , gives output. i need form able validate upon submission , if there 1 fail validation or error form should not submit , gives output. alerts. need validation. there should alerts if validation fails , form should not submit output. please me this. please see form below. in advance. <html> <head> <title>hello , javascript</title> <script> function doclear() { document.pizzaform.customer.value = ""; document.pizzaform.address.value = ""; document.pizzaform.city.value = ""; document.pizzaform.state.value = "pa"; document.pizzaform.zip.value = ""; document.pizzaform.phone.value = ""; document.pizzaform.email.value = ""; document.pizzaform.sizes[0].checked = false; document.pizzaform.sizes[1].checked = false; document.pizzaform.sizes[2].c

c - Fast 3D Lut lookups -

i'm trying write fast 3d lut lookup function , noticed luts either 33x33x33 or 17x17x17. why 33 or 17? wouldn't math quicker 32 or 16 instead? shifts instead of divides? or maybe i'm not understanding why. anyone? this because colour values typically stored 8-bit or 10-bit integers (8 bits in systems each r, g , b value stored in single byte, , 10 bits in systems store 30 bits of rgb data in 32-bit long word). to achieve spread of rgb values across entire range, need choose lut size evenly covers range 0 255 or 0 1023. since 255 = 17x15, lookup table 15 or 17 values you: 15 values: [0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255] 17 values: [0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, 195, 210, 225, 240, 255] for 10-bit values, i'll note 1023 divisible 33. can maths :-)

ruby - CSV file to hash -

i want take simple 2-column csv file , turn hash of initials keys, full name values. how this? csv_text = file.read('composer_initials.csv') csv = csv.parse(csv_text, :headers => true) i've tried: csv.to_a.map {|row| ro.to_hash} csv.map {|row| row.to_hash} solution: this ended doing job: composers = {} csv.foreach("composer_initials.csv") |row| composers[row[0]] = row[1] end hash = {} csv= csv.parse(csv_text) csv.each |row| hash[row[0]] = row[1] end

beeswax - Hive - Out of Memory Exception -

which results in mr job. mr job runs successfully, when beeswax tries render result oom exception. i wondering if there configuration setting me passed issue. java.lang.outofmemoryerror: java heap space @ java.util.arrays.copyofrange(arrays.java:2694) @ java.lang.string.<init>(string.java:203) @ java.nio.heapcharbuffer.tostring(heapcharbuffer.java:561) @ java.nio.charbuffer.tostring(charbuffer.java:1201) @ org.apache.hadoop.io.text.decode(text.java:394) @ org.apache.hadoop.io.text.decode(text.java:371) @ org.apache.hadoop.io.text.tostring(text.java:273) @ org.apache.hadoop.hive.serde2.serdeutils.buildjsonstring(serdeutils.java:280) @ org.apache.hadoop.hive.serde2.serdeutils.getjsonstring(serdeutils.java:220) @ org.apache.hadoop.hive.serde2.delimitedjsonserde.serializefield(delimitedjsonserde.java:59) @ org.apache.hadoop.hive.serde2.lazy.lazysimpleserde.serialize(lazysimpleserde.java:427) @ org.apache.hadoop.hive.ql.exec.lis

asp.net - How to use Fileupload control in UpdatePanel? -

i have fileupload , image control , button control. using updatepanel : when click button after chosing image, image control should show image without postback. not work? <asp:scriptmanager id="scriptmanager1" runat="server"></asp:scriptmanager> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:fileupload id="fileupload1" runat="server" /> <br /> <asp:image id="image1" runat="server" /> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="button1" /> </triggers> </asp:updatepanel> <asp:button id="button1" runat="server" text="button" onclick="button1_click" /> my code behind just: protected void button1_click(object sender, eventargs e) { if (fileupload1.hasfile) { fileup

How to pass Backbone.js model data to Bootbox with Handlebars.js? -

i have marionette view have method create new model bootbox. need able edit model bootbox, how can i pass current model data box? of current code: module.views.chaptersx = marionette.compositeview.extend({ template: module.templates['documents/create/course/chapter/index'], childview: module.views.chapteritemx, childviewcontainer: "#chapterscollection", events: { 'click .chapters-create': 'create', //'click #uploadfileschapters': 'startupload' }, create: function (evt) { console.log('create'); evt.preventdefault(); var me = this; var box = bootbox.dialog({ show: false, title: "nueva seccion", message: module.templates['documents/create/course/chapter/chaptermodal'], buttons: { success: { label: "guardar", classname: &quo

c# - How can I make a Sharepoint textbox (input, type=text) dynamically Multiline? -

i want textbox on web part grow vertically on demand. is, 1 line unless user enters text line, @ point word wraps , grows vertically accommodate verbosity of user. i creating controls/elements dynamically, , create element so: boxpaymentexplanation = new textbox() { cssclass = "dplatypus-webform-field-input" }; boxpaymentexplanation.width = 660; boxpaymentexplanation.style.add("display", "inline-block"); i tried adding line, in hopes of achieving functionality: boxpaymentexplanation.style.add("textmode", "multiline"); ...but makes no apparent change textbox's behavior - can enter text "until bovines come barn" keeps adding characters end of textbox on single row. never wraps, never grows. update this jquery works (derived link christopher jennings provided): $(document).on("keyup", "[id$=explainpaymenttextbox]", function (e) { while ($(this).outerheight() < this.scrollheig

delphi - "Number of elementes(256) differs from declaration(65536)" Migration D2007 to XE8 -

i in process of migrating code d2007 xe8. have function uses data construct: map: array[char] of byte = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, .............. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); here how used (s string): i := map[s[1]] + (map[s[2]] shl 6); when try compile xe8 message number of elementes(256) differs declaration(65536) what have compile , work xe8? this consequence of unicode introduction in delphi 2009. can fix issue replacing char ansichar , or adding 65 280 new entries array. in first case, should notice should let s ansistring , , not (unicode) string ; otherwise might access e.g. map[chr(3653)] not exist.

bluetooth lowenergy - android device.getUuids returns null -

i'm trying connect arduino uno via android app using bluetooth low energy (ble). i'm developing on android studio, testing samsung galaxy s4, , android version 5.0.1 i followed link: http://www.truiton.com/2015/04/android-bluetooth-low-energy-ble-example/ i'm scanning devices , when found one, it's uuid before connecting it, make sure it's right type of device: mscancallback = new scancallback() { @override @targetapi(21) public void onscanresult(int callbacktype, scanresult result) { bluetoothdevice btdevice = result.getdevice(); parceluuid[] uuids = btdevice.getuuids(); //<-- null!! :( log.d(tag, ""+btdevice.fetchuuidswithsdp()); //<-- prints true. log.d(tag, "result : " + result.tostring()); //<-- prints bunch of relevant info contains uuid want check. log.d(tag, "uuids : " + uuids); //<-- prints null. /* (p

jquery - How to include external js if exists, else do nothing (ignore)? -

i have pieced jquery snippet using ajax call call external file, works great shown: jquery.ajax({ type: "get", url: "http://www.domain.com/external.js", datatype: "script" }); i need (to create) external file under conditions, if not present, 404 error in browser console. want absolutely nothing (ignore) if file not present. the closest related post found how include external html if exists, else nothing? doesn't nothing, runs function: jquery(function() { jquery.ajax({ type: "get", url: "http://www.domain.com/external.js", cache: false, datatype: "script" success: function(html){ $('#test').html(html); } }); }); question: how go ignoring warnings if file not present, run file if is? could this? jquery(function() { jquery.ajax({ type: "get", url: "http://www.domain.com/external.js", cache: false, datatype: "script

ms access - VBA - Browsing, selecting file and saving file as -

i creating access database forms , reports. in 1 of forms want able go folder selecting file (.pdf, .doc, .xls) , saving in dedicated "attachments" folder. i know ole objects , attachment functions, both of these saving attachments within database perse. trying stay away since imperative have readily access attachments , make database lighter. i have been playing in vba application.filedialog(msofiledialogfilepicker) and application.filedialog(msofiledialogsaveas) this have far not working: option compare database private sub select_save_click() call selectfile end sub public function selectfile() string dim fd filedialog dim file_name string dim path string path = "o:\foldername" set fd = application.filedialog(msofiledialogfilepicker) fd .allowmultiselect = false .title = "please select file save attachment" if .show = true file_name = dir(.selecteditems(1)) selectfile = .selecteditems(1)

entity framework - Excel File download through web api. Getting corrupt -

Image
i trying download excel file through web api (using entity framework). download working getting error dialog file corrupt when trying open file. web api code below: public httpresponsemessage getvalue(int id, string name) { memorystream stream; try { using (datacontext db = new datacontext()) { dynamic fileobj = (from c in db.filelist c.id == idc).tolist(); stream = new memorystream(fileobj(0).file); httpresponsemessage result = new httpresponsemessage(httpstatuscode.ok); result.content = new streamcontent(stream); result.content.headers.contenttype = new mediatypeheadervalue(fileobj(0).filecontenttype); result.content.headers.contentdisposition = new contentdispositionheadervalue("attachment") { filename = name }; return result; } } catch (exception ex) { return request.createresponse(httpstatuscode.internalservererror); } } it opens fi

php and mysql date time difference -

i did in php store lastlogin in mysql datetime column date('y-m-d h:i:s') //which gave > '2014-01-04 08:00:56' and saved it when need calculate users have been online more 20 minutes, did in mysql select * `elc_users` timestampdiff( minute , lastlogin, now( ) ) <20 it didn't work, when traced in mysql, now() gave > 2014-01-04 20:00:56 now wont let me 20 minutes logged in users. how can fix this? edit i inserted record manually in phpmyadmin, sure whthear timezone issue in timestamp column default value current_timestamp , gave 2014-01-05 06:48:21 . ran query in phpmyadmin select created, now( ) `elc_users` this gave 2014-01-05 18:53:53 now exec code below check global , session timezone, , got phpmyadmin mysql> select @@global.time_zone, @@session.time_zone; which gave system | system like filip said it's timezone issue; can change timezone of script whatever timezone mysql set this: date_default_timezon

ios - How to edit a UITableViewCell in a completion block from a method called inside the delegate method cellForRowAtIndexPath: -

in uitableview delegate method cellforrowatindexpath:(nsindexpath *)indexpath, want set image cell imageview. if image not available, download , set asynchronously in complete block. problem because cells reusable, maybe when completion block called, cell may not exist anymore. how can update cell when completion block called? or way ok? - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { friendtableviewcell *cell = [self.tableview dequeuereusablecellwithidentifier:@"friend cell"]; friend *friend = self.friends[indexpath.row]; if (friend.picture) { cell.userprofileimageview.image = [uiimage imagewithdata:picturedata]; } else { cell.userprofileimageview.image = nil; nsurl *pictureurl = [nsurl urlwithstring:[nsstring stringwithformat:@"https://graph.facebook.com/%@/picture?type=normal&return_ssl_res", friend.facebookid]]; nsurlrequest *urlrequest = [nsurl

javascript - How to populate table with json data using angular? -

i have loaded json data via http having problem populating table json data based on entered value 'name'. plunker below. plunker json [ { "name": "tim", "address": "road", "phone": "1234", "status": "busy" }, { "name": "sue", "address": "street", "phone": "4321", "status": "available" } ] assuming controller , app defined correctly doing wrong? want type tim or type sue , populate table corresponding data. angular.js $http.get('data.json'). success(function(data) { $scope.jsondata = data; alert("success"); }). error(function(data) { alert("invalid url"); }); $scope.clickbutton = function(enteredvalue) { $scope.items = $scope.jsondata; an

c# - How do I log into a web service that was auto-generated by Azure Mobile Web Services? -

Image
microsoft's azure mobile web services lets download .net or javascript service , client talks service. these written in c#, or javascript. chose 1 in c#. there several parts in generated solution a windows 8.1 desktop client (yourname.windows) a windows mobile client (yourname.windowsphone) a azure mobile web service (yournameservice) a shared .net assembly named (yourname.shared) you can right click on yournameservice , click publish , takes through wizard publishes application directly visual studio azure server. @ point in wizard establishes automatically rather complex credentials (because have logged azure web subscription). can click next, next, , published. now have webservice, opens in web browser, requires log in. want know is, how know user name , password used login? http://yourapp123.azure-mobile.net/help then click "try out", , web browser authentication dialog pops up. why problem? far user have input: my visual studio login cred

oop - JavaScript Functional Classes -

i learning object oriented programming in javascript udacity course. know among below best technique create functional object , why. first code: var car = function(loc){ var obj = {loc:loc}; extend(obj, car.methods); return obj; } car.methods = { move: function(){ this.loc++; } }; second code: isnt above code same as: var car = function(loc){ var obj = {loc:loc}; obj.move= function(){ this.loc++; } return obj; } third code var car = function(loc){ var obj = {loc:loc}; obj.move=move; return obj; } move=function(){ this.loc++; }; i want know, style of coding 1 should follow. understand third code better second because more instances of functions created whenever use car function. doesn't first code create more instance of same function? thanks in advance. answer: none of above. try this: function car(loc) { this.loc = loc; } car.prototype.move = function () { this.loc++; };

c - Output Of a While Loop -

how many times while loop executed in below prog if short int of 2 bytes? main() { int j = 1; while(j <= 255); { printf("%d",j); j++; } return 0; } i think should 255 times not correct. can tell me why? you have semicolon @ end of while-line. while loop, consisting of statement ; , executes "infinitely" many times.

swift - Is it possible to use template arguments in virtual function in modern C++? -

i used c++ development several years ago , found difficult combine template programming oop. program in swift , tried doing of things struggled then. this swift code illustrate problem: // protocol java interface or c++ pure virtual base class protocol log { // want able add elements collection of ints, // should sort of collection // can treated sequence func add<t: sequencetype t.generator.element == int>(values: t) } class discretelog: log { var vals: [int] = [] func add<t: sequencetype t.generator.element == int>(values: t) { v in values { vals.append(v) } } } class continouslog: log { var vals: [double] = [] func add<t: sequencetype t.generator.element == int>(values: t) { v in values { vals.append(double(v)) } } } // don't have know whether log continuous or discrete // can still add elements var log: log = continouslog() log.add([1, 2, 3]) // , el

r - use an "array" to store objects -

i have use copulas create large sample of size n. problem procedure time consuming since have recreate same copulas n times. what i'm trying find way of storing copulas in kind of array, create copulas once, store them, , use them n times. in r, idea this: fill upper left diagonal matrix copulas kind of bi-dimensional container (named copula) for(r in 1:dimension){ for(c in 1:(dimension+1-r) ){ copula[r,c] = getcopula(copulastr, pcopula[r,c]) } } , can access copula i,j (copula[i,j] )as if array. the copulas i'm tryinng sore are: class(getcopula('frankcopula', 2)) [1] "frankcopula" attr(,"package") [1] "copula" a may of solving issue creating array lists mat<-matrix(list(), nrow = dimension, ncol = dimension) for(r in 1:(dimension+1-r)){ for(c in 1:dimension){ mat[[r,c]] = obtercopula(copulastr, pcopula[r,c]) } }

c# - Azure WebJob QueueTrigger How DeleteMessage after get it? -

i have 1 webjob on azure, queuetrigger. job long (more 30 minutes) public async static task processqueuemessageasync([queuetrigger(queuename)] string ijobid) { //doing long job } my problem how delete message in queue after triggering. message becomes invisible until timespan (30s default) comes. less of job duration. suppose have delete message @ beginning of trigger method. find how when looping getmessage() method instead triggering. how trigger, because don't have message object run .deletemessage() ? answered michael curd on msdn forums , , quoted here: the sdk should handle that. stated, message leased (or become invisible) 30 seconds default. if job takes longer that, lease renewed. message not become available instance of function unless host crashes or function throws exception. when function completes successfully, message deleted sdk. shouldn't need write special code scenario.

ios - Take Screen shot with Notification Drawer iPhone -

is there way take screen shot along notification drawer? actually i'm working on poc i'm take screenshot, when imessage comes , message notification drawer pops up, can message notification drawer capture along view ? , if it's possible, apple allow such application submission app store.

jquery - Bind an element in two forms -

im using aspnet mvc 5 develop web app , have typed view 2 forms, second 1 showed when first 1 submited ( via ajax ): @model dto.userdto <form id="firstform"> @html.editorfor(model => model.name) //need property on both forms, in second form readonly input value. @html.validationmessagefor(model => model.name, string.empty}) <button type="submit" id="btnsearchname"></button> </form> //second form @using (html.beginform()) { //other inputs other properties in userdto viewmodel <input type="submit" class="btn btn-success btn-lg" value="save" /> } <script> $("#firstform").submit(function (e) { e.preventdefault(); if (!$(this).valid()) { return false; } findname(); //ajax request return true; // if true, expand(show) second form }); </sc

postgresql - Are Postgres WHERE clauses run sequentially? -

i'm looking @ using postgres database let our clients segment customers. the idea can select bunch of conditions in our front-end admin, , these conditions mapped sql query. right now, i'm thinking best structure this: select distinct id users id in ( -- condition 1 ) , id in ( -- condition 2 ) , id in ( -- etc ) efficiency , query speed super important us, , i'm wondering if best way of structuring things. when going through each of where clauses, postgres pass id values 1 next? the ideal scenario be, group of 1m users: query 1 filters down 100k query 2 filters down 100k 10k query 3 filters down 10k 5k as opposed to: query 1 filters 1m 100k query 2 filters down 1m 50k query 3 filters down 1m 80k the intersection of queries mashed together, 5k maybe i'm misunderstanding here, i'd love thoughts! thanks! postgres uses query planner figure out how efficiently apply query. may reorder things or change how query operati

c# - How to get value of the selected item -

i want value of selected item of combobox. i'm using wpf , c#. i make that: string c = combobox.selecteditem.tag no, answers wrong here, perhaps bit 'my fault because not express myself well. however, each item in combobox associate value, example: item1 (value) => home (tag)<br> item2 (value) => away (tag)<br> item3 (value) => half (tag)<br> , september tag like: want tag when related item selected, example: user select item1 , in variable valorize home tags ... isn't working. way it? string c=combobox.selectedvalue

sql - Table design for questionaire -

Image
we working on application ask users various questions, these questions can have branches, don't run in straight order. example, if below structure of questions , can flow to: question 2 has branch if user answers yes move 3 , end @ 7, otherwise work our way down 4,5,6,7. have come table design wanted feedback if design work or if there better way structure this. there question table have id (key) , text columns. tree represented as: questionid | previousid | nextid | branch condition 1 0 2 null 2 1 3 yes 2 1 4 no 3 2 7 null 4 2 5 null 5 4 6 null 7 3 0 null 7 6 0 null the way work, once question answered system check current question's branch condition is, if null move nextid. otherwise find answer user selected , go

Python class property and class constants -

i'm trying work "getters" , "setters" in python classes. have simple rectangle class defined below each rectangle object has class variables length , width defined. there class constant called sides knows number of sides of particular shape. now, when run class, works fine. can like >>> rect = rectangle(2,3) >>> rect.length 2 >>> rect.width 3 however, if try have print out class constant sides, returns this >>> rect.sides <property object @ 0x037f6c90> rather returning value 4. how can return value? on potentially related note, tried having property method sides variable defined such @property def sides(self): return self._sides this works other object variables, when attempt access sides through method, error saying rectangle has no attribute _sides. reference sides self.__class__.sides proper? rectangle class import abc shape import shape class rectangle(shape): sides = 4 def __init_

c# - What is the most efficient way of getting these XML nodes and then saving them to the web service? -

i know simplistic, haven't worked xml files yet. proper way go getting necessary xml nodes , saving them wsdl? please let me know if there's way can make more efficient/cleaner or easier. code gets nodes xml document , puts them dictionary: public filereference loadxmldoc(string strfile) { logger.log("loadxmldoc:" + strfile); filereference fileref = new filereference(); fileref.filename = strfile; //create xml document obj xmldocument inputxmldoc = new xmldocument(); fileref.isvalid = false; //load xml document #region try { inputxmldoc.xmlresolver = null; inputxmldoc.load(strfile);//load xml file string input = inputxmldoc.outerxml;//get string console.writeline("success,loaded xml"); logger.log("loaded xml:" + strfile); //xmlnodelist xlist = inputxmldoc.getelementsbytagname("nulogyfile"); //logger.log("got xlist, length = &qu

javascript - File is not being downloaded when requested through Ajax using JQuery -

i need download .csv file information website, i'm using link , javascript/jquery table servr , create file. i have link supposed download file when clicked: <a class="areasummaryexport" value="1">...</a> and have in js file: this adds click listener link: $('.areasummaryexport').on('click', function(){ exportareasummary($(this).attr('value'), $(this)); }); this function gets table server using ajax request , sends corresponding function process: function exportareasummary(selected, sender){ $.ajax({ url: 'admin_ajax.php', method: 'get', datatype: 'json', data: {action: 'exportareasummary', area: selected} }).done(function(data){ console.log('done'); exporttabletocsv.apply(sender, [$($(data.table)[0]), data.name, data.header]); }).error(function(xmlhttprequest){ console.log('error');

debugging web page css on an android phone -

we can use inspect element/mobile device emulator in chrome add/edit css on live sites , see how site behaves. possible same directly on android phone or tablet, somehow? i have been asked improve site (but don't have server access) have noticed navigation behaves differently in chrome emulator , on android devices. (it might javascript interferes or on phone not picked in emulator) if you're running modern version of chrome, can use remote debugging feature android devices. require: chrome 32 or later installed on development machine. a usb cable connect android device. for browser debugging: android 4.0+ , chrome android. for app debugging: android 4.4+ , webview configured debugging. the full details documented @ linked page google's documentation, process consists of connecting device computer, enabling adb debugging, , navigating chrome://inspect in chrome on computer. there, you'll able use inspector on desktop chrome instan

queue - rabbitMQ persistency when consummers die -

i consummers subscribe events, in case 1 of them die, i'd messages persisted consummer, gets them once online. if producer creates n queues, 1 per consummer, works. producer shall not not take care of whether there consummers or not, , how many are. consummer shall have responsibility create own queue, select messages wants receive, , queue shall persist. can please give me direction? does require specific on producer side? the tutorials on rabbitmq website talk persistence in way if server die, messages persisted, or exemple 1 queue, n consummers, there persistency if consummers dead (becasue message not delivered), senario message delivered 1 of consummer (randomly), while need consummers receive messages subscribed to, , persistency per consummer. thanks, rod use topic exchange , have each consumer create it's own unique persistent queue , bind exchange topic want subscribe. publishing message on exchange deliver message each queue bound exchange/topic.