Posts

windows - Execute a batch script in Maven aggregator once per module -

i using exec-maven-plugin execute batch command specific modules. the entire product build consists of several of these modules , using aggregator build necessary modules @ once. trying simplify process of executing batch scripts once per module, because execution script identical every plugin , requires current plugin path. is somehow possible execute batch script within aggregator, once every module? let's aggregator looks this: <project xmlns= ...> .... <modules> <module>../modulea</module> <module>../moduleb</module> ... <module>../modulez</module> </modules> </project> would possible execute batch command such mybatch.bat -i ..\modulex from within aggregator , modulex denotes built module? it important execution of batch script "post-build" step executed after module built. executed script external tool used obfuscate .jar files. i thankful sma...

Matplotlib - set bars different color depending on where they are located on the x axis -

Image
i made bar plot in matplotlib , change color of bars either green or yellow depending on located on x-axis. example, bars represent data x values in [5, 6, 8, 9] should colored in yellow, while other bars should green. how do that? thank you! first, nice if posted code.i suggest read information provided on matplotlib.org see possible options of function using. here code example: import numpy np import matplotlib.pyplot plt x = np.arange(10) xx = x**2 cr = ['g','g','g','g','y','y','y','y','g','g'] fig,ax = plt.subplots() ax.bar(x,xx,color=cr) plt.show() this produces:

java - 2D array with user input -

i want create 5 row 2 column int array , have user input each value in array. want use stdin input. why won't work? please help! thanks. this effort: int [][] = new int [5][2]; int i; int j; for( = 0; < 4; i++ ); { for( j = 0; j < 2; j++ ); { system.out.println( "month number (e.g. august = 8)" ); int month = stdin.readint(); a[i][0] = month; system.out.println( "year number (e.g. 2007)" ); int year = stdin.readint(); a[i][1] = year; } } you're asking both values user, no need nested loop: int [][] = new int [5][2]; for(int = 0; < 5; i++ ) { system.out.println( "month number (e.g. august = 8)" ); int month = stdin.readint(); a[i][0] = month; system.out.println( "year number (e.g. 2007)" ); int year = stdin.readint(); a[i][1] = year; } i've removed semicolon ; had after first loop making useless, , fixed iterat...

javascript - How to keep React component state between mount/unmount? -

i have simple component <statefulview> maintains internal state. have component <app> toggles whether or not <statefulview> rendered. however, want keep <statefulview> 's internal state between mounting/unmouting. i figured instantiate component in <app> , control whether rendered/mounted. var statefulview = react.createclass({ getinitialstate: function() { return { count: 0 } }, inc: function() { this.setstate({count: this.state.count+1}) }, render: function() { return ( <div> <button onclick={this.inc}>inc</button> <div>count:{this.state.count}</div> </div> ) } }); var app = react.createclass({ getinitialstate: function() { return { show: true, component: <statefulview/> } }, toggle: function() { this.setstate({show: !this.state.show}) }, render: function() { var content = this.state....

markdown - Doxygen: multiple use of section label bug? -

i use doxygen document code , encounter problem when use markdown syntax. for example, have 2 .dox files: fileabc.dox: /** @page abcpage header {#abcheader} ====== abc text. */ filedef.dox /** @page defpage header {#defheader} ====== def text. */ which raise warning: warning: multiple use of section label 'header' and abcheader section not generated. there 2 workaround, none of them ok me: rename section abc header , def header or go doxygen syntax @section abcheader header so, there way use same section name in several pages, markdown syntax ? edit this bug has been introduced in version 1.8.7 : view commit it seems more bug new feature or improvement since setext-syntax (using # instead of ==) not give warning when same section name used several times. bug introduced in version 1.8.7 , resolved in version 1.8.8 bug description -- fix

How to use MKSnapshotter in Swift (iOS) -

i trying implement mksnapshotter mapkit. want create snapshot of location finding in mapview (streetview) using apple maps. here code have far: var options: mkmapsnapshotoptions = mkmapsnapshotoptions(); options.region = self.attractiondetailmap.region; options.size = self.attractiondetailmap.frame.size; options.scale = uiscreen.mainscreen().scale; var fileurl:nsurl = nsurl(fileurlwithpath: "path/to/snapshot.png")!; var snapshotter:mkmapsnapshotter = mkmapsnapshotter(); snapshotter.startwithcompletionhandler { (snapshot:mkmapsnapshot!, error:nserror!) -> void in if(error != nil) { println("error: " + error.localizeddescription); return; } var image:uiimage = snapshot.image; var data:nsdata = uiimagepngrepresentation(image); data.writetourl(fileurl, atomically: true); var pin:mkannotationview = mkannotationview(); uigraphicsbeginimagecontextwithopt...

How to maintain aspect ratio of html container using only CSS -

the title little misleading since maintaining aspect ratio of , html element trivial, using width , padding-bottom or padding-top in percentages. however, scenario little different. maybe solution trivial brain fried. so in case, have content div inside container div. assumption container div can have dimensions , size. requirement inner div needs maintain it's own aspect ratio needs fit either height or width of container div, whichever corresponds closer aspect ratio of content div. so example, content div has aspect ratio 16:9. container div 500px wide , 1000px high. in case, content div size 500px wide , 281px high, white space above , below content div. container div might resized 1000px wide , 500px high, in case content div resize 889px width , 500px height, white space left , right of content div. there's less convoluted way explain scenario again, brain fried today. appreciated. edit: looking css solution. know possible js/jquery. what want use obj...