Posts

Showing posts from July, 2015

android - Upgraded to AppCompat v22.1.0 and now getting IllegalArgumentException: AppCompat does not support the current theme features -

i've upgraded app use newly released v22.1.0 appcompat , i'm getting following exception when open app. caused by: java.lang.illegalargumentexception: appcompat not support current theme features @ android.support.v7.app.appcompatdelegateimplv7.ensuresubdecor(appcompatdelegateimplv7.java:360) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:246) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:106) how fix it? appcompat more strict on expect in theme window flags, more closely matching framework. the main reason behind support appcompatdialogs adding in release. make heavy use of windownotitle flag, appcompat didn't pay attention to. so fix issue have 2 options: the easy way use theme.appcompat.noactionbar parent theme. right thing. if can't though (maybe need support action bar , no action bar), should following: <style name="mytheme...

java - Spring model attribute gets null within the request -

i have page pagination links @ top. when click pages takes me record 1-50, 51-100 , on. having issue when click second action when click page # 2 @modelattribute values gets null. this tha page url: http://localhost:8080/tax/taxedyear.html?p=2 it takes me spring controller class /taxedyear.html , method below: @requestmapping(value = "/taxedyear.html", method = requestmethod.get) public modelandview showtaxresults(@modelattribute("criteria") criteria criteria, model model, httpsession session, httpservletrequest request) { string src = criteria.getsource(); system.out.println("src === "+src); //.... // } when called criteria null. same method called previou page , works fine. happens when click page urls calls same method in controller , sends page # in addition. from spring reference: an @modelattribute on method argument indicates argument should retrieved model. if not present in model, argument sh...

vb.net - log4net not working on other machines -

i created web service project uses log4net log event viewer , optionally .log file. works great on machine, when try deploy on machine won't log text file or event viewer. fact it's not writing text file makes me think it's not able find log4net.dll or effect? i'm receiving error message when hits noted line below in global.asax: log4net:error xmlconfigurator: failed find configuration section 'log4net' in application's .config file. check .config file , elements. configuration section should like: section name="log4net" type="log4net.config.log4netconfigurationsectionhandler,log4net" / i'm stumped, have no idea why isn't working, help! ran exe compiled following code adds source eventlog in windows, said, works fine on machine: option explicit on option strict on imports system imports system.diagnostics imports system.threading module module1 sub main() if not eventlog.sourceexists("lending...

Retain Query String In URL -

i've built web app lives on sharepoint. the user asked question @ beginning. can answer either "yes" or "no." a query string added url depending on user's answer. there 2 query strings: ?choice=yes or ?choice=no . the index.html page has this: <input type="button" value="yes" onclick="redirect(this);" id="yes" class="btn btn-primary btn-lg"> <input type="button" value="no" onclick="redirect(this);" id="no" class="btn btn-primary btn-lg"> and how query string added: function redirect(e){ location.href = "map.html?choice=" + e.id; } after user picks answer takes them map.html , first section user comes question (so url @ point can either map.html?choice=yes or map.html?choice=no ). after that, can navigate ever please on app. here's issue. navigation being pulled in external nav.js file (i.e. js include) so...

Conventionally, can a set() method return a value in Java? -

i learning how write neat , organized code in java. can set() method return value or there more efficient/readable way of doing this? public class car { private boolean mhasaxles; private boolean mhastires; private tires mtires; public setaxels(boolean hasaxles) { mhasaxels = hasaxles; } public boolean hasaxles() { return mhasaxles; } public boolean settires(tires tires) { if(hasaxles()){ mtires = tires; mhastires = true; return true; // returns true if able set tires } return false; // returns false because car did not have axels // therefore, tires not set } } in example, question settires() method. should class check whether car has axles when setting tires or should logic left class uses car ? should settires() method called else since returns value? strictly conventionally - no, setter returns vo...

assembly - Understanding assembler instruction -

i looking below answer at lpc1768 / arm cortex-m3 microsecond delay #define cal_factor ( 100 ) void delay (uint32_t interval) { uint32_t iterations = interval / cal_factor; for(int i=0; i<iterations; ++i) { __asm__ volatile // gcc-ish syntax, don't know compiler used ( "nop\n\t" "nop\n\t" ::: ); } } what \n\t after nop? looked gcc assembler guide not find answer. i found answer @ http://asm.sourceforge.net/articles/rmiyagi-inline-asm.txt '\n\t' @ end of each line except last, , each line enclosed in quotes. because gcc sends each instruction string. newline/tab combination required lines fed according correct format (recall each line in assembler indented 1 tab stop, 8 characters).

javascript - How to type check recursive definitions using Algorithm W? -

Image
i implementing algorithm w (the hindley-milner type system ) in javascript: the function implements above rules typecheck , has following signature: typecheck :: (context, expr) -> monotype it defined follows: function typecheck(context, expression) { switch (expression.type) { case "var": var name = expression.name; var type = context[name]; return inst(type); case "app": var fun = typecheck(context, expression.fun); var dom = typecheck(context, expression.arg); var cod = new variable; unify(fun, abs(dom, cod)); return cod; case "abs": var param = expression.param; var env = object.create(context); var dom = env[param] = new variable; var cod = typecheck(env, expression.result); return abs(dom, cod); case "let": var assignments = expression.assignments; var env = object.create(contex...

ios - EXC_BAD_ACCESS with viewWillTransitionToSize and Xcode 6.3 -

this code used work in our today extension, exc_bad_access using xcode 6.3. new problem? override func viewwilltransitiontosize(size: cgsize, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) { coordinator.animatealongsidetransition({ context in self.tableview.frame = cgrectmake(0, 0, size.width, size.height) }, completion: nil) } someone mentioned me think apple bug. here's workaround (or solution): override func viewwilltransitiontosize(size: cgsize, withtransitioncoordinator coordinator: uiviewcontrollertransitioncoordinator) { super.viewwilltransitiontosize(size, withtransitioncoordinator: coordinator) if let safecoordinator = coordinator uiviewcontrollertransitioncoordinator? { println("coordinator != nil") safecoordinator.animatealongsidetransition({ context in self.tableview.frame = cgrectmake(0, 0, size.width, size.height) }, completion: nil) ...

learning to parse a fasta file with python -

this question has answer here: parsing fasta file using generator ( python ) 4 answers i learning python , want parse fasta file without using biopython. txt file looks like: >22567 cgtgtccaggtctatctcggaaatttgccgtcgttgcattactgtccagctccatgccca acatttggcatcggagaatgactccgcgtgataaagtcagaataggcattgagactcagg gtggtacctatta >34454 aaaactgtgcagccggtaacaggccgcgatgctgtactatatgtgtttggtacatatccg attcaggtatgtcagggagccagcaccggaggatccagaagtaagtcgggttgactactc ctagcctcgtttcaccatccgccggataactctcccttccatcatcaactcctccctttc gtgtccaatggggcggcgtgtctaagcactgccatatagctaccgaaaggcggcgacccc tcgga i parse save headers of each sequence, >22567 , >34454 headers list (this working). , after each header read following sequence sequences list. the output, like: headers = ['>22567','>34454'] sequences = ['cgtgtccaggtctatctcggaaatt...', aaaactttgtgaaaa....

What is Compile Time constant expression value inlined by compiler in JAVA? -

this question has answer here: what inlining? 9 answers recently reading got "when declare string (which immutable) variable final, , initialize compile-time constant expression, becomes compile-time constant expression, , value inlined compiler used." and "i'm confused mean value inlined compiler" ? please explain in simple way if possible source of above line when string finalized , initialized @ compile time, compiler can copy-paste string code, instead of looking variable @ every use. similar inline expansion . final string = "asd"; string b = a; the above snippet becomes final string = "asd"; string b = "asd";

javascript - How to Delete all Cookies on my site except for one -

i'm using following function clear cookies, works. clearing out phpsessid far can tell. want retain 1 cookie alone. i added line: if (name == "phpsessid") {... ...to try , catch, , skip, altering cookie names phpsessid , doesn't catch reason. is there clear reason why it's not catching, or there better way achieve clearing cookies except " phpsessid "? the function: function clearcookies() { var cookies = document.cookie.split(";"); for(var i=0; < cookies.length; i++) { var equals = cookies[i].indexof("="); var name = equals > -1 ? cookies[i].substr(0, equals) : cookies[i]; if (name == "phpsessid") { alert("yes"); }else{ document.cookie = name + "=;expires=thu, 01 jan 1970 00:00:00 gmt"; alert(name); } } } hi found answer using devtool's console log instead of cookie viewer. there...

python - String filtering commas and numbers -

i want filter string in python, commas , , numbers [0-9] . import re x="$hghg54646jhgjh,54546654" m=re.sub("[^0-9]","",x) print(m) the result is: 5464654546654 instead of: 54646,54546654 with current code, match [0-9] . add comma , valid character, , use backslash escape literal ( \, ): import re x="$hghg54646jhgjh,54546654" m=re.sub("[^0-9\,]","",x) print(m) outputs: 54646,54546654 the docs have further information regarding other special characters must escaped backslash acquire literal, such ? , * .

python - Can't get this session to work properly -

i'm trying set session in application, doesn't seems work properly. after login, session displays on devtools doesn't redirect /index suppose do. here i've done: app.py from flask import flask, render_template, redirect, url_for, request, session, flash functools import wraps app = flask(__name__) app.secret_key = "gr3hu39ud3n89ud893e4" def login_required(f): @wraps(f) def wrap(*args, **kwargs): if 'logged_in' in session: return f(*args, **kwargs) else: flash('you need login first') return redirect(url_for('login')) return wrap @app.route("/") @login_required def home(): return render_template('index.html') @app.route('/welcome') def welcome(): return render_template('welcome.html') @app.route('/login', methods=('get', 'post')) def login(): error = none if request.method == '...

java - Where are my tables in H2? -

i deploy web app wildfly 8.02 final server. use default out of box datasource comes server jndi name space: java:jboss/datasources/exampleds and use default url: jdbc:h2:mem:test;db_close_delay=-1;db_close_on_exit=false to access h2 intellij idea database client tool or other client applications (i use url connection, because tcp connection via default port doesn't work). the app empty war entity beans , persistence.xml file. intend test purely tables created in underlying data source in accordance annotations. here thing: when set in persistence.xml: <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> war succesfully deployed, when connect via client tool h2 data source can see pre-defined tables after: select * information_schema.tables i can create tables via client tools , able track existence previous sql query. seems tables hadn't been created jpa framework. but when change pers...

c# - rectangle list what is the syntax check for collision using intersect -

i how detect collision lists of rectangles. rectanlge player; list<rectangle> blockhitbox = new list<rectangle>(); i don't know proper syntax for. blockhitbox.intersect<>(); the code should detect if rectangle hit boxes collide player hit box. my goal make room small rectangles player cant pass through them need detect more 1 collision @ time ( corners) you can use intersectswith method of rectangle object so: var commonsize = new size(100, 100); var player = new rectangle(new point(0,0), commonsize); var blockhitbox = new list<rectangle> { new rectangle(new point(0, 100), commonsize), // 1 not collide new rectangle(new point(100, 0), commonsize), // 1 not collide new rectangle(new point(0, 99), commonsize) // 1 collide }; bool collision = blockhitbox.any(item => item.intersectswith(player));

Why do I get numeric characters in my raw JSON response from WCF? -

Image
switching xml json on fly in wcf restful service. when post json service fiddler, right json back, if in raw response, json message sandwiched in between 2 numbers, this: is problematic parsing json? said, actual json looks fine.

asp.net - Linq-To-Sql SubmitChanges Not Updating Database -

i've read multiple questions similar 1 none situation. using linq-to-sql insert new record , submit changes. then, in same web request, pull same record, , update it, submit changes. changes not saved. databasecontext same across both these operations. insert: var transaction = _factory.createtransaction(siteid, userid, questionid, type, amount, transactionid, processor); using (iunitofwork unitofwork = unitofwork.begin()) { transaction.amount = amount; _transactionrepository.add(transaction); unitofwork.commit(); } select , update: itransaction transaction = _transactionrepository.findbyid(transactionid); if (transaction == null) throw new exception(constants.errorcannotfindtransactionwithid.formatwith(transactionid)); using (iunitofwork unitofwork = unitofwork.begin()) { transaction.crmid = crmid; transaction.updatedat = systemtime.now(); unitofwork.commit(); } here's unit of work code: public virtual void commit() { if (_i...

sql server - Generate list of new unique random numbers in T-SQL -

i need stored procedure generate @n records, each unique random 8 digit number. number must not incremental , must not exist in table. create table codes ( id uniqueidentifier primary key, code int, constraint uq_code unique(code) ); i can generate random numbers: declare @min int = 0, @max int = 99999999, @n int = 100; select top (@n) floor(cast(crypt_gen_random(4) bigint) / 4294967296 * ((@max - @min) + 1)) + @min sys.all_objects s1 cross join sys.all_objects s2; but i'm struggling figure out how atomically generate , insert @n numbers [codes] table whilst making provision avoid collisions. can done without loop? update "must not incremental" meant each call sp , don't want return "1, 2, 3, 4" or other common pattern. need able consume values incremental values exist generated @ different points in time rather sequentially. you can use cte calculated codes, distinct , check if cod...

javascript - Detect ajax request no connection status and state -

i'm working pure javascript (no jquery , no others...) , i'm writing code make ajax request. noticed when internet connection fails, on chrome, firefox , ie values in xmlhttp.onreadystatechange: xmlhttp.readystate=4 xmlhttp.status=0 since handle network connection problems way it? xmlhttp.onreadystatechange=function(){ if(xmlhttp.readystate==4 && xmlhttp.status==0){//no internet connection //code handle network error } } this code seems work me, haven't seen documentation abuot this, nowhere! think solid solution? you can use online/offline events : window.addeventlistener('load', function() { var status = document.getelementbyid("status"); function updateonlinestatus(event) { var condition = navigator.online ? "online" : "offline"; status.classname = condition; status.innerhtml = condition.touppercase(); log.insertadjacenthtml("beforeend", ...

Printing lines in a format in java -

so project implement paging, recalling paging unlike swapping allows memory of process broken in frames. problem structure have print this. char 'a4' , 'e4' such given these examples processed 280 frames. char stored in string[] memory. have print these memory stated 2 string char of alp , number. needs when done: 04 09 14 19 24 29 --------++--------||--------++--------||--------++--------|| a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7 31 33 35 37 39 41 --------++--------||--------++--------||--------++--------|| a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7a1d5f7e5e3r3q1q2r5y7 so top increments of location of string array showing 5th 1 starting @ 00. have -------++------ looks guess. , last line of string[] memory , in array. this have far: public static void printpmem(string[]memory, int colm, int increment){ //true memory //this prints stuff in mem...

mysql - SQL: get unique rows based on concatenation of two columns -

i need sql statement derive list of rows unique based on concatenation of 2 columns. given set of data, want result remove duplicate rows duplicate defined concatenation of column1 , column2. things: id column1 column2 column3 1 z l 2 b y g 3 b y g 4 y h 5 z l this came with: select distinct ( column1 || column2 ) things result: az ay this works fine, derives list of unique concatenation of column1 , column2, i need column3 returned well, in: column1 column2 column3 z l b y g y h this not work: select distinct ( column1 || column2 ), column3 things as returns more rows needed. how construct sql statement derive desired result of unique rows based on concatenation of 2 columns? not matter if column3 not unique. if...

ssl - Getting Certificate of A WebSite via C# -

i can display certificate code. question how can store or write certificate in file? using system.security; using system.security.cryptography; using system.security.cryptography.x509certificates; //do webrequest info on secure site httpwebrequest request = (httpwebrequest)webrequest.create("https://mail.google.com"); httpwebresponse response = (httpwebresponse)request.getresponse(); response.close(); //retrieve ssl cert , assign x509certificate object x509certificate cert = request.servicepoint.certificate; //convert x509certificate x509certificate2 object passing constructor x509certificate2 cert2 = new x509certificate2(cert); string cn = cert2.getissuername(); string cedate = cert2.getexpirationdatestring(); string cpub = cert2.getpublickeystring(); //display cert dialog box x509certificate2ui.displaycertificate(cert2); you can call cert.export(...) byte[] can write file.

r - R_Extracting coordinates from SpatialPolygonsDataFrame -

is me have problem extracting coordinates of polygon spatialpolygonsdataframe object? able extract other slots of object ( id , plotorder ) not coordinates ( coords ). don't know doing wrong. please find below r session bdrydata being spatialpolygonsdataframe object 2 polygons. > bdrydata object of class "spatialpolygonsdataframe" slot "data": id gridcode 0 1 0 1 2 0 slot "polygons": [[1]] object of class "polygons" slot "polygons": [[1]] object of class "polygon" slot "labpt": [1] 415499.1 432781.7 slot "area": [1] 0.6846572 slot "hole": [1] false slot "ringdir": [1] 1 slot "coords": [,1] [,2] [1,] 415499.6 432781.2 [2,] 415498.4 432781.5 [3,] 415499.3 432782.4 [4,] 415499.6 432781.2 slot "plotorder": [1] 1 slot "labpt": [1] 415499.1 432781.7 slot "id": [1] "0" slot "area...

sql - SqlDataAdapter and Computed Columns; not maintained? -

let's have following sql schema: sql table person columns ( id integer, firstname varchar(100), lastname varchar(100), fullname (firstname + ' ' + lastname) ) go insert person (id, firstname, lastname) values (1, 'simon', 'dugré') go vb retreiving class dim da new sqldataadapter("select id, firstname, lastname, fullname person id = 1", cn) dim ds new dataset() da.fill(ds) da.filleschema(ds) ' tried before or after da.fill, in case ' dim dr datarow = ds.table(0).row(0) assert.istrue(dr("firstname") = "simon") ' returns true ' assert.istrue(dr("lastname") = "dugré") ' returns true ' assert.istrue(dr("fullname") = "simon dugré") ' returns true ' dr("firstname") = "nomis" assert.istrue(dr("fullname") = "nomis dugré") ' return false, still "simon dugré" in it. ' while debugg...

javascript - How to Change viewmodel's data after binding a knockout template to a custom component -

i have static template binding custom component in knockoutjs. viewmodel data initialized , working fine (getting john smith in output). $(document).ready(function() { var viewmodel = function() { this.name = ko.observable('john smith'); } var viewmodelobject = new viewmodel(); ko.components.register('my-component', { viewmodel: viewmodel, template: 'name: <input data-bind="value: name" /> ' }); viewmodelobject.name('smith john'); ko.applybindings(viewmodelobject); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script> <div> <my-component></my-component> </div> jsfiddle: http://jsfiddle.net/17cmjptl/1/ here, trying change value in viewmodel. know there know use of passing v...

jquery - how to show preloader while loading content using yii CJuitabs -

i trying show preloader when press tab in cjuitabs not show prealoader. doing wrong? <div id="outertabs"> <?php $this->widget('zii.widgets.jui.cjuitabs', array( 'tabs' => array( 'bundle (' . $bundletotal . ')' => array( 'ajax' => $this->createurl('/frontier/buyflow/bundles'), 'id'=>'bundletab' ), 'standalone (' . $internettotal . ')' => array( 'ajax' => $this->createurl('/frontier/buyflow/standalone'), 'id'=>'stanadalonetab' ), 'phone (' . $phonetotal . ')' => array( 'ajax' => $this->createurl('/frontier/buyflow/phone'), 'id'=>'phonetab' ) ) // panel 3 contains content rendered partial view , // additional javascript options tabs plugin 'options' => array( 'collapsible...

magrittr - What does %>% mean in R -

i following example, server.r file here, https://github.com/wch/movies/blob/master/server.r i plan similar filter, lost %>% does. # apply filters m <- all_movies %>% filter( reviews >= reviews, oscars >= oscars, year >= minyear, year <= maxyear, boxoffice >= minboxoffice, boxoffice <= maxboxoffice ) %>% the infix operator %>% not part of base r, in fact defined package magrittr ( cran ) , heavily used dplyr ( cran ). it works pipe, hence reference magritte's famous painting la trahison des images . what function pass lhs first argument of rhs. in following example, data frame iris gets passed head() : library(magrittr) iris %>% head() sepal.length sepal.width petal.length petal.width species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 ...

sql - Postgres not allowing localhost but works with 127.0.0.1 -

postgres not accepting connection if -h localhost works if -h 127.0.0.1 [root@5d9ca0effd7f opensips]# psql -u postgres -h localhost -w password user postgres: psql: fatal: ident authentication failed user "postgres" [root@5d9ca0effd7f opensips]# psql -u postgres -h 127.0.0.1 -w password user postgres: psql (8.4.20) type "help" help. postgres=# my /var/lib/pgsql/data/pg_hba.conf # type database user cidr-address method # "local" unix domain socket connections local trust local ident # ipv4 local connections: host 127.0.0.1/32 trust host 127.0.0.1/32 ident # ipv6 local connections: host ::1/128 ident if add following line postgres service failed start: host localhost ident host localhost trust w...

R : Calling a Function -

i have matrix : x <- cbind(x1 = 3, x2 = c(4:1, 2:5)) dimnames(x)[[1]] <- letters[1:8] how following codes work ? cave <- function(x, c1, c2) c(mean(x[c1]), mean(x[c2])) apply(x,1, cave, c1="x1", c2=c("x1","x2")) particularly not understanding argument , c(mean(x[c1]), mean(x[c2])) inside function cave . also call function in way cave(x,a,b) . inside apply function input when call cave function ? when define function, last thing listed implicitly returned. when define cave as cave <- function(x, c1, c2) { c(mean(x[c1]), mean(x[c2])) } this same as cave <- function(x, c1, c2) { return(c(mean(x[c1]), mean(x[c2]))) } in r, vectors defined concatenating elements using c() . c(a, b) makes vector of length 2 elements a , b . in case, a mean of input x @ index given c1 , b mean of x @ index given c2 . when apply() function x on dimension 1, you're computing cave() on every row of x . ...

Running a standalone multi-dex jar on Android Kitkat -

i've been trying run java applications on android devices standalone jars (not apk's). went fine in beginning: used dex compiler android sdk, packed dex file jar, pushed device , used shell script (similar example in link) run it. when included more libraries , hit 65k dex function limit, used --multi-dex flag dex compiler. compilation succeeded, , able run code on lollipop device. however, running exact same jar on kitkat gets following run-time exception: java.lang.verifyerror: scala/none$ @ akka.actor.actorsystem$.<init>(actorsystem.scala:30) @ akka.actor.actorsystem$.<clinit>(actorsystem.scala) @ akka.actor.actorsystem.create(actorsystem.scala) @ com.example.myclass.calculate(myclass.java:185) @ com.example.main.main(main.java:16) @ com.android.internal.os.runtimeinit.nativefinishinit(native method) @ com.android.internal.os.runtimeinit.main(runtimeinit.java:243) @ dalvik.system.nativestart.main(native method) i faced e...

vb.net - Clear rich text box and leave certain strings -

i have lots of data in rich text box, trying clear , leave words begin az, possible @ all? have tried following coding fails string cannot of 0 length. parameter name: oldvalue the code is private sub button3_click(sender system.object, e system.eventargs) handles button3.click dim str string str = rtbjw.text if not str.contains("az") = true rtbjw.text = rtbjw.text.replace("", "").trim() end if end sub example text az0034 14 az0034l1 art3 ltd 0 srv01 000_00000_ltd ecr 0 - active - az0003 10 az0003l1 art3 ltd 0 srv01 000_00000_ltd ecr 8 - active - az0008 9 az0008l1 art3 ltd 0 srv01 000_00000_ltd ecr 12 - active - az0010 8 az0010l1 art3 ltd 0 srv01 000_00000_ltd ecr 7 - active - az0009 7 az0009l1 art3 ltd 0 srv01 000_00000_ltd ecr 7 - active - az0...

fortran - Unclassifiable statement at 1 , Non-numeric character in statement label at 1 -

i'm totally new fortran, , want write test program using real*8 function called nequick , i've written following program : program test implicit real*8 (a-h,o-z) ane=nequick(400.0d0,45.0d0,15.0d0,10,1.929d2,15.0d0) write(6,'(a,e12.5,a)') & ' nequick electron density =',ane,' m^-3' call sleep(10) end program at end when compile have following errors in each line of little program : -non-numeric character in statement label @ 1 or -unclassifiable statement @ 1 can guys please explain me what's wrong program ? the way code written tells me intended fixed-form source. requires of code start in column 7, except & in second line of write statement should in column 6. when such code pasted editor, leading blanks removed. if this, though, have rename source file have .f or .for file type compiler knows fixed-form. another, perhaps easier solution put & @ end of first line of write - make source have va...

sqlite - insert blob into sqlitedatabase java -

i have created data base , gui collects data user, want add collected data database. connection db good, function called on button click failing, returning message "null pointer exception: null" system output: opened database add database java.lang.nullpointerexception: null addtobase: private void addtobase(string name, int row) throws exception, ioexception, sqlexception { preparedstatement st = null; fileinputstream fis = null; connection con = null; try { class.forname("org.sqlite.jdbc").newinstance(); con = drivermanager.getconnection("jdbc:sqlite:heores.sqlite"); con.setautocommit(false); system.out.println("opened database successfully"); fileinputstream inputstream= new fileinputstream(selectedfile.getabsolutepath()); string sql = "insert hero (name, row, img) values (?, ?, ?)"; st = con.preparestatement(sql); st.setstring(1, name); st.setint(2, row); ...

android - How to dynamically switch orientation of TextView -

the general orientation set as: <linearlayout android:orientation="vertical" /> i need switch textview orientation , forth different views better handles available space.

design patterns - What do do when Pub/Sub Messaging eliminates a module's interface? -

as implementing "loosely-coupled" approach messaging using prism's eventaggregator, came across interesting scenario: class had no public interface; of it's input , output done via these behind-the-scenes pub/sub events. if reuse class in project, @ public interface see functionality offers , dependencies are. in case there nothing (except event aggregator service). have inside class see events subscribing to, , events publishes in order know how fits surroundings... otherwise sits there , nothing. is drawback pub/sub pattern--lack of discover-ability? interfaces hide implementation details , that's why use them, @ same time create coupling between components. pub/sub pattern tries eliminate coupling , there no way can use form of interface. yes, it's drawback. also, in case if want reuse logic pub/sub , other consumers using interfaces can extract common methods interface , call methods private pub/sub listeners.

apache spark - How to set up dynamic allocation on Cloudera 5 in YARN? -

i'm trying run spark dynamic resource allocation on cloudera 5 using yarn. in spark documentation properties required set on yarn-site.xml missing cloudera configuration interface. though set manually properties in yarn-site.xml , add yarn-shuffle.jar classpath, shuffling service not working. i got following exception org.apache.hadoop.yarn.exceptions.invalidauxserviceexception: auxservice:spark_shuffle not exist this worked me: if have cloudera deployed, go cloudera manager (port 7180) have cdh 5.6.0 go yarn (mr2 included) -> configuration -> nodemanager default group -> advanced in textbox associated "nodemanager advanced configuration snippet (safety valve) yarn-site.xml" paste following: <property> <name>yarn.nodemanager.aux-services</name> <value>spark_shuffle,mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.aux-services.spark_shuffle.cla...

css - Chrome transform matrix iframe rendering glitch -

i have weird rendering glitch on webpage in google chrome. reproduced under mac chrome, , chrome under parrallels virtual machine in windows. it's supposed simple draggable div. but, when drag around, looks this: http://imgur.com/vdy3tv2 the situation pretty unusual; it's container div css transform matrix, containing iframe, draggable div. i created demo. drag div around: https://www.dropbox.com/s/cjq39w82mghuze2/bug.7z?dl=0 any idea causes this? [edit] i still have no idea. but: updating transform matrix of parent element (in case, using fit.js, , call watching.trigger()) forces redraw. so, might useful workaround helps people. :) i found actual fix not stupid , half-working earlier attempt. iframe { -webkit-backface-visibility: hidden; /* chrome, safari, opera */ backface-visibility: hidden; } to clarify, iframe in have happening, apply above css. no more glitches. stupid, have no idea why worked, tried random things, , worked. i'm ...

How to avoid data loss in python postgresql bulk insertion -

i want insert data postgresql 1000 1000 records ( bulk insertion ) make quick , low load on dbms, code : cursor.execute("insert bar(first_name,last_name) values ('david', 'bar')") cursor.execute("insert bar(first_name,last_name) values ('david2', 'bar2')") cursor.execute("insert bar(first_name,last_name) values ('david3', 'bar3')") .... etc connection.commit() and can see committed changes @ end , that's saving lot of time me instated of committing changes after every insert query. problem if query crashed reason ( invalid data ), quires fail execute , lose data. there anyway save time of insertion , avoid data loss @ same time?? it depends on requirements of course, depending on transaction needs recommend 1 of following options: 1. using savepoint 's (subtransactions): begin; savepoint savepoint; insert ...; release savepoint; savepoint savepoint; insert ...;...

javascript - Loading GeoJSON into Meteor's leaflet -

i quite new meteor. trying implement own custom version of example leaflet meteor: interactive choropleth map it uses file import geojson data: us-states my problem is : importing file or getting render. what have done: template.map.rendered = function() { var map = l.map('map').setview([37.8, -96], 5); l.tilelayer.provider('stamen.watercolor').addto(map); http.get(meteor.absoluteurl("/us-states.js"), function(err,result) { var statesdata = result.content; console.log(statesdata); var mystyle = { "fillcolor": "#487ba1", "weight": 3, "opacity": 1, "color": "#487ba1", "fillopacity": 0.1 }; var stateslayer = l.geojson(statesdata, { style: mystyle }).addto(map); }); } #map { width: 100%; height: 100%; } <div id="column"> {{> map}} ...

ssl - Getting (58) unable to use client certificate (no key found or wrong pass phrase?) from curl -

i'm attempting make test calls third-party api requires client cert. generated new cert using command openssl: req -new -newkey rsa:2048 -nodes -out mycsr.csr -keyout mykey.key i sent them csr, , sent me mycert.crt. concatenated cert , key together: cat mycert.crt mykey.key > mycertandkey.pem finally, added mycert.crt ca-certificates folder , ca-certificates.conf , ran "update-ca-certificates --fresh". now, i'm trying make curl call bash using following command: curl -x --cert mycertandkey.pem -h 'accept-encoding: gzip,deflate' -h 'content-type: application/json' https://api.url.com i've tried: curl -x --cert mycertandkey.pem --cacert mycert.crt -h 'accept-encoding: gzip,deflate' -h 'content-type: application/json' https://api.url.com and: curl -x --cert mycertandkey.pem --cacert mycert.crt --key mykey.key -h 'accept-encoding: gzip,deflate' -h 'content-type: application/json' https://api.ur...