Posts

Showing posts from May, 2013

python - Why is Flask checking `'\\/' in json.dumps('/')` in its json module? -

the source flask.json module contains following line. '\\/' mean, , why flask checking this? _slash_escape = '\\/' not in _json.dumps('/') flask using test if json library it's using escapes slashes when doesn't have to. if library does, json.dump('/') produce '"\\/"' (equivalent raw string r'"\/"' , see here explanation on escape characters ). flask can choose 1 of multiple json libraries, , libraries/versions escape forward slashes while others don't. flask includes comment explaining this. if library escape slashes, flask undo when dumps json , consistency between libraries. # figure out if simplejson escapes slashes. behavior changed # 1 version without reason. _slash_escape = '\\/' not in _json.dumps('/') ... def htmlsafe_dumps(obj, **kwargs): ... if not _slash_escape: rv = rv.replace('\\/', '/') ... flask still escapes

maven - JHipster and database connection -

i'm using jhipster , when run sudo mvn liquibase:diff below error [info] settings ---------------------------- [info] driver: org.postgresql.driver [info] url: jdbc:postgresql://localhost/gastos8 [info] username: gastos8 [info] password: ***** [info] use empty password: false [info] properties file: null [info] properties file override? false [info] prompt on non-local database? true [info] clear checksums? false [info] changelogfile: src/main/resources/config/liquibase/master.xml [info] context(s): null [info] label(s): null [info] referencedriver: null [info] referenceurl: hibernate:spring:com.cboujon.domain?dialect=org.hibernate.dialect.postgresql82dialect [info] referenceusername: null [info] referencepassword: null [info] referencedefaultschema: null [info] diffchangelogfile: src/main/resources/config/liquibase/changelog/20150807132702_changelog.xml [info] -------------------------------------------

VBA/Excel dynamic list control -

i want create pick list depend on provided on previous list there problem. using list validation, working until didn't close file. after reopen file, when list clear, gives me error , didn't want load data it. so decided use control combo list, there problem creating array... sub rozwiń298_zmienianie(target) dim integer dim j integer dim k integer dim m integer dim lista() variant = 1 j = 1 m = 0 while sheets("dane").cells(i, 14) <> target.text = + 1 loop j = while sheets("dane").cells(j, 14) = target.text j = j + 1 loop j = j - 1 k = j - + 1 redim lista(k) m = 0 k lista(m) = sheets("dane").cells(i, 15).text = + 1 next m sheets("formularz").shapes.range(array("drop down 298")).select selection .list = lista end end sub now 2 questions... somehow it's working, give quite odd error a

uiswitch - Switch miss first call. Android -

i want rebuild app https://github.com/sheldonneilson/android-alarm-clock , change checkbox material switch https://github.com/navasmdc/materialdesignlibrary . set onchecklistener. problem. when start app. , checkon alarm, onchecklistener miss first call. after that, work normally. if first action checkoff - no problem. problem in first call if want turn on alarm. please open eyes. @override public view getview(int position, view view, viewgroup viewgroup) { if (null == view) view = layoutinflater.from(alarmactivity).inflate( r.layout.alarm_list_element, null); final alarm alarm = (alarm) getitem(position); final switch checkbox = (switch) view.findviewbyid(r.id.switch_alarm_active); checkbox.setchecked(alarm.getalarmactive()); checkbox.settag(position); //checkbox.setonclicklistener(alarmactivity); checkbox.setonchecklistener(new switch.onchecklistener() { @override public void oncheck(switch aswitc

convert date timeline in rows to columnar format in sql server -

my data : sku startdatetime enddatetime es311335 6/30/2013 5/24/2015 es311355 6/30/2013 6/28/2015 es311470 6/30/2013 12/14/2014 es311478 6/30/2013 6/28/2015 es311501 6/30/2013 6/28/2015 es311574 6/30/2013 6/28/2015 es311632 6/30/2013 6/22/2014 i want in format: sku date es311335 6/30/2013 es311335 7/7/2013 es311335 7/14/2013 es311335 7/21/2013 es311335 7/28/2013 es311335 8/4/2013 ------ ------ es311335 24/05/2014 i have used below query not giving me correct result. declare @interval nvarchar(10), @i datetime, @intervalmin datetime, @intervalmax datetime --- set interval day or month or year ----------------- set @interval = 'day' ------------------------------------------------------- declare @records table (startdatetime datetime ,enddatetime datetime) insert @records select startdatetime, enddatetime records declare @results table (startdate datetime ,enddate datetime) while e

asp.net mvc - Conflict in jQuery with Active Reports -

currently using jquery 1.10.2 in project. @ 1 page need show reports active report 9. the problem is loading jquery 1.7.2. tried resolve conflict using var jq17= $.noconflict(true); changes alias $ jq17 . now necessary change aliases in .jq libraries loading active report 9 use jq17 new alias ? or there other way go ahead without changing libraries. update: have tried answer @andreas. solved alias issue. functions of active report not accessible through this. load 1.7.2 version , call .noconflict(true) before loading version 1.10.2 (or vice versa if easier way), wrap 1.7.2 dependent code in anonymous function , pass noconflict version alias $ <script type="text/javascript" src="jquery-1.7.2.js"></script> <script> var jq172 = $.noconflict(true); </script> <script type="text/javascript" src="jquery-1.10.2.js"></script> <script> (function($) { console.log($.fn.jquery

sql server - Scalar function as a part of computed column -

i using sql server 2012. want create table computed column. column sum of columns in table, need multiply sum vat rate vat table gross value including tax. vat values inserted vat table every month , stored in column stawka smallint (in english means "rate"). values table prąd inserted every month need use current vat rate column stawka in vat table. so if tax rate (columnn stawka in vat table) 23%, it's simple math: (y+z) + 23% * (y+z) =( y+z) * (1 + 0.23) = (y+z) * 1.23 y+z sum of decimal columns before last 1 in table prąd. row example table prąd. below in last column (computed column) sum of 0.2661 + 0.2103. above, first need sum 0.2103 , 0.2661 , multiply sum 1.23: id data rok kwartał miesiąc dzień jednostka odczyt zużycie energia elektryczna czynna opłata dystrybucyjna zmienna stawka jednostkowa energii 1 2015-01-01 2015 1 1 1 kwh 300 20 0.2661 0.2103 0.4764 i c

android softkeyboard - Keyboard show/hide event not firing in Cordova 5.1.1 -

i updated cordova 4.3.0 5.1.1 , seems keyboard event not firing previously, document.addeventlistener("showkeyboard",function() { } and document.addeventlistener("hidekeyboard",function() { } where working after upgrading stopped working ,i using keyboard plugin ionic keyborad has own events window.addeventlistener('native.keyboardshow', keyboardshowhandler); they not firing ,please me issue it seems cordova-android-4.0.0 these events have been removed , suggesting use plugin such ionic-keyboard-plugin events ref-src see in other changes section

javascript - Adding round corners to Highcharts Bar Chart with stacked bars when value is 0 -

i'm using highcharts , love them, issue when add use round corner plugin, if have stacked chart 0 in it, radius wont applied. issue: here take @ jun , july. goal: in case need way assign radius left of june , right of july. var chart = new highcharts.chart({ chart: { renderto: 'container', type: 'bar' }, xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, plotoptions: { bar: { stacking: 'normal', animation: false } }, series: [ { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 0, 148.5, 216.4, 194.1, 95.6, 54.4], // usage: borderradiustopleft: 5, borderradiustopright: 5 }, { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148

javascript - Return value of Promise's resolve/reject functions -

consider situation. new promise(function(resolve, reject) { var x = resolve(2); }); what value x be? tried print , showed me undefined . intuitive, so? in docs? second question new promise(function(resolve, reject) { resolve(2); return 5; }); what should return function put promise? value ignored? the return value of promise constructor is ignored . the resolve function returns undefined . this first specified in promise constructor spec , later in es2015 (es6) language specification .

javascript - Angular: always get popup blocker on create new tab after async call -

i have following scenario: user tries login wrong password on failure ask him if wants reset password if user click 'ok' (pure confirm dialog ) , i'll open new tab url. my problem is: i popup blocker because generate window after error callback. here relevant code login method: $scope.login = function () { $auth.login({ email: $scope.fields.email, password: $scope.fields.password }) .then(function () { // ... login success }) .catch(function () { // login failed (my case) if (confirm('error: invalid password, forgot password? click \'ok\' if want reset it')){ var url_ = 'http://meeter.me/#/forgot-pass/snaggs@gmail.com'; var mypopup = window.open ('', '_blank'); mypopup.location = url_;

android - Predictive text leads to auto completion in WebView -

i have webview form. let's name richard thompson , have contact named richard mcentire. whenever type richard in text box predictive text bar tells me have contact name. when tap space start typing last name field auto completes richard mcentire. i've tried: mwebview.clearformdata(); mwebview.getsettings().setsaveformdata(false); and, in text box: autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" but it's not working. if cannot fixed, can rid of predictive text bar?

jquery - How do I reference this embedded iframe from javascript -

i using squarespace (in retrospect poor idea because of difficulty of customizing code), , need able identify vimeo iframe within div can use in javascript calls. however, javascript not recognize such iframe element existing. feel either it's impossible identify iframe shoved div (by squarespace), or missing selector. or pointers appreciated. here's iframe trying embed squarespace: <iframe src="http://player.vimeo.com/video/135481337?api=1&player_id=player1&wmode=opaque" width="500" frameborder="0" id="player1" class="vimeo" height="281"></iframe> here's embedded iframe: <div class="sqs-video-wrapper" data-load="false" data-html="&lt;iframe src=&quot;http://player.vimeo.com/video/135481337?api=1&amp;amp;player_id=player1&amp;amp;wmode=opaque&quot; width=&quot;500&quot; frameborder=&quot;0&quot; id=&quot;player1&

mysql - SQL - Left outer join with 2 tables and derived tables -

my scenario follows: table persons - id (primary key) - name table logs - id (primary key) - person_id (foreign key) - datetime - status now want create sql query in order retrieve: all names persons without relation table logs and relation table logs linked field id , person_id. only latest records person table logs (ie latest log id) this query retrieves names matched relation: select p.id, p.name, date_format(l.datetime,'%d-%m-%y %h:%i:%s') datetime, l.status persons p left outer join logs l on p.id = l.person_id l.id in (select id logs t1 inner join (select max(id) max_id logs group person_id ) t2 on t1.id = t2.max_id) order l.status, p.name"; how names without relation table logs well? you can use left join: select p.name persons p left join logs l on p.id = l.person_id l.id null

How to create a random pair in haskell -

hi trying create random pairs of specific number of mines in minessweeper game. so need make method takes mines number, (width,hight) , returns list of random positions [(x,y)] https://www.fpcomplete.com/school/starting-with-haskell/libraries-and-frameworks/randoms this should help. use system.random module ( https://hackage.haskell.org/package/random-1.1/docs/system-random.html )

jquery - How to negate if statement for type="radio" input in javascript -

i'm new in javascript world , know how use if statement. when tried negate if statement of radio button if checked, it's not working. code. <div class="form-group "> <label class="form-control-static">waiting location</label> <div class="radio"> <label><input id="radio_btn" type="radio"> location 1 </label> </div> </div> <script> if (!(document.getelementbyid('radio_btn').checked)) { alert('this pop out.'); } </script> i'm getting error message of "typeerror: document.getelementbyid(...) null" thanks in advance! your code works, have error in html itself, know comments. i created fiddle test it: http://jsfiddle.net/qks8jek1/ <form> <input type="radio" id="radio_btn" name="sex" value="male">male</input> <br/> <

java - Hibernate interprets NULL timestamp as current date/time -

i have mysql database table column called expirationdate, defined timestamp defaults null. have method pulls records table match various criteria, prints column values each record part of debugging routine. when viewing records returned, noticed records have null expirationdate in db being returned program expirationdate set current date/time. is normal behavior? if so, configurable (i'd value remain null)? i using hibernate 3.x libraries. it's not hibernate turning null values current timestamps, it's mysql. @ least that's probable reason. behaviour of timestamp column depends on multiple parameters: whether it's first timestamp column in table (different defaults apply) the table engine (myisam or innodb) the configuration ( maxdb setting) your mysql version of course behaviour sufficiently defined , in regard timestamp , null values , yet remains confusing. stopped using many mysql automagical features, e. g. because there other

Python: convert a byte to binary and shift its bits? -

i want convert encoding encoding in python school project. however, encoding translating add padding encoding on first bit. how shift binary number sequence left one, goes from: 00000001 11001100 01010101 , on to 00000011 10011000 10101010 , on so end result's lowest bit former's highest bit number? you can convert string 1 big integer , left-shift (and convert big integer string): large_int = bytes2int(mystring) large_int <<= 1 mystring = int2bytes(large_int) using e.g. simplistic implementation: def bytes2int(str): res = ord(str[0]) ch in str[1:]: res <<= 8 res |= ord(ch) return res def int2bytes(n): res = [] while n: ch = n & 0b11111111 res.append(chr(ch)) n >>= 8 return ''.join(reversed(res)) bytes = 'abcdefghijklmnopqrstuv' assert int2bytes(bytes2int(bytes)) == bytes

php - $_SESSION variables and id do not carry over between pages on localhost -

i made simple sign page , when user's information validated, right before redirecting, session id changed according token system have set up. on register page, id correct on , have variable uid set manually. although problem on next page, id different, , variable undefined. $_session['uid'] = $id; session_id($sessid); session_write_close(); header("location: /website/landing.php"); exit(); cookies enabled, sessions have directory "c:/xampp/tmp" , written to, see files correct id register page there. running on localhost , it's https connection. i've set way i'm told (through many other stackoverflow answers) should , , yet on next page: <?php session_start(); echo session_id()."\n"; echo $_session['uid']; session_unset(); session_destroy(); ?> <!doctype html> <html> <head> <title>logged in</title> </head> <body> <h1>congratulations, have logged

qt - Why ldd produces different result for the same file in different directories? -

i trying deploy qt/qml application linux. strange occured target system complained undefined symbol in libqt5widget.so.5 , while had copied qt-related libraries shown in ldd -r result of file, , ldd -r on target system said there's no "not found" libraries. after time discovered ldd -r in own system spotted undefined symbols. when ldd -r same file in qt installation directory, however, no undefined symbols found. the output looked this: wyl8899@ubuntu:~/deploy/qt_libraries$ ldd -r libqt5widgets.so.5 linux-vdso.so.1 => (0x00007ffd1409a000) libqt5gui.so.5 => /usr/lib/x86_64-linux-gnu/libqt5gui.so.5 (0x00007faac833d000) libqt5core.so.5 => /usr/lib/x86_64-linux-gnu/libqt5core.so.5 (0x00007faac7c97000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007faac7a79000) (... , more) libxau.so.6 => /usr/lib/x86_64-linux-gnu/libxau.so.6 (0x00007faac0d13000) libxdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libxdmcp.so.6

javascript - getJSON to update progress bar -

trying progress bar on bootstrap show real-time progress json api, while showing % of goal achieved: here how looks right now: http://puu.sh/jt2gu/823f6a6a0f.png both progress bars should centered on page , progress isnt updating , i'm not sure why, please help? progress bar coins sold progress bar amount raised % funded (should on top of picture) css: } .progress { position: absolute; top: 80%; z-index: 2; text-align: center; width: 50%; } html: <div class="container"> <div class="banner-buynow"> <div class="col-md-2 col-md-offset-3 object-non-visible" data-animation-effect="fadein"> <a class="btn btn-info" href="javascript:void(0);" onclick= "opentac();">buy now<br> <div class="ratebtc"></div></a> </div> <div class="progress

Idea IntelliJ 14.1 Out of memory -

Image
has experienced this?, value suggest xmx? extra info: running in 32 bit (idea.exe) that depends on work intellij (if work larger files, should increase memory more if work smaller files or projects). have set xmx 2048 mb.

java - Error when converting to PDF using xsl -

i facing strange problem when converting xml pdf using xsl (java code creates xml , applies xsl @ runtime). the code deployed on jboss server. when code executed, fails following error 10:50:49,068 error [stderr] (http--0.0.0.0-9080-3) caused by: java.lang.reflect.invocationtargetexception 10:50:49,068 error [stderr] (http--0.0.0.0-9080-3) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) 10:50:49,069 error [stderr] (http--0.0.0.0-9080-3) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) .... 10:50:49,070 error [stderr] (http--0.0.0.0-9080-3) caused by: java.lang.stackoverflowerror 10:50:49,070 error [stderr] (http--0.0.0.0-9080-3) @ sun.misc.floatingdecimal.dtoa(floatingdecimal.java:532) 10:50:49,070 error [stderr] (http--0.0.0.0-9080-3) @ sun.misc.floatingdecimal.<init>(floatingdecimal.java:459) below relevant java code public string transformwocformtopdf(idfid xmlid,string f

python - Rendering database results in Jinja seems to add extra {} characters -

i want render results sqlite database query in template. however, {colintitule': u'i icecream'} . don't want {} or column name. how render correctly? def query_db(query, args=(), one=false): cur = g.db.execute(query, args) rv = [dict((cur.description[idx][0], value) idx, value in enumerate(row)) row in cur.fetchall()] return (rv[0] if rv else none) if 1 else rv @app.route('/toto') def toto(): entries = query_db("select colintitule toto col1 = 1") return render_template('show_results.html', entries = entries) show_results.html : {% extends "layout.html" %} {% block body %} <ul class=entries> {% entry in entries %} <li><h2>{{ entry }}</h2> <br> {% else %} <li><em>no entry here</em> {% endfor %} </ul> {% endblock %} entries list of dict objects when print them in template using {{ entry }} , printing dict repr.

Find Circular circles in an image -

i have image.i want detect 4 holes have marked red line. i have images in link below. https://www.dropbox.com/sh/mlrm51qx8s1mcw0/aabu_dlm8rbvpo60h4cj7i3ka?dl=0 inputimage(input_image.bmp) preprocessed image(preprocessedimage.bmp) working image(holes detected) (detectedholes.bmp) nonworking image(only 3 holes detected)(nonworking.bmp) initially, preprocessing on input image input image :input_image.bmp hcontadj=vision.contrastadjuster; extracted_rim_contrast_adj=step(hcontadj,extracted_rim); j = adapthisteq(extracted_rim); sharp_img=imsharpen(j); se=strel('disk',300); imtop_op=imtophat(sharp_img,se); hgamma = ... vision.gammacorrector(90.0,'correction','de-gamma'); % hgamma = ... % vision.gammacorrector(12.0,'correction','gamma'); y = step(hgamma, imtop_op); h1 = imfilter(y,fspecial('gaussian',60,5)); h2=h1.*6.0; se = strel('disk',14); % perform morphological close operation on image. closebw

c++ - Different results from FFTW with FFTW_ESTIMATE and FFTW_MEASURE -

i'm using fftw perform ffts on 2d image data. 1 can use either fftw_estimate or fftw_measure plan fft. assuming same results when using either one. found case huge differences. code (minimum example): template<class t_img> void aa(t_img& img) { float* in = new float[2048*2048]; float* in2 = new float[2048*2048]; float* out = new float[2048*2048*2]; float* out2 = new float[2048*2048*2]; int dim[2] = {2048,2048}; fftwf_plan plan1 = fftwf_plan_dft_r2c(2, dim, in, reinterpret_cast<fftwf_complex*>(out), fftw_estimate); fftwf_plan plan2 = fftwf_plan_dft_r2c(2, dim, in2, reinterpret_cast<fftwf_complex*>(out2), fftw_measure); img.load(); for(int y=0; y<2048; y++) for(int x=0; x<2048; x++){ in2[y*2048 + x] = img(x, y);//(std::abs(1024-x) < 20 && std::abs(1024-y) < 20) ? 1e9 : 0; in[y*2048 + x] = img(x, y); //(std::abs(1024-x) < 20 && std::abs(1024-y) < 20) ? 1

c++ - Determine position of ith "str" using string.find() -

i trying solve problem need find position of ith "string" in main string. ex. : bearacbear ,i need find position of of second "bear" (without using substr) that current solution ( contain errors substr,that's why asked if there better way) #include <iostream> #include <algorithm> #include <iterator> #include <assert.h> #include <cmath> #include <sstream> #include <iomanip> #include <vector> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <ctime> #define ull unsigned long long // n^12 #define ll long long #define ld long double #define pb push_back #define mp make_pair #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() using namespace std; int main() { std::ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); string str; cin >> str; ll ans = 0, len; (int = 0; < str.s

How to find values with certain number of decimal places using SQL? -

i'm trying figure out way, using sql, query values go out to, say, 5 or more decimal places. in other words, want see results have 5+ decimal places (e.g. 45.324754) - numbers before decimal irrelevant, however, still need see full number. possible? if appreciated. assuming dbms supports floor , datatype conversion model supports multiplication, can this: select * table floor(num*100000)!=num*100000 this has advantage of not requiring conversion string datatype.

accessing value of a python @property -

i'm trying rework oauthlib implementation pyramid app , ran issue default values on @property decorated class defs. i somehow exposing property objects, , not calling/executing them. can suggest way 'execute' these properties? seems calling fget object/none works: self.propertyname.fget(self) this seems awkward though -- entire issue. seem implementing wrong way. the context of problem, trying load values configuration dict , falling onto property of base class. basic form below, , advice on better implementation gladly accepted. class parent(object): @property def fieldname(self): """returns tuple""" return (1, 10) class child(parent): @property def fieldname(self): """returns tuple""" return self._config.get('fieldname', parent.fieldname ) property objects descri

java - Can't decrease value of int variable -

i created 4 classes, mainp class, , others ex2 , ex3 , ex4 (3 , 4 extend 2). when call object whice decreases int variable of object, on first call. these classes: ex2: protected int par; public int getpar() { return par; } public void setpar(int par) { this.par = par; } ex3: private int par; public ex3(int par) { this.par = par; } public void bar(ex2 b) { b.setpar(par - 10); } public int getpar() { return par; } public void setpar(int par) { this.par = par; } ex4 same ex3. main: public class mainp { public static void main(string[] args) { ex3 kaka = new ex3(100); ex4 tana = new ex4(100); kaka.bar(tana); system.out.println(tana.getpar()); kaka.bar(tana); system.out.println(tana.getpar()); } } output: 90 90 i don't understand why par decreases in first call , stops @ second call. suppose it's calibrated somehow, don't see why. edit: understo

html5 - Cross-Browser WebRTC Video Viewer Only -

i have been doing lot of research webrtc project working on. aware supported in chrome, firefox, , opera. however, wondering if cross-browser viewer solution not require plugin. way require broadcasts done webrtc compliant browser viewers use other browsers such safari or ie watching/viewing capabilities only. the application working on used small group broadcasts of 25 or less people single publisher/presenter. here list of options/ideas far. somehow have html5 canvas element display frames of video on non-webrtc supported browsers. however, need support audio , don't believe there anyway of right feed audio stream html5 audio element. option may dead before considered... have server subscribe webrtc stream , create hls (http live stream) stream can consumed browser player (possibly flowplayer, supports cross-browser hls best of knowledge). have found web call server 4 guys @ flashphoner can conversion hls seems overkill simple server webrtc hls conversion. hoping ther

jquery - How to get hashed value from URL -

how hashed value url separate variables url#value1=abc&value2=xyz&value3=123 this var value1 = 'abc'; var value2 = 'xyz'; var value3 = 123; if variable not present in url then, var value4 = 0; i used window.location.hash hashed value, how separate separate variables. seems better choice use array , not separate variables. var hashvalues = window.location.hash.substr(1).split("&"); and id want them in variables, might better object instead of flooding global scope. var vals = { "value1" : 0 }; for(var i=hashvalues.length;i++) { vals["value"+i] = hashvalues[i]; }

javascript - if/switch statement based on a select value and array? -

i have simple select element multiple values groups in 4 categories. try , more efficient thought best group them in arrays , check if "selected" value in 1 of them, printing different text based on arrays select value in. wouldn’t more efficient switch? maybe it's bit vague. user starts dropdown multiple values(for example: x1,y2,x3,y4,z1) wright statement if x1,x3 something, if y2,y4 something. thought cleaner put values in arrays (for example arrayx = x1,x3 , arrayy=y2,y4.) script check array contains selected value, , print custom message each array. after tinkering,this working example: $( "#search2" ) .change(function() { var group1 = ['pl']; var group2 = ['ad','rs','ch']; var group3 = ['at','be','bg','hr','cy','cz','dk','ee','fi','fr','gr','es','nl','ir',

ios - How do I remove only one of the many values assigned to a key in a Dictionary? -

i have dictionary array of potential values key. want able remove 1 of values (according selection made user), examples find deal dictionaries don't contain array. thanks! so have nsmutabledictionary values nsmutablearray objects items nsstring objects, right? if so, retrieve array using dictionary key nsmutablearray *mutablearray = mutabledictionary[key]; then delete object [mutablearray removeobject:stringobject];

php - How to deploy Laravel Project on web -

i have developed website , available on url: http://localhost/abc/public/index.php/account/sign-in i want change deployment url http://localhost/xyz/public/index.php/account/sign-in how change base url in laravel? i have tried changing url in app.php in app folder didn't worked me. after uploading project showing forbbiden 404 error. my route /** * authenticated group */ route::group(array('before' => 'auth'), function() { /** * sign out(get) */ route::get('/account/sign-out', array( 'as' => 'account-sign-out', 'uses' => 'accountcontroller@getsignout' )); /** * delivery staff details(get) */ route::get('/add-delivery-staff-details', array( 'as' => 'add-delivery-staff-details', 'uses' => 'deliverystaffcontroller@getdeliverystaffdetails' )); /** * delivery staff deta

sublimetext3 - Reload a file in Sublime -

i edited file in sublime without saving it. want reload saved version discarding changes. how possible? have close tab without saving , open again manually or there hotkey replace shown version saved one? in sublime 3: file -> revert file you can bind hotkey in preferences -> key bindings - user { "keys": ["f10"], "command": "revert" }

java - Do this implimentation of C3P0 in my web application is correct? What are the pros and cons of this implimentation? -

i need implement connection pooling web application uses servlet , jsp pages. don't want connection pooling across application in server, want implement connection pool across servlets. i have working implementation of c3p0, don't know correct way , gives expected result. following implementation have datasource file c3p0 implementation return connection. connection retrieved on servelet init method , closed on destroy method. do type of implementation give expected result? do have close connection in destroy? what other ways of implementing connection pooling servlet app? i move db related actions separate classes, in case things have take care of , have connection in servlet , pass db methods in case ? please give pros , cons of current implementation please find connection pooling implementation below datasource file returns connection , servelt uses connection datasource file import java.beans.propertyvetoexception; import java.io.ioexception; im

php - PDO query went ok but no final result provided -

i have troubles retrieving data distant database. access pdo database ok, debug.print rowcount, returns several occurences, code seems stop when comes fetching $arr = $reponse->fetchall(pdo::fetch_assoc); here link see : http://bacly.fr/baclymphp/gettournois.php i did ame thing db, same code-like feature, , it's giving me result http://bacly.fr/todophp/www/php/gettodo.php here code gettournois.php : <?php require("config.php"); $query="select t1.tournois_id tournois_id,t1.tournois_title tournois_title, t1.tournois_date_debut tournois_date_debut, t1.tournois_date_fin tournois_date_fin, t1.tournois_date_limite tournois_date_limite, coalesce(t2.tournois_inscriptions,0) tournois_inscriptions, t1.tournois_description tournois_description, t1.tournois_simple tournois_simple, t1.tournois_double tournois_double, t1.tournois_mixte tournois_mixte "; $query.= " "; $query.= " (select t.tournois_id tournois_i

How to extract json array elements in postgresql -

what want sum 29.0 , 34.65 , group p_id table: transaction_items column name: debits, p_id column data type: text, text data: debits [{"amount":29.0,"description":"fee_type_1"} [{"amount":"34.65","description":"fee_type_1"} p_id 16 16 i tried using solution mentioned here [ how elements json array in postgresql select     transaction_line_items.p_id,            each_attribute ->> 'amount' rev from       transaction_line_items cross join json_array_elements(to_json(debits)) each_section cross join json_array_elements(each_section -> 'attributes') each_attribute where      (each_attribute -> 'amount') not null; however, got error saying "cannot deconstruct scalar". can please let me know how parse values looking for? thank you. it seems data broken. values of debtits column not valid json due lack of right square brackets. assuming da