Posts

Showing posts from March, 2012

java - Spring AOP proxy doesn't work as expected -

actually i'am confused behavior of spring proxies. think know main difference between proxy mechanisms of j2ee, cglib , aspectj. have aspectj auto proxy enabled in configuration class , aspectj included in class path. my configuration @configuration @enableaspectjautoproxy(proxytargetclass = true) public class applicationconfiguration { ... } aspectj dependency <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjrt</artifactid> <version>1.8.5</version> </dependency> by using simple setup i've assumed bean injection work intended. instead application results in illegalargumentexception s messages "can not set [...] field [...] com.sun.proxy.$proxy30". means spring uses j2ee proxy service, aspectj proxy enabled. finally i've figured out interfaces on service causes behavior. seems spring decides use j2ee proxy when service implements interface. if remove them, works. failure...

jquery - How can I keep all html in session with webservice? -

i want keep full html in page in session using webservice set session step throw exception. object reference not set instance of object. my functions [webmethod(description = "gsetsession")] [scriptmethod(usehttpget = false)] public void setsession(string html) { httpcontext.current.session["html"] = html; } [webmethod(description = "getsession")] [scriptmethod(usehttpget = false)] public string getsession() { if (httpcontext.current.session["html"] != null) { return httpcontext.current.session["html"].tostring(); } else { return ""; } } in web methods, make sure enable session [ webmethod(description="get session",enablesession=true)] reference

knockout.js - Add class through knockout if viewmodel property is not null -

i have view model property so var customproperties = json.parse(this.model.get('customproperties')); viewmodel.clickeventaction = customproperties.clickeventaction; //returns string such "here" or "there" and trying see if exists in html , if assign class element. have click happen if not null cut down on click events called. i have tried several different ways nothing seems work. like... data-bind="class: {thisisclass: clickeventaction()} data-bind="class: {thisisclass: clickeventaction} data-bind="attr: {class: clickeventaction()} data-bind="css: {thisisclass: clickeventaction() < 0} and i've tried several other ways, nothing seems want work. since property not observable not function. can evaluate directly without "()". data-bind="css: clickeventaction == null ? 'class-name' : '';" where "class-name" class want assign dom object.

javascript - Does calling stop() on a source node trigger an ended event? -

according web audio api specs http://webaudio.github.io/web-audio-api/ i can assign event handler runs when source node done playing (the onended attribute of source node). however, if call stop(0) on audio source node, event triggered? specs don't seem clear on that. i can try out on various browsers, want know proper standard behavior this. ended event fire when source node proactively stop ped? or ended event fire if audio finishes playing? yes does. onended event gets fired when audio finished playing or when stop() has been called. example mdn audiocontext docs var audioctx = new(window.audiocontext || window.webkitaudiocontext)(); var button = document.queryselector('button'); var stop = document.queryselector('#stop'); var source; // stereo var channels = 2; // create empty 2 second stereo buffer @ // sample rate of audiocontext var framecount = audioctx.samplerate * 2.0; var myarraybuffer = audioctx.createbuffer(2,...

office365 - How to update mailbox properties of exchange online by scripting? -

how use script/power shell update these properties of office 365 mailbox, such street, city, state, zipcode, workphone, office, webpage etc.? you can use set-user see https://technet.microsoft.com/en-us/library/aa998221%28v=exchg.150%29.aspx , https://technet.microsoft.com/en-us/library/jj984289%28v=exchg.150%29.aspx cheers glen

PHP/MySQL - Rank on Inner Join -

Image
my query @ moment: select * posts p inner join users u on p.author = u.uid inner join usergroups ug on u.usergroup = ug.gid tid_parent = ? this query, example provide following data: i'd rank beside these (using @currank := @currank + 1 rank maybe). when looping out table keep count , print count value rank $c=1; foreach($results $result){ //all table row html echo $c; //all rest of table row html $c++; }

ios - NSURLSession background upload - need to enable background modes? -

i instantiating nsurlsession several background uploads this: sessionconfiguration = [nsurlsessionconfiguration backgroundsessionconfigurationwithidentifier:myidentifier]; everything seems work ok part, wondering if need add in p.list background fetch key if doing background uploads , not downloads?. not able find documentation saying should or should not. on xcode 5 +, know if under capabilities>background modes, should enable or not background fetch, if doing background uploads, note read response after upload complete, considered "download". the official guide background execution declare 3 type of background executions: executing finite-length tasks - using uiapplication method beginbackgroundtaskwithname:expirationhandler: execute finite time task. downloading content in background - using nsurlsession download content. nsurlsession provided app run on separate system level daemon , when done, gets app completion handler. (your abov...

javascript - Generic session variable key template helper with Meteor -

how can make following helper more generic can set arbitrary session vars matching template vars , retrieve them without such repetitive pattern? template.feedback5.helpers({ 'posx': function() { return session.get('posx'); }, 'dragposition': function() { return session.get('dragposition'); }, 'stuck': function() { return session.get('stuck'); }, 'dragging': function() { return session.get('dragging'); } }); you can register global helper session variable given key : template.registerhelper("getsession",function(key){ return session.get(key); }); and use in spacebars templates : {{getsession "posx"}}

php - How to escape wild cards in SQL Server Like Clause -

i using mssql , sqlsrv libraries (cross platform site) php , have had use snippet string sanitation neither library provides mysqli_real_escape_string equivelent. my function this: public function sanitize($string) { if (is_numeric($string) || $string === 'null' { return $string; } $unpacked = unpack('h*hex', $string); return '0x' . $unpacked['hex']; } the function turns strings hex values cause sql statement in string interpreted string. got somewhere on stack overflow. however like queries string hello% interpret % wild card after hex encoding. in fact % must hex encoded comparison work. how ensure user entered wild card characters not interpreted wild card characters? example query: select lastname, firstname users usercode 'search string' where 'search string' string passed through sanitize function above. add % end of string before query user may put 1 @ beginning or middle or use typ...

php - wpdb not inserting row into the table -

i have form allows input of name ,email & photo...when click on submit want insert row posttype called'contact' info submitted form , image featured image nothing my code <?php if (isset($_post['submit'])) { $yourname=$_post['yourname']; $email=$_post['email']; $myimage=$_post['myimage']; include_once('../../../wp-config.php'); global $wpdb; $table = 'wp_posts'; $data = array( post_title=>$yourname, post_status=>'published', post_type=>'contacts', email=>$email, featured_image=>$myimage ); $wpdb->insert( $table, $data); } ?> <form action="" method="post"> name: <input type="text" name="yourname" value=""> <br> email: <input type="text" name="email" value=""> <br> ...

laravel - Limit number of files that can be uploaded -

how can limit number of files can uploaded? the max validation seems apply size of image (in kilobytes). how can make validation maximum number of files allowed uploaded (for example, 10 files can uploaded single input)? in laravel, there no built-in validation rule that. can create custom-validation rule handle this. here simple custom-validation rule it. create customvalidator.php in app/ directory. validator::extend('upload_count', function($attribute, $value, $parameters) { $files = input::file($parameters[0]); return (count($files) <= $parameters[1]) ? true : false; }); don't forget add app/start/global.php require app_path().'/customvalidator.php'; in validation setting, $messages = array( 'upload_count' => 'the :attribute field cannot more 3.', ); $validator = validator::make( input::all(), array('file' => array('upload_count:file,3')), // first param field name...

Android Studio Run/Debug configuration error: Module not specified -

i getting 'module not specified' error in run config. have no module showing in drop down yet can see module no probs. issue came when refactored module name, changed settings.gradle new name. now when go project structure , select module nothing shows in screen, not error. i'm not 100% sure, icon beside module looks folder cup , not folder phone. my exact steps - open in android view refactor directory name refactor module name change settings.gradle contents: name new name never mind, changed name in settings.gradle , synced , changed , synced again , inexplicably worked time.

ios - MPMoviePlayerController Black Screen when called in shared session -

i have playvideo() method in here: func playvideo() { let url = nsurl(string: "http://mtc.cdn.vine.co/r/videos_r2/20660994a41184015287536758784_sw_webm_14252654515363566800065.mp4?versionid=x5uve9shovypw7z7.vneppyihefx_uwj") //let url = nsurl(string: videourls[videonumber]) //println(videourls[videonumber]) movieplayer = mpmovieplayercontroller(contenturl: url) if let player = movieplayer { player.view.frame = cgrect(x: 0, y: 0, width: 300, height: 300) player.view.center = self.view.center player.preparetoplay() player.scalingmode = .aspectfill player.controlstyle = .none self.view.addsubview(player.view) player.play() } } when directly call viewdidload works without problem. when tried call in shared session that: var task = nsurlsession.sharedsession().datataskwithurl(url!, completionhandler: { data,response,error -> void in if(error == nil) { v...

ms access - Browse to a file location and add hyperlink to the recordset -

i found code allows me browse file location, select it, , add file path string text box on form. add file path string table in database. can show me how that, please? in advance! dim fdg object dim vrtselecteditem variant dim strselectedfile string set fdg = application.filedialog(3) 'set fdg = application.filedialog(msofiledialogfilepicker) fdg .allowmultiselect = false '.initialview = msofiledialogviewdetails if .show = -1 each vrtselecteditem in .selecteditems 'only 1 strselectedfile = vrtselecteditem next vrtselecteditem me![txtselectedfile] = strselectedfile else 'the user pressed cancel. end if end set fdg = nothing thanks response, paul. left out important detail in original question. file path needed added continuous subform because each record may have several files need linked. figured out. code used posted below: dim fdg object dim vrtselecteditem v...

angularjs - Routing for Home Page and URL's for Website -

i'm creating website multiple html files linked ionic framework , using angularjs transfer between states. wondering # means in href , role plays in state transfer. if have href on text <a href="#/app/page2">hi</a> is there way configure url instead of saying localhost/index.html#/app/page2 , localhost/index.html/page2 without "#/app" ? i've tried $locationprovider.html5mode(true); but didn't work first, means # in url any url contains # character fragment url. portion of url left of # identifies resource can downloaded browser , portion on right, known fragment identifier, specifies location within resource read more here -> source putting in other words: portion after # can "served" without making whole http request. in fact portion after # never sent in http request. by default angularjs works # in urls. means angular router fetch urls if have #. in controller, can catch request , fe...

php - Cropping an image using Jcrop and Imagemagick -

Image
i'm confused on how -crop function works in imagemagick. i have following values jcrop. (x1,y1), (x2,y2), width , height. and following command: exec("convert $target_path -crop ".$w."x".$h."+$x+$y +repage $target_path"); original image: result after crop: my question is, how used coordinates , dimensions jcrop, , use them imagemagick? i have no idea values passing convert , command needs extract light region -if aim: convert x.png -crop 240x240+120+100 out.png the first 240 width of cropped area, , second 240 height. 120 x-offset across top-left corner , +100 y-offset down top. or, in general terms, specify crop this convert input.png -crop ${x}x${y}+${a}+${b} output.png

ajax - How can I return text only from Spring servlet? -

here's story, have single page application, want call servlet ajax object, , have text returned servlet displayed on webpage. here's example of how it: index.html <!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> <script src="jquery.js" type="text/javascript" ></script> <script type="text/javascript"> function submittext() { var xmlhttp = new xmlhttprequest(); xmlhttp.open("get", "submit", true); xmlhttp.send(); document.getelementbyid("mytextfield").innerhtml = xmlhttp.responsetext; } </script> </head> <body> <input type="text" name="mytext" /> <br> <button onclick="submittext()">submit</button> <br> <div id="mytextfield"></div> </...

css - HTML input + label collides with JSSOR gallery's script - ANY FIX? -

i wonder if tried add input radio buttons , associated labels jssor image gallery. prototype tried achieve , works: https://jsfiddle.net/agq0rgol/ the goal set first input , label default having checked until click next label (i put img inside label) link associated radio button. in end used input:checked , input:checked + label modify styles (opacity in case) but linkage between radio button , label not work when insert them jssor gallery. checked not working well. just know if there workaround/fix this. the problem has been fixed, please download latest version. also, please remove <a> element html code. that's replace, <a><img src="http://d3d71ba2asa5oz.cloudfront.net/40000483/images/thumbnail1.jpg"></a> with <img src="http://d3d71ba2asa5oz.cloudfront.net/40000483/images/thumbnail1.jpg">

pygame - How do people make a Level in a game with a list of strings in python -

i know because making games in pygame , use method because looks neat , tidy. exe level = "wwwwwwww" \ "wssssssw" \ "wssssssw" \ "wssssssw" \ "wssssssw" \ "wwwwwwww" here s's empty space , w's blocks if use method, need define dimensions of level - levelwidth , levelheight, in case 8 , 6, can find block @ x, y code: levelwidth = 8 levelheight = 6 def getblock(x, y): return level[x * levelwidth + y] remembering indexes x , y both start @ 0 , end last item @ index length - 1 because of python's method of indexing. here different method have used in situations this: level = ['wwwwwwww', 'wssssssw', 'wssssssw', 'wssssssw', 'wssssssw', 'wwwwwwww'] with method need find block @ (x, y) is: level[x][y] but remember if want able edit level, need create ne...

Execute javascript without webview in Android -

i'm trying execute js fonction in android app. function in .js file on website. i'm not using webview, want execute js function because sends request want. in console in browser have question.vote(0); , how can in app ? you can execute javascript without webview. can use androidjscore . here quick example how might it: httpclient client = new defaulthttpclient(); httpget request = new httpget("http://your_website_here/file.js"); httpresponse response = client.execute(request); string js = entityutils.tostring(response.getentity()); jscontext context = new jscontext(); context.evaluatescript(js); context.evaluatescript("question.vote(0);"); however, won't work outside of webview, because presume not relying on javascript, ajax, not part of pure javascript. requires browser implementation. is there reason don't use hidden webview , inject code? // create webview , load page includes js file webview.evaluatejavascript("...

regex - Python regexes: return a list of words containing a given substring -

what function f based on regexes that, given input text , string, returns words containing string in text. example: f("this simple text test basic things", "si") would return: ["simple", "basic"] (because these 2 words contain substring "si" ) how that? i'm not convinced there isn't better way approach, like: import re def f(s, pat): pat = r'(\w*%s\w*)' % pat # not thrilled line return re.findall(pat, s) print f("this simple text test basic things", "si") works: ['simple', 'basic']

java - for loop with two variable conditons -

i got question in exam today loop 2 variable(question below ) why output of code has 1 line when giving 2 system.out.println statements. public class loop { public static void main(string[] args) { int i; int j; (i = 0 , j = 0 ;j < 0 ; ++j , ++i ){ system.out.println( + " " + j); } system.out.println( + " "+ j); } } output: 0 0 any explanation loop 2 variables appreciated. i starts off @ 0. condition requires j < 0. loop never entered.

c++ - Using Python callbacks via SWIG in OR Tools -

i hoping simple swig issue. using google or-tools optimization library. c++ library wrapped in swig (which know little about). having great difficult getting python callback function work. there c++ function decisionbuilder* makephase(const std::vector<intvar*>& vars, indexevaluator1* var_evaluator, intvaluestrategy val_str); along with typedef resultcallback1<int64, int64> indexevaluator1; and relevant swig (i believe) is decisionbuilder* varevalvalstrphase( const std::vector<intvar*>& vars, resultcallback1<int64, int64>* var_evaluator, operations_research::solver::intvaluestrategy val_str) { return self->makephase(vars, var_evaluator, val_str); } and in swig file have %{ static int64 pycallback1int64int64(pyobject* pyfunc, int64 i) { // () needed force creation of one-element tuple pyobject* pyresult = pyeval_callfunction(pyfunc, "(l)", st...

c# - Extracting count from where clause -

i have table of movie reviews: movieid userid rating 72 64817 5 238 4984 4 167 48176 2 37 19841 1 122 987981 2 48 , on.... 129 143 27 177 47 201 220 12 247 if specify particular movieid, know how display userid's rated movie, along rating. my question: if there no reviews submitted users, how display message saying so? if there no reviews, how capture characteristic? tried many things (working gui in c#): sql = string.format("select count(1) num reviews movieid = '{0}'", textbox1.text); cmd = new sqlcommand(); cmd.connection = db; cmd.commandtext = sql; object result = cmd.executescalar(); int numreviews = system.convert.toint32(result); if (numreviews == 0) { messagebox.show("no reviews"); } else { //i display them. got part } if result supposed number (cou...

excel - Change the value of another cell -

i looking excel-vba code directly show text in cell based on value of cell ,let me elaborate . table follows: i input grades in column cells a3:a13 the code must print corresponding comment on own ,like if a1 - excellent if a2 - work this code must work entry of range of 40 grade entries grades ------ comments a1 ------ excellent b2 ------ work harder a1 ------ excellent b1 ------ satisfactory a2 ------ work the following code continues until finds student in column has not been graded: sub gradecomments() dim grade string, comment string dim integer = 3 ' starting row while > 0 grade = range("a" & i).value if grade = "a1" comment = "excellent" elseif grade = "a2" comment = "good work" elseif grade = "b1" comment = "satisfactory" ...

r - Efficient way to analysis neighbours of subsets of nodes in large graph -

i have graph of 6 million of nodes such require(igraph) # graph of 1000 nodes g <- ba.game(1000) with following 4 attributes defined each node # attributes v(g)$attribute1 <- v(g) %in% sample(v(g), 20) v(g)$attribute2 <- v(g) %in% sample(v(g), 20) v(g)$attribute3 <- v(g) %in% sample(v(g), 20) v(g)$attribute4 <- v(g) %in% sample(v(g), 20) among nodes have subset of 12,000 of particular interest: # subset of 100 nodes v(g)$subset <- v(g) %in% sample(v(g), 100) what want obtain analysis (count) of neighbourhood of subset . is, want define v(g)$neigh.attr1 <- rep(na, vcount(g)) v(g)$neigh.attr2 <- rep(na, vcount(g)) v(g)$neigh.attr3 <- rep(na, vcount(g)) v(g)$neigh.attr4 <- rep(na, vcount(g)) such na replaced every node in subset corresponding count of neighbouring nodes v(g)$attribute{1..4}==true . i can create list of neighbourhood of interest neighbours <- neighborhood(g, order = 1, v(g)[v(g)$subset==true], mode = "out...

r - regression analysis (by year and firm) -

sorry, i'm awkward in english , r. hope understand words. my data set follows. year, week, a017670, a030200, a032640, market, ind.20 2000, 2000-01, 0.02, -0.001, 0.005, 0.007, 0.004, 2000, 2000-02 ... 2000, 2000-52 2001, 2001-01 ... 2014, 2014-52 i want extract adjusted r-squared , sse regression models . and want write (save) adjusted r-squared sse . my models follows: lm(a017670~market+ind.20, subset=(year=2000)) lm(a017670~market+ind.20, subset=(year=2001)) ... lm(a017670~market+ind.20, subset=(year=2014)) lm(a030200~market+ind.20, subset=(year=2000)) lm(a030200~market+ind.20, subset=(year=2001)) ... lm(a030200~market+ind.20, subset=(year=2014)) lm(a032640~market+ind.20, subset=(year=2000)) lm(a032640~market+ind.20, subset=(year=2001)) ... lm(a032640~market+ind.20, subset=(year=2014)) i need adjusted r-squared , sse each model. my data 15 years data of 700 companies (a017670, a030200, a032640, ....

c# - Executing msbuild process through code gets exit code -1073741502 -

my application executing msbuild.exe using process.start(); running user. process running service. when executing process instantly fails , returns error code -1073741502 . i executing code service. no matter user, or permissions grant occurs (even administrator). the service user has both local security policy run service , impersonate user no matter logging methods not called. means it's failing before starts? other executables have no problem executing in manner. when not executing code service executes successfully. wtf negative error code 1073741502 ??(!!) closest thing i've found this . example code: void main(){ var startinfo = new processstartinfo { filename = path, arguments = args, workingdirectory = workingpath, createnowindow = true, useshellexecute = false, redirectstandardoutput = true, redirectstandarderror = true, loaduserprofile = true, domain = system.environmen...

javascript - Jquery ui sortable issue with css3 transform -

i facing position issue when used jquery ui sortable css3 transform. jsfiddle : http://jsfiddle.net/vipin/hzvlfhxd/2/ here have used jquery ui sortable, css3 transform scale , translate. there problem while sorting top bottom. a gap appears between cursor , object while sorting bottom or trying sort bottom objects. try this remove transform:translate(50px) scale(0.777); css(.wrapper) , check

Performance Issue with Asynchronous PHP-Curl Request -

Image
the objective of following scripts send asynchronous php-curl request server. i've been using "fire , forget" technique in curl request sent server timeout_ms set 100 . mainprocess.php proceed delay of 100 milliseconds , sendme.php send curl server c without delaying execution of mainprocess.php script. i used script (benchmarking.php) print execution time of firing overall procedures. benchmarking.php $time_start = microtime(true); php-curl post server b (mainprocess.php) $time_end = microtime(true); $time = $time_end - $time_start; echo $time; initially, $time low. continuously fire benchmarking.php $time increases . resetting apache server (server b) option in order decrease $time variable again. hence, must have resources or connection handling of php. suggestions or workaround appreciated regards problem. illustration of procedures. references fire , forget techniques: http://www.tsartsaris.gr/how-to-make-asynchronous-post-with-php http://www.pa...

swing - Java - How to show an input dialog having a dropdown list with an icon for each item? -

Image
i using java code in swing application show input dialog has drop-down selection list user can select item list : string[] carmodelsarray = { "honda", "mitsubishi", "toyota" }; string selectedvalue = (string)joptionpane.showinputdialog( null, "select car model list below:", "car model...", joptionpane.question_message, null, carmodelsarray, carmodelsarray[ 0 ] ); this code works fine, wondering if can add icon each item in selection list, drop-down selection list appear : i have tried set items in list jlabel items, jlabel objects converted string values when rendered inside drop-down list if calls jlabel.tostring() method each item in list value. so there way accomplish ? short answer, not way you're doing it. long answer, more like... import ja...

Tryng to get a json response from API web to Android with android-async-http lib -

i've been working android-async-http ( http://loopj.com/android-async-http/ ) lib android reason can't catch response server, know server recieve , things should do, can't response no reason. here method calls api: public user registuser(string mail, string pass) throws unsupportedencodingexception { final user user = new user(); user.settoken("enter"); string bodyasjson = "{\"user\":{\"email\":\""+mail+"\",\"password\":\""+pass+"\"}}"; stringentity entity = new stringentity(bodyasjson); header[] headers = { new basicheader("content-type", "application/json") }; client.post(this.context, "http://104.131.189.224/api/user", headers , entity, "application/json", new jsonhttpresponsehandler() { @override public void onsuccess(int statuscode, header[] headers, jsonobject json) { ...

windows phone 8 - List box is not scrolling to last item -

i developing windows phone 8 application, in using list box display data. have requirement once page launched user should navigate last item of list box. requirement used scroolintoview method lsbsample.scrollintoview(lsbsample.lastordefault). moving last item not fully. showing last item around 60% remaining 40% need manually scroll list box. can 1 me resolve issue. thanks in advance. i think can try code scroll_content.updatelayout(); scroll_content.scrolltoverticaloffset(double.maxvalue); https://social.msdn.microsoft.com/forums/en-us/a6e3f3b6-44db-4201-828a-af7fffa7219e/scrollviewer-force-scroll-to-bottom?forum=silverlightnet

ruby - Error running Rails server on OS 10.10.2 -

versions mac os: osx 10.10.2 ruby: 2.2.1p85 rails: 4.2.0 context i following "install rails" tutorial online @ www.installrails.com. made through after encountering many errors. on last step of creating sample app, worked fine, , running server. now, run error. errors here seeing: /users/work/.rvm/gems/ruby-2.2.1/gems/json-1.8.2/lib/json/ext/parser.bundle: [bug] segmentation fault @ 0x00000000000418 ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14] -- crash report log information -------------------------------------------- see crash report log file under 1 of following: * ~/library/logs/crashreporter * /library/logs/crashreporter * ~/library/logs/diagnosticreports * /library/logs/diagnosticreports more details. -- control frame information ----------------------------------------------- *a lot of information listed here* -- ruby level backtrace information ---------------------------------------- *a lot of information...

php - How to send email in laravel -

i have tried this. <?php return array( 'driver' => 'smtp', 'host' => 'smtp.sendgrid.net', 'port' => 587, 'from' => array('address' => 'from@example.com', 'name' => 'john smith'), 'encryption' => 'tls', 'username' => 'sendgrid_username', 'password' => 'sendgrid_password', ); mail::send('emails.demo', $data, function($message) { $message->to('jane@example.com', 'jane doe')->subject('this demo!'); }); but getting error: failed authenticate on smtp server username "sendgrid_username" using 2 possible authenticators how resolve problem. please me. make sure settings ok, username , password correct, function should work posted.

selenium webdriver - How access weblements in a child window in IE8 browser -

i trying access web elements in child window in ie8 browser. i not able access of element in child window, tried developer tools (f12) in browser, macros x path, page source id/name elements nothing working there. 1 me please what mean :- nothing working there? be specific. you can open website in firefox or other advanced web-browser element's selectors , later run automated scripts using ie 8 driver.

ios - is this GCD implemented getter setter thread safe and work better than @synchronized? objc -

@interface viewcontroller () @property (nonatomic, strong) nsstring *somestring; @end @implementation viewcontroller @synthesize somestring = _somestring; - (nsstring *)somestring { __block nsstring *tmp; dispatch_sync(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ tmp = _somestring; }); return tmp; } - (void)setsomestring:(nsstring *)somestring { __block nsstring *tmp; dispatch_barrier_sync(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ tmp = somestring; }); _somestring = tmp; } @end some said it's better @synchronized way because locking handled down in gcd. first off, setter makes no sense @ all, , using default concurrent queue not want. code should more like: @interface viewcontroller () @property (nonatomic, copy) nsstring *somestring; @end @implementation viewcontroller { dispatch_queue_t _stateguardqueue; } - (instancetype)init { if (self = [super init]) ...

android - App crashes when bringing the app to foreground while playing high memory games -

i have wiered problem app. when bring app foreground background while playing high memory consuming games asphalt 8, app crashes. this happens when play high memory app asphalt 8 .the crashing occuring because activity context becomes null. i have no idea on how fix this. there knows solution on how fix this. thanks in advance :) update logcat: 7927-7927/com.xxxxx.android.beta e/androidruntime﹕ fatal exception: main process: com.xxxxxx.android.beta, pid: 7927 java.lang.runtimeexception: unable start activity componentinfo{com.xxxxxx.android.beta/com.xxxxxxxxx.android.login.initialscreen}: java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.object android.content.context.getsystemservice(java.lang.string)' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2314) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2388) @ android.app.ac...

C++: Enum definition in class after usage -

is there general way how compilers handle enum definitions in class, in, work use enum in private: define in public: section afterwards? code example: class myclass{ private: myenum mymember; public enum myenum { a, b, c }; } it seems work using gpp, proper usage? you'd need other way round class myclass{ public: enum myenum { a, b, c }; private: myenum mymember; }; so define enum before use. however, making definition of enum public, storing in private fine - might not want users able write mymember directly, you'd want them understand if class function returned myenum .

I need to profile a local Tomcat Java Application with Visual VM, but Profile tab is disabled -

i have profile local tomcat web application visual vm, when start visual vm , open tomcat connection, profile option in applications menu disabled , can't profile it. i'm using visual vm 1.3.8 , java_home points jdk 1.8 folder. i'm starting tomcat through eclipse kepler , in catalina.bat file i'm starting tomcat jdk 1.8 too. in eclipse i'm working jdk 1.8 default environment. have tried change de tmp folder because read in issues mine, although have tmp folder in c:\temp directory, profile tab doesn't show. what can do? things i'm doing wrong? can add vm options follow, profile remote in visual vm. -dcom.sun.management.jmxremote.port=xxxx -dcom.sun.management.jmxremote.ssl=false -dcom.sun.management.jmxremote.authenticate=false

Can I capture a label not found in the test string using regex? -

assuming have strings of following type: session opened (uid=0) session opened scotty is possible write regex either capture text " root " if (uid=0) found in string, otherwise capture normal user name (i.e. scotty )? regex not allow capture is missing input string. if know structure of input text, can have regex pattern return required part. here example works .net-based regex flavor: (?s)(?<=\(uid=0\).*opened )\w+ matches found: [0][0] = scotty

jQuery - If first element has class then Function -

i'm looking add piece of code sitewide affect of pages. right now, goes this. if($('#container > div:first').attr('id') == 'filteroptions') { $('#container').prepend('<div class="banner"></div>'); } the output: <div id="container"> <div class="banner"></div> <div id="filteroptions"><div> </div> example , if container looked this: <div id="container"> <div class="existingbanner"></div> <div id="filteroptions"><div> </div> nothing happen first div doesn't have filteroptions id. now i've hit bump have looks banner added to <div id="container"> <a class="existingbanner" href="#"></a> <div id="filteroptions"><div> </div> this have double banner want avoid. because it's...

sql server - DACPAC Deploy via c# fails due to missing user -

i wrote small tool uploads .bak file local sql instance , retrieves dacpac newly created database. dacpac deployed sql instance, not on same machine. all these steps done in c# via microsoft.sqlserver.smo , microsoft.sqlserver.dac. however, last step (deploying remote server) fails, saying process not create user. can live dropping user, don't want manually modify dacpac file or database. tried configuring deploy process in order skip user, doesn't work. this code deploy: var remoteservice = new dacservices(targetconnection); try { var package = dacpackage.load(file.fullname); var settings = new dacdeployoptions(); settings.ignoreusersettingsobjects = true; remoteservice.deploy(package, targetname, false, settings); } catch (exception ex) { console.writeline(ex.message); deletedb(targetname, targetconnection); } on execution, following error message shown (freely translated, couldn't find error or similar on google don't know actual e...

Use Javascript Timer in Node.Js Script to fire an event at certain time -

i have 40 or more timer in node script (a timer per connection) count time , call function when it's finished. job, want call function @ 23:59; have 2 solution: use java script timer check time , call function @ 23:59. use linux schedule emit event @ 23:59. which more logical? there solution? take @ node-cron module, i've used schedule recurring tasks on node apps before: node cron

powershell - Search GC replicas and find AD account -

i have issue ad replication. use 3rd party app create accounts in ad , powershell script (called app) create exchange accounts. in 3rd party app can not tell gc ad account has been created on , therefore have wait 20 minutes replication happen. what trying find gc account has been created on or replicated , connect server using.... set-adserversettings -preferredserver $adserver i have below script , can't work out stop when finds account , assign gc $adserver variable. write-host line there testing. $forestinfo = [system.directoryservices.activedirectory.forest]::getcurrentforest() $gcs = $forestinfo.findallglobalcatalogs() import-module activedirectory foreach ($gc in $gcs) { write-host $gc.name get-aduser $aduser } tia andy you can check whether get-aduser returns more 0 objects determine whether gc satisfied query. after that, use set-adserversettings -preferredglobalcatalog configure preference you need specify want search global catalog , not loc...

PHP array and string -

i have array containing dates (year) , position. need build string out of it, where: every position separated / if it's in different year ; , - must appear if there no result on year. , if have -, there no need use / separate years ... i'm struggling build logic , code it. example: array(7) { [0]=> array(2) { ["year"]=> string(4) "2015" ["hformpos"]=> string(1) "2" } [1]=> array(2) { ["year"]=> string(4) "2015" ["hformpos"]=> string(1) "4" } [2]=> array(2) { ["year"]=> string(4) "2015" ["hformpos"]=> string(1) "5" } [3]=> array(2) { ["year"]=> string(4) "2015" ["hformpos"]=> string(1) "5" } [4]=> array(2) { ["year"]=> string(4) "2015" ["hformpos"]=> int(0) } [5]=> array...

ios - One different key between multiple Info.plist files per scheme? -

my application's info.plist file has around 20/30 keys inside. external sdk we're implementing requires app key set in info.plist , requires separate keys debug, enterprise distribution, , release schemes. is there way can create conditional additions info.plist without having maintain 3 duplicates of file (and duplicate of other keys, identical across targets)? basically i'd base plist now, additional new -debug , -distribution , release ones, contain new key. i'm trying avoid repetition of keys, since make adding new ones in future hassle. is possible? there few different things might try. xcode run script executed before app build script automatically executed before build. let's 3 duplicate plist files called infoa.plist, infob.plist , infoc.plist exact duplicate. when build project contents of infoa.plist duplicated infob.plist , infoc.plist. require knowledge of writing shell script that, script simple. you duplicate , rename files ...

javascript - React + webpack: 'process.env' is undefined -

Image
i'm trying run hot dev server on our site webpack; site uses reactjs, has code in it: if (\"production\" !== process.env.node_env) // etc when not running hot-swap it's fine, hot-swap, gets run, resulting in error: typeerror: process.env undefined the code looks this: the project modelled after https://github.com/webpack/react-starter does work; question is; error have made in config file and/or how go looking error when 'production' compilation works fine? i've posted gist of webpack config file . in webpack config, there 2 options can affect process.env : when specify config.target (see config.target ) when define process.env variable via defineplugin looking @ code, looks process.env might undefined when both options.prerender , options.minimize false . you fix using environment defines process.env (ex: node ), or using defineplugin assign default value variable yourself.

c# - Lazy initialization error with parameter -

i coding mvc internet application , have question in regards lazy initialization. here working code before lazy initialization: declaration: private validationservice validationservice; initialization: validationservice = new validationservice(genericmultiplerepository); here code trying: declaration: private lazy<validationservice> validationservice; initialization: validationservice = new lazy<validationservice>(genericmultiplerepository); here error: error 125 best overloaded method match 'system.lazy.lazy(system.threading.lazythreadsafetymode)' has invalid arguments i have looked @ lazy<t> constructor documentation , don't see wrong. the constructor of lazy expects func returns validationservice type specified: validationservice = new lazy<validationservice> ( () => new validationservice(genericmultiplerepository) ); that equivalent to: validations...

Split String and add in combobox in c# -

im getting data database , adding combobox.the string contains list of names comma. datarow dr = newdt.rows[i]; traineecombo.items.add(dr["trainee"].tostring()); it works fine want split string , add each item combobox. tried below methods. datarow dr = newdt.rows[i]; string temptr = dr["trainee"].tostring(); string[] result = temptr.split(new char[] {','}); foreach (string s in result) { if (s.trim() != "") traineecombo.items.add(s); } second method: string temptr = dr["trainee"].tostring(); traineecombo.items.addrange(temptr.split(',')); but both methods shows error cannot convert string char[] , invalid arguments. got piece of sample code msdn.how can solve it? try this datarow dr = newdt.rows[i]; string temptr = dr["trainee"].tostring(); string[] result = temptr.split(','); foreach (string s in result) { if (s.trim() != "") trai...

How can I embed a web page in Adobe Flash Builder? (FLEX) -

i want embed web page in flash (adobe flash builder) using basic knowledge. mean want app able use 3d structure, spinning etc... , heard can use view can put url-link or appear it's in app. about web page it's (the 3d viewer embed of https://3dwarehouse.sketchup.com/model.html?id=4ceb45eacc729c5ea611269c93d910 ) thanks!

php - retrieve database username and password -

i did pretty stupid , lost database user , password.i want edit file on server notepad++,but of course must provide user , pass access server-editing connection(also in file trying access-index.php-i have these data connect database).i tried using table inspector on file(an application) doesn't show php code(where have database connection user , pass) html code.editing path file in notepad++ show html code in "index[1].php" file.is there way retrieve user , pass?i know seems hacking,but i'm trying access own files , own mysql database if own database server. stop database. , start database skip-grant-tables option. contain option my.cnf(or my.ini). can access database without username , password. reset account , restart database server without skip-grant-tables option

mysql - Getting the sum of several columns from two tables result is not correct -

i'am trying sum of 2 columns different tables, have found great posts on stack. of them helped me out. still can't solve problem out.. this query somehow down below returns incorrect total of sum of coulmns, ( rate coulmn - materialprice column ) mysql> tbl as_servicetickets; +----------+----------+ |ticket_id | rate | +----------+----------+ | 11 | 250.00 | | 11 | 300.00 | | 11 | 400.00 | | 9 | 300.00 | | 9 | 300.00 | | 9 | 1500.00 | | 9 | 250.00 | +----------+----------+ total 2 350.00 mysql> tbl as_ticketmaterials; +----------+---------------+ |ticket_id | materialprice | +----------+---------------+ | 11 | 100 | | 9 | 20 | | 9 | 50 | +----------+---------------+ total 70.00 query---------------------//// select sum(`as_servicetickets`.`rate`) `sercnt`, sum(`as_ticketmaterials`.`materialprice`) `sercnt` `as_servicetickets`, `as_ticketmateri...

vb.net - Diagnosing cause of SQLite locking -

on vb.net application, have case users actions in 1 portion of form creating sqlite lock causes problems later in application (in case, closing down). here sub-routine called when users add data list of items printed: private sub btnadd_click(byval sender system.object, byval e system.eventargs) handles btnadd.click ' add item printqueue => regenerate listprint.items dim queueitem new dictionary(of string, string) queueitem("quantity") = inputquantity.value.tostring queueitem("description") = textdesc.text queueitem("sizeuk") = inputsize.value.tostring.replace(".5", "½").replace(".0", "") queueitem("sku") = liststyles.selecteditem.tostring queueitem("colour") = textcolour.text queueitem("date") = textdatecode.text queueitem("name") = textname.text try queueitem("sizeeu") = sizeeu(inputsize.value).tostring...