Posts

Showing posts from March, 2011

android - How to load a Custom Java View class to a RelativeLayout programmatically -

i want load custom views within relativelayout don't know how. code i've tried doesn't work hence know how correctly? xml <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin"> <textview android:id="@+id/textview0" android:layout_widt...

c# - System.IndexOutOfRangeException when trying to copy data from list to 2d array -

i getting exception: system.indexoutofrangeexception: 'index outside bounds of array.' on col ++ when in second loop. trying put vales list> excel columns , rows. please let me know doing wrong. object[,] cellvaluestowrite = new string[excelrange.rows.count, excelrange.columns.count]; foreach (list<string> errorrecord in section.errorrecords) { int rows = 0; int col = 0; int length = errorrecord.count; foreach (var elem in errorrecord) { if (col < length) { cellvaluestowrite[rows, col] = elem; col++; } } rows++; } if create array excelrange.rows.count , excelrange.rows.count 5 cannot access cellvaluestowrite[5, col] because indexing starts @ 0 , try access 6-th element way. why not using old loop (especially if need indexing): for (int row = 0; row < cellvaluestowrite.getlength(0); row++) { (int col = 0; col < cellvaluestowrite.getlengt...

Encoding sys.argv in python 2.7 -

i'm writing script takes input software (maltego), , using sys.argv[1] variable. when information maltego in hebrew, question marks rather actual text. tried encoding text in different ways failed. i'm using python 2.7. any idea solution appreciated. the script being run within maltego: # -*- coding: utf-8 -*- import time selenium import webdriver selenium.webdriver.common.keys import keys bs4 import beautifulsoup maltegotransform import * import codecs import sys reload(sys) sys.setdefaultencoding('utf-8') me = maltegotransform() search_value = sys.argv[1].encode("utf-8") here fifty pence: import sys def win32_utf8_argv(): """uses shell32.getcommandlineargvw sys.argv list of utf-8 strings. versions 2.5 , older of python don't support unicode in sys.argv on windows, underlying windows api instead replacing multi-byte characters '?'. returns none on failure. ""...

Accessing members of collection during rails activerecord query with geocoder -

i'm using geocoder gem. model user has latitude , longitude , , radius attributes. have collection of users called liveusers in instance method in class user . want trim liveusers down users less radius away instance's location, using .near method geocoder . how construct kind of query? liveusers.near([self.latitude, self.longitude], liveuser.radius ) # realise won't work

How to Compress Image Size on Upload in Php -

i beginner , have been trying reduce image size on upload failing results. please me. here php code <?php if (isset($_post['update'])){ header('location:index2.php'); $upload_image = $_files["image"][ "name" ]; $folder = "images/"; move_uploaded_file($_files["image"]["tmp_name"], "$folder".$_files["image"]["name"]); $file = 'images/'.$_files["image"]["name"]; $uploadimage = $folder.$_files["image"]["name"]; $newname = $_files["image"]["name"]; $random = substr(number_format(time() * rand(),0,'',''),0,10); $resize_image = $folder.$newname.$random; $actual_image = $folder.$newname; list( $width,$height ) = getimagesize( $uploadimage ); $newwidth = 600; $newheight = 600; $thumb = imagecreatetruecolor( $newwidth, $newheight ); $source = imagecreatefromjpeg($actual_image); imagecopyresized($thum...

javascript - how could I map the divs to a two dimensional array tictactoe game -

i have tic-tac-toe game implement using 2 dimensional array. right i'm using simple array , works fine. think easier implement using 2 dimensional array, take advantage of loops when checking winners , other things. my problem can find way map div clicked index in 2 dim array. example if user clicks on 3rd div of second row on ui, how map 2darray[1][2] (the second subarray index 2)? thanks. hope explained well. interested in looking @ code here's codepen of tic-tac-toe: https://codepen.io/zentech/pen/xlrzgr var xplayer = "x"; var oplayer = "o"; var turn = "x"; var board = new array(9); var message = document.getelementbyid("message"); $(document).ready(function() { $(".square").click(function() { var sqrid = $(this).attr("id"); playermove(sqrid); if (checkwinners()) { message.innerhtml = "message: " + turn + " wins!"; return; } if (chec...

javascript - How to check if the user scrolled to 30% of an element, from the top or the bottom -

as specified in title, i'm listening scroll event in order fire function when 30% of video shows in window - regardless whether user scrolls or down. what have this: // on dom ready, set top , bottom offset of video, // +/- 30% of video height var $video = $('#js-b2b-video'); var videoheight = $video.outerheight(); var videoheight30 = parseint(videoheight/3, 10); // approx. 30% of video height var videoobj = {} videoobj.top = $video.offset().top + videoheight30; // approx. 30% top of video videoobj.bottom = videoobj.top + videoheight - videoheight30; // approx. 30% bottom of video then, scroll event: $(window).on('scroll', function() { if ($(window).scrolltop() >= videoobj.top) { alert('30% top of video reached'); } }); however, fires late, when video visible. need fire function when 30% of top or bottom of video visible. how do properly? fiddle you need take window height account. if ($(window).scrolltop()...

Spring Cloud DataFlow http polling and deduplication -

i have been reading spring cloud dataflow , related documentation in order produce data ingest solution run in organization's cloud foundry deployment. goal poll http service data, perhaps 3 times per day sake of discussion, , insert/update data in postgresql database. http service seems provide 10s of thousands of records per day. one point of confusion far best practice in context of dataflow pipeline deduplicating polled records. source data not have timestamp field aid in tracking polling, coarse day-level date field. have no guarantee records not ever updated retroactively. records appear have unique id, can dedup records way, not sure based on documentation how best implement logic in dataflow. far can tell, spring cloud stream starters not provide out-of-the-box. reading spring integration's smart polling , i'm not sure that's meant address concern either. my intuition create custom processor java component in dataflow stream performs database qu...

python - How to reshape dataframe if they have same index? -

if have dataframe df= pd.dataframe(['a','b','c','d'],index=[0,0,1,1]) 0 0 0 b 1 c 1 d how can reshape dataframe based on index below i.e df= pd.dataframe([['a','b'],['c','d']],index=[0,1]) 0 1 0 b 1 c d let's use set_index , groupby , cumcount , , unstack : df.set_index(df.groupby(level=0).cumcount(), append=true)[0].unstack() output: 0 1 0 b 1 c d

javascript - Why does jQuery or a DOM method such as getElementById not find the element? -

what possible reasons document.getelementbyid , $("#id") or other dom method / jquery selector not finding elements? example problems include: jquery silently failing bind event handler, , standard dom method returning null resulting in error: uncaught typeerror: cannot set property '...' of null the element trying find wasn’t in dom when script ran. the position of dom-reliant script can have profound effect upon behavior. browsers parse html documents top bottom. elements added dom , scripts (generally) executed they're encountered. this means order matters. typically, scripts can't find elements appear later in markup because elements have yet added dom. consider following markup; script #1 fails find <div> while script #2 succeeds: <script> console.log("script #1: %o", document.getelementbyid("test")); // null </script> <div id="test">test div</div> <...

php - Looking to recover the product attribute for a cart item -

i trying recover array of attributes products in woocomerce cart this code have written (i beginner) foreach ( wc()->cart->get_cart() $cart_item_key => $cart_item ) { global $product; $my_product_id = $cart_item['product_id']; echo "id {$my_product_id} \n"; $my_attribute = wc()->product->attribute->get_name($value); } however "call member function get_name() on null" i think getting items product_id 's ok (using echo view). not sure how use function get_name() or indeed of methods in object wc_product_attribute i guess working outside loop? i writing code wordpress 'page' in order develop it, using plugin wraps code in tags - [insert_php] & [/insert_php] help appreciated, need understand doing wrong conceptually. correct code loictheaztec produces third element of array (the attribute want retrieve) 'pa_1_scale' => object(wc_product_attribute)[1410] protected 'data' => ...

pyspark - Getting difference between value and its lag in Spark -

i have sparkr dataframe shown below. want create monthdiff column months between dates , grouped each name . how can this? #set data frame team <- data.frame(name = c("thomas", "thomas", "thomas", "thomas", "bill", "bill", "bill"), dates = c('2017-01-05', '2017-02-23', '2017-03-16', '2017-04-08', '2017-06-08','2017-07-24','2017-09-05')) #create spark dataframe team <- createdataframe(team) #convert dates date type team <- withcolumn(team, 'dates', cast(team$dates, 'date')) here's i've tried far, resulting in errors: team <- agg(groupby(team, 'name'), monthdiff=c(na, months_between(team$dates, lag(team$dates)))) team <- agg(groupby(team, 'name'), monthdiff=months_between(team$dates, lag(team$dates))) team <- agg(groupby(team, 'name'), monthdiff=months_between(select(team, 'dates...

javascript - Dynamically disabling touch-action (overscroll) for SVG elements -

Image
i'm having problems touch screen overscrolling on chrome. i have document svg element in it, contains shape, rectangle: now, want make rectangle draggable, means want disable kinds of touch actions on respective <rect> element, setting it's style property touch-action: none . this works fine on desktop browsers, except chrome. on chrome, when touch , move on rectangle, browser's overscroll feature kicks in. causes browser window awkwardly move, pointer events have set on rectangle cancelled. i.e. pointermove registered fraction of second, stops when overscroll kicks in. pointerup never called when touch released. now, if had html element instead of svg element, setting touch-action: none job. same thing on svg element fails. technically, solved either setting touch-action: none on document.body or wrapping whole svg <div> element touch-action: none set. unfortunately, not option me since need document (and rest of rectangle-surround...

c# - How to get value cell by name in click event? -

Image
i have got datagridview click event inside try value of cell selected row: private void datagridview1_cellclick(object sender, datagridviewcelleventargs e) { string status = datagridview1.rows[e.rowindex].cells[e.columnindex].value.tostring(); } it works, how can value name column this: string status = datagridview1.rows[e.rowindex].cells["status"].value.tostring(); i have column name status , ut says me there not column

word vba - VBA - Can I unload stack calls to avoid a runtime 28 "Out of stack space" error? -

i'm working on project uses vba userforms assist users in creating different word documents. 1 of requirements users able go , forth between userforms. this latest document has more userforms (31 or so) previous ones, , i've found can trigger runtime error 28 "out of stack space" populating of forms, navigating first one, going forward again. when going forward, i'm doing nothing different first time through, believe out of stack space due limit on number of calls, rather recursive or other problem listed in microsoft documentation here https://msdn.microsoft.com/en-us/library/aa264523(v=vs.60).aspx . for record, unloading forms when going or forward. example: private sub cb_back_click() 'backward navigation unload me showpreviousform end sub my question is, in vba there way can "unload" call stack? it's extremely unlikely user did, i'm not concerned part of project, know in case other parts of project closer limi...

postgresql - Trying to update column on C# using Npgsql -

i'm trying update value of column using npgsql (postgresql) , visual studio 2015. "forgot password?" form. the user needs enter 2 variables in order accomplish reset (an if condition): 1. enter ssn (aka rg in brazil); , 2. enter user-specific code unchangeable. what happens is: when try change value (using command below), nothing happens. npgsqlcommand command = new npgsqlcommand("update dbschema.dbtable set senha = '" + textbox2.text + "' rg = '" + textbox2.text + "'"); the if condition executes (i tied if command message box, shows password has been reseted - sign if condition indeed executed) - thing doesn't happen right password update (which might minor feature in release, i'd prefer reset myself on database). tried several changes in code, no success yet. thanks in advance help. lucas you have open database connection , execute command, e.g.: using (var conn = new npgsqlconnection(<c...

reactjs - React - on outside click of component subtree -

i'm aware of several solutions detecting 'outside' clicks react component - i.e. use dom elements' .contains method see if event originated within dom tree - however, know of can detect such events 'outside' of actual component hierarchy? example, work portals above method not (since dom tree isn't representative of react tree). edit: example: <div> <div onoutsideclick={handleoutsideclick}> // onoutsideclick implementation todo <div> <button /> // same dom tree, same component tree, detected not outside (ding) </div> <div> <portal> <button /> // not same dom tree, same component tree, detected outside (bzzt) </portal> </div> </div> <button /> // not same component tree, nor dom tree, detected outside (ding) </div>

notepad++ - Regex replace one value between comma separated values -

Image
i'm having bunch of comma separated csv files. replace exact 1 value between third , fourth comma. love notepad++ 'find in files' , replace functionality use regex. each line in files this: 03/11/2016,07:44:09,327575757,1,5434543,... the value replace in each line number 1 one. it can't simple regex e.g. ,1, somewhere else in line, must 1 after third , before fourth comma... could me regex? in advance! two more rows example: 01/25/2016,15:22:55,276575950,1,103116561,10.111.0.111,ngd.itemversions,0.401,0.058,w10,0.052,143783065,,... 01/25/2016,15:23:07,276581704,1,126731239,10.111.0.111,ll.browse,7.133,1.589,w272,3.191,113273232,,... you can use ^(?:[^,\n]*,){2}[^,\n]*\k,1, replace value need. the pattern explanation: ^ - start of line (?:[^,\n]*,){2} - 2 sequences of [^,\n]* - 0 or more characters other , , \n (matched negated character class [^,\n] ) followed with , - literal comma [^,\n]* - 0 or more characters other ,...

php - Include functions file in Code Igniter -

i'm new ci include code below (which sits in file called color.php) within view , reference functions. doesn't seem work when per normal php include include('/assets/color.php'); i've tried adding color.php helper , loading in view again not working … any on how best include great. class getmostcommoncolors { var $preview_width = 150; var $preview_height = 150; var $error; /** * returns colors of image in array, ordered in descending order, keys colors, , values count of color. * * @return array */ function get_color( $img, $count=20, $reduce_brightness=true, $reduce_gradients=true, $delta=16 ) { if (is_readable( $img )) { if ( $delta > 2 ) { $half_delta = $delta / 2 - 1; } else { $half_delta = 0; } // have resize image, because need significant colors. $size = ge...

javascript - How do I keep animated links underlined for the current page? -

i'm building nav menu links underlined on hover. when link clicked want underline remain, , not animate again current page. here's have far. header ul li a:after { content: ''; display: block; height: 3px; width: 0px; background: transparent; transition: width .3s ease, background-color .3s ease; margin: 14px 0px 0px 0px; } header ul li a:hover:after { width: 100%; background: #fff; } this code add underline when link hovered. i've tried keeping link underlined current page javascript, doesn't produce desired affect. document.getelementbyid('contact-link').style.borderbottom = '3px solid white'; document.getelementbyid('contact-link').style.paddingbottom = '0px'; here example want i'm trying accomplish. https://rocketlabusa.com/ i works if add class on click... $("header ul li a").on("click", function(){ $(this).addclass("visite...

github - Git mergetool will not launch, but difftool will -

Image
i have conflicts after merge. resolve conflicts, trying use meld. don't have trouble viewing differences using difftool. however, when use mergetool, meld not open. git bash after using mergetool command: my gitconfig file is: [merge] tool = meld [mergetool "meld"] cmd = \"c:\\program files (x86)\\meld\\meld.exe\" "$local" "$base" "$remote" "--output=$merged" path = c:/program files (x86)/meld/meld.exe trustexitcode = false keepbackup = false [diff] tool = meld [difftool "meld"] cmd = \"c:\\program files (x86)\\meld\\meld.exe\" "$local" "$remote" path = c:/program files (x86)/meld/meld.exe [mergetool] keepbackup = false

How to run program in R every 10 seconds without Scheduler? -

Image
this question exact duplicate of: using sys.sleep in r function delay multiple outputs 2 answers i creating program in r data off api. since real time pricing data, need run program every 10 seconds. i wondering: what effective way this? what easiest way add data excel doc? use sys.sleep() i = 1 while(true){ if (i %% 11 == 0){ break #a condition break out of loop #write.table() #but maybe want write results #to table after number of iteration } print(i) #run code sys.sleep(time = 1) #time in seconds = + 1 }

Trim string after a certain character sql -

i have list of places many of places not have id appended @ end of name of places starts after dash character (-). need show name of place , not id. ids have length of 5 characters, i.e : 132 rockaway blvd -12345 , 176-58 bayshore avenue -78952, 12-89 rosedale place need display: 132 rockaway blvd 176-58 bayshore avenue 12-89 rosedale place have tried `select distinct right(rtrim(placename),7) places` gives me last characters -12345 declare @table1 table(column1 varchar(200)) insert @table1(column1) values('132 rockaway blvd -12345') insert @table1(column1) values('176-58 bayshore avenue -78952') insert @table1(column1) values('12-89 rosedale place -9999999999') select column1, left(column1,len(column1)-charindex('-',reverse(column1))) @table1 --if can give me more example can modify query

jquery - clearTimeout(var) not working as expected -

first: searched , questions cleartimeout not working variable scope problems, not case. i need auto-hide header after x seconds without interaction, created 2 functions, startmenutimeout , clearmenutimeout() , part of code looks that: var menutimeout = null; function startmenutimeout(){ menutimeout = settimeout(function(){ $('[auto-header]').removeclass('-visible'); }, 2000); } function clearmenutimeout(){ cleartimeout(menutimeout); } when user scrolls up, make header visible , start timeout, then, on mouseenter clear timeout. problem is, doesn't clear timeout, if scroll , down few times, after 2 seconds timeout, menu goes up. i reproduced problem on codepen, click here access. after blazing fast comments of kevin b , carcigenicate solved it. thing is, every time call settimeout() , creates new id, then, if attributing timeout id variable, override, losing reference previous one. the solution clearing timeout before setting ne...

c# - Methods don't show in Swagger UI (w/ Swashbuckle) but no error message -

i'm writing api swashbuckle, running issues. have 3 methods in acontroller: [responsetype(typeof(ienumerable<a>))] public ihttpactionresult get(int bid); [responsetype(typeof(ienumerable<a>))] public ihttpactionresult get(ilist<int> cids); [responsetype(typeof(ienumerable<a>))] public ihttpactionresult get(int bid, ilist<int> cids); i expect either error overloading endpoints or work single method 2 optional parameters, covering cases. instead, i'm getting second method show, seems arbitrary. i'm wondering, there way 3 work, , also, there reason beyond chance second method shown in ui? thanks! to answer first question, able 3 methods work defining different endpoints them. each method, add following attribute: [httpget("the_end_point_you_want")]. ie) [httpget("/getbid/{bid})") [responsetype(typeof(ienumerable<a>))] public ihttpactionresult get(int bid) [httpget("/getlistcid")] [res...

c++ - Region growing segmentation clusters are wrong? -

Image
i performing region growing segmentation of point cloud have of room via pcl point cloud library. colored cloud looks following: as can see of clusters according surface. however, when show each cluster separatedly, these of results: clearly clusters not same in colored cloud, dont understand why. using code store clusters separated point clouds: //store clusters new pcls , clusters in array of pcls std::vector<pcl::pointcloud<pcl::pointxyzrgb>::ptr> clusters_pcl; (int = 0; < clusters.size(); ++i) { pcl::pointcloud<pcl::pointxyzrgb>::ptr cloud_cluster( new pcl::pointcloud<pcl::pointxyzrgb>); cloud_cluster->width = clusters[i].indices.size(); cloud_cluster->height = 1; cloud_cluster->is_dense = true; (int j = 0; j < clusters[i].indices.size(); ++j) { //take corresponding point of filtered cloud indices new pcl...

Python Slicing confusion with Numpy -

this question has answer here: python slice notation comma/list 2 answers input: import numpy np b=np.array([(1.5,2,3),(4,5,6)],dtype=float) b[[1,0,1,0]][:,[0,1,2,0]] output: array([[ 4. , 5. , 6. , 4. ], [ 1.5, 2. , 3. , 1.5], [ 4. , 5. , 6. , 4. ], [ 1.5, 2. , 3. , 1.5]]) i know b[:,[0,1,2,0]] , b[[1,0,1,0]] , not know mechanism behind b[[1,0,1,0]][:,[0,1,2,0]] . clear explanation on it? so many thanks! you indexing lists, getting corresponding rows , columns (with repeats). indexing first list returns rows, , second columns. b[[1,0,1,0],[:0,1,2,0]] returns columns 0, 1, 2, 0 of rows 1, 0, 1, 0. 2 copies of each row, , copy of column 0 on rows.

(Batch Script) - Desktop screenshot (functional) but cannot be minimized? -

thank in advance time. i found/edit batch script (bat1.cmd) take desktop screenshot. working actually. here complete code = https://pastebin.com/kvqgfx5l . my request here hide/minimize bat1.cmd window when run (within lnk, check "nb" @ end of message). i made researches , classic solution use kind of scripts : if not defined is_minimized set is_minimized=1 && start "" /min "%~dpnx0" %* && exit or if not "%minimized%"=="" goto :minimized set minimized=true start /min cmd /c "%~dpnx0" goto :eof :minimized unfortunately batch script (bat1.cmd) have special parameters not allow (?) add kind of "minimize" script (i tried add on top, inside script etc , nothing working). nb : batch script (bat1.cmd) donwloaded/run within shortcurt (bat1.lnk) adding minimized parameters in lnk won't minimized bat1.cmd window (i guess ?/i made test). c:\windows\syswow64\windowspowershell\v1.0\powe...

Behaviour space in Netlogo crashes when using extension R -

i making simulation netlogo , extension r. have made supply chain model, have distributors , consumers. consumers provide orders distributors , distributors forecast future demand , places orders suppliers in advance fulfill market demand. forecast implemented extension r ( https://ccl.northwestern.edu/netlogo/docs/r.html ) calling elmnn package. model works fine when using "go". however, when want conduct experiments using behavior space, keep getting errors. if set few ticks behavior space, model works fine. when want launch few hundred ticks behavior space keeps crashing. example, "extension exception: error in r-extension: error in eval, operator invalid atomic vector", "extension exception: error in r-extension: error in eval: cannot have attributes on charsxp". behavior crashes without error. i assume errors related computability issues between netlogo, r, r extension , java. using netlogo 5.3.1, 64-bit; r-3.3.3 64-bit; rjava 0.9-8. model ex...

azure machine learning - Is there any way to upload a file to Microsoft QnA Maker KB from visual studio? -

i trying change knowledge base of qna maker service in microsoft qna maker site. possible upload file service code? you can update kb using qnamaker v2.0 apis . in particular, can use update knowledge base operation, allow add/delete qna pairs , / or urls existing knowledge base.

java - Google Spanner NullPointerException at SpannerOptions -

i'm trying initiate , add google spanner during runtime. however, when reach line: spanneroptions options = spanneroptions.newbuilder().build(); i stack trace: 2017-08-14 14:28:39.232:warn:oejs.servlethandler:qtp998351292-16: error /_ah/api/discovery/v1/apis/helloworld/v1/rest java.lang.nosuchmethoderror: com.google.common.base.preconditions.checkargument(zljava/lang/string;ii)v @ com.google.cloud.spanner.spanneroptions.createchannels(spanneroptions.java:232) @ com.google.cloud.spanner.spanneroptions.<init>(spanneroptions.java:88) @ com.google.cloud.spanner.spanneroptions.<init>(spanneroptions.java:43) @ com.google.cloud.spanner.spanneroptions$builder.build(spanneroptions.java:179) @ com.example.b612.asteroidlist.<clinit>(asteroidlist.java) @ java.lang.class.forname0(native method) @ java.lang.class.forname(unknown source) @ com.google.api.server.spi.servletinitializationparameters.getclassforname(servletinitialization...

php - MySQL - Error 1118 Row size too large (> 8126) - No access to sql-config -

i know question asked lot , found lot advice, none practicable me. website hostet on siteground.com. works fine far , got error: 1118 row size large (> 8126). changing columns text or blob or using row_format=dynamic or row_format=compressed may help. in current row format, blob prefix of 768 bytes stored inline. on "random" basis. actually whole website (joomla 3.7.4 / php 7.0.22 /sql-server: 5.6.36-82.1-log - percona server (gpl), release 82.1, revision 1a00d79) lot of custom code isn't usable anymore because of this. now understand has total row size, database , php-amateur still don't it. are there colums in 1 row, or there data in columns? what ist ment "row size large (> 8126)"? there 81 columns per row , according phpmyadmin whole table needs 32kib of data, 16kib of index , alltogether 48 kib. if @ other tables of joomla-system pretty small amount of data (consisting out of serialized arrays, text , thats it) ...

centos6 - how can i move a lot of files on centos from one directory to another? -

i have been trying move lot of files on centos 6, 1 directory another; talking thousands of .wav recordings fill 230 gb. i use crontab it, , have command: find /var/spool/asterisk/backups/ -name ".wav" -exec mv /usr/src/scripts/ {} \ the question want use cp first instead of mv see how works, doesn't make anything, how know if 1 above mv works? if it's not many files mv /var/spool/asterisk/backups/*.wav /usr/src/scripts/ if have huge amount of files fail long command line , "find" can take forever since moves files 1 @ time (and in case wrong way, src dest not dest src) you can use like find /var/spool/asterisk/backups/ -name "*.wav"|xargs -n 100 mv --target-directory=/usr/src/scripts/ then move 100 files @ time, should speed things little. to see can prefix "echo" in "echo mv ...|head" , copy&paste 1 line output. to test little can use "cp -a" instead of mv

java - Unsupported major.minor version 52.0 -

Image
this question has answer here: how fix java.lang.unsupportedclassversionerror: unsupported major.minor version 41 answers pictures: command prompt showing versions picture of error hello.java import java.applet.applet; import java.awt.*; public class hello extends applet { // java applet draw "hello world" public void paint (graphics page) { page.drawstring ("hello world!", 50, 50); } } hello.html <html> <head> <title>helloworld applet</title> </head> <body> <applet code="hello.class" width=300 height=150> </applet> </body> </html> error hello : unsupported major.minor version 52.0 what may problem be? the issue because of java version mismatch. referring wikipedia java class reference :...

python - Why does PySpark keeps calliing Iterator.next after the TaskContext is marked as completed? -

i've built connector database , in custom rdd.compute function i'm adding listener taskcontext.addtaskcompletionlistener closes database connection (this seems common practice among spark connectors, spark's hadooprdd uses pattern well). i have pyspark application creates rdd database data , call rdd.take(1) on rdd (1 partition, 1 local worker thread). problem here pyspark keeps calling iterator.next (custom iterator well) after fired task completion handler. this doesn't happen when scala application calls same rdd.take(1) , spark source code pyspark's rdd.take differs spark's scala rdd.take . i'd appreciate thoughts on issue.

php - Form with more than one collection -

i want realize form, quite simple. thing makes things complicated 'm using 2 collections in form. displaying 2 collections in view works charme. problem validation , associated hydration of bound entity of form. if validated , no errors occur form instance tries hydrate bound entity , ends exception: zend\hydrator\arrayserializable::hydrate expects provided object implement exchangearray() or populate() but first example code ... the form classes namespace application\form; use zend\form\element\collection; use zend\form\element\text; use zend\form\form; class myform extends form { public function __construct($name = '', $options = []) { parent::__construct($name, $options); $this->setattribute('method', 'post'); $this->setattribute('id', 'my-form'); } public function init() { $this->add([ 'name' => 'my-text-field', ...

javascript - Mutipart File upload using Angularjs and Spring -

Image
i'm trying upload files using angularjs rest api exposed via spring : this controller: @requestmapping(value = util/images/{partyid}, method = requestmethod.post) public jsonnode uploadpartyrefimage(@requestpart("file") multipartfile inputfile, @pathvariable string partyid){ objectmapper objectmapper = new objectmapper(); jsonnode jnode = null; try { string[] fileinput = ((diskfileitem) ((commonsmultipartfile) inputfile).getfileitem()).getname().split("\\."); path storagepath= paths.get(uploadpath); filesystemutil.writefile(storagepath,inputfile.getinputstream()); jnode = objectmapper.readtree("{\"type\":\"" + "success" + "\",\"filestorepath\":\"" + pathstring + "\"}"); } catch (exception exapi) { logger.error("error uploading party attached image "+ exapi); } ...