Posts

Showing posts from April, 2011

c# - Thread.Sleep or Timer for showing every step -

i making game wumpus world in winforms in agent(computer) can move in 4 directions. using button control base , showing , hiding images ever needed. used thread.sleep problem when click button nothing showing on form. process on background working fine not showing each step. , yes using thread.sleep in current ui thread. i want show every step users interval of 2 seconds. it's hard answer without code go by, main problem understand change of world, , tell sleep, witch means nothing painted. , when thread wakes up, again change world , make sleep. nothing painted way. better way timer, make single timer , queue of events needed shown , on way it. are working on winforms, because if working on wpf can nicer things edit: i'm not saying timer best way it, it's valid way

Ruby: Rename keys in array of hashes? -

how rename _id keys id in array of mongodb documents? so, want make this: [{"_id"=>"1", "name"=>"matt"}, {"_id"=>"2", "name"=>"john"}, ...] into this: [{"id"=>"1", "name"=>"matt"}, {"id"=>"2", "name"=>"john"}, ...] i found complete solution. mongo_db['users'].find().to_a.each |u| u['id'] = u.delete '_id' end.to_json

security - Create a strong password for AES -

background: using pbewithsha256and128bitaes-cbc-bc algorithm ( bouncy castle ) jasypt via grails plugin . configuration straightforward: jasypt { algorithm = "pbewithsha256and256bitaes-cbc-bc" providername = "bc" password = "<your secret passphrase>" keyobtentioniterations = 1000 } i know how choose secure password above. there real or practical limits on length, restricted characters, etc? specific generator should using? couldn't find clear documentation on , examples use above (e.g., "password", "secret" etc.). password-based encryption takes password , term implies. passwords run through key derivation function obtain actual key. kdf typically constructed hash function, password may of length , contain characters. passwords have run through kdf because typical passwords don't contain anywhere near enough entropy considered secure against brute force attacks. kdf substitutes lack of &

html - Trying to stretch a background downwards, but a white space remains -

i busy placing html site wordpress template. working out far i'm stuck @ background. @ large pages background stops , shows big white space. the background consists stripes, has gradient fade dark (up) light (down). i trying stretch background down bottom of screen. works pages smaller screen, larger pages need scroll down, background stops , shows big white space. i in need of here - i've tried lot of solutions solved problems large pages, problem exists @ smaller pages. hope there solution stretch background way down, on every page. current code (works on small pages, problems on large pages) html { background: url(images/lines-bg.png); background-repeat: repeat-x; } but when add html css, problem occurs @ small pages.. background-size: auto 100%; i want background scrollable, not fixed. many, many thanks! there 2 things can try if don't have support super old browsers: you can use background-attachment: fixed; property fixes

java - how to access resources(Excel file) in jar file -

hi have exported java project executable jar file. inside project accessing excel file containing data. not able access excel file when trying access file. my project structure is: java_project_folder - src_folder - resources_folder(containing excel file) i accessing excel file fileinputstream file=new fileinputstream(new file(system.getproperty("user.dir") +file.separator+"resources"+file.separator+"excel.xlsx")); i have tried accessing file using getresourceasstream like: fileinputstream file=(fileinputstream) this.getclass().getresourceasstream ("/resources/excel.xlsx"); but getting in null exception. whats wrong can help? i tried , working me. my test1 class in default package, check accessing class in package, if go exact resource folder classpath "../" public class test1 { public static void main(string[] args) { new test1(); } test1(){ bufferedinputstream file= (bu

php Ajax jquery check -

hi every body testing code checking name availability ajax , dont why doesnt work <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="jquery.js"></script> <link href="style.css" rel="stylesheet" type="text/css" /> <title>index</title> </head> this body , jquery function check <div id="answer" > <script type="text/javascript"> //script $(document).ready(function() { $("#checkme").click(function(){ $("#answer").ajaxstart(function() { $(this).text("loading .. .").show("slow"); }); var userme = $("#username").val(); $.ajax({ type:get, url:"file.php", data:"username=" + userme, success: function(msg){ $("#answer").text(msg).fadein("slow&qu

java - hibernate - how to change properties at runtime -

i trying change properties in hibernate.cfg.xml code doesn't work. public static void changeconfiguration(string login, string password){ configuration cfg = new configuration(); cfg.configure(); cfg.setproperty("hibernate.connection.password", password); cfg.setproperty("hibernate.connection.username", login); } any idea why thats doesnt work? file hibernate.cfg.xml looks same. to make work, should build sessionfactory configuration object , use sessionfactory session. something : public static sessionfactory changeconfiguration(string login, string password){ configuration cfg = new configuration(); cfg.configure(); cfg.setproperty("hibernate.connection.password", password); cfg.setproperty("hibernate.connection.username", login); sessionfactory sessionfactory = cfg.buildsessionfactory(); return sessionfactory; } but @ end, not change hibernate.cfg.xml file, overwrite or

jQuery 3D FlipBook Plugin not working -

i trying use jquery 3d flipbook plugin ( http://codecanyon.net/item/3d-flipbook-responsive-jquery-plugin/3946817 ) not function. i put code on php page (you can see here http://eurocom.servizieweb.it/pricelist/ ) not work. know why, or has else had problem? i put code. problem not load on page. thanks in advance. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script> <script src="/catalogo/js/flipbook.min.js"></script> <script type="text/javascript"> jquery(document).ready(function () { jquery("#container").flipbook({ css:"/catalogo/css/black.css", pages:[ { src:"book/eng/page1.jpg", thumb:"book/eng/thumb1.jpg", ti

android - OpenCV4Android - capturing images in rectangles (face detection) -

i've been using opencv c/c++ in past, , i'm trying android. detecting face features. use opencv example face detection , detecting features via cascades. want ask is: 1) how capture area in reactangle variable/device memory: in opencv worked that: cvsetimageroi(img1, cvrect(10, 15, 150, 250)); iplimage *img2 = cvcreateimage(cvgetsize(img1), img1->depth, img1->nchannels); cvcopy(img1, img2, null); in android example have array rectangles of found faces: rect[] facesarray = faces.toarray(); (int = 0; < facesarray.length; i++) core.rectangle(mrgba, facesarray[i].tl(), facesarray[i].br(), face_rect_color, 3); but have no clue how save because cant work on iplimage. can guide me bit or give me source can study? 2) if there way set onclick on areas found on camera view, can click on choosen face, @ write kind of variable or save in memory i think, you're looking mrgba.submat(facesarray[i])

pdo - How can i return the id of the last updated record in MySQL? -

i using pdo connect mysql. when add new record database , want know id of last record added call lastinsertid() built in pdo. however, time trying return last updated record. according knowledge pdo::lastinsertid should return last updated id well. returns id of last inserted row, or last value sequence object but in case not return should. returns value 0 . how can configure lastinsertid() return auto_increment value of record updated update query? i count not find way return last updated id. have done accomplish looking checking countrow method return total effected rows. so update if record found done. if there no record found insert. thanks

c++ - Adding a virtual function to a sub-subclass without it being in the subclass? -

edit: dyp pointed in comments below, typo in function definition in c3(soccerworld). i have class, c1 , has virtual function, f . another class, c2 inherits c1 , , c3 inherits c2 . c2 doesn't have virtual function f , want add c3 changes. the virtual function f in c1 isn't pure, , defined in c1.cpp . still need f in c1 , well. when adding f c3 , , not c2 , unresolved external symbol error. if add f c2 virtual function well, 2 errors: 1 same before, , in c1.obj says f exists in c3 . this c1 , c2 , c3 like: class c1 { virtual void f() { ... } }; class c2 : public c1 { //no virtual f }; class c3 : public c2 { virtual void f() { /*do something*/ } }; real f function: abstractkart *world::createkart(const std::string &kart_ident, int index, int local_player_id, int global_player_id, racemanager::karttype kart_type) { ... } this in class world. class worldwithrank inherits world, , doesn't have createkart function. class soccerwo

classpath - Parent Last Classloader to solve Java Class path hell? -

i have project uses 2 versions of bouncycastle jars bcprov-jdk15 , bcprov-jdk16. jvm loads older version there feature wrote needs newer version run. tried solve classpath hell using custom class loader. after googling , of previous stackoverflow answers [1] [2] , blog , wrote following parent last class loader load classes newer jar before delegating parent class loader. public class parentlastclassloader extends classloader { private string jarfile; //path jar file private hashtable classes = new hashtable(); //used cache defined classes public parentlastclassloader(classloader parent, string path) { super(parent); this.jarfile = path; } @override public class<?> findclass(string name) throws classnotfoundexception { system.out.println("trying find"); throw new classnotfoundexception(); } @override protected synchronized class<?> loadclass(string classname, boolean resolve)

Is there a firebase security rule to only allow appending to a list? -

i'd create simple chat app, don't want any user able edit chat-entry list - do want user able append it. possible? you can utilize exists in write rule: "chat_list": { "$chat_entry": { ".write": " !data.exists() " } } this make possible append not write record exists.

java - How to compile a program (with gcc)? -

i writing cross-platform ide, , wondering best way compile program (with gcc) using java code. (it's cross-language ide) should access command prompt/terminal? also can have example code? you can execute gcc in separate process. rather handling yourself, use apache commons exec , great sort of thing.

c# - Incorrect syntax near 'and' -

string query1 = "select * client_rewards client_id=" + session["companyid"] + "and program_code=" + textboxprogram_code_merchant.text + "and reward_code=" + textboxreward_code_merchant.text; no , asp.net used producing dynamic pages have html. used make site not have database. asp.net server-side web application framework designed web development produce dynamic web pages. developed microsoft allow programmers build dynamic web sites, web applications , web services, reference

Backbone.js Model defaults and parse -

i've got backbone.model representing google books api volume: var book = backbone.model.extend({ defaults: { volumeinfo : { title: 'n.a.', authors: 'n.a.', publisher: 'n.a.', publisheddate: 'n.a.', imagelinks : { smallthumbnail: '/unavailable.jpg' } } }, parse: function(resp) { if (resp.volumeinfo.authors) { resp.volumeinfo.authors = resp.volumeinfo.authors.join(','); } return resp; } }); which fed template: <script type="text/template" id="bookcollectionrow"> <tr> <td><img class="thumbnail" src="<%= volumeinfo.imagelinks.smallthumbnail %>" /></td> <td><a target="_blank" href="<%= volumeinfo.canonicalvolumelink %>"><%= volumeinfo.

How to start multiple instances of the same module/function under the Supervisor behavior in erlang? -

having module/function mymodule , how start multiple times under supervisor behavior ? i need example 2 instances of same process (mymodule) started concurrently. called children identifiers child1 , child2 . both point mymodule module want start. have specified 2 different functions to start each instance of worker process "mymodule" ( start_link1 , start_link2 ) -module(my_supervisor). -behaviour(supervisor). -export([start_link/0, init/1]). start_link() -> supervisor:start_link({local, ?module}, ?module, _arg = []). init([]) -> {ok, {{one_for_one, 10, 10}, [{child1, {mymodule, start_link1, []}, permanent, 10000, worker, [mymodule]} , {child2, {mymodule, start_link2, []}, permanent, 10000, worker, [mymodule]} ]}}. the worker has 2 distinguished start_link functions ( start_link1 , s

java - automatic resizing of jbutton icon in gridlayout -

i'm making chess game. i'm using gridlayout(8,8) , filled jbutton[8][8]. each jbutton has icon of piece on square or icon of blank square if no piece on it. right pieces cut off. how make icons automatically resize fit whatever size grid makes jbutton? you might able use darryl's stretch icon .

xml - Sorting data from lists and grouping in a table with XSLT -

Image
four types of data need selected list , grouped in table. example of xml input looks follows: <div> <ul> <li>fr0.1.1 : en1.1.1</li> <li>fr0.2.1 : en1.2.1</li> <li>fr0.4.1 : en1.3.1</li> <li>fr0.6.1 : en1.4.1</li> <li>fr0.5.1 : en1.5.1</li> <li>fr.0.7.1 : en1.5.1</li> <li> : en1.6.1</li> </ul </div> the 2nd digit in each 3-digit number having same prefix (e.g. ‘fr’) relative 2nd digit of preceding , following 3-digit number, e.g. fr0.1.1, fr0.2.1, fr0.3.1 continuous sequence in context, while fr0.1.1, fr0.3.1, fr0.2.1 or fr0.1.1, fr0.3.1 discontinuous. i need code find gaps , discrepancies in these relations among numbers prefixed ‘fr’ on left side of each <li> element. if there number missing in such sequence, code needs retrieve , list in first column named ‘absent(fr)’. if 2nd digits not arrange in growing order go down list o

vsix - Start.process does not work with VSIXInstaller.exe arguments C# -

i trying run process uninstall vs extension on quite mode , seems arguments won't pass. string vsixinstallerpath = (string)registry.getvalue(@"hkey_current_user\software\microsoft\visualstudio\11.0_config", "vsixinstallerlocation", null); process uninstallvspackage = new process(); uninstallvspackage = process.start(vsixinstallerpath + " " + (@"/u:guid /quiet")); and error get: the system cannot find file specified when run command prompts work. to execute command arguments, have use process.start(string filename, string argument) overload , pass arguments second parameters. uninstallvspackage = process.start(vsixinstallerpath, "/u:guid /quiet");

html - -ms-transform won't work on table header group (thead) in IE10 (and below, presumably) -

can me find way -ms-transform working on table header? context i'm repositioning header (with javascript , css transform) make stick top of screen when user has scrolled down point header otherwise no longer visible (and use rmay not able read or understand data without visible column headers). here's fiddle (without javascript), i'll post code here well: <style> body { background-color: gray; padding: 0; margin: 0;} #move-table { transform: translate(10px, 10px); -ms-transform: translate(10px, 10px); -webkit-transform: translate(10px, 10px); -o-transform: translate(10px, 10px); -moz-transform: translate(10px, 10px); background-color: green; } #move-thead { transform: translate(10px, 10px); -ms-transform: translate(10px, 10px); -webkit-transform: translate(10px, 10px); -o-transform: translate(10px, 10px); -moz-transform: translate(10px, 10px); background-color: red; } </style> <table

three20 TTTextBarController semantic error ios 6 -

i'm having semantic issues tttextbarcontroller.m the error relates 2 lines. both of relate read: property 'viewcontroller' not found on object of type uiview * happening on these lines - (void)texteditordidendediting:(tttexteditor*)texteditor { uiviewcontroller* controller = self.view.viewcontroller; [controller.navigationitem setrightbarbuttonitem:_previousrightbarbuttonitem animated:yes]; tt_release_safely(_previousrightbarbuttonitem); and here: (void)texteditordidbeginediting:(tttexteditor*)texteditor { [self retain]; _origintop = self.view.top; uiviewcontroller* controller = self.view.viewcontroller; _previousrightbarbuttonitem = [controller.navigationitem.rightbarbuttonitem retain]; how resolve this. appreciated. i know it's not answer you're looking for, should think of stop using three20. it's old library, , it's been officially discontinued .

How to install geos on debian raspberry pi -

hi trying install geos on raspberry pi running rasbian wheezy can include shapely modules in python scripts. tried using: git clone git://git.debian.org/git/pkg-grass/geos this downloads properly, when try run python script gives me traceback error saying oserror: not find library geos_c or load of variants ['libgeos_c.so.1', 'libgeos_c.so'] have put geos in wrong place? there special way build files? help! you have downloaded sources far. guess wanted install binary package instead. install it, type (as root): apt-get install libgeos++

ruby on rails - Library not loaded: /usr/lib/libpq.5.dylib -

recently came computer (mac os x lion 10.7) i've had repeated environment issues, started new rails app, , ran rake db:create i got error output (with --trace): rake aborted! dlopen(/users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle, 9): library not loaded: /usr/lib/libpq.5.dylib referenced from: /users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle reason: image not found - /users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle /users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `require' /users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `<top (required)>' /users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' /users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' /users/<us

javascript - Can't trigger a click event on "a" element -

i’m trying trigger click event on <a> element, nothing happens. want link included on href open new tab. i've used: $("#tables a").eq(0).click(); anybody knows why not working? click() trigger event, not click link. closest can window.open : window.open($('#tables a').get(0).href); or, open in same page: window.location.href = $('#tables a').get(0).href;

svn - How to checkout latest stable Boost (not development or bleeding edge)? -

according boost subversion repository , can checkout boost's bleeding edge development svn co http://svn.boost.org/svn/boost/trunk boost-trunk . i'm interested in checking out latest stable version because need bcp ( bcp not part of boost downloads). believe latest version of boost version 1.55.0, there's no "xxx_1_55" in trunk , tags or branches in repository (where xxx presumably something, "release"). how checkout latest stable boost? thanks in advance. it seems releases found under tags/releases not trunk . svn list http://svn.boost.org/svn/boost/tags/release verify release interested there. this described @ development , release practices , indicates urls final releases in form http://svn.boost.org/svn/boost/tags/releases/xxx , xxx revision 1_54_0. the checkout command similar to: $ svn co http://svn.boost.org/svn/boost/tags/release/boost_1_55_0

algorithm - Aranging integers in a specific order -

given set of distinct unsorted integers s1, s2, .., sn how arrange integers such s1 < s2 > s3 < s4... i know can solved looking @ array left right , if condition not satisfied swapping 2 elements gives right answer. can explain me why algorithm works. given 3 successive numbers in array, there 4 possible relationships: a < b < c < b > c > b < c > b > c in first case know < c. since first condition met, can swap b , c meet second condition, , first condition still met. in second case, both conditions met. in third case, have swap , b give b < ? c. know b < c, if < c swapping meet second condition doesn't invalidate first condition. in last case know > c, swapping , b meet first condition maintains validity of second condition. now, add fourth number sequence. have: a < b > c ? d if c < d there's no need change anything. if have swap c , d, prior condition still met. because if b > c , c

osx - Postgresql.app user database deleted. How to recreate? -

i'm developing ruby on rails app use on heroku , want use postgresql.app locally development environment (mostly play rails 4.0's new array attributes.) had installed postgresql.app while ago when playing around it, uninstalled , deleted user database created. i've reinstalled app, tries connect database before it'll anything, including allowing me psql @ command line. if use psql @ command line, this: psql: fatal: database "bcarr" not exist logout any suggestions how reset app's settings can recreate initial user db, or how can recreate db? many in advance help! normally on installation postgres.app creates database , username matches os username (and has db superuser privileges). in case of reinstall, seems may end database missing. however if username still there , still superuser, it's still possible connect template1 , issue administration commands such create database , create user . the command simply: psql

Put a fixed title in an interactive 3D plot using rgl package, R -

i trying add fixed title interactive 3d plot using rgl package r, far haven't been able it. have 1 main title , subtitle under main title. here sample code, library(rgl) data<-read.table(text=" x y z 1 147.0883 -18.69122 -13.90000 2 147.0894 -18.69455 -10.97250 3 147.0883 -18.69122 -17.45000 4 147.0883 -18.69122 -15.44000 5 147.0883 -18.69122 -13.45000 6 147.0909 -18.69922 -12.25000 7 147.0883 -18.69122 -17.30000 8 147.0883 -18.69122 -16.40000 9 147.0883 -18.69122 -14.30000 10 147.0883 -18.69122 -18.50000 11 147.0883 -18.69122 -15.67606 12 147.0883 -18.69122 -17.25780 13 147.0883 -18.69122 -3.64000 14 147.1164 -18.68133 -22.13000 15 147.0883 -18.69122 -18.54778 16

how in drupal forms can horizontal alignment of elements happen -

in drupal how align elements such select boxes horizontallly title of select box. ? i dont want hard code format in template or forms hook function. i looked @ modules form builder , arrange fields no avail. you can use css! in form api, can use #attach property attach online or css files sets floating , display, etc css properties can use set layout of form. see #title_display property: can set title display options such 'after' , 'before'. see https://api.drupal.org/api/drupal/includes%21form.inc/function/theme_form_element/7

schema - How do I retrieve the PostgreSQL commands which create the tables and functions in my database? -

i have database have several tables (including data) , functions on. created these tables , functions command line interface. my question is: there way have database queries creates same tables/functions again in readable format. postgresql version: 9.1.9 pg_dump --schema-only my_database > my_database.sql http://www.postgresql.org/docs/current/static/app-pgdump.html

MySQL average number of hours between created datetimes for a specific time interval -

i have table field called "created" datetime field. assume now() midnight on 2013-07-21, now() = 2013-07-21 23:59:59 now let's query records created between date_sub(now(), interval 4 days) , now() let's returns results this: 2013-07-18 08:00:00 2013-07-19 08:00:00 2013-07-20 08:00:00 2013-07-21 08:00:00 i want add start , end datetime interval used (4 days) result set, have: 2013-07-18 00:00:00 (4 days ago now()) 2013-07-18 08:00:00 2013-07-19 08:00:00 2013-07-20 08:00:00 2013-07-21 08:00:00 2013-07-21 23:59:59 (now()) and want query give me average amount of hours between 6 datetime results. that (8 + 24 + 24 + 24 + 24 + 16) / 6 average of 20 hours. i found on stack on flow select time_to_sec(timediff(end,start)) timediff sessions group date(start) the problem query i'd have run 6 times passing in dates each time (in php loop) , add results , / 6 , / 3600. how can result want using mysql? thanks! just little furt

JBoss 5.1 Won't Start Using Eclipse Indigo on Windows 8 -

i having trouble running jboss 5.1 through eclipse indigo (and jboss tools) on new windows 8 laptop. server starting process hangs indefinitely @ beginning, displaying these 2 messages: "starting jboss 5.1 runtime server: (0%)" , "performing pre-launch check..." appreciate trouble-shooting tips. thanks! though i'm on macosx, having trouble well. found out rogue jboss process hanging around in background. ps aux | grep jboss note process id sudo kill -9 <processid>

php - How to Prevent Copying PDF to Another Computer -

i bought book on leanpub.com. interested in technique can copy flashdisk, file can not opened on computer (i seen white screen). every person sells @ leanpub upload files have been protected or leanpub.com create protected file @ runtime when people execute link? if created in runtime, how do php? edit 1 in simple word; want create system protect pdf file in website leanpub. so, people have download file, can't copy others. edit 2 why people down vote? don't think oot. interesting leanpub technique protect publisher right. care user right... have been searching http://php.net/manual/en/book.pdf.php . can't solve it. header("content-disposition: attachment; filename=".urlencode($the_file); header("content-type: application/force-download"); header("content-type: application/octet-stream"); header("content-type: application/download"); header("content-description: file transfer");

How can I close background processes from my Android app? -

i developing android application. how can close background process music player or video player? as of android 2.2 , above can kill background processes. if want kill background process can use following: private activitymanager actman = (activitymanager) this.getsystemservice(activity_service); actman.killbackgroundprocesses("com.root.package"); also android manifest must include permission: android.permission.kill_background_processes

perl - Replacing for my $i ( 0, 1, 2 ) with something more stylish? -

i write perl tests in way $i ( 0, 1, 2 ) { is_deeply( $fetch_public_topic_ids->[$i], $expected_sorted_topic_list->[$i], 'match' ); when $expected_sorted_topic array ref test case data. feedback should avoid writing 0, 1, 2, 3... or 0...5 in "for", considered "bad style"? but alternatives have instead? you want iterate on indexes of array, no array figures in determining of index. problem hardcoding of indexes. for $i (0..$#$fetch_public_topic_ids) { ... }

javascript - Arrow not shown in jsplumb connection -

i have created connection between div block using jsplumb. want add arrow on top of connection line. arrow not shown up. have no idea on it. is there idea why arrow not show up? thing missing? lot. ` html: abc xyz css: window20 {top: 10em; left: 10em; width: 8em;} window21 {top: 26em; left: 10em; width: 8em;} javascript: jsplumb.connect({ source:"window20", target:"window21", anchors:["bottom", "top"], connector:"straight", endpointsontop:true, overlays:["arrow"] }); ` try this jsplumb.bind('connection', function (e) { jsplumb.select(e).addoverlay(["arrow", { foldback: 0.2, location: 0.65, width: 25 }]); });

html5 - Get variable from Sencha Touch Ext.data.JSONP.request response -

i'm trying boolean (success) , html string (result) response ext.data.jsonp.request , can't fgure out how. here's code have far: ext.data.jsonp.request({ url: 'http://wereani.ml/shorten-app.php', callbackkey: 'callback', params: { data: ext.encode(values) }, success: function(response) { console.log(response); console.log(json.stringify(values)); console.log('link shortened'); if(response.responsetext['success'] == true) { ext.msg.alert('link shortened', response.responsetext, ext.emptyfn); } else { ext.msg.alert('error', response.responsetext, ext.emptyfn); } form.reset(); }, failure: function(response) { console.log(response); console.log(json.stringify(values)); console.log('error'); ext.msg.alert('error', 'please try again.', ext.emptyfn); } });

python - Django, change username form -

i'm trying create modelform allow users change username. i'm trying using formview instead of updateview because want include other forms (user management functionality) in view eventually. relevant forms.py: class formhorizontalmodelform(forms.modelform) def __init__(self, *args, **kwargs): super(formhorizontalmodelform, self).__init__(*args, **kwargs) self.helper = formhelper() self.helper.form_class = 'form-horizontal' class playerrenameform(formhorizontalmodelform): def __init__(self, user, *args, **kwargs): super(playerrenameform, self).__init__(*args, **kwargs) self.helper.add_input(submit('change_username', 'change username')) class meta: model = user fields = ('username',) def save(self): pass # figured might saving object since inherited off modelform def form_valid(self, form):

How to call a function with parameters in a java file from a jsp file? -

i have emp.java file method as boolean create(int empid,string empname,int supid ); i have register.jsp page <form name="register" action="#" method="post"> <table> <tr> <td>employee id</td> <td><input type="text" name="empid" placeholder="enter employee id " size="30"></td> </tr> <tr> <td>employee name</td> <td><input type="text" name="empname" placeholder="enter employee name " size="30"></td> </tr>

jquery - Crossfade text on click of element without it jumping down -

i trying allow user click elements on site load different text div @ bottom of page. when click image, text crossfades correctly code have both of them on page @ same time, 1 div jumps down line while other fades out. there better way doesn't jump around? you can see working example in jsfiddle: http://jsfiddle.net/a8ymj/241/ $("a[data-toggle]").on("click", function(e) { e.preventdefault(); // prevent navigating var selector = $(this).data("toggle"); // corresponding element $("div").fadeout(function(e) { $(selector).fadein(); }); }); and html: <a href="#" data-toggle="#div1"> <img src="http://192.241.203.146/assets/img/author.jpg"> </a> <a href="#" data-toggle="#div2"> <img src="http://192.241.203.146/assets/img/author.jpg"> </a> <div id="div1">div 1</div> <div id="div2">div

php creating zip file for files with unicode names -

in php app did following: $dn = sys_get_temp_dir() . '/' . uniqid('td', false); if (mkdir($dn) === true) { $fn = $dn . '/' . '関連事業調査.xls'; $writer = new \phpexcel_writer_excel5($wb); $writer->save($fn); $fzip = sys_get_temp_dir() . '/' . uniqid('td', false) . '.zip'; $password = $this->container->getparameter('zippassword'); $out = null; $ret = null; exec("zip -qjp $password $fzip $dn" . '/*', &$out, &$ret); } in linux environment correctly creates zip file given password. can unzip files in linux without problem. if download windows, , extract files, file names become incorrect. how solve problem? zip files don't have specified encoding filenames*. consequently use of non-ascii characters unreliable. *: not true: there extension format allows utf-8 filenames used, , zip command use it. windows's zip interface (“compressed fold

windows installer - WIX Major Upgrade : Run a custom action in the second run -

we have installation scenario before doing major upgrade product need to backup configuration/resource files , later sync them. so run custom action backup files : <installexecutesequence> .. <custom action='backupappfolder' before="removefiles"> <![cdata[(installed , not remove="all") or (upgradingproductcode)]]> </custom> .. </installexecutesequence> and major upgrade scheduled <majorupgrade allowdowngrades="no" downgradeerrormessage="!(loc.downgrademessage)" schedule="afterinstallinitialize"/> 'sync' action scheduled <installexecutesequence> .. <custom action='resourcesync' before="installfinalize"> (installed , not remove = "all" , not wix_upgrade_detected ) or (not installed , wix_upgrade_detected) </custom> .. </installexecutesequence> i wa

php - I have two tables, 1st country 2nd is state queried using ST_contains the state lies within the country or not -

i new postgis , breaking head across these queries ....... need help i have 2 tables, 1st country(cid int,countryname text,coutrycoordinates geometry) , other state(sid int,statename text,statecoordinates geometry) wherein have write query using st_contains state within country query not working now suppose have inserted insert country values ( 1,'country1', 'polygon ((1 5,4 5,4 7,1 7,1 5))'); insert state values ( 1,'state1', 'polygon ((2 5,3 5,3 6,2 6,2 5))'); works , gets inserted value stored geomertry coloumn of sort 01030000000100000005000000000000000000f03f000000000000f03f000000000000f03f0000000000001040000000000000104000000000000010400000000000001040000000000000f03f000000000000f03f000000000000f03f country , 010300000001000000050000000000000000000040000000000000004000000000000000400000000000000840000000000000084000000000000008400000000000000840000000000000004000000000000000400000000000000040 state in postresql db i have w

android - Google Map V2 button couldn't load -

i'm trying add button in google map. upon on click,it show location of place. however, when run it, gave me force close error. the button make work "city" other 2 of button ,i've yet set it. here logcat error. 07-22 14:50:19.260: e/androidruntime(11261): fatal exception: main 07-22 14:50:19.260: e/androidruntime(11261): java.lang.nosuchmethoderror: com.example.googlemap.mainactivity.getfragmentmanager 07-22 14:50:19.260: e/androidruntime(11261): @ com.example.googlemap.mainactivity.oncreate(mainactivity.java:26) 07-22 14:50:19.260: e/androidruntime(11261): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1050) 07-22 14:50:19.260: e/androidruntime(11261): @ android.app.activitythread.performlaunchactivity(activitythread.java:1615) 07-22 14:50:19.260: e/androidruntime(11261): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) 07-22 14:50:19.260: e/androidruntime(11261): @ android.app.activitythrea

android - Call Function from other class -

i'm making android app using bluetoothchat example. i need separate de bluetooth config activity chat activity, so, i've got main activity buttons enable/discoverable bluetooth, , button go chat activity. the functions same in example, have divided them in 2 activities. the thing need call setupchat () function main activity, call function when bluetooth enabled. i've got function in chat activity because there other variables in activity depend of it. so, how can call function main activity?? i've readed methods. if function static call without problems, public void. cant neither put function in simple class because calls "findviewbyid" function , needs in activity. so, how can call it? i incorpore booth activities here: this mainactivity: public class btactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); final button