Posts

ruby on rails - OpenDocument Spreadsheet corrupt in Microsoft Excel -

i using gem write opendocument spreadsheet ( rspreadsheet ) once data written let user download it. spreadsheet works fine in openoffice calc , numbers mac. however, when try open spreadsheet in microsoft excel tells me spreadsheet corrupt. happens when write data it. can open via ruby , save , work fine. once write data it, becomes corrupt. i have tried gem ( rubiod ) , able open spreadsheet in excel after excel had 'recover' spreadsheet. in doing removed formulas , formatting. worse in openoffice , numbers although did retain formulas. i need user able download spreadsheet in ever program choose. have no idea why excel says sheet corrupt , have tried wrap head around hours. the spreadsheet saved ods extension , downloaded using mime type of application/x-vnd.oasis.opendocument.spreadsheet , character set of utf-8 examples: original = rspreadsheet.open 'blank.ods' sheet = original.worksheets 1 sheet.a1 = 'foobar' # without this, excel can open sp...

"Java(TM) Platform SE binary has stopped working" error with Tomcat server -

the following error message appears while running tomcat web server: "java(tm) platform se binary has stopped working problem caused program stop working correctly. windows close program , notify if solution available." faulting application path: c:...\jdk1.6.0_38\bin\java.exe faulting module path: c:..\jdk1.6.0_38\jre\bin\dt_socket.dll os: windows 8 (64 bit). java: 1.6.0_38 (64 bit). tomcat: 7.0.25 . this known bug java 1.6. see: http://bugs.java.com/view_bug.do?bug_id=6810745 even latest 1.6.0.45 has same one. i have been able replace jdk/jre 1.7.0.80 in issue appears have been resolved. wasn't able upgrade 1.8 specific application had issues it. keep in mind both 1.6 , 1.7 no longer supported. of writing latest 1 1.8. just make sure download appropriate 32 or 64 version. can find previous versions here: http://www.oracle.com/technetwork/java/javase/archive-139210.html

command line - C# Reading Paths From Text File Says Path Doesn't Exist -

this question has answer here: what's fastest way read text file line-by-line? 9 answers i'm developing small command line utility remove files directory. user has option specify path @ command line or have paths being read text file. here sample text input: c:\users\mrrobot\desktop\delete c:\users\mrrobot\desktop\erase c:\users\mrrobot\desktop\test my code: class program { public static void main(string[] args) { console.writeline("number of command line parameters = {0}", args.length); if(args[0] == "-tpath:"){ clearpath(args[1]); } else if(args[0] == "-treadtxt:"){ readfromtext(args[1]); } } public static void clearpath(string path) { if(di...

Replacing AngularJS Route with UI Router -

i'm trying replace angularjs route ui router since seems uses. i'm getting started , wondering how replace following code $stateprovider: $routeprovider .when('/login', { templateurl: 'views/login.html', controller: 'loginctrl' }) .when('/dashboard', { templateurl: 'views/dashboard.html', controller: 'dashboardctrl' }) .otherwise({ redirectto: '/login' }); replace when state : $stateprovider .state('state1', { url: "/state1", templateurl: "partials/state1.html" }) more details here: https://github.com/angular-ui/ui-router

java - Give (an) example(s) of something bad that happens with a 'catch(Exception)' clause -

this follow question this one . it seems accepted doing broad 'catch (exception)' bad idea. the reasoning typically 'you must handle exception properly' , 'catch can handle' , few other generic sounding arguments. those generic answer sound reasonable, don't satisfy me. let me concrete. here's typical bit of code supposed 'bad'. try { ... something... } catch (exception e) { log(e); //leave trace debugging return ...a value context can deal with... } a sceptical mind can remain unconvinced not handling exception, (which blow entire program), better outcome handling in generic way. so specific , convincing example(s), code snippet(s), of bad happens because of supposedly broad catch clause 1 above. ps: 1 think question in other languages java, since want specific examples, specific exceptions might raised java program , jre. ps2: interested in examples of exception in fact subtype of java.lang.exception , not more b...

How to add swipe functionality on Android CardView? -

i have single cardview contains 2 textviews , 2 imageviews. want able swipe left , right "dismiss". want swipe right send intent can done later. now, want able dismiss cardview swiping left or right. want animation of swiping. i tried using romannurik's swipedismisstouchlistener cardview not respond swiping. if has better solution romannurik's custom listener, please share. here's cardview layout: <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/generate" map:cardcornerradius="@dimen/_3sdp" map:cardelevation="@dimen/_8sdp" android:id="@+id/restaurantcontainer"> <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <linearlayout ...

java - Update elements in a JSONObject -

lets gave jsonobject { "person":{"name":"sam", "surname":"ngonma"}, "car":{"make":"toyota", "model":"yaris"} } how update of values in jsonobject? like below : string name = jsonarray.getjsonobject(0).getjsonobject("person").getstring("name"); name = "sammie"; use put method: https://developer.android.com/reference/org/json/jsonobject.html jsonobject person = jsonarray.getjsonobject(0).getjsonobject("person"); person.put("name", "sammie");