Posts

javascript - CodeMirror custom helper -

i create code mirror helper / widget mimic medium.com entry writing ux. upon user hitting enter , getting new line circle + or other icon appear in gutter area , when user clicks open menu example commands, when user picks command it's full text entered document in current pos. what's best way that?

r - lapply and interp (akima) -

i'd interpolate on many individual data.frames stored within list using akima package. having split original data frame: store <- split(data, data$frameid) i tried this... results <- lapply(store, interp, x = lon, y = lat, z = precip) but error message error in interp(x = lon, y = lat, z = precip) : object 'lat' not found . single results can successfully generated following.. results <-list() # create , empty list results results[[i]]<-with(store$`600`, interp(x = lon, y = lat, z = precip)). where 600 represents name of 1 of data.frames within list. however attempting generalise entire list using loop-approach.. i=1 (i in i:length(store)){ results[[i]]<-with(store$`i`, interp(x = lon, y = lat, z = precip)) } i again receive error in interp(x = lon, y = lat, z = precip) : object 'lat' not found . any advice appreciated. using suggestions, , accounting duplicate points (same lat , lon stations) job. i=...

node.js - Assigning javascript object to new object as copy -

i have array of object obj.arr in javascript. assigned new object. var obj_arr_new = obj.arr; the problem when modify obj_arr_new , obj.arr gets modified well. not want that. how can make obj_arr_new copy of obj.arr , when modify obj_arr_new , obj.arr untouched? i using node.js v6. open using node.js module. told me lodash can job. answer using lodash helpful. lodash indeed has _.clonedeep(value) purpose. var obj_arr_new = _.clonedeep(obj.arr); it recursively clone "arrays, array buffers, booleans, date objects, maps, numbers, object objects, regexes, sets, strings, symbols, , typed arrays" modifying bits of clone doesn't affect original, or vice versa. documentation

python - duplicate returns more numbers than required -

a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] if len(set(a)) > len(set(b)): # finds biggest list largest = smallest = b else: largest = b smallest = common = largest in largest: if not in smallest: common.remove(i) print(common) prints: [1, 2, 3, 5, 7, 8, 10, 12, 13] 7, 9, 10, 11, 12 shouldnt in list. because aint in smaller list. what doing wrong? your code relies on assumption statements like largest=a copy list largest. this not true in python. rather statement makes largest reference old list a. your code, copy lists properly, should this: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] if len(set(a)) > len(set(b)): # finds biggest list largest = list(a) smallest = list(b) else: largest = list(b) smallest = list(a) common = list(largest) in largest: if not in smallest: common.remove(i) print(com...

html - Merging two rows together in a table so that no cells are visble -

Image
table { border-spacing:0 10px; border-collapse:separate; } td { padding:2px 10px; border-top:1px solid #ddd; border-bottom:1px solid #ddd; } td.gray { background:#ddd } td:last-child { border-right:1px solid #ddd; } <table> <tr> <td class="gray"> module description </td> </tr> <tr rowspan = "2"> <td> module aims provide comprehensive knowledge , experience of relational database model , its effective design, administration , implementation in order to support data driven applications.</td> </table> below images of want table , have @ moment. cant table rows merge , rid of division between first , second row. this want table like: this have far: setting padding , removing border-spacing trick: table { border: 1px solid #ddd; padding: 0; border-collapse: collapse; } td { padding: 2px 10px; } td.gray { ...

Issue in urlencoding using MySQL/PHP -

i have few textfiles input mysql database. these textfiles contain characters é , ë. have struggled getting data database , seems i've got right. however, know if there better way way describe here. the textfiles utf-8 encoded. the php scripts utf-8 encoded well. i've read important. all html output done using header this: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> the mysql database created using collation of latin1_swedish_ci (the character set left blank) all columns contain characters (varchar) defined using collation of latin1_swedish_ci i assume right way store url encoded strings when see character é stored %c3%a9 in database. found mysql function urlencoding here . when open phpmyadmin see character é presented %c3%a3%c2%a9. i can add statement replace characters in database, tells me there more efficient way achieve this. any appreciated. in advance. what missing list of 5 things is i te...

javascript - Send a file in socket.io without changing the user's window location -

i looking see if there way send html file socket.io connection without disconnecting them , changing window location. right have set if tries access website prompted enter name. when name entered , user presses play sent /game directory on website. emit name along connection info. @ moment when connect /game directory disconnects user causing information (including name) removed player list. when player joins onto /game directory have name of null , info entirely new info coordinates , things. here code use detect request /game: //sends home page asks name. app.get('/',function(req, res){ res.sendfile(__dirname + "/client/home.html"); }); //sends game file when /game requested app.get('/game',function(req, res){ res.sendfile(__dirname + "/client/game.html"); }); is there way stop user disconnecting when change game screen? way can keep info? or there else can fix problem? every time change uri in browser should rec...