Posts

Showing posts from April, 2011

c++11 - C++ best way to split vector into n vector -

i have std::vector<std::string> in vector push_back string txt file, : std::string line; std::vector<std::string> path; while(getline(fichier, line)) { path.push_back(line); } i split path vector n other vector of 10 line example. if size of vector 25, want 2 other vector of 10 element , 1 vector of 5 element. what best way ? best matter of opinion, following (with bunch_size being 10 ): for(size_t = 0; < strings.size(); += bunch_size) { auto last = std::min(strings.size(), + bunch_size); bunches.emplace_back(strings.begin() + i, strings.begin() + last); } demo if strings large , want avoid copying, can go move version: for(size_t = 0; < strings.size(); += bunch_size) { auto last = std::min(strings.size(), + bunch_size); auto index = / bunch_size; auto& vec = bunches[index]; vec.reserve(last - i); move(strings.begin() + i, strings.begin() + last, back_inserter(vec)); } demo

regex - Regular expression that doesn't accept single 0 but does accept 10 -

i have regular expression: ^[ 0-9a-z] [ 0-9]{4}[0-9][/ ][ 0-9a-z]$ and works fine, have exclude 0 in construct [ 0-9]{4}[0-9] in way. the string a 0/a should not match the string a 10/a should match so have check if first occurrence of number in second group 0 or not. how can that? if or not clear, so. so have check if first occurrence of number in second group 0 or not. i think need negative lookahead: ^[ 0-9a-z] (?! *0)[ 0-9]{4}[0-9][/ ][ 0-9a-za-z]$ ^^^^^^^ see regex demo . since [ 0-9]{4}[0-9] matches 4 digits or spaces (there may 4 spaces) , [0-9] matches digit obligatorily , (?! *0) make sure pattern above not match spaces followed 0 .

Google Places API Android: Autocompletion closes too quickly -

i added place autocompletion android app. when click button ( chooselocationbutton ) opens autocomplete widget correctly. problem when want write name in search field. directly after clicked on first keystroke, autocomplete widget close , research not done. here written in run console: w/iinputconnectionwrapper: reportfullscreenmode on inexistent inputconnection w/iinputconnectionwrapper: finishcomposingtext on inactive inputconnection here code: autocompletefilter.builder = new autocompletefilter.builder(); try { final intent intent = new placeautocomplete.intentbuilder(placeautocomplete.mode_fullscreen) .setfilter(a.settypefilter(autocompletefilter.type_filter_regions).build()) .build(this); chooselocationbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { startactivityforresult(intent, place_autocomplete_request_code); } ...

asp.net - Risks using PKCS#12 file inside Application -

we need use client ssl certificate able call our partner's services. we have no possiblity install our parnter's client ssl certificate because using azure web app. our option have our partner's pkcs#12 file inside our asp.net application. could security breach? risks?

php - Callback constraint is not a valid callable when uploading an image -

after successful sonata media installation,and when tried upload image got error : > {"methods":["isstatuserroneous"]} targeted callback constraint > not valid callable github issue github issue stackoverflow after searching in stackoverflow , github issues,i didn't find clear solution. please?

c - Accessing the structure using a pointer -

i have declared structure "node" having member variable 'm' , defined 2 variables below struct node t, *p; later in program assigned address of t p : p = &t; to access member variable need use p->m . but wanted use * operator, writing *p.m gives error. why ? for have see precedence of operators. the precedence of . operator higher * operator. writing *p.m makes compiler think *(p.m) . you have use (*p).m .

iOS Charts - always show limit line -

Image
i'm using "charts" library (by daniel gindi) on ios. i draw linechartview (no issue there), , want add limit line represent target value: let targetline = chartlimitline(limit: targetvalue, label: "") linechartview.leftaxis.addlimitline(targetline) the issue have is: if y-values of chart far target, limit line doesn't show on chart. examples: with target of 80, , last value 59: limit line not show. with target of 80, , last value 79: limit line show. how can make sure limit line appear, no matter y-values are? appendix : here rest of drawing code, it's standard: let chartview = linechartview() chartview.backgroundcolor = uicolor.whitecolor() chartview.dragenabled = false chartview.doubletaptozoomenabled = false chartview.pinchzoomenabled = false chartview.highlightpertapenabled = false chartview.descriptiontext = "" chartview.legend.enabled = false chartview.rightaxis.enabled = false // set y axis let yaxis = chartview...

pos tagger - Selecting text from corresponding tags in a sequence in R -

i trying extract text corresponding tag in sentence in sequence. trying part of speech corresponds each sentence in text file. code: postext<- "the verifone not working, when customers slide card nothing happens. screen frozen. rebooted did not help." postext1<- c("the verifone not working","scanner not scanning","printer offline","when customers slide card nothing happens. screen frozen. rebooted did not help.") tagpos <- function(x, ...) { s <- as.string(x) word_token_annotator <- maxent_word_token_annotator() a2 <- annotation(1l, "sentence", 1l, nchar(s)) a2 <- annotate(s, word_token_annotator, a2) a3 <- annotate(s, maxent_pos_tag_annotator(), a2) a3w <- a3[a3$type == "word"] postags <- unlist(lapply(a3w$features, `[[`, "pos")) postagged <- paste(sprintf("%s/%s", s[a3w], postags), collapse = " ") list(p...

bash - Passing a variable to sed inside for loop -

i have loop written in script so: for((i=0;i<${#hours[@]})); dates=("$(last | egrep -v "reboot|wtmp|^$" | sort | tr -s " " | sed "$i q;d" | cut -f5-7 -d' ')") done if execute command assigned dates in terminal, replacing $i (inside sed command) number (0,1,2...), returns me want, is, instance nov 15 23:15 . however, when inside for loop, seem have problem sed command not incrementing $i . doing wrong? your problem never change i . should update in third part of for statement: for((i=0;i<${#hours[@]};++i)); # ^^^ here

python - FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison result = getattr(x, name)(y) -

i using pandas 0.19.1 on python 3. getting warning on these lines of code. trying list contains row numbers word peter present @ column unnamed: 5 . df = pd.read_excel(xls_path) myrows = df[df['unnamed: 5'] == 'peter'].index.tolist() warning: "\python36\lib\site-packages\pandas\core\ops.py:792: futurewarning: elementwise comparison failed; returning scalar, in future perform elementwise comparison result = getattr(x, name)(y)" any ideas? my experience same warning message caused typeerror. typeerror: invalid type comparison so, may want check data type of unnamed: 5 for x in df['unnamed: 5']: print(type(x)) # 'str' ? here how can replicate warning message: import pandas pd import numpy np df = pd.dataframe(np.random.randn(3, 2), columns=['num1', 'num2']) df['num3'] = 3 df.loc[df['num3'] == '3', 'num3'] = 4 # typeerror , warning df.loc[df['num3'] == ...

Visual Studio 2017 install fails due to Microsoft.DiagnosticsHub.KB2882822 error -

anybody idea why might fail? vs2017 installation stops error in log. had similar issue vs2017 rc builds. package 'microsoft.diagnosticshub.kb2882822.win7,version=15.0.25904.2,chip=x64' failed install. return code: 0, details: invalid source and/or destination paths the issue windows username has space in , when 1 portion of installer wants access temp folder under user profile directory throws error due bug because can't handle space in username. (shout out wong man wei identified root cause!) a work around, create new user on machine not have space in name. run installer again , repair existing install done other user , repair work since has access temp directory under user has no space in name. now once repair successful can delete user account , go using 1 space in it.

Restrict ".php" File upload -

i making basic photo hosting, upload images , resize them. everything works fine, have added accept="image/*" file upload button, still possible upload other files. in php code check whether image or other file, if not image, remove it. have problem. if user uploads "index.php" file, index file on server overwritten , code should do, removes "index.php" so. self destruction. is there way restrict file upload before file uploaded on server? or @ least, there way change root directory of file uploaded? i don't think javascript or html restriction anything, because "hackermans" can change in inspect element. class upload { private $destinationpath; private $errormessage; private $extensions; private $allowall; private $maxsize; private $uploadname; private $seqnence; private $imageseq; public $name = 'uploader'; public $usetable = false; function setdir($path) { $this->destinationpath = $path; $this-...

Printing a list in Elixir gives string -

this question has answer here: elixir lists interpreted char lists 1 answer i'm running code below adds numbers in list 10. however, getting list of chars. result = enum.map([1, 2, 3], fn x -> x + 10 end) result \w\f\r if change + * code works fine. result = enum.map([1, 2, 3], fn x -> x + 10 end) returns [10, 20, 30] expected. however, moment change 10 32, encounter similar error returns ' @' any idea means , how fix it? thanks in elixir, char list (a value between 2 single quotes 'like this' ) list of numbers. so, when have list of numbers of them can written characters (within ascii range), iex print them such you. iex(1)> 'hello' 'hello' iex(2)> [104, 101, 108, 108, 111] 'hello' you still have list of numbers, , can still other operations on if list of numbers, such as iex(3)...

xctest - Setting up Documents folder prior to UI Testing -

xctest ui automation testing pretty powerful stuff, until need test portion of ui presents differently based on data. instance, our app stores data in documents folder. setting data programmagically in test pretty painful. i know don't have access app's documents folder ui test app. i'm looking ideas on how accomplish setting app ui testing. have launch argument parameter blows away contents of documents folder. plus copy on specific files. i feel maybe can done part of ui target build phase, i'm not sure how target simulator device selected in schema.

spotfire - How do you edit a dynamic item in 7.0? -

i know pseudo off-topic forum, couldn't find details anywhere. after recent upgrade 6.5 7.0, i'm noticing once create dynamic item > calculated value in text area, seems impossible edit it. in 6.5 create calculated value in text area, , right click , format or edit control. in 7.0 grayed our dynamic items, not property controls. have work around this? how change: font font size font attributes (bold, italic) font color etc... side note, i'm admin can't rights / privileges issue. it seems in 7.0 functionality removed via right-click method, , remains in html editor. right click on text area > edit html in right pane, select dynamic item select edit @ bottom edit data, expression, etc select format edit color, font, bold, etc...

javascript - Multiple user facebook sharer -

i created angular app allows users take pictures touchscreen inside shop. those users must able share these pictures on facebook. problem once first 1 has been logged-in facebook via sharer, stores session cookie , next person want share photo logged previous one. i thinking of : share photo button -> ask facebook email & password credentials -> photo shared on user wall -> user automatically disconnected is there way around problem ? use this: https://developers.facebook.com/docs/facebook-login/for-devices don´t present default login process, come session cookie issues , other problems (2 step verification, example). also, never ever ask users credentials, password. that´s not how facebook login works, , people don´t that.

Python Regular Expression query -

i have code example i'm reading text file 4 different colors. this colors.txt : ### ##### ######### #example colors #line of colors #line colors part 1 color gray color blue # line colors part 2 color yellow color green where's i'm getting gray , blue part 1 , , yellow , blue part 2 my python code example is: #!/usr/lib/env python import re file = open("color.txt","r") content = file.read() file.close() content = content.split('part ')[1:] dic = {} part in content: dic[int(part[0])] = part[1:] def color(part_index): color = re.findall('color\s(.*?)\s',dic[part_index] ) return color print color(1) #colors of part 1 print color(2)# colors of part 2 after runing code got output: part 1 : ['gray', 'blue'] part 2 : ['yellow', 'green'] i print colors separated example color(1) gray , color(2) blue , color(3) yellow , colo...

sql - How to Concat, replace, and stuff one column -

so have 2 columns id concatenated together, have dashes , first 2 characters removed, define number of digits returned. example po_no value 18-29201-202 line_no value 6 (id return 006) id end 29201202006 right combining them , removing dashes this: concat(replace(oe_hdr.po_no, '-', ''), job_price_line.line_no) [po , line no], with result of: 18292012026 how remove first 2 digits of po_no , ensure line_no 3 digits long? you want concatenate 2 pieces basically, modified po , line in standard format. you're close already, formulas both pieces little off. replace(oe_hdr.po_no, '-', '') correct, want right 8 digits assuming po format consistent (if not, you'll need more complex such finding first "-", , taking mid() / substr() depending on system). in short, you're looking following: right(replace(oe_hdr.po_no, '-', ''),8) on second part, simplest way add leading 0s string concatenat...

php - Cakephp email Encoding subject gives wrong characters -

i'm sending emails cakephp , have been testing followign website: http://spamcheck.postmarkapp.com/ i have had several problems, 1 of them encoding of subject. right now, 1 solved, following solutions i've found in internet. first line of code i'm doing subject here's code: $newsubject='=?utf-8?b?'.base64_encode($subject).'?='; $email = new email('aws'); $email->from(['xxxx@zzzz.zz' => 'test']) ->template('default','confirmation') ->viewvars([ 'user_email' => $emailto, ]) ->emailformat('both') ->to($emailto) ->subject($newsubject) ->replyto('support@uphill.pt') ->helpers(['html', 'text']) //->attachments($attachment->path) ->send($message); after recieve email, subject shows: "=?utf-8?b?sw5zy3jpw6fdo28gbm8gzxzlbnrvoiboyxrpb25hbcbdb25mzxjlbmnlig9uieh1bwfuifbhcglsbg9t...

python - Cannot override default BooleanField with FieldList FormField on wtforms -

i using wtforms , flask , running issues overriding default value boolean field. field subform shown below. not entirely sure issue is. when try , create subform value false , render subform default overrode when sub form not. class user(db.model): __tablename__ = 'users' include = db.column(db.boolean) class subform(form): include = booleanfield('include', default=true) class parentform(form): sub = fieldlist(formfield(subform)) @app.route('/') def index(): if form.validate_on_submit(): pass users = user.query.all() fields = [subform(include=user.include) user in users] form = parentform(sub=fields) return render_template('index.html', form=form) index.html {% block content %} <div> <form action="" method="post" class="form" role="form"> {% form.csrf_token %} <ul> {% field in form.sub %} {% field.form.csrf_token %} ...

javascript - Unable to post form in mvc -

brief description: on form can either select predefined associate , save it, or create new 1 , save it, cannot both simultaneously. predefined associates presented in drop-down list. .html <form id="_jqformassociate"> <select id="associateid"> <option value="">-- select --</option> <option value="1">associate_1</option> <option value="2">associate_2</option> <option value="3">associate_3</option> </select> <div id="_jqdisablepanel"> <input id="firstname" type="text"> <input id="lastname" type="text"> <input id="dob" type="text"> </div> </form> jquery $(document).on("change", "#associateid", function(){ // if associate selected drop-down list // (value of selecte...

Parsing command line inputs in C -

so have create unix shell , filesystem. stuck on getting program accept commands, such ls, cd, stat, exit. whenever "ls" inputted, returns printf line again. if "ls l", prints out "you entered ls", more or less want, don't need after ls. commands listed above, want command entered , no other spaces or characters needing entered. if use "cd", want program able diferentiate fact destination needs entered after command, believe working properly. can tell me went wrong? int main(int argc, char *argv[]){ char cmd[50]; const char spc[50] = " "; char *file, *dir; char *tok, *nextname; while(1){ printf("russ_john_shell> "); fgets(cmd, 50, stdin); //tokenizes string determine command inputed file/directory name needed tok = strtok(cmd, spc); nextname = strtok(tok, spc); //checks see whether string has file/directory name after command if (strcmp(cmd, tok) == 0){ if (strcmp(cmd, ...

python - How to execute other commands during input()? -

so here code data = input('--').encode() , want run print(s.recv(1024).decode()) whilst input being filled in , whilst things in program happening need code ran every 0.1 seconds or so. there 1 general way trying do, , quite complicated. the input() function pauses program, way else @ same time make computer run 2 things @ same time. threading advanced concept , can cause many issues in programs if not done correctly, useful thing know how do, in python, since can dramatically increase speed of programs running, , python 1 of slower languages, 1 of many prices of easy-to-use languages. i suggest learn of python's basics, gain year or 2 of experience, , learn threading. refer following website learn how use threads: https://docs.python.org/3/library/threading.html

tsql - Does the 128 character limit for table names include the database name and schema name? -

microsoft's database objects documentation states table names can 128 characters. include schema name? database name? for example, if needed run following sql statement copies data in source table destination table in different database, i'd write: select * destinationdatabase.destinationschema.destinationtable sourcedatabase.sourceschema.sourcetable now have table stores database name, schema name, , table name both source , destination tables, size limit should put on columns storing these names? is 128 character limit each part (database name, schema name, table name) or should entire identifier (like destinationdatabase.destinationschema.destinationtable ) 128 characters long? it's length of sysname data type nvarchar(128). it's per element (so table separately 128).

rest - Peferred way to call AWS Api Gateway using PHP -

the aws api gateway generate sdk js, swift , android (java) default. want call aws api gateway using php, besides hand coding http request, there better choice? while not have modeled classes, aws sdk php v3 can used call/sign api gateway apis.

c - Bison Grammar For Basic Calculator Issue -

so grammar below 'works'. however, has small caveat can stuff 1.0-----------------2.0 and flip flop between 2 , -2 until gets 1 op 2 evaluate. still new bison , unclear on how best implement fix this. have 1 idea in mind raising error every combination of '+' '-' in increments of 3 8 grammar rules , i'm not sure how throw error in bison. imagine there cleaner more understandable way this. flex lexer %option nounistd %option noyywrap %{ #include <io.h> #include <stdio.h> #include <stdlib.h> #include "parser.tab.h" #define isatty _isatty #define fileno _fileno %} %% [ \t]+ \n {return '\n';} [0-9]+(\.[0-9]+)? {yylval.number=atof(yytext); return number;} . {return yytext[0];} %% bison grammar %{ #include <stdio.h> #include <math.h> extern int yylex(void); int yyerror(const char* c) { printf("%s\n",c); return 0;} %} %union { double number; } %type <number> e...

How to set up a postgis-adaptered Ruby on Rails app for Heroku deployment? -

i have following: gems: gem 'pg', '~> 0.18' gem 'activerecord-postgis-adapter', '4.0.0' gem 'rgeo-geojson' initializer: config/initializers/rgeo.rb require 'rgeo-activerecord' rgeo::activerecord::spatialfactorystore.instance.tap |config| # default, use geos implementation spatial columns. config.default = rgeo::geos.factory_generator # use geographic implementation point columns. config.register(rgeo::geographic.spherical_factory(srid: 4326), geo_type: "point") end database settings: config/database.yml default: &default adapter: postgis encoding: unicode username: appname_u password: password su_username: appname_su su_password: pa55w0rd schema_search_path: "public, postgis" pool: <%= env.fetch("rails_max_threads") { 5 } %> development: <<: *default database: appname_development script_dir: /usr/local/opt/postgis/share/postgis test: <...

vocabulary - Tensorflow vocabularyprocessor -

i following wildml blog on text classification using tensorflow. not able understand purpose of max_document_length in code statement : vocab_processor = learn.preprocessing.vocabularyprocessor(max_document_length) also how can extract vocabulary vocab_processor i have figured out how extract vocabulary vocabularyprocessor object. worked me. import numpy np tensorflow.contrib import learn x_text = ['this cat','this must boy', 'this a dog'] max_document_length = max([len(x.split(" ")) x in x_text]) ## create vocabularyprocessor object, setting max lengh of documents. vocab_processor = learn.preprocessing.vocabularyprocessor(max_document_length) ## transform documents using vocabulary. x = np.array(list(vocab_processor.fit_transform(x_text))) ## extract word:id mapping object. vocab_dict = vocab_processor.vocabulary_._mapping ## sort vocabulary dictionary on basis of values(id). ## both statements perform same task. #sorted_vo...

reactjs - ReferenceError: window is not defined (devToolsExtension) -

so, i'm attempting make 'react developer tools' chrome extension aware of app, receiving above mentioned error. can advice best way address issue? import configuremiddleware './configuremiddleware'; import configurereducer './configurereducer'; import configurestorage './configurestorage'; import { applymiddleware, createstore, compose } 'redux'; import { persiststore, autorehydrate } 'redux-persist'; type options = { initialstate: object, platformdeps?: object, platformmiddleware?: array<function>, }; const configurestore = (options: options) => { const { initialstate, platformdeps = {}, platformmiddleware = [], } = options; const reducer = configurereducer(initialstate); const middleware = configuremiddleware( initialstate, platformdeps, platformmiddleware, ); const enhancers = compose( window.devtoolsextension ? window.devtoolsextensio...

osgi - Unit testing a Managed Service Factory or Service Component -

is there sample of unit testing creation of scr or msf via configadmin without using pax-exam? i'm looking startup msf or scr.. add configuration entry , confirm creation of service. currently, i'm using felix connect blueprint-test framework.

ios - Swift: Regular expression to detect non alpha numeric characters -

i'm trying build regular expression detect string containing alphanumeric characters , special characters haven't found right it. here code: var str = "asda~dd.asd98asd09asd098asd098ads908" let myregex = "^[a-z]{7}\\.[a-z0-9]{28}$" if (str.rangeofstring(myregex,options: .regularexpressionsearch) != nil) { str = "itwork.yes" } any of knows how can build regular expression detect non alphanumeric characters ? i'll appreciate help. how using rangeofcharacter ? // choose character set , add characters want check besides alphanumeric characters let set = characterset.alphanumerics.union(characterset(charactersin: ".\\")) // check range of characters in string let range = str.rangeofcharacter(from: set, options: .regularexpression) that's 1 of cleanest ways doing this. edit: if want detect non-alphanumeric characters, use set.inverse instead of set when calling range function.

bash - find -exec with \; runs but + terminator fails with "missing argument to -exec" -

this question has answer here: trailing arguments find -exec {} + 1 answer sometimes find command refuses execute + terminator -exec , changing + \; allows exec run. consider, after following setup: find_args=( -type f -name "*users*" -cmin -60 ) rsync_args=( -avhp -e 'ssh -i /home/some_user/.ssh/id_rsa -c arcfour' ) dest=some_user@some_host:/some/destination/ this works: # runs rsync once per file, slower should need find . "${find_args[@]}" -exec rsync "${rsync_args[@]}" {} "$dest" \; ...but 1 fails: # same, except + rather \; # ...should use same rsync call multiple files. find . "${find_args[@]}" -exec rsync "${rsync_args[@]}" {} "$dest" + ...with error find: missing argument '-exec' . i'm using gnu findutils 4.4.2, documented support + argument. ...

What Firebase Security rules should I use to read the messages? -

i want users read messages uid equal either or both to or from fields of message or if 'to' section of message set all . this database: { "intents" : { "intentfields" : "", "intentname" : "", "to" : "" }, "messages" : { "-kvivgc7zg051emxp0-5" : { "from" : "ed", "name" : "ed", "photourl" : "https://cdn1.iconfinder.com/data/icons/user-pictures/100/male3-512.png", "text" : "hello, i'm ed", "timestamp" : "1476880306", "to" : "all", "type" : "text" }, "-kwmsuvm0ujif01ehfyn" : { "from" : "capyv3mxqsuun2w1npogcj0ex9t2", "name" : "aakash bansal", "photourl" : "https://lh5.googleusercontent.com/-oqya4hxvycc/aaaaaaaaaai/aaaaaaaahko/o...

c# - Fill grid's datasource with distinct combinations of data -

i have 1 problem filling grid. okey, imagine have grid prints data basketball team. we have 4 main classes: public class player { public string playername { get; set; } } public class staff { public string staffname { get; set; } } public class fan { public string fanname { get; set; } public list<string> fanfavoriteteam { get; set; } } public class team { public string teamname { get; set; } public list<player> players { get; set; } public list<staff> staff { get; set; } public list<fan> fans { get; set; } } ... , of course class fills grid public class result { public string teamname { get; set; } public string playername { get; set; } public string staffname { get; set; } public string fanname { get; set; } public string fanfavoriteteam { get; set; } } i want print possible combinations,for example assume have data: team name - golden state warriors players - stephen curry, kevin...

html - How to place an image at the right of a centered one -

hi i'm trying put image next centered 1 the code looks : <div id="body3" > <center><img height="700" width="600" src="logo.jpg"></center> <img height="40" width="220" ;" src="reserver.png" style="float: right;"> </div> but second image go underneath first 1 , right.i want to right of centered one. any options? thank you try this: <div id="body3" > <center><img height="700" width="600" style="display: inline-block;" src="logo.jpg"> <img height="40" width="220" style="display: inline-block;" src="reserver.png"> </center> </div>

angular - Set default value of option dropdown -

currently dropdown showing posts users, want show user user.id 1 named "leanne graham" default, can't seem figure out how default user id 1 instead of showing posts default. how can tweak code make default first option , not show posts users default? usercomments.component.ts <select class="form-control" (change)="reloadposts({userid: u.value})" #u> <option value="">select user...</option> <option *ngfor="let user of users" value="{{user.id}}"> {{user.name}}</option> </select> <div class="container"> <table class="table table-bordered"> <tbody *ngfor="let post of _posts"> <tr> <td>{{post.body}}</td> <td>k</td> <td>k</td> </tr> </tbody> </table> </div> usercomments.component.ts import { component, o...

add chromium in Lazarus -

want add chromium web browser in lazarus, doing following steps, couldn't run in lazarus. saying cef version not supported. can please kindly advise? i using lazarus 1.6 in win7 64bit i downloaded chromium framework here: https://github.com/dliw/fpcef3 . can see in comments, based on cef 3.2743 installed cef3.lpk lazarus , chromium tab added downloaded cef_binary_3.2743.1449.g90ba67d_windows64_minimal.tar.bz2 http://opensource.spotify.com/cefbuilds/index.html , copied files release folder inside lazarus executable file , copied resource folder there. also, tried last step cef_binary_3.2743.1449.g90ba67d_windows32_client.tar.bz2 file without success. any appreciated.

Google Cloud Storage getImageServingUrl returns the wrong image -

i using google cloud storage store user uploaded images. use google app engine api php function create url serve image through google service. cloudstoragetools::getimageservingurl($image_file, $options); this service returns public url image. url takes arguments can appended end of url, allows me return different versions of image. resized or cropped version of image. my problem service not return correct image. let me give example: this url returned service. problem not correct image. not 1 of images. http://lh3.googleusercontent.com/2obrlam8fzbudm1byp8fgazhewvsg2plxrwwu2k3vncn-djwywl41w2vnazgfnlehrj-u4kgssoekpoduz8qpro9xnxrcaoomrnzabsx6wmf if append arguments @ end of url, example =w800 should give me resized version of image width of 800px, service returns correct image. https://lh3.googleusercontent.com/2obrlam8fzbudm1byp8fgazhewvsg2plxrwwu2k3vncn-djwywl41w2vnazgfnlehrj-u4kgssoekpoduz8qpro9xnxrcaoomrnzabsx6wmf=w800 until have discovered problem on 3 images. fin...

xml - xslt: contextless 'generate-id'? -

as understand it, xslt function generate-id() return unique id depending on node , context (ancestors). is there way obtain id dependent on node (and subnodes), , not position in document? when using xinclude , identical nodes can put multiple locations -- , hence have 2 different ids generated. how can create alphanumeric string identical each instance of node-set inserted document via xinclude ? so have file node.xml : <?xml version="1.0" encoding="utf-8"?> <node name="joe"/> and document.xml : <?xml version="1.0" encoding="utf-8"?> <document xmlns:xi="http://www.w3.org/2003/xinclude"> <container name="first"> <xi:include href="node.xml"/> </container> <container name="second"> <xi:include href="node.xml"/> </container> </document> and process.xslt : <?xml version...

javascript - JSON response not a plain object -

this coming request objects of django apps, not getting plain object, print says string javascript : $.getjson("/cadastro/getallpessoas/", function(data){ console.log(data); console.log(typeof(data)); console.log($.isplainobject(data)); //raises error on isarraylike(): $.each(data,function(){ arrayvalues.push([this["pk"],this["fields"]["nome"]]); }) }); console output : [{"model": "cadastroapp.djangotestpessoa", "pk": 1, "fields": {"nome": "gabriel"}}] string false views.py : from django.core import serializers def getallpessoas(request): data = serializers.serialize('json', pessoa.objects.all(), fields=('objectid','nome')) return jsonresponse(data, safe=false) you're serializing twice in django view, because both serializers.serialize , jsonresponse convert json. don't that; return norma...

arrays - Why do I only see the last loaded image using this JavaScript code? -

this question has answer here: javascript closure inside loops – simple practical example 31 answers the following code snippet intended loop through array (which contains 4 objects); each iteration supposed produce image of card. after 4 iterations, there should 4 cards side each in row. problem: final image shows (i.e. element of myherocards[3].image). alert box shows, in sequence, each iteration: "0","1",2". related posts refer problems using "for loops" step though array; don't think that's problem because can given image show replacing x value of 0-3. i suspect interaction how onload works , how loop statements evaluated, i'm stumped on details. function startingcardlayout(){ var nextherocard=0; var x=0; (i=0;i<=2;i++){ myherocards[x].image.onload = function (){ctx.drawimage(myheroc...

javascript - EXTJS 3.4 HOW TO GET RECORD DATAVIEW ON selectionchange -

how record on selection change when using ext.dataview ? i value 'idprd' in selectionchange event function. var tpl_ram = new ext.xtemplate( '<ul>', '<tpl for=".">', '<li class="phone">', '<img width="64" height="64" src="data/catalogo/ramos/imagenes/{idrm}/{idrm}.jpg" />', '<strong>{nomrm}</strong>', '<span>{descrm}</span>', '</li>', '</tpl>', '</ul>'); var ramos_dw = new ext.dataview({ tpl: tpl_ram, store: ramos_productos, id: 'ramos_dw', itemselector: 'li.phone', overclass: 'phone-hover', singleselect: true, autoscroll: true, autoheight: true, emptytext: 'sin resultados que mostrar', listeners: { 'click...

html - Why is there a hairline gap / border between these block elements in Chrome but not Firefox -

Image
when add background color container , stack block elements inside, there hairline gap visible between elements in chrome. no such gap exists in firefox. why? , how can avoided without additional wrapper elements? it's easier see in js bin: https://razor-x.jsbin.com/teqevoc/6/edit?html,css,output .main { background-color: black; } .item { margin: 0; padding: 0; width: 100%; height: 100px; background-color: white; } <div class="main"> <div class="item">1</div> <div class="item">2</div> <div class="item">3</div> </div> if assume used css , html, should work fine in browsers. maybe it's chrome extension have installed adds pixels or elements html. try disable chrome extensions (if any) , refresh.

design - Token to the next page in pagination API -

i have list of records on server sorted key , use pagination api return list of segments 1 one. since items can inserted in middle of list, return first key of next page pagination token has passed next page. however, i've found dynamodb uses last key of current page instead querying api, null if next page not exist. question: what pros , cons between using last item of current page , first item of next page pagination token? n.b: as me returning first item more intuitive since it's null if next page not exist. using "last item of current page" ( licp ) better using "first item of next page" ( finp ) because deals better possibility that, in meantime, item inserted between these 2 items. for example suppose first page contains 3 alphabetically ordered names: adam/basil/claude. , suppose next page elon/francis/gilbert. then licp token claude , while finp token elon . if no new names inserted, result same when next page. however, s...

encryption - Assembly Irvine x86 Encrypting and Decrypting with ASCII -

i'm using x86 assembly , it, need take string of 20 chars, or more, , char user. need rotate each char 2 bits , xor ascii code. the problem can user string , char, how loop through string? tried looping through array, crashed. .386 .model flat,stdcall .stack 4096 exitprocess proto,dwexitcode:dword writedec proto writestring proto writechar proto crlf proto readstring proto dumpregs proto delay proto .data max = 80 ;max chars read, if input more gets cut off stringin byte max+1 dup (?) ;room null stringascii byte max+1 dup (?) ;room null charmax = 2; storedstring dword ? storedascii dword ? savedspots dword ? command byte "enter 20 word string" ,0 askforchar byte "enter char" ,0 encrypt byte "encrypted string" ,0 .code main proc mov edx , offset command ;enter 20 word string call writestring ;print call crlf ;space...

php - How to count the first 30 letters in a string ignoring spaces -

i want take post description display first, example, 30 letters ignore tabs , spaces. $msg = 'i need first, let say, 30 characters; time being.'; $msg .= ' need remove spaces out of checking.'; $amount = 30; // if tabs or spaces exist, alter amount if(preg_match("/\s/", $msg)) { $stripped_amount = strlen(str_replace(' ', '', $msg)); $amount = $amount + (strlen($msg) - $stripped_amount); } echo substr($msg, 0, $amount); echo '<br /> <br />'; echo substr(str_replace(' ', '', $msg), 0, 30); the first output gives me 'i need first, let say, 30 characters;' , second output gives me: ionlyneedthefirst,letusjustsay know isn't working expected. my desired output in case be: i need first, let thanks in advance, maths sucks. you part first 30 characters regular expression: $msg_short = preg_replace('/^((\s*\s\s*){0,30}).*/s', '$1', $msg); with given $m...

javascript - I can't get selenium-webdriver with chromedriver working on Mac OSX -

i'm trying functional testing using selenium-webdriver in google chrome navigator on mac osx , have problems while trying interact navigator. i've simplified problem similar one: need open google main page , write in input, execute node script: require('chromedriver'); var webdriver = require('selenium-webdriver'), = webdriver.by, until = webdriver.until; var driver = new webdriver.builder() .forbrowser('chrome') .build(); driver.get('http://www.google.com/ncr'); driver.findelement(by.name('q')).sendkeys('webdriver'); the npm dependencies are: npm install selenium-webdriver chromedriver the results of execution are: google chrome browser opens (so chromedriver seems work ), input field isn't written, because the call never finishes executing . browser can load given web page after can't interact it. of course, i've tried download , install manually chromedriver , locating binary file...

Load data from html form, update database and display data on the same page in table using java servlet -

i need help. have small application consists of java servlet , html form. user puts data in html form , after clicking on submit button java servlet gets data in it's post method (loads in database). till works fine. using java servlet , tomcat. want display data in table on same page on html. have found, possible through ajax method. somehow can't right. here simplified code of application: java servlet: @webservlet(name = "myservlet", urlpatterns = { "/myservlet" }) public class myservlet extends httpservlet { protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("text/html"); // getting values submitted user html form string name = request.getparameter("name"); string surname = request.getparameter("surname"); // here goes logic load data in database // data database recieved array , converted // json // here can print whole ...

html - divs in same row are not displayed together -

i trying split row in two, text , image. however, no matter set size of divs, display on separate lines. <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <ul class="nav"> <li><a class="home" href="#home>">home</a><li> <li><a href="#about">about</a></li> <li><a href="#portfolio">portfolio</a></li> <li><a href="#contact">contact</a></li> </ul> </div> </div> <div class="row"> <div class="col-md-6" id="first">jusdhflksadhflk</div> <div class="col-md-6" id="second">jksdnf,asdnf,asd</div> </div> </div> i have agonized on simple issue , checked documentation closely. mis...

amazon web services - my EC2 instance seems down and it won't reboot from the console -

i have ec2 instance running on ubuntu 14.04 that's been 3 months. got ip address whitelisted payment processing partner it's kind of hard decision reboot since ip address going change. here's has happened : working on via ssh, launching node.js process , watching logs using mobile app communicating it, of sudden stopped responding keyboard input. can't visit website hosted on , can't ssh in : ssh: connect host ***.***.***.*** port 22: can't assign requested address and can't reboot instance console : click reboot, alert dialog click "yes sure", nothing happens, instance still running after refreshing page , same ip address. what should ? sometimes ec2s crash , can take hours respond reboot console. in rare cases amazon has involved kill it. best thing take snapshot of attached storage , create new ec2 instance. with regards ip should using elastic ip. 1 free 1 per ec2 , it's yours keep till release it. if have 1 can recreat...

Using XSLT to take data from two XML files and merge into one? -

i'm trying merge 2 tables using xslt 1.0. i have representation of 2 db tables in xml. first table set of key-value pairs: table1.xml <table> <row> <column name="key">key1</column> <column name="value">val1</column> </row> <row> <column name="key">key2</column> <column name="value">val2</column> </row> </table> the second table has rows of data: table2.xml <table> <row> <column name="a">a1</column> <column name="b">b1</column> <column name="c">c1</column> </row> <row> <column name="a">a2</column> <column name="b">b2</column> <column name="c">c2</column> </row> </table> i trying take 1 of key-value pairs , add insert new co...

How to create a sound signal vector by appending a vector to another vector in Matlab? -

i'm trying create music piece appending 1 vector vector. create row vector , trying use sound(ct, 8000); play music, throws error cell contents reference non-cell array object . should do? code: z = sin(0*pi*(0:0.000125:1)); g = sin(2*pi*220*2^(10/12)*(0:0.000125:0.25)); f = sin(2*pi*220*2^(8/12)*(0:0.000125:0.25)); eb = sin(2*pi*220*2^(6/12)*(0:0.000125:1)); d = sin(2*pi*220*2^(5/12)*(0:0.000125:1)); ct = [z g g g eb z f f f d]; sound(ct, 8000); what means? cell contents reference non-cell array object

git - how to get a preview of what Github's pull request diff will look like -

how diff between branches merge diff like consider graph * master |\ | * b1 |\ | * b2 if im on b2 , , person on b1 beat me , merged master , if do project>b2 $ git diff origin/master the diff include b1, not included in pr, how reproduce in command line. you can update origin/master git fetch origin . update remote branches without changing else. after that, can rebase b2 work onto origin/master git rebase origin/master . b2 based on latest work including b1 . git diff origin/master reflect addition of b1 . then can update pr git push --force .

Always be looking for a user input -

i trying creating small "game" , 1 of things can go hunting. (code isn't clean want see if works first) when "hunting" it's going find random items want when user types "stop" stops hunting items. , carrying until has typed "stop". how go around doing that? thanks. code hunting function: def gohunting(q): on_hunt = true while on_hunt == true: rand = random.randint(1,1) rand2 = random.randint(0,8) rand3 = random.randint(1,20) rand4 = random.randint(1,5) time.sleep(rand) found = items[rand2] if found == "axe": print("you found axe!") axe += rand3 elif found == 'stick': amount = rand3 amount2 = str(amount) amount2 = "[" + amount2 + "]" print("you found sticks", amount2) stick += amount elif found == 'twig': amount = amount amount2 = str(amount) amount2 ...

Need examples of valid and invalid Windows relative paths -

in order check (probably using pcre regex) if plain ansi text string represents syntactically valid windows relative path or not, first need list of examples includes unusual syntactically valid relative paths. msdn maddeningly vague on point, , i've never been able find list of examples includes many (if @ all) strange correct outliers. one major unanswered question whether or not valid unc pathname can contain relative components. example, of following strings syntactically valid windows? \\server1\share1\..\fname.txt \\server1\share1\..fname.txt \\server2\.. \\server3\share2\. \\server3\share2\folder3\folder4\..\.. two things note: (1) objects path strings represent not need exist; , (2) function plan on creating perform windows path string validation (in autoit, uses pcre format regexes) include flag specify if string needs conform windows explorer path limitations or wider non-explorer windows path syntax. would of please provide desired list of unusual syntac...

c# - FlyWay with interdependent databases -

i've seen posts flyway handling multiple databases seems databases independent. understand it, flyway can handle 1 database per instance creating/cleaning database schemas independent. multiple datasources migrations using flyway in spring boot application our problem stems bad db design , won't changed quickly. background, c# old school application mssql db , we're using flyway command line evaluation purposes. the db(s) set this. appdb applogdb appauditdb apparchivedb ... i have examples appdb has views/procedures/etc reference other tables. there cases other dbs access appdb (ie archivedb stored procedures pull appdb). with dependency between different databases, there anyway flyway can handle migration/clean in order required? example if have order of scripts appdb v1__create_table v2__create_proc_pointing_to_archivedb archivedb v1__create_table v2__create_proc_pointing_to_appdb how re-done handle more this appdb, archi...