Posts

Showing posts from February, 2011

java - Draw random circles, coloring in red any circle not intersecting another circle -

i have java swing assignment following objectives: when program starts, draws 20 unfilled circles, radius , location of each determined @ random. if perimeter line of circle not intersect other circle, draw outline of circle in red. if intersect @ least 1 other circle, draw in black. add jbutton that, each time pressed, creates new set of circles described above. i've completed objectives #1 , #3 above, i'm stumped on objective #2. before present code, let me give understanding of math behind it. there 2 ways circle can not intersect circle: the circles far apart share perimeter point, i.e. distance between centers greater sum of radii (d > r1 + r2). example . one circle inside circle, , perimeters not touch, i.e. distance between centers less difference between radii (d < |r1 - r2|). example . what i've got far: to compare circles, must specified before drawn, used for-loop store 20 values in arrays center coordinates (int[] x, int[] y) , radi...

node.js - Send Nodemailer e-mail with Namecheap email -

i have been successful connecting gmail account xoauth, acquired namecheap privateemail account , can't life of me figure out how set up. code have: var smtp = nodemailer.createtransport({ host: 'mail.privateemail.com', port: 25, auth: { user: 'contact@myemail.com', pass: 'mypassword' } }); i saw this question , tried other port numbers. it may secured connection in case port should 465 465 port ssl, 25 or 26 tls/starttls

multithreading - Powershell multithread and oracle procedure -

i have list of files increase 5 within 1 minutes never end. inserting data database using oracle procedure. (method external table) then calling procedure powershell below. foreach ($file in $files) { #executing calculate procedure executestoredprocedure -value sp_load_table_crm -filename $file.name -conn } this works okay. takes long time , wanted speed up. better use multithreading or multiprocessing ? planning set powershell script on windows task scheduler. you use runspaces. try this: $files = @('file1','file2','file3') #list of files $throttle = 10 #number of threads $runspacepool = [runspacefactory]::createrunspacepool(1, $throttle) $runspacepool.open() $jobs = @() $scriptblock = { param($file) #place executestoredprocedure function inside script block or make sure loaded appropriate module via profile executestoredprocedure -value sp_load_table_crm -filename ($file.name) -conn #heres function , pa...

ios - Play keyboard click sound in a collection view controller -

i created subclass of uicollectionviewcontroller used custom inputaccessoryviewcontroller in uitextview . https://developer.apple.com/reference/uikit/uiresponder/1621124-inputaccessoryviewcontroller i want play keyboard click sound when tap cell in collection view using playinputclick. https://developer.apple.com/reference/uikit/uidevice/1620050-playinputclick i cannot figure out how work in collection view. works simple view using inputaccessoryview property of uitextview i'm not sure view subclass in collection view controller hierarchy keyboard click sound play. @interface keyboardclickview : uiview <uiinputviewaudiofeedback> @end @implementation keyboardclickview - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if(self) { uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(tap:)]; [self addgesturerecognizer:tap]; } return self; } - (void)tap:(id)sender...

C++ for loop outputs different results with one array than multiple arrays -

i can't understand why outputs different when put 1 array simple loop , when put 2 arrays it. int arrr[100]; int arrn[100]; //function run simulation void runsim(){ for(int i=1;i<=100;i++){ arrn[i] = i; arrr[i] = i; } } //function print array void printarr(int x[100]){ for(int i=0;i <= 100;i++){ cout << x[i] << ", "; } cout << endl; } int main(){ runsim(); printarr(arrr); printarr(arrn); return 0; } this outputs arrr as: 0,1,2,3,4,5,6,...,100 want, outputs arrn as: 100,1,2,3,4,5,6,...,100 not understand. if remove arrr loop arrn prints how want int arrr[100]; int arrn[100]; //function run simulation void runsim(){ for(int i=1;i<=100;i++){ arrn[i] = i; } } //function print array void printarr(int x[100]){ for(int i=0;i <= 100;i++){ cout << x[i] << ", "; } cout << endl; } int main(){ runsim(); printarr(arrn); return 0;...

c# - Does broadcasting to a ASP.NET SignalR group that is empty waste resources? -

Image
if have many client connections part of hub hub_x , not part of specific group group_y , bad practice broadcast() group_y ? should keep track of whether or not inside group_y , , check accordingly before broadcasting it? or signalr no work when detects there no 1 in group_y , , therefore use negligible amount of resources (compared say, having track who's in group myself). ? broadcasting empty groups describe have overhead, negligible depending on use case. let's have 100,000 messages process in queue. processing of messages may require send signalr message clients watching data, vast majority of messages have no watchers. you use message/entity id name of group , execute code every 1 of 100,000 messages: var hub = globalhost.connectionmanager.gethubcontext(hubname); var group = hub.clients.group(groupname) groupproxy; if (group != null) { group.invoke(actionname, messagedata); } alternatively, if somehow able manage hashset of groups have clients ...

Generic function return List C# -

i new in c# , reading generics functions. can*t understand wrong? have, example, function: public list<t> cuttext (list<t> list) { foreach (var in list) { a.text = "yes"; } return list; } your function not generic. invalid non-compilable function returns list of unknown type t. either function or class should have <t> in declaration in order make generic. for example, this: public list<t> cuttext<t>(list<t> list) { foreach (var in list) { a.text = "yes"; } return list; } even if mark generic, type t not have text property until t specified more precisely class or interface having text property: public list<t> cuttext<t>(list<t> list) t : textbox or public list<t> cuttext<t>(list<t> list) t : ianyinterfacehavingtextproperty

php - Laravel:- Calling Functions in Controllers to View -

i new laravel , not sure how use it. have profilecontroller.php have codes , added 1 more piece of code fetch record. want record displayed on profile.blade.php inside particular , not able figure out. need guidelines on how this. please find code bellow:- profilecontroller.php public function showtimings() { $con = mysql_connect('localhost','****','****'); mysql_select_db('lblue_db',$con); if (!function_exists("getsqlvaluestring")) { function getsqlvaluestring($thevalue, $thetype, $thedefinedvalue = "", $thenotdefinedvalue = "") { if (php_version < 6) { $thevalue = get_magic_quotes_gpc() ? stripslashes($thevalue) : $thevalue; } $thevalue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($thevalue) : mysql_escape_string($thevalue); switch ($thetype) { case "text": $thevalue = ($thevalue != "") ? ...

spring - weblogic11g datasource not releasing the connections to the pool -

we have developed java application below specifications. frameworks: spring,hibernate database: oracle server: weblogic 11g problem here when use weblogic data source connections not releasing pool causing database server ram consumption after transactions. when use basic data source in application connections releasing after each transaction , there no ram consumption @ database server end. how can use container based data source? this depend on parameters have selected while configuring data source weblogic. please check following 1) not enable "pinned thread" properties 2) enable "inactive connection time out" appropriate value. may possible application has leaked connection

c - Looking for a way to work with current "session" of Lotus Notes -

i'm wondering if there c function work current "session" of lotus notes running in lotus c api toolkit, similar "notessession" in vba. wasn't able find on internet or going through documentation. need access users calendar , modify based on schedule different app. works manual input of database name , username. any appreciated. you can read information need notes.ini file using osgetenvironmentstring read keys "mailfile" , "mailserver" , "username". can use seckfmgetusername username.

Apache Flink: How does it handle the backpressure? -

for operator, input stream faster output stream, input buffer block previous operator's output thread transfers data operator. right? do flink , spark both handle backpressure blocking thread? what's difference between them? for data source, continuously producing data, if output thread blocked? buffer overflow? https://data-artisans.com/how-flink-handles-backpressure/ the article explains in great detail how backpressure handled implicitly within flink

php - How do i get the id of a row after i stored procedure -

i executed stored procedure inserts flight information table , wanted id after every insert made. not able find other ways work me. wanted flight_id on auto_increment. mysqli_query($conn,"call addschedule('$airlineid','$from','$to','$departdate','$arrivedate','$departtime','$arrivaltime','$price')"); $last_id = mysqli_insert_id($conn); echo $last_id; running mysqli_insert_id returns me value of 0 last flight id 3. can give me clear explanation? mysqli_insert_id — returns auto generated id used in last query the mysqli_insert_id() function returns id generated query on table column having auto_increment attribute. if last query wasn't insert or update statement or if modified table not have column auto_increment attribute, function return zero. so please check had set auto_increment attribute id field. or if had set auto_increment. sample code might you. <?php $mysqli = n...

android - Fatal exception is thrown in Intent -

i'm trying call other activity, throwing exception. here code: public static intent newintent(context packagecontext, boolean answeristrue) { intent = newintent(packagecontext, answeristrue);//this line throwing exception i.putextra(extra_answer_is_true, answeristrue); return i; }; and logcat here: 08-29 05:05:52.061 2457-2457/com.bbn.geoquiz e/androidruntime: fatal exception: main process: com.bbn.geoquiz, pid: 2457 java.lang.stackoverflowerror: stack size 8mb @ com.bbn.geoquiz.cheatactivity.newintent(cheatactivity.java:17) @ com.bbn.geoquiz.cheatactivity.newintent(cheatactivity.java:17) @ com.bbn.geoquiz.cheatactivity.newintent(cheatactivity.java:17) @ com.bbn.geoquiz.cheatactivity.newintent(cheatactivity.java:17) @ com.bbn.geoquiz.cheatactivity.newintent(cheatactivity.java:17) @ com.bbn.geoquiz.cheatactivity.newintent(cheatactivity.java:17) @ com.bbn.geoquiz.cheatactivity.newintent(cheatactivity.java:17) @ com.bbn.geoquiz.cheatactivity.newintent(cheatactiv...

sql server - How to write procedure to get all the data of table of tables? -

i have master table contains table names , columns corresponding table. i want write procedure iterates through records of tables , gets data , returns single result set. you need use dynamic query declare @sql varchar(max)='' set @sql = (select @sql + 'select ' + column_name + ' ' + table_name + ' union ' master_table xml path('')) select @sql = left(@sql, len(@sql) - 9) exec (@sql) note : datatype of columns should same. if not case may have explicit conversion varchar set @sql = (select @sql + 'select cast(' + column_name + ' varchar(4000)) ' + table_name + ' union ' master_table xml path(''))

android - How to dispatch touchevent from popupwindow to its child listview -

i'm using popupwindow show suggestions when user type on edittext. inside popup window, have listview shows suggestions. couldn’t use listpopupwindow because covering keyboard user can't able continue typing while popup showing. in order user continue typing, have setfocusable(false); on popupwindow. issue 1 cannot click on suggestion since window not focusable. , if make focusable, user won't able continue typing since focus removed edit text popup window . therefore have set touchlistener popupwindow , perform click programmatically. how can intercept popupwindow touchevent , perform click on listview item? tried using code snippet below never worked public void initpopupwindow(int type) { mpopupwindow = new popupwindow(popupview, viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content); mpopupwindow.setinputmethodmode(popupwindow.input_method_needed); mpopupwindow.setfocusable(false); mpopupwindow.setoutsidetouchable(true);...

python - pexpect for terminal at local computer -

i developing codes user interaction using pexpect local terminal on mac (not remote ssh) instead of using subprocess. don't know did wrong following cases receive empty outputs: 1) child = pexpect.spawn('ls') child.expect(pexpect.eof) output = child.before print output the output empty 2) child = pexpect.spawn('ls -l') child.expect(pexpect.eof) output = child.before print output it works well. output list of files , folder type ls -l @ local terminal 3) child = pexpect.spawn('pwd') child.expect(pexpect.eof) output = child.before print output the output empty the output must existing, not empty in 3 cases right? know why 'ls' , 'pwd' empty, 'ls -l' not? should fix 'empty' output? best regards, quyen tran for running commands not require interaction, spawn not right method. better use pexpect.run method , output return value. pexpect.spawn more suited spawn child process need send command...

Regex modifier to treat the pattern as a fixed string -

i have 'regular expression' default search mode in notepad++, , looking way avoid changing search modes between 'normal' , 'regular expression' time, based on type of pattern i'm searching for. is there modifier in regex treat pattern (part or whole) fixed string? example, want test_group="${test_group}" matched literal string, without having escape anything. i found modifier, (?q) , tcl here , need more general, work in searches in notepad++/vim, , preferably, works in languages such perl/java. you can use \q , \e avoid escaping of characters inside match string example: match .${hello} literally \q.${hello}\e see regex demo

security - Why not include CSRF protection for GET apis? -

i reading on csrf , came across question: https://security.stackexchange.com/questions/36671/csrf-token-in-get-request multiple people online have seem indicate 1 should not protect requests against csrf. however, confused why. if request contains sensitive information (like personal info user), want protect against csrf right? otherwise attacker can steal personal info. i shouldn't include token in url because may logged. however, can't include them in custom header? crsf attacks blind. typically send request without being able read result of action. reason here same origin policy. sop prevents reading responses received other origins, meaning can't access private stuff anyways. crsf protection instead protects requests in sense adds token symbolizes request started web app itself

java - Unable to launch Eclipse RCP application product - The Launcher was unable to locate its companion shared library -

i using eclipse juno service release 2. i created product existing eclipse rcp application. when click on launch eclipse application in overview tab of .product file, launches fine. when click on launcher(.exe) in exported eclipse rcp product. message - the testlauncher unable locate companion shared library. i using jre-32 bit , eclipse juno 64 bit. may know causing issue , how resolve it. i able resolve issue. because of mismatch in jre , eclipse versions. using eclipse juno 64 bit jre 1.6 32 bit. used eclipse juno 32 bit jre 1.6 32 bit export product , able launch product successfully. read somewhere swt libraries of eclipse platform dependent. won't able run, 64bit version on 32bit jre system.

oauth 2.0 - How to auto refresh a token when user is active - Wso2 IS, API Manager -

i using wso2 api manager 1.9 , wso2 5. i generating token curl -k -d "grant_type=password&username=username@domain.com&password=password" -h "authorization: basic zmtvztdjnuvume8ytvvqmnphoerqv05svxu wytpmm0cynmlrbvpvthlhufplthlartzyohjlshnh, content-type: application/x-www-form-urlencoded" https://10.234.31.152:8245/token response { "scope":"default", "token_type":"bearer", "expires_in":3600, "refresh_token":"42a354167211de45aca1b2ebacc27d24", "access_token":"266c3aabaad48a587a6b5145d4f5252" } here expiry of token 3600 seconds. (it can configured.) my requirement is: token should not expired when user actively accessing apis, token should expired if user idle 3600 seconds application uses api should handle api expiration time.if token expired when user accessing api, need obtain new token using refresh token[1] https://doc...

android - how to fix screen overlay detected programmatically -

in app ask permission access sms in android sdk 23 (runtime permission) problem dialog screen overlay showed , access not granted .i disabled apps overlay nothing changed . found link not helped and question how can fix programmatically ? ok , finally found solution ,i search web :d , can't find useful . answer : when ask new permission don't ever ever else showing toast or.... in case restart app , ask next permission use this code restart app , good luck.

sql - Updating a column value for multiple rows based on a condition -

i trying update column multiple rows. following query update [members] set [credits]=[credits]+@freecredits [id] in (select t1.[memberid] @members t1 right join [members] t2 on t1.memberid!=t2.id t2.activeplan null) what trying that, want add free credits members' accounts don't have active plan (=null). list of members in @members table-valued parameter , [members] table. the query not working expected. it's adding credits members, has [activeplan] not equal null . please tell me how achieve using 1 update query. sorry, bother guys. after posting question solution clicked in mind. tried following simple query , worked :) update [members] set [credits]=[credits]+@freecredits [id] in (select [memberid] @members) , [activeplan] null please see if has problems. thank :)

android - NullPointerException in converting retrofit response to string? -

this retrofit class public class apiclient { public static final string base_url = appconstants.base_url; private static retrofit retrofit = null; public static retrofit getclient() { if (retrofit == null) { retrofit = new retrofit.builder() .baseurl(base_url) .addconverterfactory(gsonconverterfactory.create()) .build(); } return retrofit; } public interface registerapi { @post(appconstants.login_page) call<jsonobject> getlogin(@body jsonobject loginparams); } } this retrofit request jsonobject loginparams = ((mainactivity) getactivity()).requestparams.getloginparams(etusername.gettext().tostring(), etpassword.gettext().tostring()); apiclient.registerapi apiservice = apiclient.getclient().create(apiclient.registerapi.class); call<jsonobject> call = apiservice.getlogin(loginparams); call.enqueue(new callback<jsonobject>() { ...

Winforms DPI scaling messed up with Windows 10 anniversary update and Visual Studio 2015 Update 4 -

i'm running winforms app using windows 10 anniversary update. when running under visual studio 2015 update 4 debugger, ui layout messed up. controls smaller, others larger, mouse hit detection off, , on. when run exe itself, without debugger, displays correctly. also, when running in previous windows 10 build 1511 , visual studio 2015 update 3, app displays fine well. so problem either anniversary build or visual studio 2015 update 4. (i unable try anniversary build visual studio 2015 update 3 latter build no longer available.) what can account this? i've verified app.vshost.exe.config has same content app.exe.config , , there no dpi-aware properties in either. edit : ran app using "start without debugging" , then attached debugger. attaching causes ui resize high-dpi unscaled view, i.e. in native screen resolution - small pixels across entire ui. different either of 2 previous scenarios, , more puzzling. edit 2 : after signing out , logging in,...

visual studio 2015 - VSTO get the publication version of my add in -

Image
i've made vsto excel addin. need put in label version of addin. can assembly version, dim ver string = messagebox.show(globals.thisaddin.gettype().assembly.getname().version.tostring()) with global class can't retrive version of publication... dim ver2 string = globals.thisworkbook.application.version but need see publication version. there way?

ExtJS(5.0): Hide/Destroy floating panel when its show by target gets hidden/destroyed -

i explain problem example: there 2 panels p1 & p2(floating).i have assigned p1 p2's showby.now when destroy/hide p1 ideally p2 must hidden.but in case p2 remains shown. there way can automatically hide p2 when p1 gets hidden/destroyed. i emissary suggested. add listener p1 hide p2 when p1 gets destroyed or hidden. p1.on('destroy', p2.hide, p2); p1.on('hide', p2.hide, p2);

linux - extracting two ranges of lines of a file a and putting them as a data block with shell commands -

i have 2 blocks of data in file, foo.txt following: a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 9 i'd extract rows 2:4 , 6:8 , put them following: b 2 f 6 c 3 g 7 d 4 h 8 i try using auxiliary files: sed -n '2,4p' foo.txt > tmp1; sed -n '6,8p' foo.txt > tmp2; paste tmp1 tmp2 > output; rm tmp1 tmp2 but there better way without auxiliary files? thanks! using process substitution : $ paste <(sed -n '2,4p' foo.txt) <(sed -n '6,8p' foo.txt) > output $ cat output b 2 f 6 c 3 g 7 d 4 h 8 $

java - Getting Exception while creating kie container for drools -

i getting below exception while creating kie container drools. no implementation org.apache.maven.bridge.mavenrepositorysystem annotated interface `org.eclipse.sisu.inject.typearguments$implicit` bound. @ org.eclipse.sisu.wire.locatorwiring 1 error @ @ com.google.inject.internal.errors.throwcreationexceptioniferrorsexist(errors.java:448) @ com.google.inject.internal.internalinjectorcreator.initializestatically(internalinjectorcreator.java:155) @ com.google.inject.internal.internalinjectorcreator.build(internalinjectorcreator.java:107) @ com.google.inject.guice.createinjector(guice.java:96) @ com.google.inject.guice.createinjector(guice.java:73) @ com.google.inject.guice.createinjector(guice.java:62) @ org.codehaus.plexus.defaultplexuscontainer.addplexusinjector(defaultplexuscontainer.java:481) @ org.codehaus.plexus.defaultplexuscontainer.<init>(defaultplexuscontainer.java:206) @ org.codehaus.plexus.defaultplexuscontainer.<...

java - Android Socket - second attempt fails with ETIMEDOUT -

the following code called once second. appears work first time fails on subsequent calls java.netconnectexception etimedout. receiving device microchip wifi module 1 port. private void senddata() { new thread() { @override public void run() { try { socket socket = null; dataoutputstream dataout = null; try { if (socket == null) { socket = new socket("1.2.3.4", 2000); } dataout = new dataoutputstream(socket.getoutputstream()); dataout.writeutf(datastring()); l.d("send"); } catch (unknownhostexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } { if (socket != null) { try { ...

python 2.7 - How to solve 403 error in scrapy -

i'm new scrapy , made scrapy project scrap data. i'm trying scrapy data website i'm getting following error logs 2016-08-29 14:07:57 [scrapy] info: enabled item pipelines: [] 2016-08-29 13:55:03 [scrapy] info: spider opened 2016-08-29 13:55:03 [scrapy] info: crawled 0 pages (at 0 pages/min),scraped 0 items (at 0 items/min) 2016-08-29 13:55:04 [scrapy] debug: crawled (403) <get http://www.justdial.com/robots.txt> (referer: none) 2016-08-29 13:55:04 [scrapy] debug: crawled (403) <get http://www.justdial.com/mumbai/small-business> (referer: none) 2016-08-29 13:55:04 [scrapy] debug: ignoring response <403 http://www.justdial.com/mumbai/small-business>: http status code not handled or not allowed 2016-08-29 13:55:04 [scrapy] info: closing spider (finished) i'm trying following command on website console got response when i'm using same path inside python script got error have described above. commands on web console: $x('//div[@class=...

multithreading - for a multithreaded singled linked list, is "p && !head.compare_exchange_weak(p,p->next)" atomic? -

the usual implementation popping element in stack data-structure multi-threading is: void pop() { auto p = head.load(); while( p && !head.compare_exchange_weak(p,p->next) ) {} } the 'while idiom' subject fact "these operators (in built-in form) not evaluate second operand if result known after evaluating first."(cf. http://en.cppreference.com/w/cpp/language/operator_logical ) i wondering why can consider whole evaluation of expression p && !head.compare_exchange_weak(p,p->next) as atomic , if not wouldn't possible 'p->next' invalid? thanks

java - Hibernate JPA EntityManager.createQuery() performance -

i have query has 2 'in' clauses. first in clause takes around 125 values , second in clause of query takes around 21000 values. implemented using jpa criteriabuilder . query executes fast , return results within seconds. problem entitymanager.createquery(criteriaquery) takes around 12-13 minutes return. i search on so, threads related performance of query.getresultlist . none of them discuss performance of entitymanager.createquery(criteriaquery) . if have seen such behavior earlier, please let me know, how resolve it. my jdk version 1.7. dependency version of javaee-api 6.0. application deployed on jboss eap 6.4. that's not concern of now, testing code using junit using entitymanager connected actual oracle database. if require more information, kindly let me know. a hybrid approach dynamically create query , save named query in entity manager factory. at point becomes other named query may have been declared statically in metadata. while may seem co...

python - Unique dictionary on basis of multiple keys -

i have dict different "types" -> modified , deleted. want unique this. mydict = [ {'type': 'deleted', 'target': {'id': u'1', 'foo': {'value': ''}}}, {'type': 'modified', 'target': {'id': u'1', 'foo': {'value': ''}}}, {'type': 'deleted', 'target': {'id': u'1', 'foo': {'value': ''}}}, {'type': 'deleted', 'target': {'id': u'2', 'foo': {'value': ''}}}, {'type': 'deleted', 'target': {'id': u'2', 'foo': {'value': ''}}}, {'type': 'deleted', 'target': {'id': u'2', 'foo': {'value': ''}}}, {'type': 'deleted', 'target': {'id': u'3', 'foo': {'value...

c++ - How can i create avi from camera using directshow? -

i capture video files camera. captured image files camera using sample grabber, don't know how capture video files , save avi format. when call renderstream function, error occurs. windows sdk 7.x comes amcap sample classic sample demonstrating preview , capture capabilities. video capture application. this sample application demonstrates following tasks related audio , video capture: capture file live preview allocation of capture file display of device property pages device enumeration stream control if have narrower problem, please post code advice specific problem. getting sample code install windows sdk 7.1 make sure install samples this sample installed under following path: [sdk root]\samples\multimedia\directshow\capture\amcap

Handling failure with Azkaban -

there way control happens in azkaban after job fails, mean doing specific thing if specific job fails, lets load hive failed , want send error splank possible? or should create specific job insert , handle failure python thanks the way handle have following job runs script command job type. have script check error condition , perform , action only if error found. #!/bin/bash check=${./_check_script.sh $arg1 $arg2} if [ -z $check ]; echo "error found" ./_error_action.sh $arg1 $arg2 fi note have allow script execution azkaban user ( chmod +x ) scripts in before run them. not inherit permissions due use of .zip upload format. type=command command=chmod +x _alert_for_error.sh command.1=chmod +x _check_script.sh command.2=chmod +x _error_action.sh command.3=./_alert_for_error.sh

How to use SUM() in MySQL for calculated values -

in mysql, dont know how use function sum calculated values. could me please? in code below, latest part. thing want add row @ end, summarizing "calculado" column thank in advance select p.id_order ref, concat (di.firstname,' ',di.lastname) nombre, ca.weight peso, if (ca.weight<1,(1), if (ca.weight>=1 , (ca.weight<3),(2), if (ca.weight>=3 , (ca.weight<5),(3), if (ca.weight>=5 , (ca.weight<8),(4), if (ca.weight>=8 , (ca.weight<10),(5), if (ca.weight>=10 , (ca.weight<15),(6), if (ca.weight>=15 , (ca.weight<20),(7), if (ca.weight>=20,(ca.weight*(0.5)),'error' )))))))) calculado, p.invoice_date fecha ps_orders p left join ps_address di on (p.id_address_delivery = di.id_address) left join ps_order_carrier ca on (p.id_order = ca.id_order) date(p.invoice_date) >= concat(date_format(last_day(now...

java - MP Chart Showing One Extra Value at X_axis in Line Chart? -

Image
i have implemented mp linechart. every thing working except one.it adds first month @ end of x axis. , values starts second point not first one. tried several solutions provided on google couldn't succeeded. e.g in following screen shot months list contains [apr,may,jun,jul,aug] adding in apr @ end , line starting may not apr. following code. string[] mmonths; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_multi_line_chart); context = this; mpref = new mysharedpreferences(this); charts_list = new arraylist<charts_data_model>(); mchart = (linechart) findviewbyid(r.id.chart1); mchart.setonchartvalueselectedlistener(this); mchart.setdrawgridbackground(false); mchart.setdescription("vsc chart"); mchart.setdrawbor...

C – initialize a two dimensional global static array of structs that contain more than one array -

i want initialize 2 dimensional global static array of structures contains arrays in it. following doesn’t seems work. struct mystuct{ int a; int b; int c[2]; int d[2]; }; static mystuct[2][3] = { {{1,1,{1,1},{1,1}}, {2,2,{2,2},{2,2}}, {3,3,{3,3},{3,3}}}, {{7,7,{7,7},{7,7}}, {8,8,{8,8},{8,8}}, {9,9,{9,9},{9,9}}} }; any suggestions? thanks struct mystuct{ int a; int b; int c[2]; int d[2]; }; static struct mystuct test [2][3] = { // | col 0 | | col 1 | | col 2 | /* row 0 */ { {1,1,{1,1},{1,1}}, {2,2,{2,2},{2,2}}, {3,3,{3,3},{3,3}} }, /* row 1 */ { {7,7,{7,7},{7,7}}, {8,8,{8,8},{8,8}}, {9,9,{9,9},{9,9}} } }; your matrix declaration has use struct type, i.e struct mystuct test just test: #include <stdio.h> int main (void) { struct mystuct{ int a; int b; int c[2]; int d[2]; }; struct mystuct test [2][3] = { // | col 0 ...

python - how to match paper sheet by opencv -

Image
i have kinds of paper sheet , writing python script opencv recognize same paper sheet classify. stuck in how find same kind of paper sheet. example, attached 2 pic. picture 1 template , picture 2 kind of paper need know if matching template. don't need match text , need match form. need classify same sheet in many of paper sheet. i have adjust skew of paper , detect lines don't know how match lines , judge paper sheet same kind template. is there 1 can give me advice matching algorithm? i'm not sure if such paper form rich enough in visual information solution, think should start feature detection , homography calculation (opencv tutorial: features2d + homography ). there can try adjust 2d features problem.

java - precision of a sum of double in jvm -

i have tests assert sum of values equal expected results. these sum not value, need put precision. logical sum([a, a, a, ...n-times..., a]) != n*a . but instead of putting arbitrary precision, know expected bound. how can compute such bound? in specific case lead question, sum n zeros , k ones (which obtained computing difference of doubles, v1-v2). should equals k +- precision. so precision should used? k * 10e-15 (n+k) * 10e-15 i guess 10e-15 depends on values added: 0 , 1 here

scala - How DataFrame API depends on RDDs in Spark? -

Image
some sources, this keynote: spark 2.0 talk mathei zaharia, mention spark dataframes built on top of rdds. have found mentions on rdds in dataframe class (in spark 2.0 i'd have @ dataset); still have limited understanding of how these 2 apis bound behind scenes. can explain how dataframes extend rdds if do? according databricks article deep dive spark sql’s catalyst optimizer (see using catalyst in spark sql), rdds elements of physical plan built catalyst. so, describe queries in terms of dataframes, in end, spark operates on rdds. also, can view physical plan of query using explain instruction. // prints physical plan console debugging purpose auction.select("auctionid").distinct.explain() // == physical plan == // distinct false // exchange (hashpartitioning [auctionid#0], 200) // distinct true // project [auctionid#0] // physicalrdd //[auctionid#0,bid#1,bidtime#2,bidder#3,bidderrate#4,openbid#5,price#6,item#7,daystolive#8], mappartitio...

How to download lots of files concurrently in android? -

i want download number of files concurrently in android, instance, there 10000 files downloaded, each file have small size 20kb, , want 3 threads concurrently download files. maybe asynctask suitable? , may queue needed manage 10000 urls? there comments mentioned downloadmanager.class, support concurrent download? because there many files , file size small, think concurrently doing faster. i think asynctask suitable this. can create 2 queues say, runningtasks , pendingtasks. when ever try download task put in runningtasks list , other tasks in pendingtasks list. execute tasks added in running tasks list using asynctask handler . add listener whenever task gets completed. remove task pendingtasks , add in pendingtasks list. see logic implmented below:- public class downloader { asynctaskscheduler scheduler; public downloader() { scheduler = new asynctaskscheduler(); } public void startdownload() { long ts = system.currentt...

scala - value registerAsTable is not a member of org.apache.spark.sql.DataFrame -

i running below code in zeppelin 0.7 %spark //val sc: sparkcontext // existing sparkcontext. sc import sqlcontext.implicits._ import org.apache.spark.sql._ import org.apache.spark.sql.dataframe; import org.apache.spark.sql.sqlcontext; val sqlcontext = new org.apache.spark.sql.sqlcontext(sc) val people = sqlcontext.jsonfile("/users/asdf/desktop/people.json") people.printschema() people.show() people.select("name").show() people.todf().registerastable("people") its working till people.select("name").show() throws error @ last line, below error: +-------+ | name| +-------+ |michael| | andy| | justin| +-------+ <console>:230: error: value registerastable not member of org.apache.spark.sql.dataframe people.todf().registerastable("people") asper knowledge imported required , converted df before registering table. missing here? add following 2 lines after line "people.select("name...

android - Map inside scrollview not scrollable -

i have map fragment inside vertical scrollview. want scrollable. not working. have tried adding transparent image , custom scrollview these answers: how set google map fragment inside scroll view google maps api v2 supportmapfragment inside scrollview - users cannot scroll map vertically my layout structure: <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".activities.tripdetailsactivity"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ecf0f1" android:orientation="vertical"> <android.support.v7.widget.cardview android:id="...

arrays - Loop through json using jq to get multiple value -

here volumes.json : { "volumes": [ { "availabilityzone": "us-east-1a", "tags": [ { "value": "vol-rescue-system", "key": "name" } ], "volumeid": "vol-00112233", }, { "availabilityzone": "us-east-1a", "tags": [ { "value": "vol-rescue-swap", "key": "name" } ], "volumeid": "vol-00112234", }, { "availabilityzone": "us-east-1a", "tags": [ { "value": "vol-rescue-storage", "key": "name" } ], "volumeid": "vol-00112235", } ] } i n...