Posts

javascript - Using toggleClass in jQuery to shrink a div -

i have div , i'm trying shrink when click button. , when click again, want original size. i'm using toggleclass this, did wrong code, , i'm not sure where. please take look. thanks. //********************************************************************* <style> div { border: 1px solid black; width: 500px; height: 500px; } .shrink { width: 250px; height: 250px; } </style> //********************************************************************* <button type = "button"> click me </button> <div> can tell me secret? </div> //********************************************************************* <script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type = "text/javascript"> $(document).ready($function { $("button").click(function(){ $("div").toggleclass("shrink...

python - Moore Neighborhood in a matrix -

Image
i have 2d text file converted image(the shape of 5 in case) , i'm trying implement moore neighborhood trace algorithm. problem when reach point in middle of matrix program starts visiting cells have been visited before never reaching bottom of matrix. input: 00000000000000000000 00000000000000000000 00000000000000000000 00001111111111100000 00001111111111100000 00001100000000000000 00001111111110000000 00001111111111100000 00000000000001110000 00000000000000110000 00011000000000110000 00011100000001110000 00001111111111110000 00000111111111000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 00000000000000000000 my output( 'x' border , cell after n iterations) 00000000000000000000 00000000000000000000 00000xxxxxxxxxx00000 000011111111111x0000 000011111111111x0000 000011xxxxxxxxx00000 0000111111111x000000 000011111111a1100000 000000000000x1110000 00000000000000110000 00011000000000110000 0001110000000111000...

asp.net - Unable to debug web control click handler -

asp.net webforms application. there custom web control (ie inherits system.web.ui.webcontrols.webcontrol). can put breakpoints anywhere in createchildcontrols() or other overloaded method , these breakpoints work fine. however, if try add breakpoint method bound button on page, error on breakpoint: the breakpoint not hit. no executable code of debugger's target code associated line. possible causes include: conditional compilation, compiler optimizations, or target architecture of line not supported current debugger code type. i've tried cleaning solution, deleting bin/obj folders, restarting local iis, recycling app pool, no avail. code in vb.net (sorry). here function definition (in webcontrol code): private sub addtocartclick(byval sender object, byval e system.eventargs) // breakpoint on line 1 here code ties function button: dim button = new button addhandler button.click, addressof addtocartclick the code executes , has worked long time, ca...

Drag the image outside of the window to create a file using Java -

Image
the image see below bufferedimage representation of pdf. bufferedimage in imageicon contained in jlabel. what attempting here able drag image out application in system. if drag document (including images) application accepts it. need drag drop application pdf. using pdfbox manipulate pdfs. end users have have implemented drag drop. other application accepting these documents written in way once document in system cannot removed , drag drop best way them so. because, however, image contained in jlabel cannot drag out, or @ least cannot find way so. can drag jlabel, dragging out not appear option. this first attempt @ doing drag drop built application of mine , can see ability drag file url onto desktop. there way me able drag (url or otherwise) out of window @ least onto desktop? thinking if can onto desktop can other application. i can save file temporarily pdf believe going have do, don't know how file out of jlabel. appreciated. my design wrong why dnd not ...

c++ - Print Index of a multilist -

Image
i trying print index of multi linked list. each node has 2 elements- warehouse number , tool number. printing tools in each warehouse. having problem iterating correctly through list. i not getting correct values , having trouble finding problem in method. struct node { int warehousenumber; int toolnumber; struct node *n; } void showwarehouses() { int tempvalue; bool flag = false; struct node *s; s = start; if (start == null) { cout<<"unable"; return; } s->warehousen = tempvalue; cout<<"warehouse "<<tempvalue<< ": tool "; while(s != null) { if (s->warehousen == tempvalue) { flag = true; cout<< s->tooln <<" "; s = s->next; } } } you haven't assigned values tempvalue causes undefined behavior. read this post. also based on ha...

javascript - What is causing "Uncaught Error: write after end" in my tests? -

i have following code: var promise = require('bluebird'); promise.longstacktraces(); var path = require('path'); var fs = promise.promisifyall(require('fs-extra')); var clone = require('nodegit').clone.clone; var tar = require('tar-fs'); var zlib = require('zlib'); var gzip = zlib.creategzip(); var globasync = promise.promisify(require('glob')); module.exports = archive; function archive(pkg) { var self = this; var tmp_dir_name = '.tmp'; var code_dir_name = 'code'; var files_dir_name = 'files'; var output_dir_name = 'archives'; var coverall_docs_dir_name = 'coverall_documents'; // archive's name (no extension): self.name = pkg.name; self.recipient_name = pkg.recipient_name; // path letter.tex: self.tex_letter_path = path.resolve(pkg.files.letter); // path resume.tex: self.tex_resume_path = path.resolve(pkg.files.resume); // path merged.pdf (letter.pdf...

awk to include name in field between location and average -

in awk below location $1 , calculated average $4 printed. can not seem syntax correct include $2 in output between $1 , $4 . thank :). awk '{ if(len==0){ last=$1;total=$4;len=1;getline } if($1!=last){ printf("%s\t%f\n", last, total/len); last=$1;total=$4;len=1 } else{ total+=$4;len+=1 } } end{ printf("%s\t%f\n", last, total/len) }' input.bed > output.txt input.bed chr1:955542-955763 agrn:exon.1 1 0 chr1:955542-955763 agrn:exon.1 2 0 chr1:955542-955763 agrn:exon.2 3 0 chr1:955542-955763 agrn:exon.2 4 1 current output.txt chr1:955542-955763 21.289593 chr1:957570-957852 304.861702 desired output.txt chr1:955542-955763 agrn:exon.1 21.289593 chr1:957570-957852 agrn:exon.2 304.861702 maybe awk '{if(len==0){last=$1;**name=$2**,total=$4;len=1;getline}if($1!=last){printf("%s\t%f\n", last, ,**name**, total/len);last=$1;name=$2;total=$4;len=1}else{total+=$4;len+=1}}end{pr...