Posts

c# - Accessing a Parent form button from a Child form button -

i have program has parent form creates child form. upon clicking updatebutton within child form, want searchbutton within parent form fire. however error protection reasons. have tried setting public see, still wont work me. error 1 'salessystem.systemform.searchbutton' inaccessible due protection level salessystem\updateform.cs 111 20 salessystem this have far. parent code namespace salessystem { public partial class systemform : form { public systemform() { initializecomponent(); } protected void searchbutton_click(object sender, eventargs e) { //search code } private void updatebutton_click(object sender, eventargs e) { try { updateform upform = new updateform(resultbox.selecteditems[0].text, dbdirec, dbfname); upform.showdialog(this); } catch (exception) ...

java - I've got a very strange crash during Android TextAdventure development -

http://scr.hu/0eug/7vny2 the situation: i press button should launch part of code (work in progress on this, it's not complete yet): public void playerattack1(view view){ setcontentview(r.layout.activity_fight_defense); displaystats(); int attacktype = 1; int dmgminimum = 10; int dmgmaximum = 15; random rn = new random(); int range = dmgmaximum - dmgminimum + 1; int damage = rn.nextint(range) + dmgminimum; fight_p_attack(damage, attacktype); sb.insert(0,"attack!\n"); textview = (textview) findviewbyid(r.id.teststring); textview.settext(sb); public void fight_p_attack(int damage, int attacktype){ setcontentview(r.layout.activity_fight_defense); int k9minimum = 1; int k9maximum = 9; random rn = new random(); int range = k9maximum - k9minimum + 1; int k9 = rn.nextint(range) + k9minimum; switch (attacktype){ ...

javascript - Elements with display set to none are shown -

i have created following greasemonkey script firefox filter class names in long list of java api reference : // ==userscript== // @name jdk api doc helper problematic // @version 1 // @namespace xolve // @description provides in place search jdk api docs // @include http://docs.oracle.com/javase/7/docs/api/* // @run-at document-end // ==/userscript== var classnamesframe; var classnamesdoc; var classnameshash = {}; var timeoutid; function textboxtextchanged(ev) { window.cleartimeout(timeoutid); console.log(ev.target.value); // case insensitive comparision var query = string(ev.target.value).trim().tolowercase(); timeoutid = window.settimeout(filterclassnames, 600, query); } function filterclassnames(query) { if(query.length == 0) { for(k in classnameshash) { classnameshash[k].style.display = ""; } return; } for(k in classnameshash) { if(k.startswith(query)) { con...

java - Custom JComponent not showing up on JLayeredPane -

i'm trying create chess interface in java , i'm using jlayeredpane put pieces on top of chessboard image. problem pieces not added layered pane. this code dragimage class (every piece going instance of class can drag , drop on chessboard). class dragimage extends jcomponent implements mousemotionlistener { private static final long serialversionuid = 1l; int imagewidth = 52, imageheight = 52; int imagex, imagey; image img; public dragimage(image i) { img = i; repaint(); addmousemotionlistener(this); } public void mousedragged(mouseevent e) { imagex = e.getx(); imagey = e.gety(); repaint(); } public void mousemoved(mouseevent e) { } public void paint(graphics g) { graphics2d g2 = (graphics2d) g; g2.drawimage(img, imagex, imagey, this); } } and code jpanel . the image...

python - balance positives and negatives in numpy -

i have matrix last column has floats in it. around 70% of numbers positive, while 30% negative. i'd remove rows positive number result matrix has approxiamtely same number of positive , negative numbers in last column. i'd remove positives rows randomly. what this: import numpy np x = np.arange(30).reshape(10, 3) x[[0,1,2,],[2,2,2]] = x[[0,1,2],[2,2,2]] * -1 = np.where(x[:,2] > 0)[0] n_pos = np.sum(x[:,2] > 0) n_neg = np.sum(x[:,2] < 0) n_to_remove = n_pos - n_neg np.random.shuffle(a) new_x = np.delete(x, a[:n_to_remove], axis = 0) result: >>> x array([[ 0, 1, -2], [ 3, 4, -5], [ 6, 7, -8], [ 9, 10, 11], [12, 13, 14], [15, 16, 17], [18, 19, 20], [21, 22, 23], [24, 25, 26], [27, 28, 29]]) >>> new_x array([[ 0, 1, -2], [ 3, 4, -5], [ 6, 7, -8], [15, 16, 17], [18, 19, 20], [27, 28, 29]]) i think easier arrays matrices, let m...

Scala recursion no side effects -

ok, recursion more functional because not changing state of object in iteration. there nothing stopping in scala. var magoo = 7; def mergesort(xs: list[int]): list[int] = { ... magoo = magoo + 1 mergesort(xs1, xs2); } in fact, can make recursion side effectless in scala can in java. fair scala make easier write concise recursion using pattern matching? there nothing stopping me writing stateless recursion code in java can write in scala? the point in scala complex recursion can achieved neater code. that's all. correct? if course can complex recursion in java. complex recursion in assembler if wanted to. in scala easier do. scala has tail call optimisation important if want write arbitrary iterative algorithm recursive method without getting stack overflow or performance drop.

jQuery Slide CSS Element Out Reducing Opacity -

hi trying slide css element out, gradually removing opacity until disappeared. e.g want slide text right reduced opacity whilst sliding till disappeared. //jquery $(document).ready(function() { $('.heading1').animate({marginright:"20px",opacity:0},500) }) //html <div class="slidercontainer"> <a class="heading1">text</a> </div> //css .heading1 { position:relative; } i have tried doesn't slide out, move across screen. fades out. idea? i want able animate in , out of screen reducing opacity when does. use integers ( 20 ) instead of strings ( 20px ): $(document).ready(function() { $('.heading1').animate({'margin-right':20,opacity:0},500); })