Posts

javascript - Same hover function for multiple paths in Raphael -

so i've got canvas , paths: var paper1 = raphael(10, 50, 960, 560); var mapshape1 = paper1.path("m339.098,175.503c0,0-55.555,58.823-16.34,75.163s227.451,49.02,227.451,49.02s67.321-25.49,47.713-50.98s-71.896-78.432-71.896-78.432l339.098,175.503z"); var mapshape2 = paper1.path("m548.902,306.876c0,0-209.15-32.026-228.758-46.405s-27.451-27.451-20.262-42.484s26.797-44.444,26.797-44.444l-41.83-86.928l-76.471,77.125c0,0-25.49,169.935,48.366,171.242s292.157-4.575,292.157-4.575v306.876z"); var mapshape3 = paper1.path("m296.614,86.614l38.562,83.66l194.771-7.843l75.817,81.7c0,0,130.066-84.967,73.203-118.301s503.15,48.706,463.935,51.974s296.614,86.614,296.614,86.614z"); and style them this: (i believe improved, there way paths @ once???) function style1(shape){ shape.attr({ "fill": "#33ccff", "stroke": "000000", "stroke-width": "5" }); } style1(map...

c# - Iterating through object types in a list of parent type -

i trying iterate through list of objects , change ones match particular type. current code looks this. (platform extension of entity, , entities list of type entity) foreach (platform p in entities.oftype<platform>) { p.dostuff() } i getting error "foreach cannot opperate on 'method group'" anyone's help. :) alright : foreach (platform p in entities.oftype<platform>()) //will loop through object of platform type in entites.oftype<platform>()

c# - Need help finishing or rewriting this algorithm for navigating a Generic Collection -

i trying come code algorithm set current object based on whether or not user clicks "forward" button or "backward" button. public step currentstep { { return _currentstep; } set { if (_currentstep != value) { _currentstep = value; onpropertychanged("currentstep"); } } } private int currentstepindex { get; set; } private void nextstep() { currentstepindex++; gotostep(); } private void previousstep() { currentstepindex--; gotostep(); } private void gotostep() { var query = step in currentphase.steps ???? select step; currentstep = query.first(); } currentphase.steps observablecollection<step> steps {get; set;} . , in constructor class have means of setting default value property " currentstep " there 1 spring-board off of. given collection hoping use index of currentstep object stored in currentstepindex go...

c# - A Star Search Algorithm -

here have query regarding star search algorithm. i'm building known 8 piece puzzle. game 9 places (1 empty) , have arrange tiles in correct order meet goal position. i need verify have written algorithm correctly can seek elsewhere in code issue. i believe algorithm correct because able solve first pre-set puzzle have created requires 1 move reach goal position. however, unable solve puzzles require more moves. i've tried work in 3 different ways , bring same issue. attempt 1: while (openlist.count() > 0) { puzzlenode currentnode; var orderedopenlist = openlist.orderby(puzzlenode => puzzlenode.getpathcost()); currentnode = orderedopenlist.first(); if (compare(currentnode.getpuzzle(), goalarray) == true) { //openlist.removeat(0); //poll break; // otherwise push currentnode onto closedlist & remove openlist } else ...

sql - MySQL - rand from the defined values -

i'm trying insert random values tables. don't want make new values totally random (like eg: random numbers or characters),i want take random value set of values defined earlier. example: defined values: xyz, abc, edf random value: abc i programming languages it's easy, in sql don't know, how store defined values , how take random value. put random values in table. then, can insert them 1 @ time doing: insert tables(val) select val randomtable order rand() limit 1 the order rand() limit 1 chooses random value list.

c# - Why can't I use format specifier on DataGrid Value? -

string foo = selectedrow.cells["foo"].value.tostring("d5"); gives me error of no overload method 'tostring' takes 1 arguments so had use string foo = selectedrow.cells["foo"].value.tostring().padleft(5,'0'); anyone can explain why? datagridviewcell.value of type system.object . object.tostring() method not take arguments. therefore, cannot provide format specifier.

Unchecked and runtime exceptions in java -

this question has answer here: difference between java.lang.runtimeexception , java.lang.exception 11 answers in java, have checked exceptions , unchecked exceptions. also, have runtime exceptions. question - runtime exceptions unchecked exceptions , unchecked exception runime excepions? means can these 2 words used interchangeably? all runtime exceptions (e.g. nullpointerexception) unchecked exceptions. since errors (e.g. stackoverflowerror) unchecked exceptions, not unchecked exceptions runtime exceptions. the java language specifications define unchecked exception: "the unchecked exception classes run-time exception classes , error classes."