Posts

jquery - Check whether form is submitted or not -

in webpage form there submit button (id = search) , predict button(id = predict). if user doesn't submit form, clicks predict button must alert form not submitted. how check whether form submitted or not in jquery. $(document).ready(function(){ $('#predict').click(function(){ if($('#search').submit()) { window.open("ouput.php"); } else { alert("please click search or upload button first \n\ , click predict "); } }); }); but alert box not appearing , if form not submitted ouput.php page opening. i don't know if understand correctly question , if you in page have form, when submit form script add class ok predict button. when click on predict button script chcks presence of ok class if scripts not find class alert message show up <!doctype html> <html> <head> <meta charset="utf-8"> <script sr...

eclipse - Can't find the generated bulkloader.yaml -

i trying generate bulkloader.yaml file in way appcfg.py create_bulkloader_config --filename=bulkloader.yaml --url=http://your_app_id.appspot.com/_ah/remote_api but error file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/tools/bulkloader.py", line 3839, in checkoutputfile raise fileexistserror('%s: output file exists' % filename) i can't manage find such file is consider using eclipse pydev on mac os through googleappenginelauncher couple of things: 1) missing --application=s~your_app_id tag 2) directory in when run this? if not sure run cd path/to/where/you/want/it 3) can try find using mac's spotlight, in case not sure saved.

javascript - Simplecart's paypal checkout currency -

why paypal checkout keep showing in usd? have manage change simplecart currency, , showing right currency when item in shelf have added cart. moment click on checkout button, paypal page show in usd currency. e.g rm10 $10 usd. simplecart.email = "my@email.com"; simplecart.checkoutto = paypal; simplecart.currency = myr; simplecart.taxrate = 0.02; i changed this, case dkk: return "rp&nbsp;"; case myr: return "rm"; case usd: case cad: case aud: case nzd: case hkd: case sgd: return "&#36;"; default: return ""; } }; me.currencystringforpaypalcheckout = function( value ){ if( me.currencysymbol() == "rm" ){ return "rm" + parsefloat( value ).tofixed(2); } else { return "" + parsefloat(value ).tofixed(2); } }; where did went...

libgdx - JSON inherit properties -

i have json file describes style (colors etc...) of widgets. defines default style each widget, , add more styles. com.badlogic.gdx.scenes.scene2d.ui.label$labelstyle: { default: { font: default-font, fontcolor: white } }, i'd add style extends default, don't have copy values of default implementation. highlighted extends default: {bgcolor: green } 'highlighted' still has font properties default. is possible json? json notation part of equation. json grammer helps determine legal grammer. this legal json: { "default" : { "font": "default-font", "fontcolor": "white" } } so question of inheritance question of builder uses json setup properties of objects based on string. based on read in libgdx api not see way of doing want. not know intricacies of how objects built. i read on , edit answer later. edit: brief search did reveal standard serializer behaviour. expectancy object created...

plot - how histogram in Gnuplot works -

Image
i try reproduce simple histogram gnuplot simple macro: reset n=9 #number of intervals width=1 #interval width hist(x,width)=width*floor(x/width) set terminal pngcairo size 800,500 enhanced font 'verdana,14' set output "test.png" set boxwidth width set style fill transparent solid 0.5 border #fillstyle set xrange [*:*] set yrange [0:2.] set xlabel "x" set ylabel "freq." plot "const.dat" u (hist($1,width)) smooth freq w boxes lc rgb "orange" notitle whit follow data: 1.1 1.1 1.1 1.1 1.1 1.1 1.1 1.1 now understand how hist(x,width) works in sense: hist(x,width)=width*floor(x/width) works every numbers taking width=1 , then: hist(1.1,1)=1*floor(1.1/1)=1 and on, right? now (hist($1,width)) take elements in columns , applay hist function everyone. and can able make follow plot macro above:! question: if use (hist($1,width)):(1.0) don't understand whit plots change elements stay in 1...

C# random value from dictionary and tuple -

i have following code, , need random item contains string "region_1" dictionary. public static dictionary<int, tuple<string, int, currencytype>> itemarray = new dictionary<int, tuple<string, int, currencytype>>() { { 0xb3e, new tuple<string, int, currencytype>("region_1", 1500, currencytype.fame) } }; public static int generateitemid(string shopid) { var generateditem = itemarray.elementat(new random().next(0, itemarray.count)).key; } how select this? it's not possible efficiently... first create static random @ class level... prevent non-random behaviour if run query on short period of time... (it's seeded discrete clock) static random rnd = new random(); then: var item = itemarray.values .where(t => t.item1 == shopid) .orderby(_ => rnd.next()) .firstordefault()

user interface - Quintus JavaScript Programming GUI -

in simple javascript/html 5 game have believe update error don't know how fix. thing there no real error, not responding code how wanted to. problem is, want on screen gui displays number of enemies killed on map. far have gui there. here picture of game: http://i.stack.imgur.com/0rx4d.png [this shows 3 enemies on screen, gui in top right corner, , player.] now problem whenever kill enemy number should raise, of course doesn't. here code: window.addeventlistener("load",function() { var ekl1 = 0; // enemies killed level 1 var q = window.q = quintus() .include("sprites, scenes, input, 2d, anim, touch, ui, tmx") .setup({ maximize: true }) .controls().touch() q.sprite.extend("player",{ init: function(p){ this._super(p, { sprite: "player", sheet: "player", speed: 150, x: 410, y: 90 }); this.add('2d, platformercontrols, animation'); },...