Posts

android - Hide context menu without disabling text selection -

the goal show custom context menu, on top of selected text. tried clearing menu items in onsupportactionmodestarted: @override public void onsupportactionmodestarted(android.support.v7.view.actionmode mode) { super.onsupportactionmodestarted(mode); mode.getmenu().clear(); mode.getmenu().close(); } but context menu still showing blank background , button , no items inside i tried setting <item name="windowactionmodeoverlay">false</item> apptheme no avail. is there way this? have tried way? @override public void onactionmodestarted(actionmode mode) { super.onactionmodestarted(mode); mode.getmenu().clear(); mode.getmenu().close(); } i have made without support , worked. have not needed: <item name="windowactionmodeoverlay">false</item> remember implement in 1 activity.

html - How to insert a JavaScript variable into Flask url_for() function? -

i have following code in flask template: <div id="cell1"></div> <script> var id="0014"; cell1.innerhtml = '<a href={{url_for('static',filename='+id+'".txt")}}">'+id+'</a>'; </script> i want link render to: http://my_address/static/0014.txt but got this: http://my_address/static/+id+.txt how make js variable id in flask url_for() function work? thanks help! try this: cell1.innerhtml = '<a href={{url_for('static', filename='')}}' + id + '.txt>' + id + '</a>'; url_for() generate link this: .../static/<filename> . if use url_for('static', filename='') , generate link like: .../static/ , can add text after (i.e. + id + '.txt>' ) .

java - mysql-connector strange behaviour in Tomcat -

i trying deploy app tomcat.everything works fine, except expected have error after deleting connector file(mysql-connector-java-5.1.40) web-inf>lib directory, but,surprise, still working without it. so, question if tomcat saving conector elsewhere(i ve searched in tomcat directories , found nothing). start tomcat use startup.bat bin directory of tomcat. simple code mysql db connection: public void jspinit() throws jspexception{ try{ class.forname("com.mysql.jdbc.driver"); con=drivermanager.getconnection("jdbc:mysql://localhost:3306/test","root",""); pst.con.preparestatement("insert employee values(?,?,?)"); } catch(exception e{ e.printstacktrace(); } } if left tomcat running deleted mysql driver jar, tomcat nevertheless have java bytecode loaded in jvm. did restart tomcat when deleted jar? update look for... a copy of jdbc driv...

mysql - Receive ERROR 1235 (42000) when only one Trigger exists. How can I fix this? -

i have been trying following trigger run. delimiter $$ create trigger prevent_value_less_than_6 after insert on t each row begin if exists (select * t numberofpeople <= 5) delete t numberofpeople <= 5; end if; end; $$ i receive following error despite having absolutely no other triggers database. error 1235 (42000) @ line 26: version of mysql doesn't yet support 'multiple triggers same action time , event 1 table' how can fix this?

node.js - Cognito USER_SRP_AUTHENTICATION -

in aws cognito docs, http://docs.aws.amazon.com/awsjavascriptsdk/latest/aws/cognitoidentityserviceprovider.html#initiateauth-property one of supported authentication flow user_srp_auth. when call initiateauth(), get invalidparameterexception: missing required parameter srp_a error. the doc silent how get/generate srp_a method requires. can find how use auth flow? thanks in advance! i had similar problem "admininitiateauth" method. able mine working enabling admin_no_srp_auth in userpool. go userpool > apps > show details , check checkbox "enable sign-in api server-based authentication (admin_no_srp_auth)". once done, use authflowtype.admin_no_srp_auth. // example java implementation... admininitiateauthrequest request = new admininitiateauthrequest(); request.withclientid(client_app_id); // clinet id assigned in userpool request.withuserpoolid(user_pool_id); // id of user pool request.addauthparametersentry("username", use...

sql - Duplicate rows using left join -

suppose have table this: +----+--------+-------------+----------------+--------+ | id | parent | description | numberofthings | number | +----+--------+-------------+----------------+--------+ | | null | | 1 | null | | b | null | b | 3 | null | | c | null | c | 2 | null | +----+--------+-------------+----------------+--------+ and want use numberofthings x create children number of things: +-----+--------+-------------+----------------+--------+ | id | parent | description | numberofthings | number | +-----+--------+-------------+----------------+--------+ | | null | | 1 | null | | b | null | b | 3 | null | | c | null | c | 2 | null | | a-1 | | | 1 | 1 | | b-1 | b | b | 1 | 1 | | c-1 | c | c | 1 | 1 | | b-2 | b | b | 1 | 2 | | c-2 | c | c | ...

java - Making new objects of different classes in a single for loop -

i'm new programming, , stuck. have 5 different classes in project: foo1, foo2, foo3, foo4, , foo5 different, similar things. need create new object of each one, like: foo1 bar1 = new foo1(); foo2 bar2 = new foo2(); foo3 bar3 = new foo3(); , on. sure works, i'm trying find way conserve lot of space if instantiate objects need in single for-loop, or in least put objects want create in single array work out of. can working if same class, not if different. possible? try read polymorphism can use in java. how interfaces , abstract classes works. extends , implements keyword in java , other ... i found these tutorials looks good: tutorialspoint polymorphism oracle polymorphism