Posts

Background image css animate() within setInterval() function call in JQuery -

Background image css animate() within setInterval() function call in JQuery - i have noticed behaviour can't explain. i'm sure must limited knowledge of jquery/javascript. when run next code on webpage, works expected - background image rotates: //background image rotator var imgarr = new array('/images/1.jpg', '/images/2.jpg', '/images/3.jpg'); var preloadarr = new array(); var i; /* preload images */ (i = 0; < imgarr.length; i++) { preloadarr[i] = new image(); preloadarr[i].src = imgarr[i]; } var currimg = 1; var intid = setinterval(changeimg, 5000); function changeimg() { $('#homediv').css({ 'background': 'url(' + preloadarr[currimg++ % preloadarr.length].src + ')' }); } however, if replace .css() function .animate() , in next code, currimg++ seems increment 2 , wrong image loads. //background image rotator var imgarr = new array('/images/1.jpg', '/images/2.jpg', ...

osx - Automator Application to Tar File -

osx - Automator Application to Tar File - i have tried creating application in automator when double clicked, tar to-do.txt file. command i'm using pretty standard: tar -cvzf todo.tar.gz /users/myusername/desktop/to-do.txt the above command works when entered terminal, created application in automator , set 'run shell script' action workflow command above. however, when double click application nil @ all. if run workflow in automator, runs know there no errors. can tell me why isn't working? i have managed work changing 'shell:' alternative /bin/sh instead of /bin/bash . works well. changed specified filename utilize arguments $@ , can tar file it. osx terminal tar automator

ajax - Django throws error no. 10053 when receiving POST from jQuery -

ajax - Django throws error no. 10053 when receiving POST from jQuery - i'm trying out jquery send post , requests django. so far recognized, , post errors, , although works cannot individual fields send django app. so wonder what's problem, , how post work? views.py def xhr_test(request): if request.is_ajax(): if request.method == 'get': message = "hello ajax" print request.get print "hello" elif request.method == 'post': message = "hello post ajax" print request.post else: message = "hello" homecoming httpresponse(message) template <html> <head> <title>ajax jquery example</title> <script type="text/javascript" src="{{ media_url }}js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { ...

ruby on rails - Sunspot: find all events in a country, or state -

ruby on rails - Sunspot: find all events in a country, or state - the title not clear allow me explain: in apps, have events. geolocated: store latitude , longitude. problem that, when users search events, type things like: kansas , montreal etc. when locate kansas (using geocoder), "center", , when inquire sunspot events "near" location, ones close center of location. it's worse if type france or australia . i wondering if knew way handle that. my thought right store country , state etc of location of event when it's saved (i can normalized address google), , text search of entered in location field... but there problem approach :( in solr, it's impossible following: any_of with(:coordinates).near(coord[0], coord[1], :precision => 3) keywords end because near can't nested. see here. did create changes in sunspot 1.3 allow that? do see other solution? might take changing solr search platform elastic search ...

c++ - Escalate App Privileges Programmatically OS X -

c++ - Escalate App Privileges Programmatically OS X - i've done digging , main ideas i've seen floating around using setuid/getuid , using authorization services (which, reason gives me symbol error when compiling appears deprecated now). my application needs able request root access (for accessing raw disk drive) @ point, preferably os x authentication dialog (i'm new os x have no thought phone call that). authorization services pretty supported, afaik. here's link tutorial (with sample projects!) can utilize launch little tool in can admin priviledges , can phone call setpriority api on calling process (documentation linked you). c++ osx root

jquery - combining two variables to set a new variable to an already declared variable using javascript -

jquery - combining two variables to set a new variable to an already declared variable using javascript - i trying set new variable same value declared variable combining 2 variables create name of original variable... may sound confusing, here's example: // javascript document document.write (finalvar); $(document).ready(function() { var position_1 = $("#box_1").position(); var left_1 = position_1.left; var top_1 = position_1.top; var position_2 = $("#box_2").position(); var left_2 = position_2.left; var top_2 = position_2.top; var box; var boxlength; var boxnumber; var selected = 0; $("#box_1").click (function() { if (selected == 1) // if box selected run next { box = $(".selected").attr("id"); boxlength = box.length; boxnumber = box.charat(boxlength-1); // finds number of box al...

python - Unable to save to database. Submitting form refreshes form page instead -

python - Unable to save to database. Submitting form refreshes form page instead - i'm trying carry on player_id , save stakes table referencing player_id, foreign key stakes table. however, not sure how so. have edited views.py reflect 2 of answers below, still seems refresh form , not save database. thing can think of beingness due datetimefield. however, using copy/pasted date database in exact format uncertainty it. models.py class player(models.model): user_name = models.charfield(max_length=200) real_name = models.charfield(max_length=200) site_choices = ( ('ftp', 'full tilt poker'), ('stars', 'pokerstars'), ('ub', 'ultimate bet'), ) site_played = models.charfield(max_length=5, choices=site_choices) class stakes(models.model): player = models.foreignkey(player) stakes = models.charfield(max_length=200) amount_won = models.decimalfield(max_digits=12, decimal_pla...