names

mysqli php table names with hyphen or space

青春壹個敷衍的年華 提交于 2020-01-16 11:51:31
问题 The website is intended to display certain laws/rules by jurisdiction. There is a simple mysqli query that finds the counties and then displays the county names on screen with this: echo "><a href=\"index.php?sel_subj=" . urlencode($subject["county_name"]) . "\"> {$subject["county_name"]}</a></li>"; Then you click on a county name (embedded with the link) and a mysqli query is supposed to look up a table with that county name and get all the jurisdictions within that county. if (isset($_GET[

How to prevent name caching and detect bluetooth name changes on discovery

拟墨画扇 提交于 2020-01-11 04:05:15
问题 I'm writing an Android app which receives information from a Bluetooth device. Our client has suggested that the Bluetooth device (which they produce) will change its name depending on certain conditions - for the simplest example its name will sometimes be "xxx-ON" and sometimes "xxx-OFF". My app is just supposed to seek this BT transmitter (I use BluetoothAdapter.startDiscovery() ) and do different things depending on the name it finds. I am NOT pairing with the Bluetooth device (though I

Heuristics for splitting full names

谁说胖子不能爱 提交于 2020-01-05 05:52:16
问题 Splitting a full name into first and last names is an unsolvable problem because names are really, really complicated. As a result, my model, which represents authors and other contributors to a book, includes both name and filingName fields, where filingName should usually be "Last, First" (for Western names). However, as a convenience for my users, I'd like to have my app make a reasonable guess at the filing name when the user fills in the regular name. The user can edit the filing name if

Preserve names when coercing vector from binary to `as.numeric`?

冷暖自知 提交于 2020-01-01 07:36:26
问题 In R, when you coerce a vector from binary to numeric, the names are stripped away. There are a few possible solutions, which I've outlined before. It seems dangerous to rely on implicit conversion by adding 0 to all the values, and the sapply() adds an additional loop to my operations (which seems inefficient). Is there any other way to preserve the names when converting a vector using as.numeric ? # Set the seed set.seed(1045) # Create a small sample vector and give it names example_vec <-

Invalid character range error in a new function [duplicate]

我的未来我决定 提交于 2019-12-29 08:08:29
问题 This question already has answers here : Is the regular expression [a-Z] valid and if yes then is it the same as [a-zA-Z]? (7 answers) Closed 2 months ago . I have a problem with the follwoing error message invalid regular expression '([a-Z]*)_(.*)', reason 'Invalid character range' so the line of code which causes the error is if(tide=="long") names(problem) <- sub("([a-Z]*)_(.*)","\\2",problem) so if long is selected for the parameter tide in the function the names of problem shall be

R: losing column names when adding rows to an empty data frame

余生长醉 提交于 2019-12-28 11:41:22
问题 I am just starting with R and encountered a strange behaviour: when inserting the first row in an empty data frame, the original column names get lost. example: a<-data.frame(one = numeric(0), two = numeric(0)) a #[1] one two #<0 rows> (or 0-length row.names) names(a) #[1] "one" "two" a<-rbind(a, c(5,6)) a # X5 X6 #1 5 6 names(a) #[1] "X5" "X6" As you can see, the column names one and two were replaced by X5 and X6 . Could somebody please tell me why this happens and is there a right way to

Access and preserve list names in lapply function

独自空忆成欢 提交于 2019-12-28 03:31:06
问题 I need to access list names inside the lapply function. I've found some threads online where it's said I should iterate through the names of the list to be able to fetch each list element name in my function: > n = names(mylist) > mynewlist = lapply(n, function(nameindex, mylist) { return(mylist[[nameindex]]) }, mylist) > names(mynewlist) NULL > names(mynewlist) = n The problem is that mynewlist loses the original mylist indexes and I have to add that last names() assignment to restore them.

How to print names of values in R

一笑奈何 提交于 2019-12-25 01:32:00
问题 I read a SPSS file into R like this: twobytwo <- read.spss("twobytwo.sav", use.value.labels=FALSE, to.data.frame=TRUE) I used use.value.labels=FALSE because I don't want my variables to be turned into factors. The data structure looks like this: > str(twobytwo) 'data.frame': 2743 obs. of 3 variables: $ chm : atomic 0 0 0 0 0 0 0 0 0 0 ... ..- attr(*, "value.labels")= Named num 1 0 .. ..- attr(*, "names")= chr "member" "none" $ cpv : atomic 0 0 0 0 0 0 0 0 0 0 ... ..- attr(*, "value.labels")=

Adding Column From One Dataframe To Another Having Different Column Names Using Pandas [duplicate]

杀马特。学长 韩版系。学妹 提交于 2019-12-25 01:05:57
问题 This question already has answers here : Merge two different dataframes on different column names [duplicate] (3 answers) Pandas join on columns with different names [duplicate] (2 answers) Pandas: join DataFrames on field with different names? (2 answers) how to concat two data frames with different column names in pandas? - python (2 answers) Joining pandas dataframes by column names (2 answers) Closed last year . I have a dataframe called prices contains two columns : Timestamp and closing

Can you have variables with spaces in PHP?

故事扮演 提交于 2019-12-24 14:29:47
问题 I was messing around with variable variables in PHP, so I came up with the code: $a = 'two words'; $$a = 'something'; echo $$a; // outputs something echo "$two words"; // error since $two doesn't exist I was just trying to understand how PHP will behave if we have a string with spaces, and try to make a variable variable from it. And it seems it still stores the variable with spaces, since I did var_dump($GLOBALS); and I have this: 'a' => string 'two words' (length=9) 'two words' => string