Posts

FORTRAN logic notproblem -

if use function once, works properly. if make loop down below, 4 lines of commented code, code malfunctions. can't figure out why return t or f every other number after initial value. asterisks in parenthesis of write , read doesn't show here reason. program prime integer :: n = 0, = 1,x = 0 logical :: ip write (*,*) "enter number:" read (*,*) n !do while ( n < 1000) ip = isprime(n) write (*,*) ip, n !n = n + 1 !end read(*,*) x contains function isprime(n) logical :: isprime integer, intent(in) :: n isprime = .true. if (n == 2) write (*,*) n else while (i <= (n/2)) = + 2 if (mod(n,i) == 0) isprime = .false. end if end end if return end function isprime end program prime you're forgetting reset i 1 during each call isprime . the first time isprime called, i=1 top of program main . however, i incremented during first isprime call other 1 second call starts i/=0 . note because isprime contai...

python - Break Existing Dataframe Apart Based on Multi Index -

i have existing dataframe sorted this: in [3]: result_gb_daily_average out[3]: nrel avert month day 1 1 14.718417 37.250000 2 40.381167 45.250000 3 42.512646 40.666667 4 12.166896 31.583333 5 14.583208 50.416667 6 34.238000 45.333333 7 45.581229 29.125000 8 60.548479 27.916667 9 48.061583 34.041667 10 20.606958 37.583333 11 5.418833 70.833333 12 51.261375 43.208333 13 21.796771 42.541667 14 27.118979 41.958333 15 8.230542 43.625000 16 14.233958 48.708333 17 28.345875 51.125000 18 43.896375 55.500000 19 95.800542 44.500000 20 53.763104 39.958333 21 26.171437 50.958333 22 20.372688 66.916667 23 20.594042 42.541667 24 16.889083 48.083333 25 16.416479 42.125000 26 28.459625 40.125000 27 1.055229 49.833333 28 ...

java - Apache Tiles - HTTP Status 500 - Servlet.init() for servlet dispatcher threw exception -

i want use apache tiles in spring project. added these dependencies pom.xml file: <dependency> <groupid>org.apache.tiles</groupid> <artifactid>tiles-api</artifactid> <version>3.0.5</version> </dependency> <dependency> <groupid>org.apache.tiles</groupid> <artifactid>tiles-core</artifactid> <version>3.0.5</version> </dependency> <dependency> <groupid>org.apache.tiles</groupid> <artifactid>tiles-jsp</artifactid> <version>3.0.5</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.7.6</version> </dependency> that's dispatcher-servlet.xml file: <beans xmlns="http://www.springframework.or...

mysql - Trigger to change all the rows after an update is done -

having table name transitions , i want change values of rows after update made. i'm using following trigger, changes row i'm making update to. create trigger signaturetrigger before update on `transactions` each row begin set new.signature = '288'; end i'm trying change rows signature = 288 , how can modify trigger in order archieve that? thought using for each row enough. thanks in advance. you can use after update trigger update statement: create trigger signaturetrigger after update on `transactions` each row begin update transactions set new.signature = '288'; end; this seem strange thing do, however. consider alternative: add updatedat column table , update signature in row. then, when want recent signature use: select signature transactions order updatedat desc limit 1; an index on transactions(updatedat, signature) make quite speedy. and, update go much, faster updating rows.

JAVA JFileChooser Window showing on last place -

don't know how ask /english isn't mother language :)/, i'm adding screenshot show this. when use jfilechooser, opens dialog window on last place /see screenshot/, not in front place - have click on last window, window, not showing first window = doesn't "pop up" after run program. enter image description here it works fine, when use in main, when use in method, doing this. import javax.swing.jdialog; import javax.swing.jfilechooser; public class jframechooser { public static void vybersuboru() { jfilechooser filechooser = new jfilechooser(); jdialog dialog = new jdialog(); int result = filechooser.showopendialog(dialog); if (result == jfilechooser.approve_option) { system.out.println(filechooser.getselectedfile().getabsolutepath()); } } } you creating file chooser newly created dialog empty , not visible. instead use applications's main window parent. something wa...

google maps - I can not use feature.get Geometry () in a MultiLineString -

i'm plotting geojson on map using google maps api v3. point of layers functioning normally. have multilinestring camda , center map on geometry gives error.this occurs polygon, points works well. there other way centralize multilinestring , polygons? google.maps.event.addlistener(cicloviaslayer, 'addfeature', function (e) { console.log(e.feature.getgeometry().gettype()); // multilinestring ok! map.setcenter(e.feature.getgeometry().get()); }); erro: e.feature.getgeometry(...).get not function the data.multilinestring class doesn't have get method, has getat , getarray methods. getat(n:number) return value: data.linestring returns n-th contained data.linestring. the returned linestring has getat method returns google.maps.latlng object getat(n:number) return value: latlng returns n-th contained latlng. google.maps.event.addlistener(cicloviaslayer, 'addfeature', function (e) { ...

oracle - stored procedure using the IF NOT EXISTS -

Image
i researching issues regarding oracle. i'm creating stored procedures , boot following errors show them in picture, hope me resolve error. [ ] you can add variable v_count number :=0; in procedure check if value exists. example: create or replace procedure procedure_name(parameters) v_count number := 0; begin select count(1) v_count your_table .. . if v_count = 0 insert ... elsif update ... commit; end if; end;