Posts

javascript - How to force Atmosphere.js to use the preferred transport when reconnecting to the Server? -

when preferred transport fails, atmosphere tries use fallback transport. tried reconnect maxreconnect times. after calls onclose , onerror. when try subscribe again atmosphere uses fallback transport connection. here client configuration: atmosphererequestconfig jsonrequestconfig = // ... jsonrequestconfig.settransport(atmosphererequestconfig.transport.websocket); jsonrequestconfig.setfallbacktransport(atmosphererequestconfig.transport.long_polling); jsonrequestconfig.setloglevel("debug"); jsonrequestconfig.setmaxreconnectonclose(1); atmosphere atmosphere = atmosphere.create(); clientrequest = atmosphere.subscribe(jsonrequestconfig); when server running , client connects first time (page reload) connection on websockets. stopped server client shows this: atmosphere.js:3252 sat jan 30 2016 22:17:14 gmt+0100 (cet) atmosphere: websocket.onclose atmosphere.js:3252 websocket closed, reason: normal closure; connection completed whatever purpose created. - wasclean: t...

Running Python on Android in ADB Shell -

i have python script (2.7, can make python 3 work) part of bigger testing framework, i'd able run on android. i know there various projects creating applications based on python, that's not i'm interested in. i'm interested in simplest way make python command line executable available running on android platform i'm connected via adb shell. workflow i'm aiming @ this: <host> $ adb shell <and. device>$ <path1>/python <path2>/script.py <arguments> i know crystax ndk offers python environment consistently crashes memory errors when script ends.

dataframe - R, create new column that consists of 1st column or if condition is met, a value from the 2nd/3rd column -

b c d 1 boiler maker <na> <na> 2 clerk assistant <na> <na> 3 senior machine setter <na> 4 operated <na> <na> <na> 5 consultant legal <na> <na> how create new column takes value in column 'a' unless of other columns contain either legal or assistant in case takes value? here base-r solution. use apply , any test every column @ once. df$col <- as.character(df$a) df$col[apply(df == "legal",1,any)] <- "legal" df$col[apply(df == "assistant",1,any)] <- "assistant"

Copy row from one MySQL DB to another -

how it's possible copy 1 entry row of table same data (same id, same data values) database -> same table? example: table units: uid department name item 67 hr john doe table if both tables equal no. of columns , in same order want insert use below simple query- insert mytable select * units uid=67; if want insert selected column in table's selected columns , in order use below- insert mytable(col1,col2,col3,col4) select uid,department,`name`,item units uid=67;

javascript - Sweet alert html option -

i'm trying make sweet alert html option: swal({ title: "html <small>title</small>!", text: "a custom <span style="color:#f8bb86">html<span> message.", html: true }); but instead of text put button, have tried one: var boton = "button"; swal({ title: "html <small>title</small>!", text: "<input type=" + boton + ">", html: true }); but doesn't work! (i want make menu options(the buttons)) know how that? thanks! you can use button tag instead of input . like this: var boton = "button"; swal({ title: "html <small>title</small>!", text: '<button type="' + boton + '">button</button>', html: true }); <link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" rel="stylesh...

c# - Regular Expression to replace one letter surrounded with dashes -

i try replace specific letter surrounded 1 or 2 dashes letter examples : modif-i-ed => modifyed (-i- replaced y) a-im => eim (a- replaced e) i tried regex.replace(word, "-?([a-za-z])-", new_letter) but generates example modiyyed first example. the problem once first - becomes optional, there 2 matches inside modif-i-ed : f- , i- . thus, there 2 replacements. i suggest matching , capturing letters before -x- pattern , return them in match evaluator, , use -?[a-z]- match , replace: (\b[a-z](?=-))|-?[a-z]- c#: var myletter = "y"; var str = " modif-i-ed a-im y-i-eld"; var res = regex.replace(str, @"(\b[a-z](?=-))|-?[a-z]-", m => m.groups[1].success ? m.groups[1].value : myletter); console.writeline(res); // => modifyed yim yyeld see ideone demo

ios - share text and image using QLPreviewController -

i have implemented qlpreviewcontroller social sharing i.e. what's app, facebook etc. working great whenever send particular image or text. requirement send image , text simultaneously 1 click. , didn't find method send both @ once. following method 1 data can shared either text or image. qlpreviewcontroller *previewcontroller = [[qlpreviewcontroller alloc] init]; previewcontroller.datasource = self; previewcontroller.delegate = self; previewcontroller.currentpreviewitemindex = indexpath.row; [[self navigationcontroller] pushviewcontroller:previewcontroller animated:yes]; if use uiactivityviewcontroller doesn't allow user share content what's app. please upon issue, if has solution, please share me. thanks!