Posts

Showing posts from March, 2011

ios - Healthkit permission limit to 20 -

i have integrated health kit project , working fine, when read 8 health kit records. need records, application asks permission 20 health kit type identifiers. can read health kit data? need special permission? here code tried: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [self requestauthorization]; } - (void)requestauthorization { if ([hkhealthstore ishealthdataavailable]) { nsset *writedatatypes = [self datatypestowrite]; nsset *readdatatypes = [self datatypestoread]; [self.healthstore requestauthorizationtosharetypes:writedatatypes readtypes:readdatatypes completion:^(bool success, nserror *error) { if (!success) { nslog(@"you didn't allow healthkit access these read/write data types. in app[][1]. error was: %@.", error); return; } }]; } } - (nsset *)datatypestoread { hkquantitytype *...

arrays - How to Save complex Arrayobjects to device using NSKeyedArchiver swift -

i want save array of class (e.g let array = symptomsmodel) type device using nskeyedarchiver in swift . i know how save array if symptomsmodel class contains variables primitive data types , don't know how save if contains array of other class property below have explained problem of example , please go through , provide solution. have class class symptomsmodel: nsobject, nscoding ,responsejsonobjectserializable { var slug:string? var name:string? var images:[sym_images]? var videos:[sym_videos]? struct keys { static let name = "name" static let slug = "slug" static let images = "images" static let videos = "videos" } required init(json:swiftyjson.json) { self.slug = json["slug"].string self.name = json["name"].string self.images = [sym_images]() if let imagesj...

r - Disconnected from Server in shinyapps, but local's working -

i deployed shiny code shinyapps.io successful. data has little rows (over 190,000), these data's can display in local pc shinyapps cannot 'disconnected server.' so basic-plan , set memory size xxxlarge , config other settings. but apps shut-down 'disconnected server.' continue.. how can set server setting? please me, , sorry bad english. here server log , url https://tmap.shinyapps.io/break_map/ (rn count 3~19, , select mech_cd, shut-down) 2016-08-24t05:34:08.539162+00:00 shinyapps[121340]: server version: 0.4.5.2170 2016-08-24t05:34:08.539194+00:00 shinyapps[121340]: r version: 3.3.0 2016-08-24t05:34:08.539201+00:00 shinyapps[121340]: shiny version: 0.13.2 2016-08-24t05:34:08.539203+00:00 shinyapps[121340]: rmarkdown version: na 2016-08-24t05:34:08.539204+00:00 shinyapps[121340]: knitr version: na 2016-08-24t05:34:08.539212+00:00 shinyapps[121340]: rjsonio version: na 2016-08-24t05:34:08.539204+00:00 shinyapps[121340]: jsonlite version: 0.9.19 2016...

Spring application behaves differently when adding AOP Advice -

Image
i'm using spring integration project logging aspect created. using aop annotations aspect configured. application works expected logging annotation commented. if annotation uncommented app still work, boolean field applysequence magically becomes false. any appreciated.

Mule - Mapping data from JSON -

i json message in mule this: { "id":1, "description":"test", "issueid":16 } i want map issueid other values, example: 16 = 1000 17 = 1010 18 = 1020 what best way that? advisable properties file modify in future? you can use lookup() feature of dataweave, see: https://docs.mulesoft.com/mule-user-guide/v/3.8/dataweave-language-introduction#calling-external-flows

javascript - How get links from href property using regex -

i have regex expression returns me links html file, has problem: instead of returning link, http://link.com , returns href=" ( href="http://link.com ). can links without having href=" ? this regex: /href="(http|https|ftp|ftps)\:\/\/[-a-za-z0-9.]+\.[a-za-z]{2,3}(?:\/(?:[^"<=]|=)*)?/g full code: var source = (body || '').tostring(); var urlarray = []; var url; var matcharray; // regular expression find ftp, http(s) urls. var regextoken = /href="(http|https|ftp|ftps)\:\/\/[-a-za-z0-9.]+\.[a-za-z]{2,3}(?:\/(?:[^"<=]|=)*)?/g; // iterate through urls in text. while( (matcharray = regextoken.exec( source )) !== null ) { var token = matcharray[0]; token = json.stringify(matcharray[0]); token = matcharray[0].tostring(); urlarray.push([ token ]); } regexp#exec store contents captured capturing groups defined in pattern. may access group 1 [1] index. use var token = matcharray[1]; ...

ios - how to do truncation of text in UILabel -

Image
i have problem truncation of text in uilabel have set linebreakmode = nslinebreakbywordwrapping perfectly. here code snippet : lblselectedtext = [[uilabel alloc] init]; lblselectedtext.numberoflines = 0; lblselectedtext.linebreakmode = nslinebreakbywordwrapping; lblselectedtext.font = [uifont fontwithname:@"myriadpro-regular" size:(is_ipad_pro?13.0:9.0)]; lblselectedtext.textalignment = nstextalignmentcenter; lblselectedtext.textcolor = [uicolor lightgraycolor]; lblselectedtext.text = strkey; // here text dynamic cgfloat width = 150; cgsize strsize = [self findheightfortext:strkey havingwidth:width andfont:lblselectedtext.font]; lblselectedtext.frame = cgrectmake(12, 10, cgrectgetwidth(acontainercontroller.view.frame)-20, strsize.height+15); - (cgsize)findheightfortext:(nsstring *)text havingwidth:(cgfloat)widthvalue andfont:(uifont *)font { cgsize size = cgsizezero; if (text) { if (is_english) { cgrect frame = [text boundingrectwi...

javascript - How to assign click event for dynamically added span element? -

this question has answer here: event binding on dynamically created elements? 19 answers html: <div class="testspandiv"></div> javascript: $(document).ready(function () { $('.testspandiv').append('<span id="testspan">hello</span>'); } $('#testspan').on('click', function(){ $(this).parent().remove(); }); event not firing while giving click span element added dynamically. event firing if span element statically added html. can give suggestion on it. i tried below also, not working. $('#testspan').on('click', '.testspandiv', function(){ $(this).parent().remove(); }); you need use this: $('.testspandiv').on('click', '#testspan', function(){ // ^^ parent div ^^ element in want bind...

generics - Why do Rust's operators have the type Output variable? -

this question has answer here: when appropriate use associated type versus generic type? 3 answers i've been reading through rust book online , i've reached 4.1, operators , overloading . noticed std::ops::add defines fn add(self, rhs: rhs) -> self::output; type output defined separately in trait. i understand what's going on here: add function accepts left hand side self , , right hand side generic parameter type rhs . i want know why output type defined output alias, instead of being generic (ex. add<rhs, output> )? convention, or there specific reason it? while functions operate on variables, can think of traits functions operate on types. when thought of way, type parameters serve inputs function , associated types serve outputs. since output associated type, 2 types a , b wish impl add , restricted picking single outpu...

Importing files into sql using java -

i need way import text, excel or .csv file microsoft sql database new table. normally, ssis packages in directly importing these files database. is there equivalent tool java automatically reads file , creates table (and defines data structures)? suppose have big excel worksheet, , want store table in database. there automated method reads worksheet me , automatically generates database table appropriate data types? you need use apache poi read excel file, , create table jdbc statements, determine excel cell datatype can use: hssfcell cell = (hssfcell) cells.next(); int type = cell.getcelltype(); and build sql create statement using determined datatypes. 1 important things formatting of excel sheets, each column should have same datatype of course.

What are the different graph processing alternatives for Hadoop/Spark -

giraph, graphx, neo4j solutions today aware of. area tech-giants working, updated list appreciated. comparison of tools listed above not seen anywhere. firstly, should mention giraph , graphx graph processing , neo4j graph database. if going store graph , query "give me nodes have content 'x' 2 distance neighbor having content 'y'" solutions neo4j (graph database) should applied. otherwise, giraph , graphx play graph processing role. unfortunately, although graphx offer nice apis, large graph size fails when available distributed memory not enough. condition observed when size of intermediate data not fit in available memory. in addition, represented in literatures, giraph got worst place in performance more stable graphx. there other solutions graphlab , titan "distributed graph processing" valuable investigate.

python 2.7 - Converting to date format in pandas -

i have dataframe contains column holds: date: 31062005 072005 12005 2012 i convert these dates format: date: 31/06/2005 07/2005 01/2005 2012 what simplest way this? fields not in date format yet, strings. suppose write function def convert_date(s): if len(s) == 4: return s elif len(s) < 7: return s[: -4].zfill(2) + '/' + s[-4: ] else: return s[: -6].zfill(2) + '/' + s[-6: -4].zfill(2) + '/' + s[-4] then if dates in df.dates , can use >>> df.dates.apply(convert_date) 0 31/06/2 1 07/2005 2 01/2005 3 2012 name: dates, dtype: object note converts string in 1 form string in different form, meaning can't manipulate dates further. if want that, i'd suggest amend preceding function use appropriate datetime.datetime.strptime format matching length of string. this: def convert_date(s): if len(s) == 4: return datetime.datetim...

c++ - counting time point in chrono library -

i'm using chrono library first time please lenient c:. want write simple time function return processor tics chrono. when try use clock() function value time point initialized steady_clock::now() , gcc says time_point doesn't contain count() member. /home/siery/documents/project/changestatemachine/main.cpp|41|error: ‘struct std::chrono::time_point<std::chrono::_v2::steady_clock, std::chrono::duration<long long int, std::ratio<1ll, 1000000000ll> > >’ has no member named ‘count’| here code: float gettime() { float tic = 0.0; auto start = std::chrono::steady_clock::now(); tic = (float)start.count(); return tic; } thank you! edit: gettime() function should return current time calculate delta time update objects in program like: fpasttime = fcurrenttime; fcurrenttime = gettime(); fdt = fcurrenttime - fpasttime; if (fdt >= 0.15f) fdt = 0.15f; update(fdt); recommendation: std::chrono::steady_clock::time_point...

angularjs - Crosswalk browser for Android throws “Only secure origins are allowed” error -

i thought common issue can't find straight-forward answer problem. included crosswalk webview engine android i'm getting following error message: "only secure origins allowed" .... presumably http requests made local , external servers (like http://localhost:3000 or https://my.own.server/ ) using angular $http service. what solution issue? after many hours of googling i'm still clueless how solve issue. please point me in right direction? kind regards, edit: question not related permissions given in server has been pointed out, it's related content security policy . can read here , , quote: controls network requests (images, xhrs, etc) allowed made (via webview directly). you have understand webview in case crosswalk (which chromium underneath) , need configured can make requests both: local servers ( http://localhost:3000 , etc) , external ones ( https://my.own.server ). question more akin this one in opinion. how configure crosswa...

How to configure bi-directional sync in SymmetricDS? -

has achieved bidirectional configuration symmetricds? there many things configure, , got of them: server.properties: #xxxxxxx nombre de la cabana #sssssss ip del servidor engine.name=xxxxxxxxxxx # class name jdbc driver db.driver=com.mysql.jdbc.driver # jdbc url used connect database db.url=jdbc:mysql://localhost/huttebullen_xxxxxxxxxxx? tinyint1isbit=false # user login can create , update tables db.user=addd # password user login db.password=cc registration.url=http://sssssss:31415/sync/xxxxxxxxxxx sync.url=http://sssssss:31415/sync/xxxxxxxxxxx # not change these running demo group.id=server external.id=000 initial.load.create.first=true auto.registration = true auto.reload = true create.table.without.foreign.keys=true client embedded hsql client.properties(generated in code): properties props = new properties(); props.setproperty("engine.name", "cabana-" + args[0]); props.setproperty("db.driver", "org.hsq...

php - Missing argument 2 for App\Http\Controllers\ProductController::getAddToCart() -

i have been struggling in finding solution error. tried different solutions getting same result. problem of second argument , don't know why not working? index page: @extends('layouts.master') @section('title') laravel shopping cart @endsection @section('content') @foreach($products->chunk(3) $productchunk) <div class="row"> @foreach($productchunk $product) <div class="col-sm-6 col-md-4"> <div class="thumbnail"> <img src="{{$product->imgpath}}" class="img-responsive"> <div class="caption"> <h3>{{$product->title}}</h3> <p class="description">{{$product->description}} </p> <div class="clearfix"> <div class="price pull-left">${{$product->price}}</div> <a href="{{route('product.addtocart'...

indexing - MongoDB: What index should I use? -

i got highscore mongodb table contains documents such {username:"bob",score:10,category:"mostlikes"} {username:"john",score:32,category:"mostlikes"} {username:"bob",score:2,category:"leastdeaths"} the goal fetch top 100 (sorted) of specific category. important: highscore categories ascending (lower better ex: leastdeaths ) , others descending (bigger better ex: mostlikes ). means depending on category, want either 100 biggest scores or 100 lowest scores. there 2 main queries in application: db.highscore.find({category:category}, {}).limit(100).sort({ score: 1 /*or -1*/ }); db.highscore.find({username:username}); what index recommend? would keeping ascending category , descending categories in different tables result in better performance? note: not want have 1 table per category. i did test on local sample datasets , think best option create index on "category_1_score_1_username_1" ...

Having trouble drawing an image in Qt using QGraphicsScene -

the code below loads image using qlabel. code uses: mylabel.setmask(pixmap.mask()); , works should. problem comes when try , load image using qgraphicsscene. #include <qapplication> #include <qlabel> #include <qtgui> int main(int argc, char *argv[]) { qapplication app(argc, argv); qlabel mylabel; qpixmap pixmap("/path/tomy/image.jpg"); mylabel.setpixmap(pixmap); mylabel.setmask(pixmap.mask()); mylabel.show(); return app.exec(); } in code attempting same above using qgraphicsscene. pixmap loaded properly, after not sure why program not working properly. because there no setmask() operation? or there operation missing needed make image visible? #include <qtglobal> #if qt_version >= 0x050000 #include <qtwidgets> #else #include <qtgui> #endif int main(int argc, char *argv[]) { qapplication a(argc, argv); qpixmap pixmap("/path/tomy/image.jpg"); qgraphicspixmapitem item( pixmap)...

C# LINQ Statement for the Below Scenario -

i trying build linq statement joining below 2 list in c#. list1: formid formround 2 1 2 2 2 3 3 1 4 2 list2: formid formround category date 2 1 test1 23-aug 2 1 test2 24-aug 2 1 test3 25-aug 2 2 test1 26-aug 2 2 test3 27-aug 3 1 test1 28-aug 3 1 test2 29-aug 3 1 test3 30-aug i should output below. formid formround test1date test2date test3date 2 1 23-aug 24-aug test3 2 2 26-aug na 27-aug 3 3 28-aug 29-aug na can please me in framing linq statement? this linq query might like: var results = (from in list1 join b in list2 on new { a.formid, a.formround } equals new { b.formid, b.formround } group b new { a.formid, a.formround } c ...

opengl - How to deduce the triangle vertices in fragment shader -

if draw triangles using opengl, how deduce vertices each fragment? sending position vertex shader interpolates it, leading loss of information. from geometry shader may access 3 vertices of triangle, may pass them fragment shader via in/out (aka varying) variables. prevent them interpolating, use flat interpolation qualifier .

javascript - Jquery: Draggable sensibility -

i have draggable dom element using jquery. if client clicks without moving, draggable start isn't called , acts wasn't draggable. when clients clicks , move mouse 1 pixel away while holding down, drag starts. event triggered, classes applied etc... is there way trigger drag start if client clicked element , moved mouse @ least 10px away instead? note: isn't related scrolling. code example live demo @ https://jqueryui.com/draggable/ : <style>#draggable { width: 150px; height: 150px; padding: 0.5em; }</style> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script> <script> $(function(){ $("#draggable").draggable(); //goal starts dragging if mouse moved more 10px }); </script> <div id="draggable" class="ui-widget-content"> <p>drag me around</p> </div...

testing - Is there an option in sipp to use tls version 1.2 -

i using sipp software test of tls 1.2 related code flow in sbc. configured sbc use tls v1.2. whenever run sipp client tls, exits error "returning epipe on invalid socket: 0x1e73060". searching epipe error yields connection terminated on remote end. also, on traces seen client hello, tls protocol version used 1.0. whenever change configuration on sbc use tlsv1.0, works fine. there option, either compile time or run-time, set tls version in sipp ? sipp version used 3.3

tkinter - Resize window without covering widget -

this python-tkinter program uses pack geometry manager place text widget , "quit" button in root window -- text widget above button. import tkinter tk root = tk.tk() txt = tk.text(root, height=5, width=25, bg='lightblue') txt.pack(fill=tk.both,expand=true) txt.insert('1.0', 'this text widget') tk.button(root, text='quit', command=quit).pack() root.mainloop() when resize root window dragging lower border up, lose quit button. vanishes under root window's border. i'm trying quit button move along window's border, while letting text widget shrink. have played "fill" , "expand" in pack() , "height" in both widgets without success. is there straightforward way keep quit button visible while dragging window smaller? (while researching, noticed grid geometry "sticky" cells can accomplish task easily. i'm still curious know if there simple way same pack geometry.) pack quit bu...

webpack - How to handle png in css with loader -

i'm packaging angular2 project webpack. app.component.ts is: import { component } '@angular/core'; import '../../public/css/styles.css'; @component({ selector: 'my-app', template:require('./app.component.html'), styles: [require('./app.component.css')] }) export class appcomponent {} and css app.component.css is: main { padding: 1em; font-family: arial, helvetica, sans-serif; text-align: center; margin-top: 50px; display: block; background: url("../../public/images/icon_background.png"); } and webpack.common.js as: var webpack = require('webpack'); var htmlwebpackplugin = require('html-webpack-plugin'); var extracttextplugin = require('extract-text-webpack-plugin'); var helpers = require('./helpers'); module.exports = { entry: { 'polyfills': './src/polyfills.ts', 'vendor': './src/vendor.ts', 'app': './src/main.ts...

user interface - How To Make a Window in Python without GUI toolkits -

i'm curious, making window tkinter seem easy. python have alert thing similar javascript default? there no graphical alert in python. tkinter default python gui interface. if need alert, that's less dozen lines of code. here's python 3 example: import tkinter tk import tkinter.messagebox def alert(message): root = tk.tk() root.withdraw() tkinter.messagebox.showwarning("alert", message) root.destroy() alert("danger robinson!")

How do I specify unique constraint for multiple columns in MySQL? -

i have table: table votes ( id, user, email, address, primary key(id), ); now want make columns user, email, address unique (together). how do in mysql? of course example just... example. please don't worry semantics. alter table `votes` add unique `unique_index`(`user`, `email`, `address`);

arm - Need to convert int to string using C -

hi pretty new coding , need help. have decimal value , converted binary value. using method long decimaltobinary(long n) { int remainder; long binary = 0, = 1; while(n != 0) { remainder = n%2; n = n/2; binary= binary + (remainder*i); = i*10; } return binary; } and want give each character of binary it's own space inside array. however, can't seem save digits return values in string array. think has converting long string wrong! here have far. not want use sprintf(); not wish print value want value stored inside if conditions can read it. appreciated! int decimalg = 24; long binaryg = decimaltobinary(decimalg); char mystringg[8] = {binaryg}; for( int = 0; i<8; i++) { if (mystringg[i] == '1' ) { t1(); } else { t0(); } } in case since decimal 24, binary 11000 therefore should execute the function t1(); 2 times , t0() 6 times. doesn't , can't seem find answe...

stanford nlp - French coreference annotation using CoreNLP -

can me correct setting performing coreference annotation french using corenlp? have tryed basic suggestion editing properties file: annotators = tokenize, ssplit, pos, parse, lemma, ner, parse, depparse, mention, coref tokenize.language = fr pos.model = edu/stanford/nlp/models/pos-tagger/french/french.tagger parse.model = edu/stanford/nlp/models/lexparser/frenchfactored.ser.gz the command: java -cp "*" -xmx2g edu.stanford.nlp.pipeline.stanfordcorenlp -props frenchprops.properties -file frenchfile.txt which gets following output log: [main] info edu.stanford.nlp.pipeline.stanfordcorenlp - adding annotator tokenize [main] info edu.stanford.nlp.pipeline.stanfordcorenlp - adding annotator ssplit [main] info edu.stanford.nlp.pipeline.stanfordcorenlp - adding annotator pos reading pos tagger model edu/stanford/nlp/models/pos-tagger/french/french.tagger ... done [0.3 sec]. [main] info edu.stanford.nlp.pipeline.stanfordcorenlp - adding annotator parse [main] info ...

python - Ansible: given a list of ints in a variable, define a second list in which each element is incremented -

let's assume have ansible variable list_of_ints . i want define incremented_list , elements obtained incrementing fixed amount elements of first list. for example, if first variable: --- # file: somerole/vars/main.yml list_of_ints: - 1 - 7 - 8 assuming increment of 100, desired second list have content: incremented_list: - 101 - 107 - 108 i thinking of on lines of: incremented_list: "{{ list_of_ints | map('add', 100) | list }}" sadly, ansible has custom filters logarithms or powers , not basic arithmetic, can calculate log10 of numbers, not increment them. any ideas, apart pull request on https://github.com/ansible/ansible/blob/v2.1.1.0-1/lib/ansible/plugins/filter/mathstuff.py ? this it: --- - hosts: localhost connection: local vars: incremented_list: [] list_of_ints: - 1 - 7 - 8 incr: 100 tasks: - set_fact: incremented_list: "{{ incremented_list + [ item + incr ] ...

loops - Iterate through two Arrays VBscript -

Image
i have 2 arrays, first 1 has similar values, , in sorted order, second array csv map. want how concatenate values in first array, grouped together, based on second value of map what have: arr1 map ---- --- x x, 1 x y, 1 x z, 2 y y z what want: newarr ---- x x x y y, 1 z , 2 my code: for each x in arr1 each y in map line = split(y, ",") if instr(x, line(0)) redim preserve newarr(i) newarr(i) = newarr(i) & x elseif instr(x, line(1)) redim preserve newarr(i) newarr(i) = newarr(i) & x else = + 1 end if next next my logic compare val in arr1 map(0), if there similarities, put in...

asp.net - UrlRewrite 2.0 not removing www from url in IIS 8.5 -

i've these 2 rules in web config file force https , remove www url. <rule name="remove www" stopprocessing="true"> <match url="^(.*)$" /> <conditions> <add input="{http_host}" pattern="^(https?://)?www\.(.+)$" /> </conditions> <action type="redirect" url="{c:1}{c:2}" redirecttype="permanent" appendquerystring="false"/> </rule> <rule name="redirect https" stopprocessing="true"> <match url="(.*)" /> <conditions logicalgrouping="matchall" trackallcaptures="false"> <add input="{https}" pattern="off" ignorecase="true" /> </conditions> <action type="redirect" url="https://{http_host}{r:1}" redirecttype="found" appendquerystring="f...

Driver null while opening session in Neo4j OGM Java driver v2 -

i put ogm.properties file in same folder class neo4jsessionfactory. when run project information driver "null". problem? use neo4j ogm driver java in version 2. my session factory class: public class neo4jsessionfactory { private final static sessionfactory sessionfactory = new sessionfactory("school.domain"); private static final neo4jsessionfactory factory = new neo4jsessionfactory(); public static neo4jsessionfactory getinstance() { return factory; } public session getneo4jsession() { return sessionfactory.opensession(); } } stack trace: exception in thread "main" org.neo4j.ogm.exception.servicenotfoundexception: driver: null @ org.neo4j.ogm.service.driverservice.load(driverservice.java:51) @ org.neo4j.ogm.service.driverservice.load(driverservice.java:63) @ org.neo4j.ogm.service.components.loaddriver(components.java:126) @ org.neo4j.ogm.service.components.driver(components...

asynchronous - While loops using Await Async. -

this javascript function seems use while loop in asynchronous way. correct way use while loops asynchronous conditions? var boo; var foo = await getbar(i) while(foo) { boo = await getbar3(i) if (boo) { // } foo = await getbar(i) i++ } what think this: var boo; var foo; getbar(i).then( (a) => { foo = a; if(foo) { getbar3(i).then( (a) => { boo = if(boo) { //something i++; getbar(i).then( (a} => { repeat itself...}  } } } }) if that's totally false show way async await + while loop? thanks!! is correct way use while loops asynchronous conditions? yes. async function s suspend execution on every await until respective promises fulfills, , control structures continue work before.

jquery - Windows keypad keycodes not working -

i added simple mask text input allows numbers inputted. did using following code: jquery(function($) { $("#zip").keydown(function(event) { // allow backspace , delete if ( event.keycode == 46 || event.keycode == 8 ) { // let happen, don't } else { // ensure number , stop keypress if (event.keycode < 48 || event.keycode > 57 ) { event.preventdefault(); } } }); }); the issue i'm coming across keypad numbers aren't working on windows (they work find on macs). however, numbers found on top row of keyboard work fine. has come across before? you not including keycodes numberpad in if statement. should work: jquery(function($) { $("#zip").keydown(function(event) { // allow backspace , delete if ( event.keycode == 46 || event.keycode == 8 ) { ...

swift - Return results from regular expression pattern matching -

i have string (html in example case) contains same pattern displaying results of sports games. so, html tags known, values each game not. in perl, can this: if ( $content =~ /\<\/a\>\<br\>(\d+)\<\/span\>\<br\>(\d+)\-(\d+).+\<\/a\>\<br\>(\d+)\<\/span\>\<br\>(\d+)\-(\d+)/) { $visitingteamscore = $1; // $1 1st matched digit $visitingteamwins = $2; // $2 2nd matched digit $visitingteamlosses = $3; // etc $hometeamscore = $4; $hometeamwins = $5; $hometeamlosses = $6; } which returns digits inside parentheses, in case 6 total integers of varying digit lengths. can assign matches variables. from answer in question: swift string between 2 strings in string , have following swift code: extension string { func slicefrom(start: string, to: string) -> string? { return (rangeofstring(start)?.endindex).flatmap { sind in (rangeofstring(to, range: sind..<endindex)?.startindex).map { eind i...

android - how to show hidden button in listview for authorized user only? -

when authorized person enter watch group list, listview don't contain delete option if avalide person watch group list, listview contain delete button(like facebook group, admin show option member not) here code memberactivity.java public class memberactivity extends appcompatactivity { private listview memberlistlistview; private string useridstring; private string groupidstring; private string groupnamestring; private string universitynamestring; memberlistadapter memberlistadapter; private sqlitehandler db; arraylist<memberlismodel> memberlist; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_member); memberlistlistview= (listview) findviewbyid(r.id.memberlistlv); useridstring = getintent().getstringextra("userid"); groupidstring = getintent().getstringextra("groupid"); groupnamestring = getintent().getstringextra("groupname...

angular - process is not defined in lite-server with redux -

when using default systemjs config angular 2 rc.5, lite-server throw error of process not defined if add redux dependency. has experienced this? here trace stack: (index):43 error: referenceerror: process not defined @ object.eval (http://localhost:3000/node_modules/redux/lib/index.js:38:5) @ eval (http://localhost:3000/node_modules/redux/lib/index.js:47:4) @ eval (http://localhost:3000/node_modules/redux/lib/index.js:48:3) @ object.eval (http://localhost:3000/node_modules/ng2-redux/lib/components/ng-redux.js:14:15) evaluating http://localhost:3000/node_modules/redux/lib/index.js evaluating http://localhost:3000/node_modules/ng2-redux/lib/components/ng-redux.js evaluating http://localhost:3000/node_modules/ng2-redux/lib/index.js evaluating http://localhost:3000/actions/session.actions.js evaluating http://localhost:3000/app/app.component.js evaluating http://localhost:3000/app/app.module.js evaluating http://localhost...

php - PDO - 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 -

i error when trying update table in database. code: $stmt = $db->query("update pages set title, desc values :title, :newdesc id = '1'"); $stmt = $db->execute(array(":title" => "awesome", ":newdesc" => "test")); the error this, found it's nothing other parts of code put empty file , same thing happened: error: [23-aug-2016 15:24:02 america/chicago] php fatal error: uncaught exception 'pdoexception' message 'sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mariadb server version right syntax use near ' desc values :title, :newdesc id = '1'' @ line 1' in /home/officia4/gptscript/mitch.php:25 stack trace: #0 /home/officia4/gptscript/mitch.php(25): pdo->query('update pages se...') #1 {main} thrown in /home/officia4/gptscript/mitch.php on line 25

mongodb - Retrieve only documents with the highest value -

i want write query finds documents highest value. there multiple documents same value, , want of them. i know can use sort sort high low. don't know how many documents there are. won't work. { total: 1, id: 1 }, { total: 1, id: 2 }, { total: 2, id: 3 }, { total: 2, id: 4 }, { total: 3, id: 5 }, { total: 3, id: 6 } in example want return documents have total 3 . how can query documents have highest value? this work you: db.yourcollectionname.aggregate([ { $group:{ _id: null, high_val: {$max:"$total"} } }, { $lookup:{ from: "yourcollectionname", localfield: "high_val", foreignfield: "total", as: "elements" } }, { $unwind: "$elements" }, { $project:{ _id:false, id: "$elements.id...

whm - Cpanel - There is another upcp process running -

i have error when try use cpanel upgrade new version there upcp process running, , watching log existing process. and in box see unable find log file: /var/cpanel/updatelogs/last please how can terminate ps aux | grep upcp shows no process running. have deleted update_in_progress.txt /usr/local/cpanel . able access tweak settings not able upgrade. tried upcp --force . please help if /scripts/upcp --force not working, think best option reboot server , run again.

python - Form input-box not displaying -

Image
i'm trying display simple form input-text box django. i'm deploying on amazon aws. site works fine on different server (pythonanywhere) there major problem on aws. specifically, input box not being displayed. i'm using templates follows: home.html {% extends 'lists/base.html' %} {% block header_text %}start new to-do list {% endblock %} {% block form_action %}{% url 'new_list' %}{% endblock %} base.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x ua-compatible" content="ie-edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>to-do lists</title> <link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link href="/static/base.css" rel="stylesheet"> ...