Posts

C# Create one Label filled with 2d string array -

Image
im doing c# maze should fill screen like x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x the x's places randomly , mouse trying find way out. having trouble finding way fill x's. tried creating 2d string array full of x's , fill label, no luck. what best way of doing this? using panel or maybe don't know about? have in wfa same example other answer windows forms :) same. public partial class form1 : form { public form1() { initializecomponent(); } private void panel1_paint(object sender, painteventargs e) { var blackpen = new pen(brushes.black); (int y = 0; y < 10; y++) { (int x = 0; x < 10; x++) { e.graphics.drawline(blackpen, new point(x*20, y*20), new point(x*20 + 10, y*20+10)); e.graphics.drawline(blackpen, new point(x*20, y*20+10), new point(x*20 + 10, y*20)); } } } } you have...

io - Python: Shifted Averaging And Space Delimiting -

i'm trying figure out average set of predictions (values between 0 , 1 model has created. prediction values shifted, however, such if there 10 data values predictions made in sets of 3 so: 0.6825 0.7022 0.7023 0.6193 0.6410 0.6389 0.5934 0.6159 0.6145 0.5966 0.6191 0.6184 0.3331 0.3549 0.3500 0.1862 0.2015 0.1999 0.1165 0.1270 0.1267 0.1625 0.1761 0.1740 wherein these values correspond indexes follows: 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10 i'm trying write script such read input line line , output average of prediction values appropriate each index (average 2 twos together, 3 threes, 3 fours, etc) such there 1 per line: 0.6825 0.7001 etc... however, i'm not sure how read in data such i'm able differentiate between 0.6825 , 0.7022 in line 1, example. how read in information such i'm able store in contiguous array? as far logic goes, figure can have special cases first, second, last, , second-to-last values,...

JAXB on JAX-RS - JPA Entity with relations returns no JSON HTTP 500 no error on logs (Glassfish) -

i trying build rest endpoint using jax-rs return jpa entities in json format. found similar question though after applying similar changes in case still http 500 internal error code , glassfish produces no log or shows no error messages related request. here code: entity class: @xmlrootelement @entity @table(name = "tb_banner_image") public class bannerimage extends baseentity<integer> { private filereference filereference; private string type; private string labeltitle; private string labeltext; public bannerimage() {} @id @tablegenerator(name="genbannerimage", table="tb_id_generator", pkcolumnname="id_name", valuecolumnname="id_val", pkcolumnvalue="tb_banner_image", allocationsize=1) @generatedvalue(strategy=generationtype.table, generator="genbannerimage") @column(name = "id_banner_image", unique = true, nullable = ...

javascript - Debugging SVG performance on IE 10 -

i have pretty complicated svg doc i'm displaying on ie 10. it's stretched full size of viewport , uses viewbox attribute. i'm noticing transforming layers in doc extremely slow (like, 1fps slow). not happen in other desktop browsers. aside js profiling using f12, have ideas on other tools available ie10 relevant figure out what's slowing down transformations?

php - Is it possible for Apache to mod_rewrite a file to its absolute path? -

question is possible re-write symlinked document root resolved absolute path? in other words, let's assume have following directory structure: /www/current -> /www/tags/a /www/tags/a /www/tags/b so /www/current symlink points /www/tags/a. if /www/current document root, possible re-write file path /www/tags/a, file being served no longer following symlink, serving file @ full absolute path? note not asking followsymlinks . want re-write served file full absolute path. background info so may asking, why care this? well, there appears issue symlinked paths when serving php content. if use symlink part of deploy process, , flip @ exact wrong time, appears apache read previous file, , yet php instantiate magic constants such __file__ resolved new directory. so in previous example, race condition play out follows: 1) apache receives request /www/current/myfile.php 2) apache/mod_php reads file /www/tags/a/myfile.php 3) symlink gets flipped /www/current -...

if statement - Perl If-Elsif-Else always going to else -

i have block of code in larger program suppose take letter (a...d) , convert number (0...3). reason jumps down else. here code: $aa = shift @filearray; chomp($q); chomp($a1); chomp($a2); chomp($a3); chomp($a4); chomp($aa); print "1:$aa\n"; #convert answer number $ab = 0; if ($aa eq "a") { $ab = 0; } elsif ($aa eq "b") { $ab = 1; } elsif ($aa eq "c") { $ab = 2; } else { $ab = 3; } print "2:$ab\n\n"; the output along lines of 1:b 2:3 1:a 2:3 1:d 2:3 1:c 2:3 1:d 2:3 1:b 2:3 1:b 2:3 1:a 2:3 1:d 2:3 now realize @ point subtract 65 ascii value, still want know...what happening? maybe $aa contains invisible characters (whit...

excel vba - Run time error 91 in vba -

private sub commandbutton1_click() dim rng range dim range dim cell range dim hvalue double dim svalue double set rng = selection hvalue = 0 svalue = 0 each cell in rng next cell if cell.value > hvalue hvalue = cell.value 'here run time error 91 each cell in rng next cell if cell.value < hvalue , cell.value > svalue cell.value = svalue msgbox "hvalue= " & hvalue & "svalue=" & svalue end sub your error because variable cell valid locally inside loop , if statement outside loop. move if statements inside loop this. private sub commandbutton1_click() dim rng range dim range dim cell range dim hvalue double dim svalue double set rng = selection hvalue = 0 svalue = 0 each cell in rng if cell.value > hvalue hvalue = cell.value next cell each cell in rng if cell.value < hvalue , cell.value > svalue cell.value = svalue next cell msgbox "hvalue=...