Posts

php - Nested collection fields in Sonata Admin (2.3) -

Image
i'm having problems creating form creating course. part of database scheme i'm trying create form: so i'm trying create course can create sessions , dates (moment) attached session. should this: in courseadmin class have: protected function configureformfields(formmapper $formmapper) { $formmapper ->add('name', 'text', array('label' => 'naam')) ->add('description', 'textarea', array('label' => 'beschrijving')) ->add('materials', 'textarea', array('label' => 'benodigde materialen')) ->add('numberofparticipants', 'number', array('label' => 'aantal deelnembers')) ->add('numberofdays', 'number', array('label' => 'aantal dagen')) ->add('pr...

Polymer 1.x: Data binding -

i want select states in <google-chart> geo map element shown in jsbin . when select state, expect change color (to dark teal) instead, stays same color (light grey). follow these steps recreate problem: open jsbin . in section dom-module > <script> > properties > items > value , change array ['alabama', 0] ['alabama', 1] . notice state of alabama changes color light grey dark teal. hover mouse on state of alabama. notice value of select variable 1 state of alabama (and 0 other states). return value of array ['alabama', 0] . note previous step proves code generating geochart behaves expected when items property manually mutated. here's trouble begins... click state of alabama. in console, notice value of items[1] array ['alabama', 1] . notice select value 0 (unlike case when manually changed above). what problem here? i'm uncertain but perhaps solution involves implementing advice ...

jquery - Javascript redirect to page and append text -

i have forum can filter 'category1', 'category2', or 'all' now have dropdown has 3 options. javascript/jquery i'm doing this: $('#dropdown').on('change', function () { if ($('#dropdown').val() == 'category1') { window.location.href += "/cat1"; } else if ($('#dropdown').val() == 'category2') { window.location.href += "/cat2"; } else { window.location.replace(window.location.href); } }); the problem code above first change goes correctly say: "website/foo/bar/cat1" when change dropdown again cat2 goes , fails: "website/foo/bar/cat1/cat2" is there anyway can keep same url everytime change dropdown value? theres catch though. "website/foo/bar/" has "bar" can such this: "website/foo/something/" or "website/foo/else/" when add url += appending existing url. var url = "htt...

Sessions, multiple PHP files, die() and authentication flags -

i have login built thusly: there admin.php script checks if $_session["auth_flag"] defined "true" (string") if not, admin.php include()'s login.php login.php generic login page module, sends xhttp request input do_login.php if credentials correct do_login.php sets $_session["auth_flag"] true , die("0") ; after login.php checks return of do_login.php if "0" location.reload() via javascript reloading page (admin.php) however after - $_session["auth_flag"] not set. does die() unset changes made $_session during same script? will post relevant snippets of code on request since there no errors in error.log besides [sun feb 07 20:45:28.957347 2016] [:error] [pid 1593] [client 89.201.9.253:18390] php notice: session had been started - ignoring session_start() in /mnt/disk/html/dev/prefs.php on line 3 [sun feb 07 20:45:28.957766 2016] [:error] [pid 1593] [client 89.201.9.253:18390] php notice: session...

javascript - Bootstrap tabs - Next & previous Buttons -

i using bootstrap 3.4. i using tab-pills on form 3 tabs. i trying place next & previous buttons aid navigation between tab form. i have read post on topic (and bootply ), require, , applied necessary code. on form, in 3 tabs, see next1 button, never see other buttons. i figured out error class=active on <li class="active"> line of code> (or @ least error). i have searched google , figure out how js code working, cannot figure out correct simple issue. have exhausted attempts, turn assistance. can suggest how might correct this? here js code: $('.btnnext').click(function(){ $('.nav-pills > .active').next('li').find('a').trigger('click'); }); $('.btnprevious').click(function(){ $('.nav-pills > .active').prev('li').find('a').trigger('click'); }); here html code: <ul class="nav nav-pills"> <li class="active"> ...

php - HTACCESS: Dynamic rewrite url with multiple variables -

Image
i've been working on couple of days , i'm wondering if point me in right direction please... i'm trying pass 2 variables in rewrite. unless given url file or directory, i'd urls dynamically rewritten follows: example.com/category -> example.com/index.php?p=category example.com/category/page -> example.com/index.php?p=category&article=page example.com/category2/page -> example.com/index.php?p=category2&article=page i'm having hard time trying turn following in dynamic: rewriterule ^category/(.+?)$ ?p=category&article=$1 [l] i'm trying doesnt work: rewriterule ^(.+?)/(.+?)$ ?p=$1&article=$2 [l] ...also trying doesnt work either: rewriterule ^(.*)/(.+?)$ ?p=$1&article=$2 [l] i'm trying avoid putting in following make work: rewriterule ^category2/(.+?)$ ?p=category2&article=$1 [l] here full code: options +followsymlinks rewriteengine on rewriterule ^category/(.+?)$ ?p=category&article=$...

python - Flask not registering routes -

i have following code doesn't seem registering routes. #!/usr/bin/python import os,sys,json flask import flask, url_for class foo: server = flask(__name__) mountpoint = "/api" def __init__(self,startup="run",config="",mountpoint="/api"): self.mountpoint = mountpoint self.startup = startup self.server = server @server.route("/test") def test(self): return "hello world!" def getendpoints(self): server = self.server server.test_request_context(): print url_for('test') def start(self,**kwargs): getattr(self.server,self.startup)(**kwargs) if __name__ == "__main__": mon = foo() mon.getendpoints() mon.start(host='0.0.0.0',debug=true) if don't call "getendpoints" things seem run fine, /test returns 404. when calling "getendpoints" returns build error. i...