Posts

Showing posts from September, 2011

Querying a number from a range in Rails -

say have item range in it: item.rb :min_age # 3 :max_age # 7 :type :available now have display item range. currently doing this: item.where(type: item_type.singularize.capitalize, available: true, min_age: age) however display items within min_age..max_age range. tried conditions, apparently not doing right. item.where(type: item_type.singularize.capitalize, available: true).where("min_age > ?", age).where("max_age < ?", age) i think work.

How to access the Event Loop from Node.js code? -

is there native function can executed node.js code outputs array or object containing information what's supposed in event loop? recently there a request see in event loop, in io.js project. there 2 names of functions surfaced, in this comment , process._getactivehandles() gets handles still alive process._getactiverequests() gets info active libuv requests. this can collect event loop, guess. note: both of them undocumented functions , cannot rely on them in production code.

r - data.table operations by column name with spaces fails -

reproducible example #use iris data set library(data.table) iris colnames(iris)[3] <- "petal length" iris <- as.data.table(iris) accessing column without space fine iris[,petal.width] however access column name contains space doesn't work iris[,petal length] iris[,'petal length'] the solution seems be iris[,iris$'petal length'] comments i'm new data.table. understand there's lot of quirks in data.table; 1 of them? change variable names rid of spaces, i'd prefer not if didn't need to. read previous questions regarding column names - , understand in 2 years since last question updates have allowed - can seen in ease when colname has no spaces. just use with = false explained under data.table faq points 1.1-1.3 , 2.17: iris[ ,'petal length', = false] and make sure read excellent introduction data.table pdf vignette , new html vignettes . in case, expect (a vector), using [[ more appropria

msbuild - TFS 2015 RC Build.Preview Execute xUnit Tests -

we trying xunit tests run using tfs 2015 rc. we're trying access test runner stored in our solutions nuget packages folder lives in our build agent's drop folder. we trying reference test runner using path in "path custom test adapters" $(build.sourcesdirectory)\webiz\packages\xunit.runners.1.9.2\tools.the build able resolve path okay (it failing before invalid path message), cannot find test runner 2015-06-09t20:05:40.4008595z executing powershell script: d:\tfs\build_vnext\agentschlitz\agent\tasks\vstest\1.0.8\vstest.ps1 2015-06-09t20:05:41.9947507z warning: path 'd:\tfs\build_vnext\agentschlitz\1c692895\webiz\webiz\packages\xunit.runners.1.9.2\tools\' specified in 'testadapterpath' not contain test adapters, provide valid path , try again. extensions. example: vstest.console.exe mytests.dll /usevsixextensions:true what should proper configuration "path custom test adapters"? should proper configuration be: $(build.sourcesdirect

Open Mozilla Firefox Browser using JavaScript -

my application default start google chrome. when user access 1 of menu option , open that url mozilla firefox browser. not google chrome. can please me on same? possible open explicit browser javascript? thanks , niraj salot. which browser opened dependant on users os (if browser present, browser primary etc etc), such it's not can done through browser. it massive security risk if browser could open external application open exploits , abuses pretty go. about permissiable way create plug-in chrome request user if open link in browser, thats alot of work this. you'd better off checking browser being used (again since have no control on 1 users using) , politely ask open link in firefox.

java - Why does if statement not work properly inside for loop? -

i have array classified same value.. int[] clusters= 0 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 int[] clusterdistinct = 0 1 2 it fine using code below, on last statement (if statement) inside loop not print. don't know whats wrong code private void autoclustering(int[] clusters) { int[] clusterdistinct = getclusters(clusters); (int = 0; < clusterdistinct.length; i++) { system.out.println("\ncluster " + clusterdistinct[i]); (int j = 0; j < clusters.length; j++) { if (clusters[j] == clusterdistinct[i]){ system.out.print(j+","); } } } } private int[] getclusters(int[] clusters) { arraylist<integer> klaster = new arraylist<integer>(); (int =

asp.net - Get the url without the name of the method that called it -

i try url of website plus current controller without method called it. inside examplecontroller, examplemethod request.url.tostring() => http://localhost:51747/.../examplecontroller/examplemethod i need http://localhost:51747/.../examplecontroller the solution use parse , remove after last slash, not sure if there method using server info. your issue can solved using 1 of url.action html helper overloads. generate example url: http://localhost:51747/.../examplecontroller you need do: @url.action("examplecontroller", "index", null, request.url.scheme) assuming using default asp.net mvc routing config. in more detail, if action provide helper 1 set default in routeconfig, not specified in resulting url. routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); see action = "in

version control - Reverse Merge and svn:mergeinfo -

we using svn manage development pipeline, in merge changes first stage of development environment second-stage branch. have created tools merge revisions first stage second stage. what want alert users using tool when there prior revisions files affected revisions tool moving in first stage not exist in second stage, in order them review potential logical dependencies (regardless of whether these cause merge-conflict), , determine whether these prior revisions should moved second-stage branch. however, running problem revisions reverse-merged showing false positives. here's scenario alice commits revision 100 file stage 1. alice realizes have made huge mistake , reverse-merges r100 create r101 same file. bob codes new change r102 same file. carl ready test bob's change , wants pull second-stage. alerted revisions 100 , 101 impact same program, , should reviewed logical dependencies. according svn red book section on mergeinfo : applying reverse merges tar

unix - starting a new process group from bash script -

i want run script (which calls more scripts) in new process group can send signal processes called script. in linux, found out setsid helps me in doing that, not available on freebsd. syntax setsid (provided util-linux-ng). setsid /path/to/myscript i, learnt session , process group not same. starting new session solves problem. sessions , groups not same thing. let's make things clean: a session consists of 1 or more process groups, , can have controlling terminal. when session has controlling terminal, session has, @ moment, 1 foreground process group , 1 or more background process groups. in such scenario, terminal-generated signals , input seen every process in foreground process group. also, when session has controlling terminal, shell process session leader, dictating process group foreground process group (implicitly making other groups background process groups). processes in group put there linear pipeline. example, ls -l | grep | sort typically cr

sitecore7 - Sitecore Inheriting an Item from Branches (Inheriting complete structure) -

in sitecore 7.0, content editor, possible set base template of item lets 'bank' branch item (by branch item mean item created in /sitecore/templates/branches/ ) lets branch item company 2 folders in address , contacts . so when item created template " bank " 2 folders "address" , "contacts" created. i think answer no, but, may define branch definition outside /sitecore/templates/branches/ location. branche item template /sitecore/templates/system/branches/branch if helps structure. an other options create folders automatically item:added event. and if want share structure other branches can try clone branch, create clones, never used in way, no idea if works correctly.

javascript - Jquery $.post not working as expected -

i'm creating web app using php , jquery , , mongodb , running trouble $.post . have page table each row marked custom button designed in css. use following script index of button , pass php file. gets correct index , posts file fine. <script> $(".completed").click(function() { var index = $(".completed").index(this); $.post("lock.php", {position: index}); }); </script> lock.php supposed put index session variable , load new page called display_page.php , display_page never gets loaded , no errors displayed in firebug. i've tried posting display_page directly not change anything. here lock.php looks like: <?php $pos = $_post['position']; session_start(); $_session['index'] = $pos; header('location: display_page.php'); ?> if point in right direction appreciate it. you need below:- <script> $(".completed").click(function() { var index =

regex - How to get token before dot('.') at current cursor postion in javascript for autocompletion in codemirror editor? -

function (editor, currentpos) { return editor.gettokenat(currentpos); } i designing code editor custom language. so, want autocompletion based on mode state. want token before . when press ctrl + space during hello . then, method should give me hello can suggest properties related it. how can this? the javascript-hint addon this, continuing previous token in loop until finds not property. want code looks similar.

c# - Trying Zip different folders in in a specified directory using ZipFile -

i found code below on stack overflow tried didn't know how use fully. basically want able zip files separately using foreach loop won't have list of files change each time. so how can list of folders/directories inside root directory array? public static void createzipfile(string filename, ienumerable<string> files) { var zip = zipfile.open(filename, ziparchivemode.create); foreach (var file in files) { zip.createentryfromfile(file, path.getfilename(file), compressionlevel.optimal); } zip.dispose(); } normally use dotnetzip , code: using (var file = new zipfile(zipname)) { file.addfiles(filenames, directorypathinarchive); file.save(); } where zipname name of zip archive want create , filenames names of files want put in it.

powershell - Entitiy Framework migration with EF in multiple projects -

currently trying separate data model different project in same solution, code first. if have 1 project ef( 6.1.3 ) installed, migration ( enable-migration , add-migration ) work intended. but add other project , install ef packet, if try enable-migration , i've got error: join-path : cannot bind argument parameter 'path' because null. @ c:\projects\ims 2\packages\entityframework.6.1.3\tools\entityframework.psm1:713 char:27 + $toolspath = join-path <<<< $installpath tools + categoryinfo : invaliddata: (:) [join-path], parameterbindingvalidationexception + fullyqualifiederrorid : parameterargumentvalidationerrornullnotallowed,microsoft.powershell.commands.joinpathcommand join-path : cannot bind argument parameter 'path' because null. @ c:\projects\ims 2\packages\entityframework.6.1.3\tools\entityframework.psm1:780 char:73 + $utilityassembly = [system.reflection.assembly]::loadfrom((join-path <<<< $toolspath

javascript - XMLHttpRequest cannot load file:///myfilepath/www/aws-sdk?=xxxxxxxxxx -

i rather new phonegap. trying build simple app javascript,html , jquery. unable connect server after appropriate objects created. var s3 = new aws.s3({accesskeyid: accesskey , secretaccesskey: secretkey}); //listing buckets console s3.listbuckets(function(error, data) { if (err) { navigator.notification.alert(err); } else { (var index in data.buckets) { var bucket = data.buckets[index]; console.log("bucket: ", bucket.name, ' : ', bucket.creationdate); } } });

jquery - Isotope select filter by link/button -

i using isotope.js on wordpress website , buttons below logo activate corresponding filters , scroll page #content do. website: http://www.nuweb.si/terramystica/ for isotope functionality a3 portfolio plugin used https://wordpress.org/support/plugin/a3-portfolio thanx! isotope filter can set code this: $grid.isotope({ filter: '.metal' }); check documentation: http://isotope.metafizzy.co/filtering.html so should set correct filter upon clicking navigation buttons

angularjs - How to set an object to the updated value returned by Angular $resource? -

how save object $resource , set object api response value returned $resource ? i have object, value (which part of array of objects iterating through), save rest api. when save successful, api responds same object, plus details such object's id (if save create) or perhaps file paths end saved to. stuff front end can't know until end adds it. i want update saved value object details returned in response , can't figure out how it. i have tried returning response $resource callbacks, can't make work. returns $$state object (which don't know with) rather response. may doing wrong. in case rather set value object response object inside success callback, because want set object response when save successful, not when there's error. but don't know how pass value object callback updated, crux of problem. (and can't figure out how search array object inside callback because $resource success response doesn't include $$hashkey . erro

How to change emphasis on confirm javascript buttons? -

i have following javascript: var leave_page_confirm = true; function save_data_check() { var msg; if (leave_page_confirm === true) { $('.input-right').each(function() { if (this.value) { msg = 'you have unsaved data on page.'; return false; } }); } return msg; } window.onbeforeunload = save_data_check; this confirm box displays when have unsaved data in form on pages. however, when appears emphasis (default button) "leave page" emphasis on "stay on page" despite quite bit of googling, can't seem find code changes emphasis of buttons on confirm alert. is there way accomplish this? you might want refer question: how personalize alert buttons - window.confirm() , window.alert() basically, can't. can make own modals kind of thing , have full control on looks , buttons emphasized.

php - Correct way to run a select query from blades in laravel 5 using eloquent -

what correct way retrieve column value based on select filter on model variable availed compact method inside blade. (larevl 5) read bad practice query database staright views, , hence followed convention avail required data compact method view however, in scenario need query table based on column value returned in foreach loop inside blade first table, unable figure out correct approach example: have 2 models user & group schema user table id,name,email,group_id scheme group table id , groupname here usercontroller -> compact method $users = \app\user::all(array('id','name','email','group_id')); $groups = \app\group::all(array('id','group_name')); return view('user.index', compact('users','groups')); here how blade needs them @foreach ($users $user) <tr> <th>{{$user->id}}</th> <th>{{$user->name}}</th>

python - Pandas - Convert Unbalanced Panel Data to Cross Section -

actually unsure if end of cross-section because it's on time period, think still. i have data frame looks this: player finish tournament year id ------------------------------------------------ aaron baddeley 9 memorial 2012 1 aaron baddeley 17 masters 2013 1 aaron watkins 15 open 2012 2 adam scott 9 open 2014 3 adam scott 4 memorial 2014 3 alex cejka 8 open 2010 4 andres romero 2 memorial 2012 5 andrew svoboda 19 memorial 2014 6 andy sullivan 13 memorial 2015 7 i want convert data single observations, desired output this: player 2012_memorial 2013_memorial 2014_memorial ... id ---------------------------------------------------------------------------- aaron baddeley 9 17 2012 1 adam scott na na 9 3 . . .

PHP Notice: Array to string conversion Error -

this question has answer here: reference - error mean in php? 29 answers <?php $arr00 = array(1,5,7); $arr01 = array(9,6,3,$arr00); $arr02 = array(4,8,12,$arr01); echo $length = count($arr00); echo "<br />"; echo $length1 = count($arr01); echo "<br />"; echo $length2 = count($arr02); echo "<br />"; for($i = 0; $i < $length; $i++) for($j = 0; $j < $i; $j++) for($k = 0; $k < $j; $k++){ echo "<pre>"; print_r($arr02); echo "</pre>"; } foreach ($arr00 $value) { echo $value." "; } foreach ($arr01 $value1) { echo $value1." "; } foreach ($arr02 $value2) { echo $value2." "; } notice: array string conversion in c:\xampp\htdocs\mywebpage\3dimns.php on l

javascript - Remove duplicates in an array of objects -

i've read posts duplicates removed array. example, array "one", "one", "two", "three" return "one", "two", "three" using code i've found in posts. need remove both values "one", "one", "two", "three", return "two", "three". i'm parsing file , searching items based on regular expression. here's have code. there times though there duplicate data in file i'm parsing. need remove data. function parsetext(text) { var records = text.match(fileregex); var filearray = []; if (records != null) { records.foreach(function (element, index, array) { var matches = elementregex.exec(element); if (matches != null) { var year = matches[parsesettings.parseyearposition]; if (year == 2) { year =

Play Framework: How to call a Javascript Function from a Scala Template -

i have scala template shows bunch of model objects , gives user option add or delete these objects. each model object has location data associated it. i'd embed google map on page, , users manipulate (add,delete,edit,load) place marker each model object on map. i can map loaded correctly, don't understand how call js functions scala template directly. template looks this: @(stupas:list[stupa], stupaform:form[stupa]) @import helper._ <head> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=apikey"></script> <script type="text/javascript"> var map; function initialize() { var mapoptions = { center: { lat: -34.397, lng: 150.644}, zoom: 8 }; map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); console.log("map should init now&q

jenkins - Git/CI workflow: remote branch to specify version to deploy on integration-test system? -

we using remote branch point @ version deployed our continous-integration system (jenkins) on integration test system (using docker). whenever update remote branch, ci system checks out , builds branch , deploys result on integration test system. this works fine, long branch follows branch (merges , fast-forward commits). when want switch integration-test system between feature branches, easier reset branch pointer. however, reseting remote branch pointer seems prohibited in default configuration ( git reset --hard , remote repository ). before going change default configuration - there (best-practice) alternative using remote branch workflow we've realized? try following: set generic job no git repo set job paramaterized build plugin provide branch name on demand build parameter have default value in build steps, manually kick off git command makes use of branch name via parameter provided this not automate process unless schedule job run every "x&qu

Dynamically changing javascript function for efficiency -

my question has optimizing javascript code more efficient. i have function called code inside needed called once, so: function removeblankcanvas() { if ( --numberofchartsstillloading == 0 ) { //do stuff } } this works fine function still called countless times after numberofchartsstillloading 0, , know never 0 again. i'm thinking doing this: function removeblankcanvas() { if ( --numberofchartsstillloading == 0 ) { //do stuff removeblankcanvas = function() { return true; } } } could more efficient code? instance, if function called millions of times? i'm asking strictly curiosity's sake. your performance bottleneck unlikely simple if statement. this trick cause unexpected result, because functions immutable, , have callbacks keep reference original function, after changed name reference function. my 2 cents: find real performance issues optimize.

ios - custom uitableviewcell label hide/show -

i have custom table view cell in table view controller. on cell there label want either show/hide based on row information. can show/hide label based on row information. possible expand or collapse height of tableview cell based on whether label present or not? expect 1 row of data label. use -tableview:heightforrowatindexpath: attach uitableviewdelegate uitableview's delegate. , implement above method , set height depending on if cell collapsed or expanded. -(cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return (indexpath.row == _rowindexwithlabel) ? tableview.rowheight + _heightoflabel : tableview.rowheight; }

asp.net mvc - pass empty string when user does not input anything in @HtmlTextboxFor -

facing problem have @htmltextboxfor when user doesnot insert returning error how pass empty string or null if left blank. the parameters dictionary contains null entry parameter 'fromdate' of non-nullable type 'system.datetime' when user doesnot insert pass empty string or null value otherwise value inserted user. whats wrong code. public class reportviewmodel { public string fromdate { get; set; } public string todate { get; set; } private tdbcontext tdbcontext; private ireportservice reportservice; public void viewreportlist(datetime fromdate, datetime todate) { reportservice = new reportservice(tdbcontext); reportlist = reportservice.getreportslist(fromdate, todate); } } view @model req.viewmodels.reportviewmodel @using (html.beginform("index", "print", formmethod.post)) { @html.textboxfor(m => m.fromdate, new { @readonly = "readonly", @class = "d

difference between Theme.AppCompat, @style/Theme.AppCompat, and @android:style/Theme.AppCompat -

what's difference between: theme.appcompat @style/theme.appcompat @android:style/theme.appcompat and in case should use 1 vs other? also, make difference if write <style name="customactionbartheme" parent="theme.appcompat"> instead of <style name="customactionbartheme" parent="@style/theme.appcompat">

looping through the list of thumbnails and linking them to larger images using Flickr API and Jquery -

i trying display thumbnails flickr , link them larger images. thumbnail portion working, can't "wrap" thumbnails link larger image. got piece of code elsewhere links thumbnails own source , works. //var url set above https://api.flickr.com/services/rest/? bla bla // loop through photos var src; $.getjson(url + "&format=json&jsoncallback=?", function(json_received){ $.each(json_received.photoset.photo, function(i,item){ thumbnail = "https://farm"+ item.farm +".static.flickr.com/"+ item.server +"/"+ item.id +"_"+ item.secret +"_q.jpg"; large = "https://farm"+ item.farm +".static.flickr.com/"+ item.server +"/"+ item.id +"_"+ item.secret +"_b.jpg"; $("<img/>").attr("src", thumbnail).appendto("#images"); //add links - thumbnails linked $("img").each(function()

javascript - JQUERY Donation for paypal -

hello stackoverflow community!, this might lot ask i'm trying make donation box, user able select donation amount or write amount. once confirm button clicked direct user paypal page amount set on page. able guide me in right direction? i'm @ html , css (currently learning jquery , php). i got inspiration website - http://www.losttype.com/font/?name=liberator many thanks paypal has guide on create donate button . can take @ document: how add donate button page using paypal payments standard .

Automatically update time in PHP using Ajax -

how automatically update time in php using ajax..the below command work refreshing page hit f5 or reload button.. echo date('s'); or if necessary update time using ajax in php.. so can done using php , ajax. lets have 2 files index.php , timer.php. can achieve desired results doing following. in index.php <?php echo "<html> <head> <title>todo supply title</title> <meta charset='utf-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <script src='http://code.jquery.com/jquery.js'></script> <script> $(document).ready(function(){ setinterval(_inittimer, 1000); }); function _inittimer(){ $.ajax({ url: 'timer.php', success: function(data) { console.log(data); data = da

URL-encoding VARCHAR and TEXT values in PostgreSQL -

are there well-known pl functions/libraries extending postgresql (9.4.1) database url encoding (also known percent encoding ) capabilities? here's example of intended functionality: input string: international donor day: give blood cause! output string: international%20donor%20day%3a%20give%20blood%20for%20a%20good%20cause%21 i guess alternative roll out own implementation, since afaik there no built-in way of doing this. this trivial in external pl,e.g. create language plpythonu; create or replace function urlescape(original text) returns text language plpythonu $$ import urllib return urllib.quote(original); $$ immutable strict;

Memory error in c++ (armadillo) -

i wanted solve kind of ordinary differential equation (master equation) , wrote following program in c++ of armadillo: #include <iostream> #include <armadillo> #include <iomanip> using namespace std; using namespace arma; cx_mat tens( cx_mat a1,cx_mat a2,cx_mat a3,cx_mat a4,cx_mat a5,cx_mat a6,cx_mat a7,cx_mat a8,cx_mat a9,cx_mat a10,cx_mat a11,cx_mata12,cx_mat a13,cx_mat a14,cx_mat a15,cx_mat a16,cx_mat a17,cx_mat a18,cx_mat a19,cx_mat a20,cx_mat a21) {return kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(kron(a1,a2),a3),a4),a5),a6),a7),a8),a9),a10),a11),a12),a13),a14),a15),a16),a17),a18),a19),a20),a21);} cx_mat ii(2,2,fill::eye);// make 2*2 identify cx_matrix cx_mat ee = ii.col(0); // extract column vector cx_mat gg = ii.col(1); cx_mat a1 =tens(ee,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg); cx_mat a2 =tens(gg,ee,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg,gg); cx_mat a3 =tens

vb.net - unwanted treeview node duplicating at the end of list -

i have following code cant seem find reason (nor solution) why parent node keeps appearing @ end of list duplicate? imports system.io public class form1 private sub form1_load(sender object, e eventargs) handles mybase.load dim di new io.directoryinfo("c:\la") dim diar1 io.fileinfo() = di.getfiles() dim dra io.fileinfo each dra in diar1 'dim sr streamreader = new streamreader(dra.fullname) if system.io.path.getextension(dra.name).tolower() = ".xls" treeview1.nodes.add("offerts") treeview1.nodes(0).nodes.add(dra.name) end if next end sub end class on first .xls file finds, creates "offerts" node in root of tree, , creates node filename under "offerts". on subsequent .xls files, creates another "offerts" node in root, , creates node filename under first node (the first "offerts" node created). so think want create "of

java - JavaFX TextArea - unwanted ScrollBars when resizing -

Image
i have problem resizing update/event of textarea in javafx. illustration created empty javafx project through intellij idea anchorpane root pane , anchorpane contains textarea propecties anchorpane.bottomanchor="0.0" anchorpane.leftanchor="0.0" anchorpane.rightanchor="0.0" anchorpane.topanchor="0.0" in sample.fxml file (in short: textarea takes space of scene). problem description: launch application , starts in small window (300 x 275). maximalize it. there normal behavioral, when got in window, both of scrollbars shown. similar situation happens when resizing window smaller window. when start scrolling, nothing happens textarea viewport. when start write letter or resize window bigger window, scrollbars disappeared. that's strange behavioral! my question: there listener or method catch/stop showing scrollbars when isn't necessary? have got problem too? screenshot after return maximized form main.java package sample;

jquery - ReSharper is extremely slow with JavaScript files -

the original issue slows , freezes.currently i'm using resharper 9 vs 2013. when start typing in mark file contains javascript/jquery or javascript file , before can 3rd or 4th letter out processing , reformatting file. @ times ide isn't responsive @ all. limit number of files open , turn off analysis @ page level in hopes that limit resources being used. go resharper → → profile visual studio, , take profile snapshot of slow behaviour. reported jetbrains , dev team can investigate. more details available @ this support post . also, try disabling other plugins (both visual studio , resharper) see if helps - perhaps something's conflicting?

java - Why does eclipse say I have no return statement in this method -

i wrote helper method class doing in java eclipse ide. code method follows private foo getfoomonitor(string id) { if(foolist.isempty()) { if (mgr.getvalue(name, listpath + id) == null) { return null; } } else { for(foo f : foolist) { if(f.getid().equalsignorecase(id)) { return foo; } } return null; } } i curious why if method forced return something, since has if else block has return statement hit no matter what, why eclipse think not have return statement? is eclipse enforcing weird syntax because has trouble parsing if else block see method forced return, or java thing not allowing non void method valid unless has return statement last line in method body? not paths return. if mgr.getvalue(name, listpath + id) == null returns false method doesn't have return value

entity framework - EF6: Why Does Count return 0 but Find return an element? -

in code using (var db = new dbperson()) { var b = db.people.create(); b.name = "homer"; db.people.add( b ); console.writeline( "count: {0}", db.people.count() ); foreach (var bb in db.people) console.writeline( bb.name ); var fb = db.people.find( b.id ); // id guid generated in person ctor // not db-generated identity. console.writeline( "found: {0}", fb != null ); db.savechanges(); console.writeline( "count: {0}", db.people.count() ); } the output looks this: count: 0 found: true count: 1 i have seen other posts count not being updated until savechanges called. ok, "way works". my question this: why find return object db.people when count() returns 0 , enumerator returns no elements? shouldn't find , count() act similarly, waiting savechanges before returning entities in "added" state? what reasoning this? ask be

javascript - Input type text not taking values even after making it editable -

hi have requirement editing fields when click on edit link.initially fields under disabled , readonly state.oncei click on edit value should blank , editable. my problem here value changed blank , can place cursor in text box.but not taking values type. below code: <html> <head> <style></style> <script type="text/javascript"> function editemail(){ var demo = document.getelementbyid('email'); demo.readonly = false; demo.disabled = false; demo.value=" "; return false;} function editmob(){ var demo = document.getelementbyid('mobile'); demo.readonly = false; demo.disabled = false; demo.value=" "; return false;} </script> </head> <body> <h3>edit profile</h3><h3>${username}</h3> <form action="/changeprofile" method="post"> <table> <tr> <td><l

asp.net mvc - "ExceptionMessage": "Multiple actions were found that match the request: -

hi found many helpful link solve nothing working me :(. can 1 @ going wrong? controller : [actionname("savebook")] [httppost] public httpresponsemessage postsavebook([frombody]book product) { return add(product); } [actionname("savemobile")] [httppost] public httpresponsemessage postsavemobile([frombody]mobile product) { return add(product); } webapirouteconfig. config.routes.maphttproute( name: "controlleronly", routetemplate: "api/{controller}" ); // controller id // handle routes `/api/vtrouting/1` config.routes.maphttproute( name: "controllerandid", routetemplate: "api/{controller}/{id}", defaults: null, constraints: new { id = @"^\d+$" } // integers ); // controllers a

c# - Unity: Text type issue in a ScoreManager script -

i've done ui canvas , attached ui text , named scoretext . have scoremanager script resetting score , writing text it. code public class scoremanager : monobehaviour { public static int score; text text; void awake () { text = getcomponent <text> (); score = 0; } void update () { text.text = "score: " + score; debug.log (score); } } the code attached scoretext . working in official unity's survival shooter tutorial , worked project well. but problem text text not recognized. "the type or namespace text not found." it worked in unity4 . current project in unity5 . counting works fine in debug.log . want set score text. add using unityengine.ui; at top of code in order import namespace. side note, tag unity game engine unity3d , not unity :)

C# - I am trying to create a grid lock game and I need your assistance -

since don't have 10 reputation post image, going leave link of game picture. http://thinkfun.com/mathcounts/play-rush-hour this want create. game rectangle must pass through other rectangles through hole win game. main rectangle can move forward , other rectangles can move either right, left, or down depending on position. must move other rectangles in way make way main rectangle pass. here plan how going create game: create forms, import images , graphics ready work them. write code 1 rectangle able move around. write algorithm wouldn't allow rectangles go through each other. make winning hole. code other rectangles, make full game. make fancy animations. import statistics : score, move counter , etc. here questions wanted ask before trying develop game. (oh, , way, using visual studio c# form ) i assume these rectangles not going buttons, kind of "button" (or whatever call features ) should use? how make skin rectangles? can make wood , mak

javascript - JSON object passed to Controller is NULL -

i understand question has been posted thousand times, have tried every solution no avail. i have json object: { "manufacture":"hp", "model":"testmodel", "serialnumber":"testserial", "description":"test description", "checkin":true, "stand":false, "tilt":true, "pivot":false, "heightadjust":true, "size":27, "porttypes":"2 vga", "resolution":"1080p" } i pass json object controller just function submitmonitor(monitor monitor) return false end function the ajax call pass controller follows: jquery.ajaxsettings.traditional = true; $.ajax({ url: '@url.action("submitmonitor", "home")', type: 'get', contenttype: 'application/json', //contenttype: "application/json; charset=utf-8", //datatype: 'json&

java - on clicking pass value of anchor tag to another file -

i trying print data database anchor tags , pass value(in rs.getstring(1)) next jsp file(demo.jsp) on clicking it. tried make session , retrieve values it, in file demo.jsp printing last values in database. know because of session being replaced everytime loop runs. able print data in given file, problem occuring pass value demo.jsp. there alternative way of doing this <% try { string cars2=request.getparameter("cars"); class.forname("oracle.jdbc.driver.oracledriver"); connection con=drivermanager.getconnection("jdbc:oracle:thin:@amit-pc:1521:xe","system","tiger"); preparedstatement st=con.preparestatement("select thread thread_all car=?"); st.setstring(1,cars2); resultset rs; rs=st.executequery(); while(rs.next()) { %> <div class="rows"> <div class="

html - Table width does not work in Outlook 2010 -

i have created campaign (edm) client , works in mobile, tablet , modern browsers chrome , safari on desktop, not work in outlook 2010 on windows pc. width of table extends width of outlook window layout broke. (imgs: when works in chrome / that's happens in outlook 2010 ) here code use tables: <table align="center" width="600px" cellpadding="0" cellspacing="0" border="0" table-layout="fixed" > <tbody><tr><td style="text-align:left" overflow: "hidden"></td></tr></table> thank help! do not define widths or heights on tables rows , cells. rows invalid html. table cells can have widths when cell sharing space cell , cell needs restricted specific width. cells can have heights let content or image define , cell adhere contents dimensions. you missing of head information required email clients correctly render design. , hadn't closed wrappi

selenium - How to disable Reader View in Firefox using webdriver -

whenever run test in firefox, 'reader view' message box pops in address bar. pop hides element view, webdriver throwing "elementnotvisibleexception. pop displayed pages in languages other english. disabled reader view option. not me much.any thoughts on how overcome issue appreciated. thanks something this: @before public void setup() throws exception { firefoxprofile firefoxprofile = new firefoxprofile(); firefoxprofile.setpreference("reader.parse-on-load.enabled",false); driver = new firefoxdriver(firefoxprofile); baseurl = "http://google.com"; driver.manage().timeouts().implicitlywait(30, timeunit.seconds); } should it.

java - Android studio Gradle is not building the new Jar file -

i wanted try new android lib, added dependency in new version of android studio. not @ building project only. below gradle file, new lib added compile 'com.android.support:design:22.2.0' `apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "droid.myapplication" minsdkversion 8 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) // compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.android.support:design:22.2.0' } ` exception coming in log file as. i'm new android studio, getting t

c++ - WinVerifyTrust error code handling -

i've been tasked determining whether particular dll third party company has been tampered with, after installation on user's system. i've never done related digital signing before. i'm trying set test on own system using winverifytrust. { wintrust_file_info wtfi; wtfi.cbstruct = sizeof(wintrust_file_info); wtfi.pcwszfilepath = text("*****.dll"); //wtfi.hfile = dllhandle; wtfi.pgknownsubject = null; guid wtvpolicyguid = driver_action_verify; wintrust_data wtd; wtd.cbstruct = sizeof(wintrust_data); wtd.ppolicycallbackdata = null; wtd.psipclientdata = null; wtd.dwuichoice = wtd_ui_none; wtd.fdwrevocationchecks = wtd_revoke_none; wtd.dwunionchoice = wtd_choice_file; wtd.pfile = &wtfi; wtd.dwstateaction = wtd_stateaction_ignore; wtd.pwszurlreference = null; wtd.dwprovflags = wtd_revocation_check_none; //wtd.psignaturesettings = null; // win8 , server2012 only? long

java - Trie Data Structure in Finding an Optimal Solution -

this question part of ongoing competition , have solved 75% of question data set 25% giving me tle. asking why it's giving tle sure complexity o(n*n) question: string s consisting of n lowercase english alphabets. has prepared list l consisting of all non empty substrings of string s . asks q questions. ith question, need count number of ways choose ki equal strings list l example: string = ababa l = {"a", "b", "a", "b", "a", "ab", "ba", "ab", "ba", "aba", "bab", "aba", "abab", "baba", "ababa"}. k1 = 2: there 7 ways choose 2 equal strings ("a", "a"), ("a", "a"), ("a", "a"), ("b", "b"), ("ab", "ab"), ("ba", "ba"), ("aba", "aba"). k2 = 1: can choose string l (15 ways). k3 = 3: there

javascript - How to use the <webview> methods in Electron -

on electron <webview> documentation there list of methods can use object. when try run of methods, none of them work. when looked in inpect properties of <webview> element in inspector, says prototype webview . ( __proto__ : webview ) it in prototype of methods stored. element should inherit methods prototype when use methods (e.g. mywebview.opendevtools() ). however! when use object.getproptotypeof(mywebview) htmlelement , not webview shows in inspector. here example of code: <webview id="mywebview" src="path/to.file"></webview> <script> var mywebview = document.getelementbyid('mywebview'); console.log("mywebview: ",mywebview); console.log("prototype: ",object.getprototypeof(mywebview)); //=> htmlelement mywebview.opendevtools(); </script> i discovered issue , added example electron documentation the bottom line need add listener webview listens when webview el