Posts

c - flmoon function in numerical recipies -

i have problem understanding implementation of following function in c: #include <math.h> #define rad (3.14159265/180.0) #include "fulmoon.h" void flmoon(int n, int nph, long *jd, float *frac) { /*this programs begin introductory comment summarizing purpose , explaining calling sequence. routine calculates phases of moon. given integer n , code nph phase desired (nph = 0 new moon, 1 first quarter, 2 full, 3 last quarter), routine returns julian day number jd, , fractional part of day frac added it, of nth such phase since january, 1900. greenwich mean time assumed.*/ int i; float am,as,c,t,t2,xtra; c=n+nph/4.0; t=c/1236.85; t2=t*t; printf("jdhdhdhd"); as=359.2242+29.105356*c; am=306.0253+385.816918*c+0.010730*t2; *jd=2415020+28l*n+7l*nph; xtra=0.75933+1.53058868*c+((1.178e-4)-(1.55e-7)*t)*t2; if (nph == 0 || nph == 2){ xtra += (0.1734-3.93e-4*t)*sin(rad*as)-0.4068*sin(rad*am); } else (nph == 1 || nph == 3){ xtra += (0.1721-4.0e-4*t)*sin(ra...

c++ - How to OCR multiple column in a document using tesseract -

i working on project of ocr sinhala language using tesseract. goal ocr, multiple column including text in document. , out put file in correct format. there method identify column in document using tesseract? you can try below solution identify columns when scanning picture. tessbaseapi baseapi = new tessbaseapi(); baseapi.setdebug(true); baseapi.init(data_path, lang); //data_path - image stored , lang - en(english) baseapi.setpagesegmode(tessbaseapi.pagesegmode.psm_single_column);//this line segment captured image - hope looking line baseapi.setimage(bitmap); //recognized text after capturing image process it. string recognizedtext = baseapi.getutf8text(); if not expecting solution please try pagesegmode, hope may resolve issue.

java - How can I ensure Spring constructs a bean once -

i have complex enterprise environment multiple projects depending on each other. configuration handled spring , includes crazy number imports , not. looks default spring ok constructing bean same name more once. particularly, in case of multiple spring contexts. each context own instance of same singleton bean. singleton not singleton in spring architects' minds... unfortunately, in case there's bean can never created more once. is there way enforce spring checking upon bean whether it's been created , not try call constructor again? particularly, bean creates ehcache's cachemanager inside , fails because cachemanager same name can't created twice. <bean id="cacheservice" class="somepackage.cacheserviceimpl"> <constructor-arg index="0" value="/somepackage/ehcache.xml" /> </bean> i don't have control on cacheserviceimpl code. can change configuration around it. diff...

google apps script - URL fetch sometimes leads to "Uncaught ScriptError" resp. 404 -

my goal write add-on, converts spreadsheet file xlsx-file , sends given mail distribution list on daily, weekly or monthly basis. everything works fine, except url fetch. please find function below: function startwizard () { var addresses = spreadsheetapp.getactive().getsheetbyname("einstellungen").getrange("a1").getvalues(); var filename = spreadsheetapp.getactivespreadsheet().getname(); var ssid = spreadsheetapp.getactivespreadsheet().getid(); var url = "https://spreadsheets.google.com/feeds/download/spreadsheets/export?key=" + ssid + "&exportformat=xlsx"; var token = scriptapp.getoauthtoken(); var response = urlfetchapp.fetch(url, {headers: {'authorization': 'bearer '+ token}}); logger.log(url); var contents = response.getcontent(); mailapp.sendemail(addresses,"subject" ,"body", {attachments:[{filename:filename+".xlsx", content:contents, mimetype:"application//xlsx"}]}); } ...

android-imageView dosent show the image on galaxy while it works on other devices -

i don't know why happening. first press "camera" button camera app starts working take picture , save it. should see picture on screen shows picture upside down disappears. work on other devices. public class cameraactivity extends activity { private button btncamera; private imageview ivcapture; private static final int activity_start_camera_app = 0; private string mimagefilelocation = ""; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_camera); btncamera = (button)findviewbyid(r.id.btncamera); ivcapture = (imageview)findviewbyid(r.id.ivcapture); btncamera.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { takephoto(v); } }); } public void takephoto(view view){ intent callcameraapplicationintent = new intent(); callcameraapplicationintent.setaction(mediastore.action_image_...

jvm - How can i figure out instruction pointer address in the certain part of my java code? -

i'm trying memory trace generated java code(jvm) using pin tool(pinatrace). every result of microbenchmarks try figure out traces shows same graphs, , utilizing processbuilder inside java code gives no remarkable results @ least in comparing among different microbenchmarks. realized should extract substantive part(excluding useless part analysis, initializing, accessing jvm in middle of main code....) of code figure out going wrong. because instruction pointer sent pinatrace @ moment detects memory access, thought getting instruction pointer of substantive part , set parameter information work. finding way(or tool) job driving me crazy, since java not familiar field me.... i've tried ida pro, says input file format wrong, when input .class file. , setting .java file input shows me binary code seems text file converted binary things , nothing. tried install idajava addon not work....... there easy method ip instead? want know ip java code.. thank you!

java - Converting total amount of days in the year so far, to a day in a month -

i'm converting timestamp payload 1430848842000 , simpledateformat(yyy-mm-dd hh:mm:ss) . output is: 2015-05-125 14:00:42 as can see, days part of conversion odd. instead of giving me date in month of may year, instead gave me total amount of days in year leading timestamp creation. i did quick math , determined 125 time stamp, should mean 5th of may, how can convert automatically output looks like: 2015-05-5 14:00:42 ? your simpledateformat should yyyy-mm-dd hh:mm:ss instead of yyyy-mm-dd hh:mm:ss . " dd " " dd " instead.