Posts

Searching nested jsonb array in PostgreSQL -

i have orders table store summary of order in jsonb column {"users": [ {"food": [{"name": "dinner", "price": "100"}], "room": "2", "user": "bob"}, {"room": "3", "user": "foo"} ]} now want query users food->name . i tried following, gives me user foo , has no food . select jsonb_array_elements(jsonb_array_elements(summary->'users')->'food')->>'name' food, jsonb_array_elements(summary->'users')->>'user' user_name orders; food | user_name -------+----------- dinner | bob dinner | foo how such query? update i have summery 2 food options {"users": [ {"food": [{"name": "dinner", "price": "100"}, {"name": "breakfast", "price": "100"}], "roo...

c# - Transparent background form -

Image
i have c# visual form wrapper custom background image (png), if launch app, looking nice, if i'll go move window - troubles. // import using system; using system.collections.generic; using system.text; using system.drawing; using system.windows.forms; using system.componentmodel; using system.drawing.drawing2d; // window control class ztwindow : form { // variables private point m_mouseposition; private image m_background; // initilization /* default constructor */ public ztwindow() { initialize(); } /* initilization constructor */ public ztwindow(string title) { initialize(); text = title; } /* default destructor */ ~ztwindow() {} /* initilization */ private void initial...

parsing - Is there already a simple language and parser to embed logic within XML? -

i have xml representation of survey rendered on multiple platforms code written in multiple languages. i'd embed simple logic in xml describe how questions should skipped in survey - , possibly more complicated rules later. example, "if answer question 5 'y', skip question 10". embedded language need parsed in multiple languages. there established way or easier create own language , parser? xml information carrier. decide information, , how break (nested) chunks. isn't proactive in sense. if want "include" logic in xml control how processed, can pick programming language like, , include chunk of in xml chunk have designated purpose. whatever recipient supposed process xml, can, convention, display pleases, , run code chunk (usually "eval" mechanism, limits choice of language) provide custom behavior. but there isn't magic.

javascript - AJAX: only error callback is been fired -

i have declared success , error callbacks, in case of status code 200 calls error callback only. i have been making curl call other php file inside registry.php . here tried: $.ajax({ type: "post" ,data: { action: "blah" ,mobileno: that.mobno ,token: that.key } ,url: "http://90.8.41.232/localhost/registry.php" ,cache: false ,datatype: "json" ,success: function (response) { console.log("success"); } ,error: function () { console.log("error"); } }); i have read in documentation don't have call success callback explicitly, hope it's correct. any idea how call success callback when 200 status code. response hope help, copied chrome console, not printed console.log(). bort: (statustext) always: () complete: () done: () error: () fail: () getallresponseheaders: () getresponseheader: (key) overridemimetype: (type) pipe: () progress: () promise: (obj) readystate: 4...

tkinter - Access to Canvas Items stack -

as per official documentation , items inserted on tkinter canvas placed on stack. though there methods raise, lower , remove items stack, not find method access stack. is there way access stack ? or have maintain own stack items added canvas ? the find method return items based on whatever search criteria give it. items returned in stacking order. item, use search criteria "all" : items = the_canvas.find("all")

importing assignment into modul re/expected string or buffer Python, -

well started learning python don't understand how make code correct (worth learn youtube))). want code -- if assignment num1 has 8 in end , should printed command print, , if doesn't print nothing. import re def x(): num1 = 5894652138 vav = re.match(r'[8]''$', num1) print vav x() you don't need use re here. check last digit in decimal number, should use modulos 10: num1 = 5894652138 if num1 % 10 == 8: print num1

amazon web services - Use Virtual Private Cloud in Blueprint of Apache Brooklyn -

if virtual private cloud (vpc) created in amazon web services (aws) or wherever. there chance use (and configure it) in our blueprint deploy later via apache brooklyn? has apache brooklyn vpc support? as far know, cannot specify vpc. can instruct brooklyn use specific subnet (tied vpc) through templateoptions so: within brooklyn.properties : brooklyn.location.named.my-location.templateoptions={subnetid: subnet-aa461fec} as provisioning property within yaml blueprint: ... provisioning.properties: templateoptions: {subnetid: subnet-aa461fec} ...