Posts

deployment - Deploy python deb test project using make-deb and dh-virtualenv -

in development use anaconda manage environments. have not yet developed python project production. in context have 2 related questions. first, solution incurs lower technical debt: a. install anaconda on production servers; or b. deploy python deb packages? second, simplest structure of python project folders , files test functionality of make-deb , dh-virtualenv described in last section of nylas blog article? nylas blog (how deploy python code: building, packaging & deploying python using versioned artifacts in debian packages) https://www.nylas.com/blog/packaging-deploying-python/ make-deb: https://github.com/nylas/make-deb dh-virtualenv: https://github.com/spotify/dh-virtualenv for test add requests package standard python 2.7 environment , write 1 module download , save small csv file. test make-deb , dh-virtualenv deploy cloud server or raspberry pi server. want run code verify download app works expected on server. want further develop application , test d...

ios - Semantic Issue, Parse Issue and Apple LLVM 9.0 Error issues in xcode 9 -

Image
i new in ios app development swift 4 , xcode 9.getting semantic issue, parse issue , apple llvm 9.0 error issues during adding admob ads using firebase of pods.everything ok, ads displayed format, however, getting errors during archive project publish in googletoolboxformac , nanopb . don't how facing such kind of error during publishing. do have idea, how solve such kind of error?i expecting suggestions.thanks in advance.

nlp - Similarity between two text documents -

i looking @ working on nlp project, in language (though python preference). i want write program take 2 documents , determine how similar are. as new , quick google search not point me much. know of references (websites, textbooks, journal articles) cover subject , of me? thanks the common way of doing transform documents tf-idf vectors, compute cosine similarity between them. textbook on information retrieval (ir) covers this. see esp. introduction information retrieval , free , available online. tf-idf (and similar text transformations) implemented in python packages gensim , scikit-learn . in latter package, computing cosine similarities easy as from sklearn.feature_extraction.text import tfidfvectorizer documents = [open(f) f in text_files] tfidf = tfidfvectorizer().fit_transform(documents) # no need normalize, since vectorizer return normalized tf-idf pairwise_similarity = tfidf * tfidf.t or, if documents plain strings, >>> vect = tfidfvecto...

javascript - How do I filter out a key from an object? -

i have following object in js. how can select keys except first financial_year , put new empty object? i understand can obj["mainline_revenue"] select individual elements long list , don't want type elements keys individually. var obj = {financial_year: 1, mainline_revenue: 18743, regional_revenue: 2914, other_revenue: 3198, salaries_wages: -6897} var newobj = {} new object this: console.log(newobj) {mainline_revenue: 18743, regional_revenue: 2914, other_revenue: 3198, salaries_wages: -6897} you clone object object.assign use delete removed undesired property: var newobj = object.assign({}, obj); delete newobj.financial_year; of course there other more functional ways achieve this, maybe filtering keys, reducing object: var newobj = object.keys(obj).filter(key => key !== 'financial_year' ).reduce((newobj, currkey) => (newobj[currkey] = obj[currkey], newobj), {}); though approach more suited if had an array of keys wan...

ios - Outlets cannot be connected to repeating content iOS10 -

this question has answer here: outlets cannot connected repeating content ios 5 answers “the constraint outlet tableviewcontroller nslayoutconstraint invalid.” error 1 answer i have uitableview , inside table view set cell. inside cell took couple of item constraints , dragged cell uitableviewcell call , set constraints different screen sizes. when run app gives , error of outlets cannot connected repeating content, although have same set done different tableview , fine , more interesting part error app still runs , fine. class cellclass: uitableviewcell { @iboutlet weak var item1: nslayoutconstraint! @iboutlet weak var item2: nslayoutconstraint! override func awakefromnib() { super.awakefromnib() self.setconstants() } func setconstants () { swi...

ruby - Chef custom resource action properties not working -

i'm having issue custom resource created in new cookbook i'm working on. when kitchen converge on following setup following error: error: nomethoderror: undefined method `repository_url' poiseapplicationgit::resource info development machine: chef development kit version: 2.1.11 chef-client version: 13.2.20 delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427) berks version: 6.3.0 kitchen version: 1.17.0 inspec version: 1.33.1 here's custom resource under resources/deploy.rb: resource_name :opsworks_deploy property :app_path, string, name_property: true property :app_name, string, required: true property :repository_url, string, required: true property :repository_key, string, required: true property :short_name, string, required: true property :app_type, string, required: true property :app, object, required: true property :permission, string, required: true action :deploy apt_update 'update' # install nginx packa...

python - Return a string of country codes from an argument that is a string of prices -

so here's question: write function return string of country codes argument string of prices (containing dollar amounts following country codes). function take argument string of prices following: "us$40, au$89, jp$200" . in example, function return string "us, au, jp" . hint: may want break original string list, manipulate individual elements, make string again. example: > testequal(get_country_codes("nz$300, kr$1200, dk$5") > "nz, kr, dk" as of now, i'm clueless how separate $ , numbers. i'm lost. def test(string): return ", ".join([item.split("$")[0] item in string.split(", ")]) string = "nz$300, kr$1200, dk$5" print test(string)