Posts

Showing posts from February, 2013

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...

php - Selection database rows and treat them as object -

php - Selection database rows and treat them as object - i'm developing sort of "model" in i'd love able select few rows (or one) constructor , able treat them object example, selecting posts has "admin" author limit of 10 be: $posts = new post(array( 'where' => array('author' => 'admin'), 'limit' => array(0 => 10), # optional: 'order' => array($by => 'desc/asc') )); # field $id = $posts->row[0]['id']; # editing fields $posts->row[1]['body'] = 'new body'; $posts->row[2]['body'] = 'new body post # 3'; $posts->update(); # delete selected posts $posts->delete(); ... et cetera. but don't way select posts. seems mechanic , total of arrays in arrays don't like. thought "one object beingness 1 row" take require of 10 posts perform 10 different queries. , that's not efficient. question #1 there ...

algorithm - Testing load balancers in linux environment -

algorithm - Testing load balancers in linux environment - i'm still trying project relates making simulation tool network load balancing (similar cisco's packet tracer) verify efficiency of algorithm of network load balancer need test in real servers setup. linux servers have install , configure provides network load balancing algorithms round robin, minimum expected delay, to the lowest degree connections. these algorithms need test on future setup. note: , i'm talking software load balancers. linux algorithm load

JSP include HTML body overrides HTML BODY tag that is included? -

JSP include HTML body overrides HTML BODY tag that is included? - i'm facing confusion how jsp include tag works. what's happening base of operations page's body tag has id attribute of included jsp. base.jsp <%@page contenttype="text/html" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>jsp page</title> </head> /* base of operations jsp has no id body */ <body> <h1>hello world!</h1> <jsp:include page="include.jsp" /> </body> </html> include.jsp <%@page contenttype="text/html" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transi...

c# - Can't make TCP client code work without USB cable attached -

c# - Can't make TCP client code work without USB cable attached - i'm having bit of problem in getting simple tcp client working on htc titan w/ windows phone 7.5. when usb cable attached phone, tcp client works charm, cable unplugged, client unable connect tcp server running on development machine. devices on same network , i'm using explicit ip-address of desktop machine connect, there's no name resolution going on afaik. here's code use. of taken sockets samples on msdn (can't seem find link though). private socket _sock = null; private manualresetevent _done = new manualresetevent(false); private const int timeout = 5000; //connect server public string connect(string ip, int port) { string result = string.empty; var host = new ipendpoint(ipaddress.parse(ip), port); _sock = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); _sock.setnetworkrequirement(networkselectioncharacteristics.noncellular); v...

'reload' a variable in python -

'reload' a variable in python - so have next situation. have configuration class config.py holds number of scheme setting variables like: class tvbsettings(): tvb_config_file = os.path.expanduser(os.path.join("~", 'tvb.configuration')) tvb_storage = os.path.expanduser(os.path.join("~", "tvb" + os.sep)) .... etc ... now besides have configuration file when exists overwrite couple of these variables. in order display these 'overwritable' configuration variables in ui i'm using genshi/cherrypy , have base of operations dictionary in settingsservice speficifies info (in setttingsservice.py): from tvb.config import tvbsettings cfg configurable_keys = {'tvb_storage':{'label':'root used projects:', 'value':cfg.tvb_storage, 'type':'text'}, 'server_ip':{'l...

blackberry star icon -

blackberry star icon - i developping application has chat&message support. need know weather applicaple on bb os 4.5 set star icon on application icon in messages application . you can that. need have 4 images icons. are standard app icon standard roll on icon standard icon * standard roll on icon * once have utilize next code if (unreadchatmessages> 0) { appicon = bitmap.getbitmapresource("app_alert.png"); rollovericon = bitmap.getbitmapresource("app_rollover_alert.png"); // turn on led if(led.issupported(led.led_type_status)) { led.setstate(led.state_blinking); led.setconfiguration(100, 1000, led.brightness_100); } } else { // utilize default icons....

jquery - Javascript: Iterating over array with non-consecutive keys -

jquery - Javascript: Iterating over array with non-consecutive keys - i need iterate on array keys non-consecutive: var messages = new array(); messages[0] = "this first message"; messages[3] = "this message"; obviously using index of loop not work depends on keys beingness sequential: for (var i=0 ; i<messages.length ; i++) { alert(messages[i]); // alert first message, never equal 3 } what canonical way of dealing this, seeing the for-each syntax not intended iterating on values in array in javascript? thanks. the idiomatic way utilize object, not array. sure check hasownproperty create sure don't pick stray things may have been added prototype. var messages = { }; messages[0] = "this first message"; messages[3] = "this message"; (var in messages) { if ({}.hasownproperty.call(messages, i)) alert(messages[i]); } javascript jquery oop iterator

javascript - Assistance with jquery variables -

javascript - Assistance with jquery variables - today need help jquery, not have much knowledge of. in next code, have "variablecommentlimitneedstogehere," how set variable have defined commentlimit. have tried many different things, have had no success. thanks! <input type='hidden' id='commentlimit' value='8'/> <script> $(window).scroll(function () { if ($(window).scrolltop() >= $(document).height() - $(window).height()) { document.getelementbyid("loadingcomments").style.display = 'block'; var commentlimit = document.getelementbyid('commentlimit').value; $('#load').load('getprofilecomments.php?username=<?php echo $profilename; ?>&commentlimit=variablcommentlimitneedstogohere'); //alert('end of page'); } }); </script> $('#load').load('getprofilecomments.php?u...

javascript - Calling a function from within nested functions in jQuery -

javascript - Calling a function from within nested functions in jQuery - i'm guessing scope problem, can't work out! have function validates form before sending. on submit, iterates through each field , checks details. should set cookie each value, since form sends user away site, temporarily, , need info when return. i have set cookie function works fine, calling function within 2 nested functions nothing. $(document).ready(function() { $("form#mainrequestbrochure").submit(function(event) { event.preventdefault(); //prevent form.submit() var missingdata = 0; // missing required fields counter $("form#contactform input").each(function(index) { var ok = 0; var v = $(this).val(); var n = $(this).attr('name'); if(isblank(v)===true) { // if empty $(this).addclass("error"); // add together error class mi...

PHP MYSQL: instant select + insert -

PHP MYSQL: instant select + insert - i need pull mysql value , alter forwards value , insert in mysql. for illustration : $str = mysql_fetch_assoc(mysql_query('select `str_id` `ids` order `num_id` desc limit 1 ')); // = aaa $str = $str++; // aaa -> aab // check if "aab" key exist // if not , insert key "aab" as algorithm there risk script runs 2 sides of globe , 2 unique keys sign "aab".. how can without risk of sign unique key 2 times? if set database column unique, mysql table not allow add together same value twice. can check result of transaction ensure succeeded. from illustration looks want incremented unique key. should utilize integer this, can automatically increment when insert new row. if want in string form perform basic math on it. i.e. 1 = 2 = b ... 27 = aa 28 = ab this assuming don't have primary key on table, in case don't understand why need string in form. helps, , apologize if misund...

sql - Update query on MySQL only when two conditions exist, otherwise Insert ( -

sql - Update query on MySQL only when two conditions exist, otherwise Insert ( - i have table this: id id_user source content or just: create table `p_l_0215` ( `id` bigint(20) not null auto_increment, `id_user` bigint(20) not null, `source` varchar(50) not null, `content` text not null, key `id` (`id`) ) engine=myisam default charset=utf8 auto_increment=2 ; i want update when id_user=value1 , source='default' if status not exist want insert. know method when have duplicate key, in table id_user neither source unique. how can solve this? help! 1) create procedure delimiter // create procedure smartinsert(given_id_user bigint(20),given_source varchar(50), given_content text) begin if (exists(select * p_l_0215 `id_user`=given_id_user , `source`=given_source)) update p_l_0215 set `content`=given_content `id_user`=given_id_user , `source`=given_source; else insert p_l_0215 values (null, given_id_user, given_source, given_content);...

ubuntu - Set Eclipse to follow system classpath -

ubuntu - Set Eclipse to follow system classpath - in ubuntu set-up, if echo $classpath , like .:/usr/import/fannj-0.4.jar:/usr/import/ij.jar:/usr/import/javacpp.jar which allows me compile, via command line, classes using, say, library ij. however, if utilize library ij in eclipse project, i'd "import cannot resolved" error. while know how add together ij build path of project, it'd still nice if eclipse followed plain command-line calls javac (namely, readily link ij , other libraries). there way this? (note: managed jars classpath modifying .bashrc export in /usr/import---a directory created additional java libs---to scheme classpath.) thanks suggestions! you don't want since impossible work on newer version of library while it's installed on system. want level of command on what's in project's classpath. eclipse ubuntu classpath

backbone.js - How to implement login in a Backbone app -

backbone.js - How to implement login in a Backbone app - i have backbone app know start implement login. till had no login , app starts creating relevant models , collection on start. api demands session cookie response. what improve solution: having login.html forwards app.html after successful login having login part of backbone app own route in both solution, how can prevent user sees login dialog again, pressing button? i utilize standard way of login handling, simple login page separated application. /admin/ in route have simple middleware checking user session if user not authenticated, redirected on /admin/login . once user obtains valid session can freely go /admin/ application resides. same apply when need authenticate users openid or oauth provider. there no utilize in handling authentication in browser since it's much simple handle in backend. in fact in backend have 3 standard routes: /* accessible routes */ /admin/login /* protected ro...

pointers - How to cast a char* to string in D? -

pointers - How to cast a char* to string in D? - i have standard char pointer im trying cast string. // string char* char *x = cast(char*)("hello world\0"); // char* string? string x = cast(string)x; string x = cast(immutable(char)[])x; error! any ideas how cast char* string in d? use std.conv.to convert char* string . utilize std.string.tostringz go other way. class="lang-cpp prettyprint-override"> import std.string; import std.stdio; import std.conv; void main() { immutable(char)* x = "hello world".tostringz(); auto s = to!string(x); writeln(s); } string pointers casting char d

html - What javascript syntax highlighter does Github use? -

html - What javascript syntax highlighter does Github use? - does know syntax highlighter github using on site display code when click on file names? thanks help. as this help page of github.com says, they’re using linguist library, written in ruby. linguist’s highlighters each language within vendor/grammars . javascript html github syntax-highlighting

hibernate - grails not using cache -

hibernate - grails not using cache - i've noticed slow downwards on site , after turning on debug 'org.hibernate.sql' see troubles are. i've set domain class cached using.... class foo{ ... static mapping ={ cache 'read-only' } string name //<-- simple info type, no associations string description //<-- simple info type, no associations } my hibernate config looks this... hibernate { cache.use_second_level_cache=true cache.use_query_cache=true cache.provider_class='net.sf.ehcache.hibernate.ehcacheprovider' } my query looks (in web flow)... def wizardflow = { ... def flow.foos = foo.list([sort:"name", order:"asc", cache:true]) // def flow.foos = foo.findall([cache:true]) <--- same result, no caching } i think either query cache or sec level cache stop database beingness nail log loaded with... select ... thing thing0_ thing0_.i...

c++ - what's wrong with declaring a variable inside if's condition? -

c++ - what's wrong with declaring a variable inside if's condition? - perhaps getting rusty (have been writing in python recently). why not compile? if ( (int i=f()) == 0) without () around int i=f() another, much more reasonable error of i not beingness boolean. that's why wanted parentheses in first place! my guess using parentheses makes expression, , declaration statements not allowed in expression. so? , if yes, 1 of c++'s syntax quirks? btw, trying this: if ( (mymap::iterator = m.find(name)) != m.end()) homecoming it->second; you can declare variable in if statement in c++ restricted used direct initialization , needs convert boolean value: if (int = f()) { ... } c++ doesn't have described "declaration expression", i.e. [sub-] expressions declaring variable. actually, looked clause in standard , both forms of initialization supported according 6.4 [stmt.select] paragraph 1: ... condition: look ...

c# - How to access SMS Message threads from Windows phone programmatically -

c# - How to access SMS Message threads from Windows phone programmatically - i want access messages on windows phone & take of or create re-create of on pc / phone. i searched couldn't on internet. is there api available achieving this. this windows phone os 7.5 mango only. unfortunately there no api available this. but yesterday i've found this: http://wpdev.uservoice.com/forums/110705-app-platform you can vote there:) page connected apphub forum. c# .net windows-phone-7 windows-phone

algorithm - Producer-consumer with sempahores -

algorithm - Producer-consumer with sempahores - producer-consumer problem taken wikipedia: semaphore mutex = 1 semaphore fillcount = 0 semaphore emptycount = buffer_size procedure producer() { while (true) { item = produceitem() down(emptycount) down(mutex) putitemintobuffer(item) up(mutex) up(fillcount) } up(fillcount) //the consumer may not finish before producer. } procedure consumer() { while (true) { down(fillcount) down(mutex) item = removeitemfrombuffer() up(mutex) up(emptycount) consumeitem(item) } } my question - why producer have up(fillcount) //the consumer may not finish before producer after while loop. when programme there , why needed? i think code doesn't create sense way. loop never ends, line in question can never reached. the code didn't contain line, , added anonymous editor in march 2009...

tomcat - Response time too high during load testing even when CPU utilization falls after Auto Scaling -

tomcat - Response time too high during load testing even when CPU utilization falls after Auto Scaling - here's scenario: i'm running java/spring app on amazon ec2 linux instance in load balancing mode 3 servers initially, can scale or downwards required. scale criteria: when cpu utilization goes above 30% more 10 mins, add together 2 more servers. scale downwards criteria: when cpu utilization decreases below 15% more 10 minutes, remove 1 server. loading (with blazemeter.com): increment no. of users steadily 0 50 in around 15 minutes, , remain constant there onwards. response: in first 15 minutes, load increased 50 hits/second, , remained steady 5 minutes. cpu utilization remains @ around 30%. response time below 20ms in phase. while load @ 50 hits/second, @ around 20 mins start, cpu utilization spiked around 33% more 10 mins thereby triggering step up. response time increases dramatically fluctuate between 5000ms 15000ms. with 2 additional servers ...

Problems posting to Facebook Wall from iOS -

Problems posting to Facebook Wall from iOS - i have simple app allows people post new entry facebook wall. i'm using ios facebook connect implementation, permissions required (i believe) "publish_stream". works fine me, however, have tester travels lot , switches in , out of aeroplane mode during airline travels. says when switches out of aeroplane mode he's not able post wall. i have user "connect" 1 time , store token used in graph api phone call i'm using via http post publish wall. understanding there no session timeout when using publish_stream offline_access assume 1 time have token user can post wall. can think of why aeroplane mode situation may causing problem? sound wrong in i'm doing? thank you. i'm going utilize both offline_access , publish_stream , see how works after reading: facebook publish_stream versus offline_access on android app ios facebook-graph-api ios5 facebook monotouch

sql - How can a substring from a varchar variable be null? -

sql - How can a substring from a varchar variable be null? - primarily sql server user suprised in oracle syntax valid: select var table substr(var, 2, 1) null how can subsrting varchar string variable null ? in sql server never true(?). select var table substring(var, 2, 1) null in many cases in oracle, the empty string null. if substr() outside range of in-string, sql server returns empty string, while oracle returns null (its equivalent empty string). sql sql-server oracle

bash - Wrapping a binary data file to self-convert to CSV? -

bash - Wrapping a binary data file to self-convert to CSV? - i'm writing custom firmware sparkfun logomatic v2 records binary info file on 2gb micro-sd card. info file size range 100 mb 1 gb. the format of binary info in flux board's firmware evolves (it dynamically reconfigurable @ run-time). rather create , maintain separate decoder/converter programme each version of firmware/configuration, i'd much rather create info files self-converting csv format starting info file bash script written info file before info recording starts. i know how create here document, suspect bash unable parse , convert gigabyte of binary data, i'd create process run much faster having script first compile c code (assume gcc nowadays , in path), run resulting program, passing binary info stdin. to create problem more concrete, assume firmware create binary info consisting of 4 16-bit integer values: timestamp (unsigned) followed 3 accelerometer axes (signe...

datagrid - How to edit ui.jqgrid.css -

datagrid - How to edit ui.jqgrid.css - hi using struts2 jquery datagrid in project. have import jar files file folder , working properly. here code <sj:head jqueryui="false" jquerytheme="false" /> <sjg:grid id="gridtable" datatype="json" href="%{remoteurl}" pager="true" gridmodel="citylist" rownum="%{rows}" altrows ="true" altclass = "even" pagerbuttons="true" pagerinput = "true" > <sjg:gridcolumn cssclass="idclass" name="id" index="id" title="id" formatter="integer" sortable="false" /> <sjg:gridcolumn cssclass = "cityclass" name="name" index="name" title="name" sortable="false"/> <sjg:gridcolumn cssclass=...

c# - Sorting rows in a data table -

c# - Sorting rows in a data table - we have 2 columns in datatable , so: col1 col2 abc 5 def 8 ghi 3 we're trying sort datatable based on col2 in decreasing order. col1 col2 ghi 8 abc 4 def 3 jkl 1 we tried this: ft.defaultview.sort = "occr desc"; ft = ft.defaultview.totable(true); but, without using dataview , want sort datatable itself, not dataview . i'm afraid can't in-place sort of datatable sounds want do. what can create new datatable dataview create original datatable. apply whatever sorts and/or filters want on dataview , create new datatable dataview using dataview.totable method: dataview dv = ft.defaultview; dv.sort = "occr desc"; datatable sorteddt = dv.totable(); c# sorting datatable

New line does not display when getting jira issue using php soap -

New line does not display when getting jira issue using php soap - i trying issue details jira 3.13 using php soap. able login , issues; however, on 1 of field, not new line formatting. so, got text particular field without new line character (everything append single line of text). of now, guessing php did re-formatting of string soap. reason saying because did testing soap ui , able text out formatting. can help me out way displaying text formatting? in advance. this php code: try { $soap = new soapclient("<<jira url>>"); $auth = $soap->login($formusername, $formpassword); if ($auth) { $result0 = $soap->getissue($auth,'<<jira issue id>>'); $result = (array) $result0; foreach ($result $key => $a) { $z = $z . '<br/>' . $key . ' = ' . $a; } echo $z; } } catch(exception $e){ $string = urlencode($e->getmessage())...

ffmpeg - How to extract frames using mencoder into specific directory? -

ffmpeg - How to extract frames using mencoder into specific directory? - i can't seem extract images specific directory. the current command running is mplayer -vo jpeg customlogoani.mp4 is possible set prefix file? similar ffmpeg %d.jpg when combining images run command: mencoder "mf://*.jpg" -ovc x264 -o output.avi but not work. can help? you want -vo jpeg:outdir=/tmp/frames/ output specific directory. don't believe prefix possible. ffmpeg mplayer mencoder

java - Making a web service, which approach? -

java - Making a web service, which approach? - i have made java ee 6 application user can browse set of questions, add together new questions , on. user can optionally log in he/she gets "credit" adding question or reporting bad. now want create iphone application user can pretty much same. reply web service assume. have not worked web service before see there @ to the lowest degree alternatives: soap , rest. which 1 should choose? want user able log in application browse questions in database...pretty much many of actions can on web site. i don't know much security , overhead introduce. also want user able retrieve list of questions thorugh web server , have alternative save it, he/she won't need have net unless he/she wants update it. can accomplish both web services? you can take @ this previous post guidance. recommend using rest, seems less messy soap , java has back upwards available shown here. through utilize of annotations, can...

javascript - Why does this return a reference to the global window object, even though 'this' is within another function -

javascript - Why does this return a reference to the global window object, even though 'this' is within another function - if (typeof obj == 'undefined') { obj = {}; } obj.thing = new function () { if (typeof this.global == 'undefined') { this.global = (function () {return this;})(); } } this.global assigned within of function. so, why homecoming reference window object? console.log(this) > domwindow console.log(obj.thing.global) > domwindow console.log(window) > domwindow i love understand better. in es 3 , es 5 there this keyword associated every execution context (es 3) or lexical environment (es 5). value set according rules entering global or function code described in ecma-262 §10.4. in code have: this.global = (function () {return this;})(); where result of calling anonymous function assigned this.global. within anonymous function, value of this set according algorithm in §10.4.3. since function ca...

php - Zend Website Processing Time -

php - Zend Website Processing Time - i have web site developed using zend framework. using mvc architecture , couple of zend libraries. 1 time host site on server noticed takes considerable time load page. specially processing time. take sometime start responding http request. used zend auto loader. $autoloader = zend_loader_autoloader::getinstance(); $autoloader->registernamespace('classes_'); $autoloader->registernamespace('crypt_'); $autoloader->setfallbackautoloader(true); it's still considerably slow. mydb indexed require fields. please suggest me way rid of issue. thank you. finally found solution. works well. http://framework.zend.com/manual/en/performance.classloading.html php performance zend-framework

Delphi XE2: Invoke WinAPI EnumResourceNames cause access violation in Win64 platform -

Delphi XE2: Invoke WinAPI EnumResourceNames cause access violation in Win64 platform - running next code in delphi xe2 win32 platform works. however, same code compile in win64 platform cause access violation in "enumrcdataproc" if run in debug mode: procedure tform2.button1click(sender: tobject); function enumrcdataproc(hmodule: thandle; lpsztype, lpszname: pchar; lparam: nativeint): boolean; stdcall; begin tstrings(lparam).add(lpszname); result := true; end; var k: nativeint; l: tstringlist; h: thandle; begin h := loadpackage('resource.bpl'); l := tstringlist.create; seek enumresourcenames(h, rt_rcdata, @enumrcdataproc, nativeint(l)); showmessage(l.text); l.free; unloadpackage(h); end; end; when debug code in delphi xe2 ide on win64 platform, found value of hmodule in enumrcdataproc doesn't match variable h. suspect might wrong parameters constructed enumrcdataproc. however, can't figure ...

Retrieving images in Android gallery through Intent -

Retrieving images in Android gallery through Intent - i building custom gallery in app populating android gallery through intent. working fine want filter images. for illustration not want images android gallery images taken on specific date. can set filter or pack parameters intent andriod gallery subset of images required returned? you'll have query this. http://developer.android.com/reference/android/provider/mediastore.images.media.html http://developer.android.com/reference/android/provider/mediastore.images.thumbnails.html columns can select here. http://developer.android.com/reference/android/provider/mediastore.mediacolumns.html here blog post solid code samples. http://androidsamples.blogspot.com/2009/06/how-to-display-thumbnails-of-images.html android image android-intent gallery galleryview

c# - programmatically hooked-up event not firing? -

c# - programmatically hooked-up event not firing? - i'm creating table containing couple of buttons. these buttons hookup events firing method updating specific database item. somekind of reason event isn't proper hooked-up. method should executed isn't executed @ all. doing wrong pseudo code: public void createtable(list<bll> itemlist) { //newtable; foreach (bll item in itemlist) { //newrow; //create multiple cells... tablecell cell = new tablecell(); button button = new button(); button.id = "buttonname" + counter.tostring(); button.text = "update"; button.click += new system.eventhandler(this.updatebutton_click); cell.controls.add(button); //addcelltotablerow } //addrowtotable } public void updatebutton_click(object sender, eventargs e) { //logic sender , update database. //debugger doesn't breakpoint here. } you need read on asp.net page life cycle. when create dynamic contro...

Why can't STATIC_URL begin with 'http://' or '/' for a DJango dev server? -

Why can't STATIC_URL begin with 'http://' or '/' for a DJango dev server? - recently i've been wanting add together load of functionality site. create process faster wanted serve static files off dev machine. specifically, wanted utilize built-in dev server ships django v1.3.1; modifying production server bad thought , having upload static files each time they're altered wasting lot of time , energy. getting dev serve play ball has been nightmare! i've wasted 4 hours trying serve static info , turns out had wrong dev server doesn't appear '/' @ origin of static_url ? i'd know why and/or i'm doing wrong... i've been trying utilize the settings suggested in docs either i've mis-read or there's more this. my project looks this: <project root> /app1 ..various files.. /app2 ..various files.. /static /style style.css /templates manage.py settings.py ...

visual c++ - why is overload with unsigned __int64 and __int64 ambiguous -

visual c++ - why is overload with unsigned __int64 and __int64 ambiguous - using vs2008, why ok (not allowed utilize 2010). void assert(int exp, int actual) {if (exp!=actual) printf("assert failed\n");} void assert(unsigned int exp, unsigned int actual) {if (exp!=actual) printf("assert failed\n");} but ambiguous. void assert(__int64 exp, __int64 actual) {if (exp!=actual) printf("assert failed\n");} void assert(unsigned __int64 exp, unsigned __int64 actual) {if (exp!=actual) printf("assert failed\n");} sample error text d:\my documents\visual studio 2008\projects\classtest\classtest\classtest.cpp(31) : error c2668: 'assert' : ambiguous phone call overloaded function d:\my documents\visual studio 2008\projects\classtest\classtest\classtest.cpp(12): 'void assert(unsigned __int64,unsigned __int64)' d:\my documents\visual studio 2008\projects\classtest\classtest\classtest.cpp(10): or 'void assert(__i...

visual studio 2010 - XML-Configuration file in VB.Net UnitTest -

visual studio 2010 - XML-Configuration file in VB.Net UnitTest - i'm trying visual studio 2010 vb.net unit tests run. in project , test project have xml configuration file marked "copy output directory: always". if run unit test accessing configuration file i'll exception: system.io.filenotfoundexception: system.io.filenotfoundexception: die datei "z:\repositories\project.git\testresults\r25 2012-01-24 13_09_55\out\project.config.xml" konnte nicht gefunden werden.. what doing wrong? vb.net visual-studio-2010 unit-testing

Porting scipy.ndimage.filters correlate1d from Python to C++ or C# -

Porting scipy.ndimage.filters correlate1d from Python to C++ or C# - i need port code python (a prototype haven't written), c# , c++. original python code makes utilize of scipy.ndimage.filters correlate1d mode = "wrap". far understood, wrap manner of normalizing output of correlation. do know of c++ (or c#/.net) available function/library perform such algorithm (it should provides similar output), or know of algorithm in wrap mode corresponds ? code algorithm solution, have no thought formula behind wrap mode. @joekington had commented question giving link github branch of scipy, the c code function correlate1d.. c# c++ python scipy

javascript - Options-enabled content-script Chrome extension without background page? -

javascript - Options-enabled content-script Chrome extension without background page? - i'm making content script extension google chrome, adds functionality website's page. want add together couple of options, not big deal really, i'd need 2 strings (none of sensitive user data). from this answer, assume need background page, i'd rather not add together extension - don't want gain unnecessary weight. do need background page, or have options page without (and storage use)? update of chrome 20 can utilize storage api..... http://code.google.com/chrome/extensions/storage.html old way create iframe points page in extension has script gets settings need local storage , sends parent in message content script gets.....well crap explanation, code says improve ;)....... content script // create iframe our page sends settings var el = document.createelement("iframe"); el.setattribute('src', chrome.extension.geturl("gimmesett...

cordova - js event is not triggering using jquery mobile and phoengap for android -

cordova - js event is not triggering using jquery mobile and phoengap for android - i developing application using phonegap in eclipse android .i have created folder construction in assets->jquery.mobile folderi have set jquery library files jquery.mobile-1.0rc2.min.js etc.and assets->www folder set html files .i have include jquery library file in html <script type="text/javascript" src="jquery.mobile/jquery-1.6.4.min"></script> <script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"></script> <script type="text/javascript" src="jquery.mobile/jquery.mobile-1.0rc2.min.js"></script> in html file have written code <script type="text/javascript"> $( function() { $('body').bind( 'taphold', function( e ) { alert( 'you tapped , held!' ); e.stopimmediatepropagation(); homecoming false; } ); $('b...

odbc - Converting Oracle date to Access Data format -

odbc - Converting Oracle date to Access Data format - good morning, i linking oracle info (table) through odbc. not have command on how table design or info stored. however, info column in coming in text info type in next format, example: 20120110 i used next code convert date in access: cdate(right([example.my_date],2) & "/" & mid([example.my_date],5,2) & "/" & left([example.my_date],4)) this converts date to: 01/10/2012 is right way going? i getting mix results, meaning result set on query not accurate, want create sure conversion method right. example: `select cdate(right([example.my_date],2) & "/" & mid([example.my_date],5,2) & "/" & left([example.my_date],4)) format_date where (((cdate(right([xample.my_date],2) & "/" & mid([xample.my_date],5,2) & "/" & left([xample.my_date],4)))>#01/09/2012#) order cdate(right([example.my_date],...

How to process webdav server XML request in C# -

How to process webdav server XML request in C# - i writing custom webdav server in c#. 1 of client test programs using netdrive , claims , appears webdav compliant client. problem receiving request on server in next format: <?xml version="1.0" encoding="utf-8"?> <propfind xmlns="dav:"> <allprop/> </propfind> but other clients this: <?xml version="1.0" encoding="utf-8"?> <d:propfind xmlns:d="dav:"> <d:allprop/> </d:propfind> the 2 different namespace formats maintain on fooing logic "allprop" element. code looks bit this: string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><propfind xmlns=\"dav:\"><allprop/></propfind>"; //hardcode create stackoverflow users' lives easier xpathdocument doc = new xpathdocument(new stringreader(xml)); xpathnavigator nav = doc.createnav...

r - How to convert 4d array to 3d array subsetting on specific elements of one of the dimensions -

r - How to convert 4d array to 3d array subsetting on specific elements of one of the dimensions - here easy question.. struggling help much appreciated. i have 4d info wish transform 3d data. info has next attributes: lon <- 1:96 lat <- 1:73 lev <- 1:60 tme <- 1:12 info <- array(runif(96*73*60*12), dim=c(96,73,60,12) ) # fill random test values what calculate mean of first few levels (say 1:6). new info of form: new.data <- array(96*73*12), dim=c(96,73,12) ) # 1 time again test info but contain mean of first 5 levels of data. @ moment way have been able create work write rather inefficient loop extracts each of first 5 levels , divides sum of 5 mean. i have tried: new.data <- apply(data, c(1,2,4), mean) which nicely gives me mean of vertical levels can't understand how subset 3rd dimension average of few! e.g. new.data <- apply(data, c(1,2,3[1:5],4), mean) # returns error in d...

java - Axis 2 (1.6.1) client webservice Basic Auth -

java - Axis 2 (1.6.1) client webservice Basic Auth - i´m trying implement client webservice (axis 2 1.6.1) in jboss 5.1.0 ga. i´ve generated stubs , first invocation (to mockservice) works fine. now want invoke web service (without mockservice) , need inplement basic-authentication. i implements basic authentication code , i´m sure there isn´t bug in code. httptransportproperties.authenticator basicauth = new httptransportproperties.authenticator(); basicauth.setusername("username"); basicauth.setpassword("password"); basicauth.setpreemptiveauthentication(true); stub._getserviceclient().getoptions().setproperty(httpconstants.authenticate, basicauth); since can create invocation using soap ui, believe problem haven´t set "wws-password type" , "wws timetolive" (i have same error message when disable these properties on soap-ui). i think may need set axis2.xml in server set these properties but... when set configuration file ...

html - Segoe UI does not render properly in Google Chrome OR Firefox while running under Windows Server 2008 -

html - Segoe UI does not render properly in Google Chrome OR Firefox while running under Windows Server 2008 - this making development hard, since need on server machine sharepoint deployment. is bug? known issue? html browser

uitableview - Set background color for all UITableViewCells in iOS app -

uitableview - Set background color for all UITableViewCells in iOS app - what's easiest way set backgroundcolor of uitableviewcell s in ios app? consider app has relatively big number of uitableviewcontroller subclasses. background color specified via web service. using color in each tableviewcontroller not easiest thing do. perhaps every tableviewcell inherit uitableviewcell subclass color set derived classes? there might easier way. my recommendation singleton. example: @interface colorthemesingleton : nsobject @property (strong, atomic) uicolor *tableviewbackgroundcolor; +(colorthemesingleton *)sharedinstance; @end and .m : #import "colorthemesingleton.h" @implementation colorthemesingleton @synthesize tableviewbackgroundcolor = _tableviewbackgroundcolor; +(colorthemesingleton *)sharedinstance{ static colorthemesingleton *shared = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ shared = [[colorthe...

ruby - Rails Engine vs. Rack Application -

ruby - Rails Engine vs. Rack Application - i'm thinking writing "add-on" application , releasing gem. however, i'm not sure if should writing rails engine or rack application. differences , should choose? update: thought application sort of "suggestion box". users (or co-workers) can submit suggestions improvements application. then, when you're ready work on new feature, can attach cucumber test (or point location of one) submitter can see when feature has been completed (tests passing). ideally, mount application @ /suggestions or ever , functionality. with rails engine, have powerfulness of rails @ disposal, inherently rack application because of rails. generally rack application have lot of less(or more) bells , whistles compared rails. have figure rack components utilize , how setup middleware if needed. if need quick , testable solution, go rails engines. otherwise building rack application supremely more fun compared rails ...

c# - How to add effects to image -

c# - How to add effects to image - i new image processing.i want know how can add together effects image using emgucv or other technique.just microsoft lifecam.(ex. showing hat on head,showing name on head etc.) please help,thanks in advance. update::i working code face recognition x86 in using function currentframe.draw(...) drow image. want add together new bitmap image current image showing me exception. opencv: operation neither 'array op array' (where arrays have same size , same number of channels), nor 'array op scalar', nor 'scalar op array' so image myimg.add() a start read documentation. i have used emgu cv , there face detection module, returns rectangle of persons face. (haar cascades) once have info easy position graphic on top of image in location relative face. the library supports eye detection draw on glasses using same method above. it's easy utilize , documentation first-class start there. updat...

wpf - Binding from trigger to object in Collection -

wpf - Binding from trigger to object in Collection - i have object these properties: islightonval collection 2 fields: string state name , bool value, can see in 2nd picture: in controltemplate of object, want create trigger for: when value of first object in collection true, this.... i can access property islightonval1 , islightonval1 of 1st picture, cannot access collection. so working fine: <trigger property="islightonval1" value="true"> <setter property="foreground" targetname="tkvalue1" value="{staticresource amber}"/> </trigger> but when seek collection, never have access, tried: <trigger property="{binding islightonval[0].value, relativesource={relativesource ancestortype=namespace:myobject}}" value="true"> <setter property="foreground" targetname="tkvalue1" value="{staticresource amber}"/> </trigger> but tr...

c# - nhibernate generic repositories with object relationships -

c# - nhibernate generic repositories with object relationships - i new nhibernate , have been looking @ repository patterns. problem having how should deal object relationships saving new sub objects generic-repository? am right in thinking best solution create new instance of generic-repository of type of sub object , utilize save them? (pseudo code below) genericrepository<product> genrep1 = new genericrepository<product>(session); product prod = genrep1.find(1); category cat = new category(); genericrepository<category>() genrep2 = new genericrepository<category>(session) genrep2..save(cat); prod.category = cat; genrep1.save(prod); or missing something? or perhaps there improve way? if set product.category cascade.saveupdate (or other kind of cascade) in mapping need save product object , kid object saved (or update) automatically. c# nhibernate repository

What are the security risks I should guard against when running user-supplied Java code? -

What are the security risks I should guard against when running user-supplied Java code? - is there comprehensive list of security issues running user-supplied java code on server? i'm already using timeouts of 10 seconds running code in separate process limited available memory using securitymangager prevent file , network io running code under business relationship extremely limited filesystem permissions i'm running on freebsd server if matters. the question i'd inquire myself is, 'how much trust people, , how much trust code won't break system?' in general, reply not much, , not far throw 'em. but, off top of head, here things want guard against. infinite loops (timeouts help) dodgy i/o operations (trying read/write from/to directories have no access to) privilege escalation code (limiting business relationship able execute in specific context, or specific permissions huge plus) creation of many objects/removing memory (limiting...

Javascript and PHP Regular Expression for url validation -

Javascript and PHP Regular Expression for url validation - possible duplicate: regular look url validation (in javascript) so i've seen many similar questions , answers can't find solution fits specific needs. i'm terrible @ regex's , struggling simple regex next url validation. domain.com domain.com/folder subdomain.domain.com subdomain.domain.com/folder also validate optional http:// , http://www. super helpful. thanks! as near can be: /[a-z]+:\/\/(([a-z0-9][a-z0-9-]+\.)*[a-z][a-z]+|(0x[0-9a-f]+)|[0-9.]+)\/.*/ note question hasn't limited urls set of protocols, tlds or character sets. something skype://18005551212 or gopher://localhost valid url. heck, depending on you're using browse, next might valid ways same server (though not quite same virtualhost): http://stackoverflow.com/ http://64.34.119.12/ http://1076000524/ http://0x4022770c/ they work me in firefox. if want farther restrictions, determine are. ...

java - Android Location DistanceTo null -

java - Android Location DistanceTo null - package com.competitivegamingaudio; import android.app.activity; import android.content.context; import android.location.*; import android.os.bundle; import android.util.log; import android.widget.*; import com.google.android.maps.*;; public class findmyfriendsactivity extends activity { private static final string tag = "findmyfriendsactivity"; public textview locationlabel; public textview distancelabel; public mapview mymapview; public location oldlocation; public location currentlocation; @override public void onresume() { super.onresume(); locationmanager locationmanager=(locationmanager) this.getsystemservice(context.location_service); locationmanager.requestlocationupdates(locationmanager.network_provider,0,0,locationlistener); locationmanager.requestlocationupdates(locationmanager.gps_provider,0,0,locationlistener); } @override public void oncreate(bundle savedinstancestate) { super.onc...