Posts

python - Pandas: Repeat function for current keyword if except -

i have built web scraper. program enters searchterm searchbox , grabs results. pandas goes through spreadsheet line-by-line in column retrieve each searchterm. sometimes page doesn't load properly, prompting refresh. i need way repeat function , try same searchterm if fails. right now, if return , go on next line in spreadsheet. import pandas pd selenium import webdriver selenium.webdriver.common.keys import keys df = pd.read_csv(searchterms.csv, delimiter=",") def scrape(searchterm): #loads url searchbox = driver.find_element_by_name("searchbox") searchbox.clear() searchbox.send_keys(searchterm) print "searching %s ..." % searchterm no_result = true while no_result true: try: #find results, grab them no_result = false except: #refresh page , above again current searchterm - how? driver.refresh() return pd.series([col1, col2]) df[["colum...

mysql - STR_TO_DATE returns blob value -

Image
this question has answer here: phpmyadmin: date fields display blob 1 answer i don't understand why mysql returns blob value here : select dat_real, str_to_date(dat_real, '%d-%m-%y') `entretiens` dat_real <> '' from phpmyadmin : clicking on blob link leads me page saying request = select str_to_date(dat_real, '%d-%m-%y') 'entretiens' 'entretiens'.'dat_real' = '02-09-2010' , .'str_to_date(dat_real, '%d-%m-%y')' = '2010-09-02'; type of dat_real varchar(12) please specify data type of "dat_real" field. , please ensure must string, since str_to_date accepts first parameter date in string format.

Makefile: Save a variable during execution time -

i'm using makefiles "make" lot of things starting / stopping / configuring services i've written. i'd read input user. ways know either make user pass input name=value when executing make, or putting command read -p "setting x: " var ; echo $$var makefile. name=value has disadvantage user must manually set , can't "ask" him enter value. read has disadvantage read value can not (or don't know how) saved in variable , can't used multiple times. is there way read user input variable during executing specific makefile target? (i don't want put file ?= 'read -p "value: " var ; echo $$var' in header because value needed 1 target, , when put line in target itself, error "/bin/bash: file: command not found. ". i use intermediate files purpose. input = dialog --inputbox 80 10 10 all: case1 case2 case1: read-input echo $(shell cat read-input) in case 1 case2: read-input echo $(s...

java - Spring @Scheduled annotation -

how can use @scheduled annotation of spring dynamically? crontrigger(string expression, timezone timezone) http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/support/crontrigger.html#crontrigger-java.lang.string-java.util.timezone- as have multiple timezones in database, how can pass them dynamically? i tried in code: timezone timezone = null; string timezone1 = null; public schedulerbean(string timezone2) { this.timezone1 = timezone2; //constructor } @scheduled(cron="0 0 8 * * ?", zone =timezone.gettimezone(timezone1) ) //error @ line public void sendquestionnotif() { //......code } here error getting, *type mismatch: cannot convert timezone string* please me. because want trigger cron based on timezones . tia. annotation parameters cannot set dynamically. can programmatically, this class scheduler implements runnable { public scheduler(taskscheduler scheduler, string timezone, string cron) { ...

Find a list of strings across a data table in R -

i have vector of strings (candidates), each of want find within data table (fbgn_dmels), , return first column entry if match found within row (e.g. cg2175 should return "1-dec"). > head(candidates) [1] "cg2175" "cg31196" "cg3169" "cg15168" "cg2252" "cg2019" > fbgn_dmels v1_01 v1_02 v1_03 v1_04 v1_05 v1_06 v1_07 v1_08 v1_09 v1_10 v1_11 v1_12 v1_13 v1_14 1: 1-dec fbgn0000427 fbgn0000645 cg2175 na na na na na na na na na na 2: 1-sep fbgn0011710 fbgn0005665 fbgn0013404 fbgn0014082 fbgn0024226 cg1403 na na na na na na na 3: 128up fbgn0010339 fbgn0010196 cg8340 na na na na na na na na na na 4: 14-3-3epsilon fbgn0020238 fbgn0011329 ...

Chrome extension maximum message length -

Image
i'm using google chrome notification api. question simple , short, possible change maximum length of message in notification? example if question wasn't clear: that's notification options: var options = { type: "basic", title: title, message: text, iconurl: "152.png" } in case text = "time t oast toastt oastt oasttoas ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast toastt oasttoa sttoastto astto ast oasttoasttoasttoa sttoasttoast toastt oastto asttoastto asttoast toastt oast." it's example as can see notifications api cut @ middle , added 3 dots: so question is, can make notification show full message , not cut @ middle? i've read few tutorials , saw there called expandedmessage , doesn't appear in api document...

c++ - Passing matrix to a function -

i getting error when calling 'printmat' function. requirement create matrix after accepting number of rows , columns, , take input matrix, call printmat sending matrix , print elements. error follows: error: parameter 'a' includes pointer array of unknown bo und 'int []' #include<iostream> using namespace std; int row,col; void printmat(int* a[]) { for(int i=0; i<row; ++i) { for(int j=0; j<col; ++j) { cout<<a[i][j]<<" "; } } } int main() { cin>>row; cin>>col; int mat[row][col]; for(int i=0; i<row; ++i) { for(int j=0; j<col; ++j) { cin>>mat[i][j]; } } printmat(mat); return 0; } int* a[] is array of pointer, passing pointer array: int (*a)[]