Posts

Showing posts from July, 2014

html5 - Soundjs is not playing sound in iPad1 and Window Lumia Phone -

i new html5 developer, using soundjs library play audio in html5 web application. soundjs not able play sound in ipad1, window phone , of android mobile. seem not initialized audio plugin, that's hwy not able load file , dispatch complete event. using code (soundjs library import in script tag) : if (!createjs.sound.initializedefaultplugins()) { alert("return") return; } var audiopath = "assets/audio/"; var manifest = [ {id:"music", src:audiopath+"watersplash.mp3|"+audiopath+"watersplash.ogg"}, {id:"thunder", src:audiopath + "ohh.mp3|"+audiopath + "ohh.ogg"} ]; this.displaymessage.innerhtml = "loading audio"; //var loadproxy = createj...

google app engine - How can we upload video to a specific user account in using youtube api in android -

i creating application in want application users upload videos application's youtube page in place of own user account. i have tried/studied below mentioned methods achieve above requirement. service account --> per investigation cannot use service account access youtube api. hard-coding user id , pwd in application , call youtube apito token. have used guidelines in this url. below observations/investigations. a. able receive token google b. in subsequent call received token getting 401 response code. use oauth 2 protocol token request. in not sure how can pass user id , password access token. if has solution above mentioned problem please share. please let me know if more information required. please don't this; if decide this, it's not youtube can offer support for. the reasons why bad idea outlined in this blog post .

download - How do I integrate an InDesign PDF into my rails app -

i have been given task create rails app can purchase pdf , download it. know pdf have been made in indesign, have no idea how can integrate app. have had @ pdf kit , coverts html pdf, not need. does know whether possible , have ideas, grateful. thank much! you can export file using indesign javascript or applescript. example, export open document desktop on mac: var doc = app.activedocument; var outputfile = file("~/desktop/temp.pdf"); doc.asynchronousexportfile(exportformat.pdftype, outputfile); if you're looking little more involved, take @ idmllib or indesign server . might contain functionality need, although don't have experience them.

Google Analytics API login causes security breach due to web server IP change -

i access google analytics account web server through google's api , poll analytics stats web site have. this has been running smoothly couple of years, hosting company moved vps runs site 1 server , consequence ip number of server changed. the google account system shut down access new server/ip address , has been unable fetch data since then. i can make work locally local server (in denmark), production server in , has been blocked. have tried kinds of wizardry , followed instructions find, confirmed login me on google account security settings , whatnot, google keeps on bouncing me , sending me alerts suspicious login attempts, , tells me after each login attempt: “for security, continue display these events 2 weeks.” and seems these 2 weeks never end, because have tried numerous times during last month or so, , resets , keeps on going no matter how try confirm server legit. i have found 1 possible remedy, not useful one, asked me go page ip address in question , ...

MSBuild - Build Error because of dll Fakes -

configuration : visual studio 2012 premium + update 2 hi, unittest project uses 2 fake assemblies. 1 of theses assemblies produces build error , don't know why. if take off assembly, compilation ok. error "result: unexpected exception occured (-1002 - 0xfffffc16)" i have seen other post same error because of moles assembly. has solution fix issue ? here 1 part of build result : .fakes fakes\technical.sdk.fakes generate ...\workflow.unittests\fakesassemblies\technical.sdk.fakes.dll verbosity: warning x86: false framework version: v4.5 target runtime version: v4.0.30319 referencefiles: 78 ...\packages\automapper.3.0.0-ci1037\lib\net40\automapper.dll ...\packages\automapper.3.0.0-ci1037\lib\net40\automapper.net4.dll ...\lib\directory.proxy.dll ...\lib\platform.common.dll ...\lib\platform.interfaces.dll ...\bin\release\technical.entityframework.dll ...\bin\release\technical.sdk.dll ...\bin\release\technical.servicebus.dll...

addition of matrix in php -

i trying matrix addition in php. here trying input user , make array addition. tried this. have more mistakes here. 1 can give solution this... in advance... <html> <body> <form name="form1" action="matrixaddjs.php" method="post"> enter number of rows matrix : <input type="text" name="ar"> enter number of columns matrix : <input type="text" name="ac"> <input type="submit" name="submit" value="submit"> <script> var row=document.getelementbyid('ar').value; var col=document.getelementbyid('ac').value; var i; var j; var k; var l; var amatrix= new array(); document.write('<table>'); for(i=0;i<row;i++) { amatrix[i]=new array(j); document.write('enter matrix :'); document.write('<tr>'); for(j=0;j<col;j++) { document.write('<td>'); d...

java - FileNotFound exception, when files are in /Applications/Foobar.app on a Mac -

summary - code: file f = new file("dbfile.dat"); f.getabsolutepath(); returns: /applications/dbfile.dat the problem application's resources (3d party jars instance) located in "applications/foobar.app/...". how path install folder without hardcoding anything? details : i'm using 3d party library need provide filename: ls = new lookupservice("dbfile.dat"); when distributed, file placed in root of install folder, next executable files - works great on windows. however, on mac fnf exception because library isn't searching in correct location: java.io.filenotfoundexception: dbfile.dat (the system cannot find file specified) @ java.io.randomaccessfile.open(native method) @ java.io.randomaccessfile.<init>(unknown source) ... try this: url myclass = myclass.class.getresource("myclass.class"); system.out.println(myclass.getpath()); this print out this: file:/home/mike/test.jar!/myclass....

mysql - Optimizing a SQL query by only looking in the last X rows (Not simply LIMIT) -

i perform sql query across large table. however, need through last 100,000 rows. currently: select * bigtable columna='foobar' order id desc limit 10 i same make in last x ids. edit: selecting 100k rows first , selecting not solution. selects full previous 100k rows, if more 10 of needed rows have been found. makes slower. in database cannot query checks "last x rows". relational database not guarantee rows physically stored in specific order. , therefore sql not allow express that. if can translate actual constraint based on data contained in rows possible achieve. taking example, worst operation database has sort of full result set before returning data. regardless of limit clause, because after run through rows , sorted them know rows have highest ids. however, if there index columna , id , order, database engine should use index, sorted, go through rows faster, resulting in faster response time.

javascript - Form Validation on Twitter Bootstrap Modal -

i have working form validation checks fields before sending email trough contact form. the form validation won't work inside twitter bootstrap modal. script checks in js if fields filled , correct. sends information php file processing , returns false or true in ajax js file confirms user if email send or not. when tried plug in bootstrap modal ajax true wont return js file , displays "true" in browser window. it needs send "true" js file "send button" changes in "messages succesfully send" when clicking send redirects email.php. so how can "true" value passed on js file , keep modal open change send button successfull message? the code following: html <div id="mymodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-header"> <but...

c++ lua error on setting global variable -

i have folowing code: lua_state *lua; lua = lua_open(); lual_openlibs(lua); std::string code = "print(gvar)\n" "function test()\n" "print(gvar)\n" "end\n"; if(!lual_loadstring(lua, code.c_str())){ if (lua_pcall(lua, 0, 0, 0)){ const char* error = lua_tostring(lua, -1); lua_pop(lua, 1); } } lua_pushstring(lua, "100"); lua_setglobal(lua, "gvar"); if (lua_pcall(lua, 0, 0, 0)){ const char* error = lua_tostring(lua, -1); // returns "attempt call nil value" lua_pop(lua, 1); } lua_close(lua); calling functions , getting global variables works fine, when try set global variable "attempt call nil value". , cant understand why that? if(!lual_loadstring(lua, code.c_str())){ if (lua_pcall(lua, 0, 0, 0)){ const char* error = lua_tostring(lua, -1); lua_pop(lua, 1); } } this code loads string anonymous function using lual_loadstri...

Multiple artifacts resolved error with ivy-maven-plugin -

i'm trying use ivy-maven-plugin in order execute sbt launcher scala program builds maven. (side note: i'm not looking answers like: use sbt...) my ivyconf.xml looks this: <ivysettings> <property name='ivy.checksums' value=''/> <resolvers> <url name='typesafe-repo' alwayscheckexactrevision='yes' checkmodified='true'> <ivy pattern='http://repo.typesafe.com/typesafe/releases/[organization]/[module]/[revision]/ivys/ivy.xml'/> <artifact pattern='http://repo.typesafe.com/typesafe/releases/[organization]/[module]/[revision]/jars/[artifact](.[ext])'/> </url> <ibiblio name="maven2-repo" m2compatible="true"/> </resolvers> <modules> <module organisation='com.jcraft' matcher='regexp' resolver='maven2-repo'/> <module organisation='jline' matc...

connection - RAD Embedded Derby database inside my project folder how to connect to database path -

i using derby embbeded database in rad ide. have created database inside project folder , connected by class.forname("org.apache.derby.jdbc.embeddeddriver"); con = drivermanager.getconnection("jdbc:derby:i:\java programs\eappointment\webcontent\eappointment;create=true;user=subbu;password="); but when send ear file superior. not running. database path error occurs. can suggest me how overcome error. might problem backslashes in java strings. you're not getting windows path separator, rather getting characters \j, \e, \w, , \e embedded string. so you'd have double backslashes, or change them forward slashes. and spaces in directory name going annoying, too, it's easier avoid them. try starting making database @ root level of "i:" drive, in: "jdbc:derby:i:/eappointment;create=true;user=subbu;password=" then once basic syntax working, can work on techniques more advanced control of database location.

c++ - Conversion from Derived** to Base*const* -

please read question before linking parashift, can google search, different case. this isn't allowed child **cc; base ** bb = cc; because do *bb = new otherchild; but if have child **cc; const base *const *const bb = cc; i don't think const necessary example, sure.. i think minimum should work base *const *bb = cc; then can't this *bb = new otherchild; so should safe. why isn't allowed? you're confusing 2 cases: the addition of const upcasts while formally (in computer science theory) both of these deal subclassing, reality c++ rules these different, because representation of const t , t guaranteed same, while representations of base* , derived* differ offset (but may radically different when virtual inheritance involved). in 3.9.3, standard declares that the cv-qualified or cv-unqualified versions of type distinct types; however, shall have same representation , alignment requirements given: struct base ...

jquery - javascript regex to find specific html tag details -

i want regex find out specific html tag details. i tried bellow 2 regex : <\s*tag[^>]*>(.*?)<\s*/\s*tag> <tag[^<>]*>.+?<\/tag> bellow 2 test cases 1st regex : in 1st example getting correct result in example 2 getting wrong result. in both cases in-puts same. 1st case : individual string , 2nd case : single string . =================================== example 1 input =================================== <tagx>aaa</tagx> <tag>ggg</tag> <tag id="tag896">hhh</tag> <tagy>iii</tagy> <tag id="tag017">jjj</tag> <tag>kkk</tag> =================================== output 1 // correct =================================== <tag>ggg</tag> ggg <tag id="tag896">hhh</tag> hhh <tag id="tag017">jjj</tag> jjj <tag>kkk</tag> kkk =================================== example 2 input (as single ...

Getting an object in Python Matplotlib -

Image
to make plot, have written code in following fashion: from pylab import * x = [1,2,3] y = [1,2,3] matplotlib.pyplot.scatter(x,y,label='blah') matplotlib.pyplot.legend(title='title') matplotlib.pyplot.show() i want change font size of legend title. way go legend object , change title way (e.g., how set font size of matplotlib axis legend? ) instead of rewriting code using ax.xxx, figure.xxx, etc, there way @ legend object code have written, , go there? that say, how define legend from original piece of code, such that title = legend.get_title() title.set_fontsize(30) would @ title object , allow me play .get_title()? i think i'm on verge of eureka moment regarding object-orientated languages. have feeling answer give me eureka moment! cheers, ged first, in code should stick using either from pylab import * , use imported methods directly, or import matplotlib.pyplot plt , plt.* instead of matplotlib.pyplot.* . both these "...

Is it possible to conditionally import libraries in Java? -

this question has answer here: conditional import 2 answers is possible check if library exist before importing in java. instance have code: if (library.java exists) import library no, not possible do conditional import.

Scala - Lower bound inference in path-dependent types -

i'm trying understand why can't scala compiler infer following restriction on path-dependent type: trait mytrait class mytraitimpl extends mytrait trait mytrait2[a <: mytrait] { type mytraittype = } class mytrait2impl[a <: mytrait] extends mytrait2[a] val obj: mytrait2[_] = new mytrait2impl[mytraitimpl] def mymethod[a <: mytrait](t2: mytrait2[a]) = println("hi!") mymethod[obj.mytraittype](obj) // <console>:14: error: type arguments [obj.mytraittype] not conform method mymethod's type parameter bounds [a <: mytrait] // mymethod[obj.mytraittype](obj) for me, intuitively, mytraittype can't other subclass of mytrait , bound right on a in mytrait2 . if there is, can give me example or point me code snippet wrong? if scala compiler limitation, can show me way achieve using type system? note that: i not have mytrait object, nor mymethod receive one; i not need mymethod know concrete type of a ; needs know a sub...

pawn - Tag mismatch player health -

i'm trying health of player i'm getting tag mismatch error on code below. new health; getplayerhealth(playerid, health); hopefully can me, important server. this common problem in sa:mp (which presume you're developing for). getplayerhealth gives player's health float, you're saving untagged variable. to fix this, change new health; new float:health;

regex - Perl - can't strip blank lines -

let's say, have file (it's not actual content hexdump): 0000000 \r \n \r \n t h s s f 0000010 l e \r \n \r \n h e r 0000020 e ' s s o m e t e x t \r \n 000002f if run following: #!/usr/bin/perl use strict; use warnings; use file::slurp; $_ = read_file("file.txt"); s/^\s*$//mg; print; the output produced is: 0000000 \n t h s s f l e \r 0000010 \n \n h e r e ' s s o m e t e 0000020 x t \r \n apparently, blank lines aren't stripped. can point out i'm doing wrong? in regexes, $ assertion can bit confusing. according docs, “match[es] end of line (or before newline @ end)”. behaves like (?=\n\z)|\z with /m modifier, changes to (?=\n)|\z this means \n not included in matched substring. want: s/^\s*\n//mg; now there remain points in cod...

ajax - Auto Complete Jquery return more than one value -

i have jquery autocomplete function returns text database, , want return more 1 value in ajax, because when return text cant know id column database, , when select result, want receive id, make select id selected or thing, because text aucomplete generates not good. example: if digit "br" gonna return "brasil, brasilia, bring..." can't know how id of words database, return brasil 2, brasilia 34, bring 18.. id don't need appear, come text, make when select result single, example make select * country id = 2 or 34 or 18, today return "ui.item.value" returns text have make select * country name '%brasil%' example, not id, did understand?

regex - how to get length of substring in Regular Expression JavaScript -

here regular expression /^[a-za-z0-9-]{40}([a-za-z0-9-]{3}2[a-za-z0-9-]{12}){2,10}$/ there 1 condition: length of every string after first 40 characters must 16 characters. 16 characters string non repeating , minimum of 2 times , maximum of 10 times. want length of sub-string should 16. here input string: string input="pr212d4eb2-6b25-4020-bd2a-941f69c0aa4102gex2421262506027gex2437345435522" i want match length of "gex2421262506027" , "gex2437345435522". this, there 10 strings max. want validate if length should 16 characters. try this var pattern = /^[a-za-z0-9-]{40}([a-za-z0-9-]{3}2[a-za-z0-9-]{12}){2,10}$/; var exp = text.match(pattern); if (exp) { alert(exp[0].length); }

How does java detects Checked Exceptions? -

if write things : public static void main(string[] args) { try { } catch (malformedurlexception e) { e.printstacktrace() }; } java compiler shows compilation error @ catch clause of malformedurlexception . if insert line url url = new url("hi"); in try block , complaining stops. thought java must binding these checked exceptions package. tried class of java.net package inserting " cookiemanager manager = new cookiemanager(); " in try block. compilation error again starts. so how jvm bind these checked exceptions java classes compilation time errors this? a method declaration specifies exceptions method throws. information accessible compiler. compiler emits error message if attempt catch exception cannot thrown code invoked in try clause.

twitter bootstrap - How to put the thumbails correctly inside the tab content -

Image
i wanted create ui layout twitter bootstrap. wanted achieve have list of thumbnails search results inside tab. except first row other rows having 3 items. not in css. please on achieving layout. <div class="container-fluid"> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="#">title</a> <div class="nav-collapse collapse navbar-responsive-collapse"> <ul class=...

python - How to re-use Auth to register, authenticate as Rest Api in Web2py -

i novice in both python , web2py. project using angularjs front-end, , web2py backend rest service. i have noticed web2py has developed class auth used authentication , authorization. however, if use rest api, don't know how re-use class on rest api. for example, try ajax call register new user: $http.post('/myapp/authentication/register', user) the below code not work @ all: def register(): return dict(form=auth.register()) i have naively insert auth_user table in manual manner: def register(): username = request.vars.username password = request.vars.password email = request.vars.email row = db.auth_user(username=username) if not row: db.auth_user.insert(username=username, password=password, email=email) else: raise http(409, 'username exists') this method work out insert new user auth_user table. but, when try use method login_bare : login_bare(self, username, password) it's failed user...

c# - Convert json string to CLR Types -

i have following json stirng { "api_version" : 2 , "lang" : "en_us", "hotels" : [ { "hotel_id" : 258705 , "desc" : "the hotel commonwealth stands above kenmore square \"t\" subway station in boston, mass. fenway park located 2 blocks away, while shops along newbury street 3 blocks hotel.", "amenities" : ["restaurant","non_smoking"], "room_types" : { "fenway room" : { "url" : "http://www.partnersite.com/hotel_commonwealth/fenway_room", "desc" : "one king bed pillowtop mattress, frette italian linens, down bedding, multiple pillows. view of fenway park." }, "commonwealth room" : { "url" : "http://www.partnersite.com/hotel_commonwealth/commonwealth_room", "desc" : "one king bed pillowtop mattress, frette italian linens, down bedding, multiple pillows. view of commonwealth...

io - process A read a file which process B write to -

there 2 process share file f,the size of each io line less 4k a: read line f b: write line f (append mode) i want konw if case below happen? b write half of line ,then read a,and found eof of f readed ,and return half of line. at time, file can used single process only. if want shared between 2 processes, have synchronize them. also, have close file before used second process.

php - compare client device clock with server clock exactly upto milliseconds -

i finding way difference between client clock , server clock. till have tried following approach. collecting: client request time server time client response time the problem unknown delay between request reach server , response reach client. here's implementation of scheme using javascript , php: time.js var request = new xmlhttprequest(); request.onreadystatechange = readystatechangehandler; request.open("post", "http://www.example.com/sync.php", true); request.setrequestheader("content-type", "application/x-www-form-urlencoded"); request.send("original=" + (new date).gettime()); function readystatechangehandler() { var returned = (new date).gettime(); if (request.readystate === 4 && request.status === 200) { var timestamp = request.responsetext.split('|'); var original = + timestamp[0]; var receive = + timestamp[1]; var transmit = + timestamp[2]; var sending = receive - o...

c# - Does using System.Threading.Thread.Sleep(x) slow down bots hitting site? -

i came across code today added in logon post action of site. system.threading.thread.sleep(3000); //slow down bots (it worth noting application limits failed attempts before forcing user click out of page.) i wondering if sleeping system thread doing comment suggests, slowing down bots trying access site? and if slow down bots, effective enough worth having implemented? thanks. no, won't. reason login requests on bot's side (probably) asynchronous. after request sent, bot releases thread , moves on until server responds. on other hand, locking own thread, waiting, instead of handling other requests legit users. you'd shooting in foot.

multithreading - Load All Phone Images to GridView with Thread in Android -

i have problem thread in android . have gridview checkbox , want load images gallery grid . want load thread. when click load images program closed. code . please see , give me best solution . thanks add_image.java : public class add_images extends activity implements runnable { private int count; private bitmap[] thumbnails; private boolean[] thumbnailsselection; private string[] arrpath; private imageadapter imageadapter; private string selectimages=""; private final progressdialog pd = new progressdialog(this); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.add_images); pd.setprogressstyle(progressdialog.style_spinner); pd.setmessage("please wait..."); pd.setindeterminate(false); pd.setcancelable(true); pd.show(); thread t = new thread(add_images.this); t.start(); } ...

html - How Can I Solve Windows Phone WebClient Wrong Encoding? -

i creating turkish application , want make dynamic messages usingmy domain. i editing this html , getting webclient in windows phone application getting turkish characters wrong. have tried this, mywebclient.encoding = system.text.encoding.utf8; but hasn't run correctly too. how can fix it? thanks. have tried using httpclient nuget package, should have improved support encoding. http://www.nuget.org/packages/httpclient/

CSV Data Import To MYSQL DB Using RUBY -

i trying insert data via csv database. controller code require 'csv' def index end def add @filename=csv::reader.parse(params[:dump][:file]) n=0 csv::foreach(@filename, :headers => true) |row| student.new(row.to_hash.symbolize_keys).save n=n+1 end flash.now[:message]="csv import successful, #{n} new records added data base" end now when inserting csv file getting error **can't convert csv::ioreader string** my ruby version 1.8.7 any appreciated. if using ruby, use following code: require 'csv' def index end def add n=0 csv::foreach(params[:dump][:file]) |row| student.new(row.to_hash.symbolize_keys).save n=n+1 end flash.now[:message]="csv import successful, #{n} new records added data base" end you can more information csv:foreach on http://apidock.com/ruby/csv i failed above reply because assumed [:dump][...

javascript - Make anchor tags behave like checkboxes and radio buttons -

i have unordered list like: <ul class="list-one"> <li><a href="#">hip hop</a></li> <li><a href="#">country</a></li> <li><a href="#">pop</a></li> <li class="selected"><a href="#">religious</a></li> </ul> i want anchors behave checkboxes. have similar list , want checkboxes there behave radio buttons. is there way using jquery? searched google couldnt find anything. you can work jquerys parent() , siblings() methods. check jsfiddle demo radios ! jquery radio: $(".list-one a").click(function(){ $(this).parent().addclass("selected").siblings().removeclass("selected"); }); jquery checkboxes : $(".list-one a").click(function(){ $(this).parent().toggleclass('selected'); }); if need radios form, can use label instead of ...

compilation - Building Vim .debs on Ubuntu -

from vim site: sudo apt-get install mercurial libssl-dev sudo apt-get build-dep vim hg clone http://hg.debian.org/hg/pkg-vim/vim cd vim hg checkout unstable debian/rules update-orig dpkg-buildpackage -i -i cd .. it looks there no commands called debian/rules on system. the wikia vim tips site not complete , ignores hard work of packagers of vim. standard way build debian or ubuntu binary package source package. using source packages far better solution people. pkg_basics.en.html#s-sourcebuild the upstream site https://code.google.com/p/vim/ indeed hosted mercurial , there github clone https://github.com/b4winckler/vim few people need bleeding edge sources. build-deps pretty significant. the debian vim maintainers use mercurial maintain packaging per debian/readme.source @ http://hg.debian.org/hg/pkg-vim/vim , debian developers commit access can packaging uses quilt maintain patches @ url ssh://hg.debian.org/hg/pkg-vim/vim information debian binary packages...

gfortran - Breakpoints are not hit when debugging Fortran using Eclipse. -

i have problem when debugging fortran using eclipse (i use gfortran compiler). can't set breakpoints, or, more precisely, "parallel breakpoints" type available (the green ones). when start debugging, program executed (whereas want stop, of course, whenever breakpoint hit). i'm used programming in matlab have started learning fortran, faster; got crazy debugging issue (matlab lot easier debug; doble-click set breakpoint , press f5, or f11 if want step in). it bug in ide, see bug 384187 . using latest photran version? @ how set breakpoints using photran ide in eclipse? claimed bug has been fixed. if works (which should), debugging in eclipse easy in matlab. fortran has long history in numerical computations why have such vast amount of legacy fortran code. however, if started learning new programming language either learn c or c++.

tcl - Can't pack a widget inside a sibling toplevel -

i'm trying pack (or place ) widget child of root toplevel . inside toplevel, child of . itself. is, % toplevel .tl .tl % frame .f .f % pack .f -in .tl can't pack .f inside .tl however, i've found code almost works: % frame .tl .tl % frame .f .f % pack .f -in .tl % wm manage .tl i said almost , because .f not visible. it's bit strange, because if put button inside .f , such as button .f.b -text foobar pack .f.b i see empty space reserved geometry manager, no widget visible. i'm sure i'm doing wrong, don't know , why, , pack , grid , place man pages don't help. edit: details i'm doing i'm trying build snit widget automates toplevel creation stuff. 1 thing putting ttk::frame inside every toplevel create, , managing using pack ... -fill both -expand true command. my snidget should it, i'd hide user perspective, change implementation wouldn't break existing code. the simple way this snit::widget toplevel ...

jquery - How to pass event to named function on.('click')? -

i have following trigger in jquery: $('.text').on('click', '.readless', contract); in contract, want use event.preventdefault() doesn't work in firefox, need pass event contract. how do this? you can this: $(function () { // attach event // new way (jquery 1.7+) - on(events, selector, handler); $('.text').on('click', '.readless', contract); function contract(e) { e.preventdefault(); alert(e.type); } // create elements dynamically $('.text').append('<div class="readless">click me</div>'); }); after adding reference of function contract on() method, event or e variable automatically passed function first argument. fiddle