Posts

Showing posts from July, 2010

menu - CSS counter on hidden submenu -

i'm trying make dropdown menu using nested <ul> , every <li> displaying number generated css counters. sub-menus hidden display:none when not hovered. my problem counters not incremented when element has display set none . do know css property prevent this? if replace display: none visibility: hidden , it's working i'm not sure if it's nice use menu, there traps? you can mimick display: none (hidden) behavior setting font-size 0px , make element counted counter property. .hidden{ font-size: 0px; } demo or, bit more complex version of above (mentioned hashem qolami in comments) .hidden{ font: 0/0 a; visibility: hidden; } demo 2 note: visibility: hidden work leave space equivalent height of 1 line in output. demo using visibility property

scala - DBAction together with IsAuthenticated: -

i have following code, complains: could not find implicit value parameter session: play.api.db.slick.config.driver.simple.session how fix it? trait secured extends controller { /** * retrieve connected user id. */ def username(request: requestheader) = request.session.get("email") /** * redirect login if use in not authorized. */ def onunauthorized(request: requestheader): result def isauthenticated(f: => string => request[anycontent] => result) = security.authenticated(username, onunauthorized) { user => dbaction(request => f(user)(request)) } } i have following code: object application extends controller secured { .... def list(modelname: string, page: int, orderby: int, filter: string) = isauthenticated{username=> implicit rs => ok(html.list( model.byname(modelname), page, orderby, filter )) } you have import slick's session in controller import play.api....

c# - Usage of extension methods for framework types -

in new line of work have been told avoid using extension methods types (or organization) have no control over, meaning external libraries, framework types such string, list, , others. the argument given bad if framework developer decides implement method has same names and/or parameters extension method. while problem may arise, argument reduces usability of extension methods zero. argument considered valid? not suggesting use extension methods everywhere, know of similar arguments , against it. it's argument has some merit, in lots of cases problems can avoided: if control code , can update if necessary, can write unit tests detect problem , correct if occurs. (i assume you'd validating update external library before deploying anyway.) if trust external library developer follow normal practices backward compatibility, shouldn't adding members interfaces anyway, break existing implementations... @ least write extension methods interfaces. if extensi...

ios - How to change the class assigned in app delegate -

i using refrostedviewcontroller showing slide-in menu.and it's working fine in application .i got situation have modify uitableview data-source;like have change value in nsarray displaying in table , doing fine .but problem refrostedviewcontroller instance created in appdelegate , @ instance of demomenuviewcontroller gets created in appdelgate used throughout application life cycle until user quits application . demonavigationcontroller *navigationcontroller = [[[demonavigationcontroller alloc] initwithrootviewcontroller:[[[searchviewcontroller alloc] init]autorelease]]autorelease]; demomenuviewcontroller *menucontroller = [[[demomenuviewcontroller alloc] initwithstyle:uitableviewstyleplain]autorelease]; // create frosted view controller refrostedviewcontroller *frostedviewcontroller = [[[refrostedviewcontroller alloc] initwithcontentviewcontroller:navigationcontroller menuviewcontroller:menucontroller]autorelease]; my issue want change demomenuviewcontroller can use mo...

c++ - What type of loop would I wrap around this statement? -

for reason i'm getting extremely confused type of loop should wrapping around switch statement. if have switch statement below , want user able keep inputting keystroke until hits 1 of cases type of loop best use this? thanks, int input; cin >> input; switch( input ) { case 1: playgame(); break; case 2: loadgame(); break; case 3: multiplayer(); break; case 4: cout << "thanks, exitting \n"; break; default: cout << "error \n"; cin >> input; break; } there missing stop condition. int input = 0; // make habit of initialising variables bool again = true; while(again) { // use input != 4 (stop value) cin >> input; ... case 4: // magic numbers bad, maybe use enum cases. cout << "thanks, exiting \n"; again = false; // <----- else wont out. break; ... }

javascript - FAQ Toggle Arrow Animation -

hello have below code faq toggle issue when click on question slides , show answer arrows in question triggers. <div class="faqbox" id="faq-list"> <div class="qblock"> <span class="arrow"></span> <h2>lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</h2> <div class="answer"> <p>lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euism tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip.</p> </div><!-- answer --> </div><!-- qblock --> <div class="qblock"> <span class="arrow"></span> <h2>lorem ipsum dolor sit...

how to process logical operation between 2 BSONObj precreated in mongodb -

i'm new mongodb. want execute query (a=3 or b=5 condition) using c++ driver.. i can create separately 2 bsonobj objects each a=3 , b=5 through bsonobjbuilder follows. mongo::bsonobjbuilder builder = new mongo::bsonobjbuilder; mongo::bsonobjbuilder inner = new bsonobjbuilder(builder->subobjstart(condition)); inner->append("$gte", value); inner->append("$lte", value); mongo::bsonobj obj = builder.obj(); so have 2 different bsonobj. , can run them successfully. how can combine these objects using $or or $and logical operators. assuming goal query {$or: [{a: 3}, {a: 5}]} , construct mongodb c++ driver follows: mongo::bsonobjbuilder querybuilder; mongo::bsonarraybuilder orclause(querybuilder.subarraystart("$or")); mongo::bsonobjbuilder firstclause(orclause.subobjstart()).append("a", 3).done(); mongo::bsonobjbuilder secondclause(orclause.subobjstart()).append("a", 5).done(); orclause.done(); mongo::bson...

java - Writing HTML-String to new window from Javascript in JSP -

this question has answer here: why split <script> tag when writing document.write()? 5 answers how can write html-conform string new window using jsp inner javascript? our situation: - theres .jsp-file used tomcat-server - .jsp contains <script language="javascript> -tag - script needs write complete, html-5-valid-string new window using window.open , 'window'.document.write(htmlstring) our .jsp-file (schematic): <%@ include file = "..." %> <...some page imports...> <...some scripts...> (e.g. <script type = "text/javascript" src="...."> </script>) <% string strmethod = "foo_method_bar"; string stroutput = ""; stroutput = somejavabean-call_that_brings_valid_html5_string_with_script-nodes; %...

jquery - how concatenate object with number javascript -

i have problem concatenate number object i need [object object] concatenate (button + indexoptionvaluetochange), following var indexoptionvaluetochange = 1 alert(button + indexoptionvaluetochange) -----> function button(nombre){ this.nombre = nombre; }1 i need concatenate (button + indexoptionvaluetochange) == button1 alert(button1) ----> [object object]

r - dcast with empty left-hand side in formula -

i'm having problems using dcast withoud "id" variables. expected result transposition -- creating 1-row data frame many columns there rows in original data frame. i've tried different approaches, "hacks" seem work now. before filing bug , wanted double-check if i'm missing something. d <- data.frame(variable=letters[1:3], value=1:3) d ## variable value ## 1 1 ## 2 b 2 ## 3 c 3 reshape2::dcast(d, ...~variable) ## . b c ## 1 . 1 2 3 reshape2::dcast(d, .~variable) ## . b c ## 1 . 1 2 3 reshape2::dcast(d, ~variable) ## error: subscript out of bounds reshape2::dcast(d, 0~variable) ## 0 b c ## 1 0 1 2 3 sessioninfo() ## r version 3.1.1 (2014-07-10) ## platform: x86_64-pc-linux-gnu (64-bit) ## ## locale: ## [1] lc_ctype=en_us.utf-8 lc_numeric=c ## [3] lc_time=en_us.utf-8 lc_collate=en_us.utf-8 ## [5] lc_monetary=en_us.utf-8 lc_messages=en_us.utf-8 ## [7] lc...

cpan - HTML::HTMLDoc installation issue on Strawberry Perl -

i trying build html::htmldoc on strawberry perl (32 bit) on xp. consistently face following problem after re-installing strawberry. appreciated. thanks. cpan> install html::htmldoc fetching lwp: http://cpan.strawberryperl.com/authors/01mailrc.txt.gz fetching lwp: http://cpan.strawberryperl.com/modules/02packages.details.txt.gz fetching lwp: http://cpan.strawberryperl.com/modules/03modlist.data.gz creating database file ... done! running install module 'html::htmldoc' running make m/mf/mfrankl/html-htmldoc-0.10.tar.gz fetching lwp: http://cpan.strawberryperl.com/authors/id/m/mf/mfrankl/html-htmldoc-0.10.tar.gz fetching lwp: http://cpan.strawberryperl.com/authors/id/m/mf/mfrankl/checksums checksum c:\strawberry\cpan\sources\authors\id\m\mf\mfrankl\html-htmldoc-0.10.tar.gz ok scanning cache c:\strawberry\cpan\build sizes done cpan.pm: building m/mf/mfrankl/html-htmldoc-0.10.tar.gz unparsable version '' prerequisite ipc::open3 @ makefile.pl line 4. checking ...

regex - How to remove this empty <p><span>&nbsp;</span></p> tag using regular expression and php -

i have requirement need remove piece of text. <p><span>&nbsp;</span></p> for example <p><span>because coffee grinds stay in pod there virtually no cleaning either.</span></p> <p><span>&nbsp;</span></p> <p><span>hey presto, coffee, way every time. </span></p>. i have tried to remove empty <p></p> using regular expression $pattern1 = "/<p[^>]*><\\/p[^>]*>/"; how should modify remove empty tag <p><span>&nbsp;</span></p> if need remove piece of code, don't need regex @ all. simple replace, using str_replace $string = str_replace("<p><span>&nbsp;</span></p>", "", $string);

apache - htaccess simple redirect without changing URL -

i'm trying redirect people go site want not show in url. http://www.example.com/ -> http://www.example.com/dev/ except /dev part shows in url when redirection takes place, how hide stays http://www.example.com/ ? here's htaccess file.. rewritebase / <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ dev/index.php [l] </ifmodule> any appreciated, thanks.

Java compiler not optimizing string concatenation -

i have noticed java compiler not converting string addition (+) stringbuilder.append() method. have created class has 1 method public void dosomething(string a, string b) { string c = + "a"; string d = b + "b"; string e = c + d; string f = e; system.out.println(f); } after compilation , decompilation method looked this: public void dosomething(string paramstring1, string paramstring2) { string str1 = paramstring1 + "a"; string str2 = paramstring2 + "b"; string str3 = str1 + str2; string str4 = str3; system.out.println(str4); } why compiler not optimizing code? using ant packaging , debug setting false. i've tried javac single java file result same. i did javap -c test.class , stringbuilder appeared (java 8). public void dosomething(java.lang.string, java.lang.string); code: 0: new #2 // class stringbuilder 3: dup 4: invokespecial #3 // method strin...

c# - Windows Form run external process without blocking UI -

i want to: show form textbox. run external program (notepad.exe ease of example). continue allow user enter data form textbox whilst notepad running. run more (continue) native form code when notepad closes. update form, amongst other things. i'm having problems making happen. i'm aware of multitude of posts similar issue, haven't found solution works me. i have tried: doing waitforexit, of course blocks ui , users cannot enter data. attempting asynchronous process call, method called when process completed. causes problem new method called thread , can't update form. doing wait/sleep loop in ui, again naturally block ui. what neatest, , simplest solution simple windows form program? there no classes used, , code in form1 class . the process class fires exited event when process exits. can add handler event execute code when process exits without blocking ui thread: process.enableraisingevents = true; process.exited += (s, args) =...

javascript - How to use tlsSocket.renegotiate(options, callback) in Node.js 0.11.8 and higher -

i'm new node.js , have simple https server running. when user requests context path server should initiate ssl renegotiation , ask client certificate authentication. saw supported in node.js 0.11.8 , higher. i tried far, renegotiation not happening. not error thrown. var https = require('https'); var fs = require('fs'); var optssl = { key: fs.readfilesync('ssl/server/keys/server.key'), cert: fs.readfilesync('ssl/server/certs/server.crt'), ca: fs.readfilesync('ssl/ca/ca.crt'), requestcert: false, rejectunauthorized: true, ciphers: 'ecdh+aesgcm:dh+aesgcm:ecdh+aes256:dh+aes256:ecdh+aes128:dh+aes:ecdh+3des:dh+3des:rsa+aesgcm:rsa+aes:rsa+3des:!anull:!md5:!dss', honorcipherorder: true }; var optclientauth = { requestcert: true, rejectunauthorized: true }; var server = https.createserver(optssl, function(req, res){ res.writehead(200); res.end("hello world\n"); }); server.on('requ...

javascript - AJAX call to invoke a remote JS function -

i have slideshow (jquery cycle2 plugin) running on server. slideshow can paused , stopped buttons invoking jquery functions on slideshow. the application structured follows: in index.php define slideshow functions (stop, pause, etc.) , ajax call within function sends post php script load slideshow content server. far, works nicely. now, want have script (or maybe webservice) remotecontrol.php allows me remote control slideshow third device. run slideshow on server , site (probably same domain) call slideshow functions in index.php using ajax. @ moment not work. in body section of index.php put: if(isset($_post['action'])){ $actiononslideshow = $_post['action']; echo '<script>'.$actiononslideshow.'();</script>'; } ?> followed other content , scripts slideshow. $actiononslideshow variable contains respective function sent ajax request in remotecontrol.php. relate same-origin-policy. second ajax call same domain should n...

Nested blocks having arguments in Ruby -

i have serious troubles understand blocks arguments. use such kind of ruby code: foobar.foo |foo_arg| bar |bar_arg| define_method :hello!, foo_arg, bar_arg "hello, #{foo_arg} , #{bar_arg}!" end end end include foobar hello!(:alice, :bob) # => "hello, alice , bob!" and so, added thoses lines: module foobar def self.foo &foo_block instance_eval &foo_block end def self.bar &bar_block instance_eval &bar_block end end but because arguments between pipes specials, i've got syntax error. help! your module seems work correctly. issue usage of define_method . parameters foo_arg , , bar_arg need part of block passed define_method . module foobar def self.foo(&foo_block) instance_eval &foo_block end def self.bar(&bar_block) instance_eval &bar_block end foo |foo_arg| bar |bar_arg| define_method :hello! |foo_arg, bar_arg| "hello, #{foo_arg...

java - Packaging persistence.xml outside of jar with OpenJPA -

so i'm using jpa (openjpa 2.3.0 implementation) in perhaps rather unconventional way. i'm writing piece of software maintain personnel data , assign work said personnel. type of work assigns undefined - user must extend mapped superclass, add additional mappings class, , software take there. have several systems follow pattern, , wanted write assignment code once. however, there small differences in gets assigned - system assign case, other assign smaller piece of case, others assign based on customer, etc. to maximum configurability, put metadata persistent entities mapping file instead of using annotations. since programmer using software have extend mapped superclass , add own mapping persistence unit, didn't want package persistence.xml or mapping xml jar i'm creating. figured programmer include files somewhere in ear. wrote entire thing using java se, not ee, i'm creating entitymanagerfactory myself instead of injecting it. my organization using ...

ios - Assigning array property is always going to crash EXC_BAD_ACCESS -

i cannot understand why following code every time crashes on xcode 6 gm using swift. me understand issue? thank in advance. optionstoselect.swift import foundation struct optiontoselect { var value : var desc : string var available : bool } someclass.swift import foundation class someclass { var items = array<optiontoselect>() } viewcontroller.swift override func viewdidload() { super.viewdidload() var c = someclass() c.items = [ /// <------------- __ exc_bad_access here, why?! __ optiontoselect(value: 1, desc: "a", available: true), optiontoselect(value: 2, desc: "b", available: true) ] } edit 1 on twitter got answer it's related any , , indeed. why? the compiler still has various problems any , short answer "bug in swift." has trouble if value protocol. suspect has trouble figuring out how make copy; that's guess. but should...

ruby - Unpermitted Parameters: profile (NestedAttributes) - RAILS 4 -

this question has many times asking others user still not solved problem here. im having problem rails apps error "unpermitted parameters: profile" appear. user_controller.rb class admin::userscontroller < applicationcontroller before_filter :set_user, only: [:edit, :update] before_filter :store_location, only: [:index] before_filter :require_admin def edit if @user render else redirect_to admin_users_path, notice: "user profile not found." end end def update # rails.logger.debug "===> (1)" if @user.update(user_params) redirect_to edit_admin_user_path, notice: "#{@user.profile.full_name} account has been updated." else render 'edit' end end private def set_user @user = user.find(params[:id]) end def user_params params.require(:user).permit(:id, :username, :email, profile_attributes: [:user_id, :full_name]) end end edit.html.erb <%...

java - use specific maven profile to deploy a feature branch using jenkins -

is possible use specific maven profiles when running tests/deploying feature branch using jenkin , maven. we have team of developers using feature branches. have our own maven profiles , associated uat deployment environments. how can set jenkins deploy, example, branches : feature/developer1-new-button feature/developer1-replace-payment using maven profile " developer1 " i havent used jenkins believe bamboo quite similar. in bamboo can create several plans can triggered changes on repository , can specify branch name pattern you'll accept start build. example can make 3 similar plans triggered changes on repository , 1 branches start feature/* other branches start bugfix/* , other development. since plans different can write tasks execute goals profile. might have pushed branch feature/deve... you'll start build feature/* , there might configure goal : clean deploy/test -p developer1

javascript - jQuery search by class AND css value NOT equal to foo -

not sure in jquery documentation find this. have jquery element found on dom. within that, want elements class == 'bar' , css value 'display' == 'none' . first part easy: $myelement.find(".bar"); how can elements within list css value 'display' == 'none' ? all in 1 line if possible. thanks! you can use filter: $myelement.find(".bar").filter(function(){ return $(this).css('display') == 'none'; }).apply_your_jquery_method_now();

android - Parsing JSON from url with exception: Error parsing data org.json.JSONException: Unterminated array at character 115 -

Image
i'm parsing url , i've got exception , don't know how skip over... need names of 100 popular apps. there key "im:name" , inside of key "lebel", see invalid jsonarray, need find way names key "im:name"... has smb ideas how can fix this? this asynctask.class public class asynctaskparsejson extends asynctask<string, string, string> { string jsonstringurl = "https://itunes.apple.com/br/rss/topfreeapplications/limit=100/json"; jsonarray datajsonarr = null; @override protected void onpreexecute() {} @override protected string doinbackground(string... arg0) { try { // instantiate our json parser jsonparser jparser = new jsonparser(); // json string url jsonobject json = jparser.getjsonfromurl(jsonstringurl); // array of users //here need change datajsonarr = json.getjsonarray("feed"); // wrong /...

c# - Accessing route and POST params in Web Api 2 Controller Method -

i have controller needs access both route , post body parameters. when use implementation public class messagecontroller : apicontroller { [route( "data/message/{apikey}/{userid}" )] [httppost] public message post( guid apikey, string userid, [frombody] string message) { // ... } } the message argument null . how can access apropos data? [frombody] parameters must encoded value don't try this: public message post( guid apikey, string userid, [frombody] string message) { // ... } try instead public message post( guid apikey, string userid, [frombody] string value) { // ... } and use kind of code post request jquery: $.post('yourdomain/data/message/{apikey}/{userid}', { '': value }); for more detail, here link http://encosia.com/using-jquery-to-post-frombody-parameters-to-web-api/

Get all windows of a process in powershell -

i want list windows of process, word. gives me main window: get-process winword |where {$_.mainwindowtitle} |format-table id,name,mainwindowtitle –autosize i want list document1 here. id name mainwindowtitle 1616 winword document2 - microsoft word is there way access windows other main one? thanks bacon bits suggestion managed find solution, if have less cumbersome this, please share: <# .synopsis enumerieren der vorhandenen fenster #> $typedef = @" using system; using system.text; using system.collections.generic; using system.runtime.interopservices; namespace api { public class winstruct { public string wintitle {get; set; } public int winhwnd { get; set; } } public class apidef { private delegate bool callbackptr(int hwnd, int lparam); private static callbackptr callbackptr = callback; private static list<winstruct> _winstructlist = new list<winstruct>(); [dllimport("user32.d...

greenDao: store data in sqlite file on Android -

what recommended way store data in sqlite file located on filesystem of android smartphone? intend restore data after device reboot. difference between "daomaster.createalltables(db, true)" , "daomaster.createalltables(db, false)"? currently using code in mainactivity.java: db = sqlitedatabase.openorcreatedatabase(new file(getexternalfilesdir(null).getpath(), "opendao.sqlite"), null); daomaster = new daomaster(db); daomaster.createalltables(db, true); daosession = daomaster.newsession(db); locationentitydao = daosession.getlocationentitydao(); locationtraceentitydao = daosession.getlocationtraceentitydao(); photoentitydao = daosession.getphotoentitydao(); photosentitydao = daosession.getphotosentitydao(); poientitydao = daosession.getpoientitydao(); primitiveattributesentitydao = daosession.getprimitiveattributesentitydao(); i had modify geńerated daomaster.java: public daosession newsession(sqlitedatabase db) { return new daose...

xml - How do I access sub-components of a list field in OpenERP 7? -

if go details page product , click on " procurements " tab, you'll see list label " suppliers ". looking @ xml page, field can see in location " seller_ids ". however, list shows " delivery lead time " , " minimal quantity ". are these fields somehow contained within " seller_ids ", array? i can't find other views add other fields. add " product name " , " product code " list. i believe of fields in " product.supplierinfo " model. how go this? if @ product.product model see seller_ids one2many field. when openerp encounters this, looks @ model o2m field represents , retrieve tree view , display fields seeing coming tree view seller model (product.supplierinfo memory). behind scenes, openerp returns list of records seller table related product based on foreign key. if want amend have 2 options. change tree view seller model. downside effects everywhere tree ...

git - How can I clean the history of / remove duplicate commits from my master branch? -

i'm trying clean old repository, may first 1 created when still learning how use git. looking @ history of master , noticed this: r -- p -- -- b -- c -- d -- m -- e \ / a' --- b' --- c' --- d' where a' , b' , ... same commits a , b ,... m merge commit , e isn't last one. there 2 branches in repository ( master , develop ), , master affected( develop has been created later). i remove duplicate commits, p (exclusive) m , resulting in this: r -- p -- -- b -- c -- d -- e how achieve that? seems m merge of branch rebased version of same branch i following: git checkout master git rebase --onto d m this commands rebase commits m master branch tip on d (removing m history), since a' - b' - c' - d' reachable because of m, commits "removed" history , history end way looking for: r--p-----a-----b----c----d----e rebase powerful command, can amazing things :) ...

php - In transaction insert same key for two tables (1. primary 2. foreign) -

i have in code 2 queries. (in real code have 6 queries , need transaction). i don't know how variable $category_id cause category isn't putted yet in database (it should inserted in same time - or nothing) code: try { $this->mysqli->begin_transaction(); $this->mysqli->query("insert `category` (`name`) values ('$category')"); $this->mysqli->query("insert `subcategory` (`name`,`category_id` ) values ('$subcategory','$category_id')"); $this->mysqli->commit(); } catch (exception $e) { echo $e; $this->mysqli->rollback(); } mysql tables: category: --------- |id|name| subcategory: |id|name|category_id| so need solution how know before query value of $category_id , or how modify query category_id in database filed. last_insert_id() want here. try { $this->mysqli->begin_transaction(); $this->mysqli->query("insert...

sql server - how to to get first top 6 records indifferent columns T-sql? -

i got situation display first top 6 records. first 3 records in firstcol , next 3 in secondcol . query this: select top 6 [empname] [emp ] order [salary] desc result: [empname] ---------------------- sam pam oliver jam kim nixon but want result this: firstcol secondcol sam jam pam kim oliver nixon you can using several windowing functions, kind of ugly result want: ;with data ( -- top 6 select top 6 empname, salary emp order salary desc ), buckets ( -- use ntile split 6 rows 2 buckets select empname, nt = ntile(2) over(order salary desc), salary data ) select firstcol = max(case when nt = 1 empname end), secondcol = max(case when nt = 2 empname end) ( -- create row number each item in buckets return multiple rows select empname, nt, rn = row_number() over(partition nt order salary desc) buckets ) d group rn; see sql fiddle demo . uses function ntile ,...

Trigger.io Forge 2.2.0 iOS "Non-Public APIs" -

after getting caught in trigger.io forge 2.2.0 upgrade today, , re-building our app app-store distribution, encountered error: "the app links non-public libraries in payload/device-ios.app/forge: /system/library/privateframeworks/webkit.framework/webkit" anyone know how fix this? don't use non-public trigger.io modules. trigger io released update today. https://trigger.io/docs/current/api/release_notes.html

html - How to auto submit a form just on the change of drop down using php -

how auto submit form on change of drop down using php? i.e. form should automatically submitted whenever 1 selects value select box. i know can done using jquery , others want done through php . there way this? i'd try use javascript it. add onchange or onblur event html input of choice with, this: onchange = formname.submit(); or, can separate js function, have give id form. can this: on input: onchange = formsubmit(); js: function formsubmit() { document.getelementbyid("formid").submit(); } the important thing know php it's server side. means it's first thing run, every time open page, without exceptions. serves gets request page, runs php code, gives necessary info browser in turn display page , runs js code.

c - cross compiling why cant ld find shared library / how to debug further? -

im trying cross-compile , link aggregate on ubuntu arm-router , following error. in past think have been able workaround setting appropriate environment variable time not working . can me figure out why might not work: /home/ubuntu/downloads/toolchain-arm_cortex-a9_gcc-4.9-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.9.1/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: cannot find -lpopt however libpopt.so exists in : lrwxrwxrwx 1 root root 34 sep 10 12:46 /lib/x86_64-linux-gnu/libpopt.so -> /lib/x86_64-linux-gnu/libpopt.so.0 i set following environment variables , in order of desperation, no avail. library_path=/lib/x86_64-linux-gnu/ ld_library_path=/lib/x86_64-linux-gnu/ path=/lib/x86_64-linux-gnu/:/usr/include/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin thinking might caused because might target architecture issue (ie maybe need libpopt.so built target of cross-compile) copied libpopt.so router ubuntu , set paths ag...

python - SymPy Comparison and Conditional -

what sympy equivalent of mathematica function: f[x_]:=if[x==infinity,1,2] ? if tried without success: lambdify(x,piecewise((1, <expr> ),(2,true)) where <expr> 1 of 1) eq(x,oo) 2) simplify(x)==oo 3) eq(x+1,x) the correct expression should piecewise((1, eq(x, 0)), (2, true)) . == structural comparison , not create symbolic object (see http://docs.sympy.org/latest/tutorial/gotchas.html#equals-signs ). this works me in [3]: f = lambdify(x, piecewise((1, eq(x, 0)), (2, true))) in [4]: f(0) out[4]: 1 in [5]: f(1) out[5]: 2

ruby - Basic string formatting in Rails view using loops -

hi newb rails here. i want format string fit html div. model i'm after is; break string array seperated whitespace. if array item length greater 22 split characters lengths of 22 , display. else separate words whitespace , display. it's handling long names on guestbook type application. <% $p = 0 %> <% @m = name.split(" ") %> <% while $p < @m.size %> <% if @m[$p].length > 22 %> <%= name.slice(0, 21) %><br> <%= name.slice(21, 43) %><br> <% else %> <% $i = 0 %> <% @x = name.split(" ") %> <% while $i < @x.size %> <%= @x[$i] %><br> <% $i +=1 %> <% end %> <% end %> <% $p +=1 %> <% end %> (1..(name.length / 22)).each { |i| name[22*i] = ' ' } if name.length > 22 ...

javascript - Inline D3 sparklines in a table alongside text -

say if there table this: var data = [ ['orange', 'orange', [6,3,3,2,5]], ['apple', 'red', [6,2,6,5,5]], ['grape', 'purple', [9,1,2,3,1]] ] i'd strings represented strings, number array represented d3 line chart. if it's text care about, can selectall td elements , insert text. var tcells = trows .selectall("td") .data(function(d, i) { return d; }) .enter() .append("td") .text(function(d, i) { return d; }); the 3rd column text i'd update graphs or alternatively append column of graphs. lines function creates line graph, call lines() passes data 3rd column each row. trows.selectall("td") .data(function(d) {return d[2]}) // scope out data 3rd column .enter() .append("td") //.call(lines([3,8,2,5,8,4])); // works .call(lines); // doesn't my d3 knowledge spotty not clear on how data , selection passed. ...

sql - How to convert a string to Date format -

i have following sql statement line: cast(convert(varchar(10), ct.attr2752, 110) datetime) 'new' which displays: 2014-12-19 00:00:00.000 i trying convert 12-19-2014 , use date instead of string. how can accomplish that? i know have use cast , convert not sure how. cast(convert(varchar(10), ct.attr2752, 110) date) 'new'

matrix - initializing transitionMatrix in kalman filter -

i working on object tracking project , want improve results getting using kalman filter. kalmanfilter kf(4 , 2 , 2 ,cv_32f ); mat_<float> state(4, 1); mat_<float> processnoise(4, 1, cv_32f); mat_<float> measurement(2 , 1 , cv_32f); measurement.setto(scalar(0)); kf.statepre.at<float>(0) = 0; kf.statepre.at<float>(1) = 0; kf.statepre.at<float>(2) = 0; kf.statepre.at<float>(3) = 0; kf.transitionmatrix = *(mat_<float>(4, 4) << 1,0,1,0, 0,1,0,1, 0,0,1,0, 0,0,0,1); //including velocity in last line,we have error "windows has triggered breakpoint in project(kalman).exe. this may due corruption of heap, indicates bug in project(kalman).exe or of dlls has loaded. this may due user pressing f12 while project(kalman).exe has focus." please me :( const float transition[2][2] = { 1, 1, 0, 1} ; memcpy(kf.transitionmatrix.data , transition , sizeof(transition) ) ;

Jenkins Git Plugin not pulling latest changes before building job -

i working jenkins ci , trying configure jobs use git. i have git plugin installed , configured 1 of jobs. when build job, expect pull latest changes branch specify , continue rest of build process (e.g., unit tests, etc.). when @ console output, see > git fetch --tags --progress ssh://gerrit@git-dev/util +refs/heads/*:refs/remotes/origin/* > git rev-parse origin/some_branch^{commit} checking out revision <latest_sha1> (origin/some_branch) > git config core.sparsecheckout > git checkout -f <latest_sha1> > git rev-list <latest_sha1> i see plugin fetches , checks out proper commit hash, when tests run seems though repo wasn't updated @ all. if go repository in jenkins, see there latest changes never pulled. shouldn't pull before tries build? i have git 1.8.5 installed on jenkins machine, recommended version. https://wiki.jenkins-ci.org/display/jenkins/git+plugin after checking other similar sounding questions on so, answers we...

c# - Localizing StringLengthValidator does not get the right resource string -

i have following code in datacontract following validation attributes field lastname: [datamember] [required(errormessageresourcetype = typeof(patientdatacontractres), errormessageresourcename = "lastnamerequired")] [stringlengthvalidator(1, 50, errormessageresourcename = "lastnamelength" , errormessageresourcetype = typeof(patientdatacontractres))] public string lastname { get; set; } the required attribute working fine when change culture while running application, stringlengthvalidator seems default resource string. app in english , french , stringlengthvalidator returns english text. both attributes use same resource. why working required attribute? i solved problem adding cultureinfo in constructor of propertyvalidatorcachekey , fixing propertyvalidationfactory use it private struct propertyvalidatorcachekey : iequatable<propertyvalidatorcachekey> { private type sourcetype; private ...

windows - Reducing buffer length in Win 8 MediaElement -

i'm working on implementing streaming client takes audio , video streamed server on user's local network , renders in real-time. i've been using mediaelement handle receiving stream: <mediaelement x:name="mediaelement" autoplay="true" source="{binding streamuri}" /> we need mediaelement responsive possible. user on client can send commands streaming server can alter contents of stream, , able show user results of change immediately. however, there seems hard-coded buffer length of 5 seconds, resulting in constant 5-second delay between user's action , result. is there way can reduce or eliminate buffering time? i've found mediaelement.bufferingtime property, seems exist in silverlight , windows phone 7. (for legacy reasons, have use windows 8 instead of upgrading windows 8.1.) the property realtimeplayback of mediaelement reduces delay of stream playback: mediaelement media = new...

mod rewrite - Remove special character ? from url with .htaccess -

i redirect url: http://www.domena.pl/?tekst,123.html to this http://www.domena.pl/tekst,123.html i want remove ? after first /, redirect every url domena/?...... domena/...... i using htaccess , works domena/testtekst,123, don't know how should change work special character ? rewritecond %{http_host} ^www.domena.pl$ rewritecond %{request_uri} ^/test(.*)$ rewriterule ^test(.*)$ http://www.domena.pl/$1 [l,r=301] this not work: rewritecond %{http_host} ^www.domena.pl$ rewritecond %{request_uri} ^/?(.*)$ rewriterule ^?(.*)$ http://www.domena.pl/$1 [l,r=301] and doesn't work too: rewritecond %{http_host} ^www.domena.pl$ rewritecond %{request_uri} ^/\?(.*)$ rewriterule ^\?(.*)$ http://www.domena.pl/$1 [l,r=301] you can use: rewriteengine on rewritecond %{the_request} ^[a-z]{3,}\s/+\?([^\s&]+) [nc] rewriterule ^ /%1? [r=302,l,ne]

asp.net - Increasing Glimpse History tab limit -

the documentation says : what happens when maximum number of stored requests reached (by default 25)? internally store requests in fifo queue. means when maximum number spaces in queue filled, take first 1 entered , remove queue, making room new request. how increase limit of 25? want use glimpse gather data , dig diagnose after 30 users in 30 minutes session there lot more requests 25. due boneheaded mistake, me, number of requests glimpse stores, supposed configurable, isn't. the offending line can seen in our implementation of applicationpersistancestore . your best bet running build glimpse (very easy do) , change buffersize whatever see fit. alternately, implement own ipersistancestore , have whatever you'd like.

extjs5 - ExtJS Paging Grid will not advance -

i trying implement grid paging toolbar in extjs 5. first page of data, when advancing grid not update new data. it appears data.asp page not being updated new starting value update .absoluteposition property of recordset. grid keeps displaying 1st page of information. my code below... var gridstore = ext.create('ext.data.jsonstore', { autoload: false, fields: [ {name: 'field1', type: 'int'}, {name: 'field2', type: 'int'} ], pagesize: 25, proxy: { type: 'ajax', url: 'data.asp', reader: { type: 'json', rootproperty: 'rows', totalproperty: 'totalcount', } } }); gridstore.load({ params: { start: 0, limit: 25 } }); grid = ext.create('e...

php - How can I employ "if exists" for creating or dropping an index in MySQL? -

i wondering if there's way check if index exists before creating or destroying on mysql. appears there feature request few years back, can't find documentation solution. needs done in php app using mdb2. here 4 liner: set @exist := (select count(*) information_schema.statistics table_name = 'table' , index_name = 'index' , table_schema = database()); set @sqlstmt := if( @exist > 0, 'select ''info: index exists.''', 'create index i_index on tablename ( columnname )'); prepare stmt @sqlstmt; execute stmt;

Android MediaPlayer wrong track duration -

the problem mp plays less time track duration is. track ends before should in few seconds. i've got bug on long tracks (one hour , more). suggestions? thanks. it different duration values mediastore.audio.media.duration , mediaplayer.getduration() . using last 1 solved problem. should set follow code in mp oncompletion() : mp.seekto(mp.getduration()) .

javascript - jQuery form submition prevention not working -

i have form submit button trying intercept data for. i've not had trouble in past there seems in particular set wrong. i have form: <form id="myform"> <!--inputs--> <!--...--> <input type="submit" value="search"> </form> i'm using js: $(document).on("submit", "#myform", function(e){ e.preventdefault(); }); and i've tried: $(document).on("submit", "#myform", function(e){ return false; }); and both times form still submits. i've put in function serializing form data in event listener, , function fires, know submit event listener working, it's not preventing it. there no errors in js console, , nothing else behaving improperly. i'm using jquery 1.9.1 , jquery mobile 1.4.2.

jquery - Unable to get property 'hasClass' of undefined or null reference -

i using angularjs framework , using 'hasclass' inside jquery in order have dropdown on mouse over. working fine in chrome , ff in ie, gives error "unable property hasclass of undefined or null reference" when click on button , navigate page. error not show every time appears , in ie only. similarly, instead of 'hasclass', throws 'height' undefined or null reference. here code: (function ($, window, delay) { var thetimer = 0; var theelement = null; var thelastposition = { x: 0, y: 0 }; $('[data-toggle]') .closest('li') .on('mouseenter', function (inevent) { if (theelement) theelement.removeclass('open'); window.cleartimeout(thetimer); theelement = $(this); thetimer = window.settimeout(function () { theelement.addclass('open'); }, delay); }) .on(...