question
stringlengths
11
28.2k
answer
stringlengths
26
27.7k
tag
stringclasses
130 values
question_id
int64
935
78.4M
score
int64
10
5.49k
I am developing some apps which depends on one of them. I see pip can create bundles. I have all my projects source in one dir. How to create bundle for these projects and then install in other Ubuntu system? probably I should use virtualenv. Is it possible to have one virtualenv for all of them?
To create a bundle, use something like: pip bundle <name of bundle>.pybundle -r requirements.txt where requirements.txt contains your list of apps to install. Or you can create a bundle with a single app (why?): pip bundle <name of bundle>.pybundle <my app> Then, on the other system, to install your bundle, you use: ...
Distribution
9,093,124
18
I understand that three phase commit was made to solve the problem of "two phase commit" when in the second phase the coordinator and the cohort fails at the same time it is impossible to know if the coordinator had decided on a commit message. Apparently three phase commit aims to solve this problem by adding an extra...
In 3PC it is possible to figure out failed coordinator decision by querying remaining active cohorts. If any active cohort is in pre-commit state- that means that all of them agreed to commit (otherwise coordinator would not have sent pre-commit). And we need to commit the rest of the cohorts because failed ones might ...
Distribution
11,209,564
18
I'm currently using 1 + (int)(rand() * 999.0 / RAND_MAX) to generate a random number between 1 and 999 inclusive but the two and one digit numbers don't occur as often as the three digit numbers. How can I fix this? Note that although the original code gives a range of 0 to 999 inclusive, I actually want a range of 1 t...
Your observation that one digit numbers don't occur as often as two and three digit numbers is not surprising. There are only 9 one digit numbers (not including zero), but there are 90 two-digit ones, and 900 three digit ones. So a uniform random number generator will draw numbers in that frequency. To generate random ...
Distribution
37,073,369
18
A distribution is beta-binomial if p, the probability of success, in a binomial distribution has a beta distribution with shape parameters α > 0 and β > 0. The shape parameters define the probability of success. I want to find the values for α and β that best describe my data from the perspective of a beta-binomial dis...
One thing to pay attention to is that comb(n, k) in your log-likelihood might not be well-behaved numerically for the values of n and k in your dataset. You can verify this by applying comb to your data and see if infs appear. One way to amend things could be to rewrite the negative log-likelihood as suggested in http...
Distribution
54,505,173
18
In iPhone Developer Program Portal, there's a video to demonstrate how to create a development certificate and assign a private key Now I have finished the development process and starting to distribute I have created a "Distribution Certificate", but how do I assign a private key to this certificate? As it got the "C...
As no one has updated or answered this question since Nathan pointed out the original answer link is unavailable (Point number one on posting on stackoverflow "Please be sure to answer the question") here is an answer from my experiance, hope it helps someone: For this specific question (Dev/Distribution cert installed...
Distribution
688,809
17
I have some data points and their mean point. I need to find whether those data points (with that mean) follows a Gaussian distribution. Is there a function in MATLAB which can do that kind of a test? Or do I need to write a test of my own? I tried looking at different statistical functions provided by MATLAB. I am ver...
Check this documentation page on all available hypothesis tests. From those, for your purpose you can use: Chi-square goodness-of-fit test Lilliefors test z-test t-test Kolmogorov-Smirnov test ... among others You can also use some visual tests like: hist normplot cdfplot
Distribution
1,882,944
17
To plot a normal distribution curve in R we can use: (x = seq(-4,4, length=100)) y = dnorm(x) plot(x, y) If dnorm calculates y as a function of x, does R have a function that calculates x as a function of y? If not what is the best way to approach this?
What dnorm() is doing is giving you a probability density function. If you integrate over that, you would have a cumulative distribution function (which is given by pnorm() in R). The inverse of the CDF is given by qnorm(); that is the standard way these things are conceptualized in statistics.
Distribution
19,589,191
17
Google uses bsdiff and Courgette for patching binary files like the Chrome distribution. Do any similar tools exist for patching jar files? I am updating jar files remotely over a bandwidth-limited connection and would like to minimize the amount of data sent. I do have some control over the client machine to some exte...
Try the javaxdelta project on Sourceforge. It should allow to create patches and to apply them. [EDIT] This tool doesn't exist, yet. Open the JAR file with the usual tools and then use javaxdelta to create one patch per entry in the JAR. ZIP them up and copy them onto the server. On the other side, you need to install ...
Distribution
2,546,581
16
Possible Duplicate: Making a standard normal distribution in R Using R, draw a standard normal distribution. Label the mean and 3 standard deviations above and below the (10) mean. Include an informative title and labels on the x and y axes. This is a homework problem. I'm not sure how to get going with the code. ...
I am pretty sure this is a duplicate. Anyway, have a look at the following piece of code x <- seq(5, 15, length=1000) y <- dnorm(x, mean=10, sd=3) plot(x, y, type="l", lwd=1) I'm sure you can work the rest out yourself, for the title you might want to look for something called main= and y-axis labels are also up to yo...
Distribution
10,543,443
16
I'm writing a function which I want to accept a distribution as a parameter. Let's say the following: #include<random> #include<iostream> using namespace std; random_device rd; mt19937 gen(rd()); void print_random(uniform_real_distribution<>& d) { cout << d(gen); } Now is there a way to generalise this code, in ...
There is no such traits in standard library. You can just write something like template<typename T> struct is_distribution : public std::false_type {}; and specialize for each type, that is distribution template<typename T> struct is_distribution<std::uniform_int_distribution<T> > : public std::true_type {}; Then jus...
Distribution
27,482,972
16
I'm developing an iOS app for iPhone and iPad. It runs great on the simulators and actual devices. It installs without error using both iTunes and the iPhone Configuration Utility. I cannot, however, seem to get wireless distribution to work properly. Sanity checks: I have an Apple developer license. I have a valid de...
NovaJoe -- I was pretty discouraged to review your link as it does appear to read that you need Enterprise Developer license... I think I figured it out. Read the first paragraph and first bullet point: http://developer.apple.com/library/ios/#featuredarticles/FA_Wireless_Enterprise_App_Distribution/Introduction/Introd...
Distribution
4,742,959
15
I have a vector of count data that is strongly over dispersed and zero inflated. The vector looks like this: i.vec=c(0,63,1,4,1,44,2,2,1,0,1,0,0,0,0,1,0,0,3,0,0,2,0,0,0,0,0,2,0,0,0,0, 0,0,0,0,0,0,0,0,6,1,11,1,1,0,0,0,2) m=mean(i.vec) # 3.040816 sig=sd(i.vec) # 10.86078 I would like to fit a distribution to this, which...
Here is one approach # LOAD LIBRARIES library(fitdistrplus) # fits distributions using maximum likelihood library(gamlss) # defines pdf, cdf of ZIP # FIT DISTRIBUTION (mu = mean of poisson, sigma = P(X = 0) fit_zip = fitdist(i.vec, 'ZIP', start = list(mu = 2, sigma = 0.5)) # VISUALIZE TEST AND COMPUTE GO...
Distribution
7,157,158
15
I am facing some issues related with iOS Developer program and iOS Enterprise Program. One of my client ask me to suggest one of them. Please answer my questions related to iOS Enterprise Program- If i purchase an iOS Enterprise account so when it is available for in-house application distribution? How many device i h...
As soon as you sign the contracts and make the purchase and Apple verifies all the information, you can create your distribution certificate, provisioning profile and then sign your app with the certificate, and distribute your app with the profile. There is no limit to the number of devices. No, you do not need to ge...
Distribution
7,306,441
15
I am working on a simple desktop java application. I would like to make it as seamless to install for end users as possible. E.g. similar to how Minecraft is distributed - a simple executable for OS X and an EXE file for Windows. What tool should I use?
Users of your Java app must have the JRE installed in order to run it. You can either tell them to install Java first, or distribute JRE with your app, as Processing does. Note, however, that your packaged program will be heavy if you include JRE with it. And, if you want to do that, users will need to download the app...
Distribution
7,915,315
15
I want to distribute two versions of my app, the stable branch as well as the current development trunk, using TestFlight. And, if possible, I want to invite the testers only once. Can I have two versions of one app in one TestFlight team? Or maybe two app with different namens? Or can I create a second team and link i...
Unfortunately I think there is no nice way to do that. Your options are: Two different TestFlight teams. You'll have to invite people to both teams. But, TestFlight is clever and if it already knows about a user in another team who is in the provisioning profile in the IPA you upload, then you select that they can acc...
Distribution
9,711,061
15
I would like to compute the Earth Mover Distance between two 2D arrays (these are not images). Right now I go through two libraries: scipy (https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.wasserstein_distance.html) and pyemd (https://pypi.org/project/pyemd/). #define a sampeling method def sampeling2D...
So if I understand you correctly, you're trying to transport the sampling distribution, i.e. calculate the distance for a setup where all clusters have weight 1. In general, you can treat the calculation of the EMD as an instance of minimum cost flow, and in your case, this boils down to the linear assignment problem: ...
Distribution
57,562,613
15
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consisten...
I favor bundling dependencies, if it's not feasible to use a system for automatic dependency resolution (i.e. setuptools), and if you can do it without introducing version conflicts. You still have to consider your application and your audience; serious developers or enthusiasts are more likely to want to work with a ...
Distribution
598,299
14
I'm working on packaging a small Python project as a zip or egg file so that it can be distributed. I've come across 2 ways to include the project's config files, both of which seem to produce identical results. Method 1: Include this code in setup.py: from distutils.core import setup setup(name='ProjectName', ...
MANIFEST.in controls what files are put into the distribution zip file when you call python setup.py sdist. It does not control what is installed. data_files (or better package_data) controls what files are installed (and I think also makes sure files are included in the zip file). Use MANIFEST.in for files you won'...
Distribution
2,968,701
14
reading the doc from apple I need to create an ad-hoc distribution app, and to do so I need the entitlements.plist. when i create a new entitlement, the value "get-task-allow" is not present, so I added by hand.. is right?? at the end the Entitlements.plist is this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pli...
Try, in XCode, to go "new file" and in the wizard select "code signing". Select the "Entitlements" file type. Just name it "Entitlements.plist". Make sure the task-allow is not checked for adhoc distrobution. This is all you need to do, no need to "roll your own" :) (Xcode 3.2.2) UPDATE: Since Xcode 4.2 the Entitlemen...
Distribution
3,021,569
14
Is it possible to (legally) sell WP7 apps outside of Microsoft's App Hub? Are there license restrictions to this? Is it ideal to even approach app distribution in such a manner (i.e., are there other sites/services that are easily accessible by WP7 users to find new apps).
Strictly speaking, I'm not aware of any restrictions in place to prevent exchange (commercial or otherwise) of xap files outside of the marketplace. However, to deploy the xap files the would be users would have to have an active marketplace account. Even then, you're limited to 10 apps deployed not via the marketplace...
Distribution
4,139,063
14
I need to generate 3 random numbers, the amount of which is equal to 1. My implementation does not support uniform distribution. :(
Just get 3 random numbers and then calculate a factor which is 1 / [sum of your numbers]. Finally multiply each of the random numbers with that factor. The sum will be 1.
Distribution
5,563,808
14
I am trying to write a program to select a random name from the US Census last name list. The list format is Name Weight Cumulative line ----- ----- ----- - SMITH 1.006 1.006 1 JOHNSON 0.810 1.816 2 WILLIAMS 0.699 2.515 3 JONES 0.621 3.136 ...
The "easiest" way to handle this would be to keep this in a list. You could then just use: Name GetRandomName(Random random, List<Name> names) { double value = random.NextDouble() * names[names.Count-1].Culmitive; return names.Last(name => name.Culmitive <= value); } If speed is a concern, you could store a se...
Distribution
7,366,838
14
This might have been asked lots of times, but still I couldn't find info on why are they needed. I use DEVELOPER prov profiles to test apps on my device, that makes sense. The Provisioning Portal explains prov profiles like this: A Provisioning Profile is a collection of digital assets that uniquely ties developers an...
Absolutely yes. The distribution profile is used for submission to the App Store. It does not have the 100 device limit that the development profiles have. From the Tools Workflow Guide: When you’re ready to share your app for user testing or for general distribution through the App Store, you need to create an archi...
Distribution
12,689,073
14
Can I use Inno Setup to import a .cer file (a certificate)? How can I do it? I need to create a certificate installer for Windows XP, Windows Vista and Windows 7.
Actually the CertMgr.exe is not available on all PCs and furthermore it does not appear to be redistributable (as hinted by @TLama); and besides you don't even need it. CertUtil is available on every Windows machine (that I have tested) and works perfectly: [Run] Filename: "certutil.exe"; Parameters: "-addstore ""Tru...
Distribution
12,754,314
14
I am looking to find the peaks in some gaussian smoothed data that I have. I have looked at some of the peak detection methods available but they require an input range over which to search and I want this to be more automated than that. These methods are also designed for non-smoothed data. As my data is already smoot...
There exists a bulit-in function argrelextrema that gets this task done: import numpy as np from scipy.signal import argrelextrema a = np.array([1,2,3,4,5,4,3,2,1,2,3,2,1,2,3,4,5,6,5,4,3,2,1]) # determine the indices of the local maxima max_ind = argrelextrema(a, np.greater) # get the actual values using these i...
Distribution
35,282,456
14
Let's say I have this Hello.scala. object HelloWorld { def main(args: Array[String]) { println("Hello, world!") } } I could run 'scalac' to get HelloWorld.class and HelloWorld$.class. I can run using 'scala -classpath . Hello'. But I can't run 'java -cp . Hello'. Why is this? Isn't scala interoperable with Ja...
You need to add Scala to the classpath, e.g. -classpath scala-library.jar:. or by adding -Xbootclasspath/a:scala-library.jar to the VM arguments. Addition: Sorry, did not see that last question. If you want do distribute single JAR files many people use ProGuard to ship the classes needed from the scala-library.jar...
Distribution
3,366,545
13
My client asked me to get the review of the app on which I am working. So, I want to get the ipa file and mobile provision file from Xcode 4.2 to share my app to run in real device. I have a paid account of apple with me. Please tell me the procedure to get it. Thanks in advance.
STEP-1: You need to refer steps for AdHoc Distribution I think you need to login with your credentials at Developer Apple Login Once you are logged in go through this link and read through it step by step. I think this is the best solution you can get as this documentation guide is given by Apple https://developer.app...
Distribution
9,595,925
13
This is getting frustrating. I have two identities, one old, one new, and the latter should be used to deploy iOS apps to the App Store. I've created the new user, granted him admin access, then I created the app name and provisioning profiles. However, in the Organizer I see that the Dev provision works flawlessly, wh...
You need the key that was used to create the Distribution Certificate for your company. Remember when you created your developer certificate? Then you went to keychain -> certificate assistant -> Request a certificate from ... When you did this, your Mac paired your certificate request to a key in your keychain. Once y...
Distribution
11,359,001
13
I'm using the following code to fit the normal distribution. The link for the dataset for "b" (too large to post directly) is : link for b setwd("xxxxxx") library(fitdistrplus) require(MASS) tazur <-read.csv("b", header= TRUE, sep=",") claims<-tazur$b a<-log(claims) plot(hist(a)) After plotting the histogram, it see...
Looks like you are making confusion between MASS::fitdistr and fitdistrplus::fitdist. MASS::fitdistr returns object of class "fitdistr", and there is no plot method for this. So you need to extract estimated parameters and plot the estimated density curve yourself. I don't know why you load package fitdistrplus, becau...
Distribution
39,961,964
13
I have cells for whom the numeric value can be anything between 0 and Integer.MAX_VALUE. I would like to color code these cells correspondingly. If the value = 0, then r = 0. If the value is Integer.MAX_VALUE, then r = 255. But what about the values in between? I'm thinking I need a function whose limit as x => Intege...
The "fairest" linear scaling is actually done like this: floor(256 * value / (Integer.MAX_VALUE + 1)) Note that this is just pseudocode and assumes floating-point calculations. If we assume that Integer.MAX_VALUE + 1 is 2^31, and that / will give us integer division, then it simplifies to value / 8388608 Why other an...
Distribution
1,549,717
12
I'm looking at moving a program that currently embeds a Python interpreter to use Lua. With Python it's fairly easy to use modulefinder, compileall, and zipfile to make a nice tidy zip containing all the external libraries used. Does Lua have the ability to bundle up its libraries like that, or is there some better be...
As is typical with Lua, there's no one standard and a lot of people roll their own. There's an effort to standardize on a package-management system called Lua Rocks, but I'm not sure how much momentum is behind it or how mature it is. (In 2008 it was not quite ready for prime time, but things may have changed.) I myse...
Distribution
3,065,783
12
I'm interested in how to distribute a Java application that has a lot of dependencies (specified in a pom.xml in Maven). Obviously it would be possible to just package everything in one big .jar file. However that seems wasteful, since an update of the application would require sending a new copy of all the dependencie...
Can you just use Maven, with something like described at Maven Run Project ? This is how I have some of my own applications setup within my own network. I've never needed to worry about messing with the classpaths or downloading / providing dependencies for programs setup like this for a long time. This approach also...
Distribution
8,547,718
12
Supposing the following scenario: Company A asks company B to produce an IPad App for them. Company A only wants to use it for themselves on a very limited amount of IPads (less than 100). Company A is not necessarily interested in offering it on the app store. How can company B distribute the app (sell it) to company ...
Enterprise distribution is exactly what you want in this situation.
Distribution
10,885,112
12
I am trying to model some data that follows a sigmoid curve relationship. In my field of work (psychophysics), a Weibull function is usually used to model such relationships, rather than probit. I am trying to create a model using R and am struggling with syntax. I know that I need to use the vglm() function from the V...
Here's my solution, with bbmle. Data: dframe1 <- structure(list(independent_variable = c(0.3, 0.24, 0.23, 0.16, 0.14, 0.05, 0.01, -0.1, -0.2), dependent_variable = c(1, 1, 1, 0.95, 0.93, 0.65, 0.55, 0.5, 0.5)), .Names = c("independent_variable", "dependent_variable"), class = "data.frame", row.names = c(NA, -9L)) ...
Distribution
14,777,393
12
I'm trying to calculate p-values of a f-statistic with R. The formula R uses in the lm() function is equal to (e.g. assume x=100, df1=2, df2=40): pf(100, 2, 40, lower.tail=F) [1] 2.735111e-16 which should be equal to 1-pf(100, 2, 40) [1] 2.220446e-16 It is not the same! There s no BIG difference, but where does it c...
> all.equal(pf(100, 2, 40, lower.tail=F),1-pf(100, 2, 40)) [1] TRUE
Distribution
21,433,528
12
I am looking to count the number of times the values in an array change in polarity (EDIT: Number of times the values in an array cross zero). Suppose I have an array: [80.6 120.8 -115.6 -76.1 131.3 105.1 138.4 -81.3 -95.3 89.2 -154.1 121.4 -85.1 96.8 68.2]` I want the count to be 8. One solution is to...
This produces the same result: import numpy as np my_array = np.array([80.6, 120.8, -115.6, -76.1, 131.3, 105.1, 138.4, -81.3, -95.3, 89.2, -154.1, 121.4, -85.1, 96.8, 68.2]) ((my_array[:-1] * my_array[1:]) < 0).sum() gives: 8 and seems to be the fastest solution: %timeit ((my_array[:-1] * my_a...
Distribution
30,272,538
12
I have an array of colors that will populate a pie chart to act as a game spinner. I don't want the same colors to appear next to each other, making one huge chunk in the circle. My array looks something like this: var colors = ["blue", "red", "green", "red", "blue", "blue", "blue", "green"] The problem is of course ...
Disclaimer: In order to generate a "random" solution I am going to use backtracking. This approach is NOT fast and is NOT cheap by a space point of view. Infact both Time And Space Complexity are O(n!)... and this is HUGE! However it gives you a valid solution as random as possible. Backtracking So you want a random ...
Distribution
39,170,398
12
I need to develop a small-medium sized desktop GUI application, preferably with Python as a language of choice because of time constraints. What GUI library choices do I have which allow me to redistribute my application standalone, assuming that the users don't have a working Python installation and obviously don't ha...
This may help: How can I make an EXE file from a Python program?
Distribution
153,956
11
In the context of creating a custom Eclipse distribution for a development team. How would I go about building a custom Eclipse distribution containing a specific set of plugins? Would it be difficult to also add a kind of update site to put specific versions of the plug-ins from which the customized eclipse would upda...
I realize this is an old post, but it keeps coming up on searches I do and I’d like to put in some more details given all the changes and maturity that has occurred when it comes to delivering Eclipse plug-ins... So, for those who end up on this page, hopefully the following will help you out! To summarize my personal...
Distribution
351,373
11
Hello fellow software developers. I want to distribute a C program which is scriptable by embedding the Python interpreter. The C program uses Py_Initialize, PyImport_Import and so on to accomplish Python embedding. I'm looking for a solution where I distribute only the following components: my program executable an...
Have you looked at Python's official documentation : Embedding Python into another application? There's also this really nice PDF by IBM : Embed Python scripting in C application. You should be able to do what you want using those two resources.
Distribution
2,494,468
11
I'm working on an application that I need to be cross-platform. I'd like to use Python for it, and am looking for GUI toolkits that make interface programming simple and easy. After a slight hunt, I found PythonCard. This looks like it fits the bill perfectly, but I'm not sure if it will be possible to compile this ...
I think the answer here is less about the particular GUI toolkit and more about distributing stand-alone python applications. Personally, I've found the tools for this a little less perfect than I'd like but, after some finagling, they get the job done. The most likely candidate that'd fit your needs is cx_Freeze. Thou...
Distribution
3,604,113
11
According to the question " How to get Linux distribution name and version? ", to get the linux distro name and version, this works: lsb_release -a On my system, it shows the needed output: No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 9.10 Release: 9.10 Codename: karmic Now, to get...
You can simply use the function: int uname(struct utsname *buf); by including the header #include <sys/utsname.h> It already returns the name & version as a part of the structure: struct utsname { char sysname[]; /* Operating system name (e.g., "Linux") */ char nodename[]; /* Name within "...
Distribution
6,315,666
11
I have a C# library that is called by various clients (both 32-bit and 64-bit). Up to now it was compiled as AnyCPU, so there was no issues. Recently I added a dependency to SQLite .NET library which come in both 32 and 64-bit flavors (but not AnyCPU). So, now, I have to have 2 builds - for both bitnesses. In the ...
There are several ways you can handle this. Code changes (small) are required for the first three approaches: A. You can modify the PATH to point to the platform specific folder during application start up. Then .NET will automatically load local DLLs from that folder. B. You can subscribe to the AssemblyResolve eve...
Distribution
9,469,467
11
I am new IOS development, i want to distribute my iPad app (.ipa format file) over my website. So, others can download my iPad app (.ipa format file) from my website. So, Is it possible to download the iPad app (.ipa format file) over website by others?
You need to check the Box "Distribute to Enterprise" when you Archive your Application. When you do so, a plist File is generated. (Be Careful with the Informations you Provide, the URL has to be right). Place the ipa and plist to your server. Then you can Link to the plist from an HTML File: itms-services://?action=do...
Distribution
11,538,177
11
After making games with XNA, I wanted to broaden my horizon by working with python. I know XNA is supposedly easy to distribute; however, i'm not sure if a game made with pygame compiled with py2exe could be submitted to steam? My overall question is...How would I submit a game made with pygame to steam?
That it is Python, assembly or XNA doesn't really matter for Steam, AFAIK. There are two general ways to distribute games through Steam, contacting the Steam team (I just love saying that) themselves, or getting accepted through the Green Light program. Seeing that you aren't a AAA game dev team, the latter would proba...
Distribution
11,586,579
11
I have been doing some data analysis in R and I am trying to figure out how to fit my data to a 3 parameter Weibull distribution. I found how to do it with a 2 parameter Weibull but have come up short in finding how to do it with a 3 parameter. Here is how I fit the data using the fitdistr function from the MASS packa...
First, you might want to look at FAdist package. However, that is not so hard to go from rweibull3 to rweibull: > rweibull3 function (n, shape, scale = 1, thres = 0) thres + rweibull(n, shape, scale) <environment: namespace:FAdist> and similarly from dweibull3 to dweibull > dweibull3 function (x, shape, scale = 1, th...
Distribution
11,817,883
11
How do you define your own distributions in R? If I have a distribution that looks something like this: P(D=0)=2/4, P(D=1)=1/4, P(D=2)=1/4 How do I turn that into a distribution I can work with? In the end, I want to be able to use these and do things involving cdfs, icdfs and pmfs. Like find the probability of 1 thr...
If you just need to generate random variates from the distribution, this should suffice: rMydist <- function(n) { sample(x = c(0,1,2), size = n, prob = c(.5, .25, .25), replace=T) } rMydist(20) # [1] 1 0 2 0 2 1 1 0 2 2 0 0 2 1 0 0 0 0 0 1 prop.table(table(rMydist(1e6))) # 0 1 2 ...
Distribution
12,848,736
11
I want to extract file "default.jasperreports.properties" from depended jasperreports.jar and put it in zip distribution with new name "jasperreports.properties" Sample gradle build: apply plugin: 'java' task zip(type: Zip) { from 'src/dist' // from configurations.runtime from extractFileFromJar("default.ja...
Here is a possible solution (sometimes code says more than a thousand words): apply plugin: "java" repositories { mavenCentral() } configurations { jasper } dependencies { jasper('jasperreports:jasperreports:2.0.5') { transitive = false } } task zip(type: Zip) { from 'src/dist' // n...
Distribution
13,339,237
11
I am trying to write a Winbugs/Jags model for modeling multi grain topic models (exactly this paper -> http://www.ryanmcd.com/papers/mg_lda.pdf) Here I would like to choose a different distribution based on a particular value. For Eg: I would like to do something like `if ( X[i] > 0.5 ) { Z[i] ~ dcat(theta-gl[D[i], 1:...
Winbugs/JAGS is not a procedural language, so you cannot use the construct like that. Use step function. Quote from the manual: step(e) ...... 1 if e >= 0; 0 otherwise So you need a trick to change the condition: X[i] > 0.5 <=> X[i] - 0.5 > 0 <=> !(X[i] - 0.5 <= 0) <=> !(-(X[i] - 0.5) >= 0) <=> !(step(-(X[i]...
Distribution
15,414,303
11
Javascript's Math.random() returns a psuedo-random number with "uniform" distribution. I need to generate a random number in the range [0,1] that is skewed to either side. (Meaning, higher chance of getting more numbers next to 0 or next to 1) Ideally I would like to have a parameter to set this curve. I supposed I ca...
I think you want beta distribution with alpha=beta=0.5 It is possible to transform uniform random number to beta distribution using inverse cumulative distribution. unif = Math.random() I am not familiar with javascript, but this should be clear: beta = sin(unif*pi/2)^2 PS: you can generate many such numbers and plot...
Distribution
16,110,758
11
We want to distribute our application in China, but we currently have a BIG issue. The application requires Google Play Services installed. It normally works well: the user is prompted a dialog, and the brought to the Google Play application where he can install the Google Play Services application. And in China? When ...
The Google Play Services APK is only available from the Google Play Store and doesn't support installation on devices without the store app, see http://developer.android.com/google/play-services/index.html Depending on what kind of functionality you use from the Google Play Service APK you would need to use a 3rd party...
Distribution
16,233,531
11
Frozen Distribution In scipy.stats you can create a frozen distribution that allows the parameterization (shape, location & scale) of the distribution to be permanently set for that instance. For example, you can create an gamma distribution (scipy.stats.gamma) with a,loc and scale parameters and freeze them so they d...
Accessing rv frozen parameters Yes, the parameters used to create a frozen distribution are available within the instance of the distribution. They are stored within the args & kwds attribute. This will be dependent on if the distribution's instance was created with positional arguments or keyword arguments. import sci...
Distribution
37,501,075
11
I've checked the examples in the Boost website, but they are not what I'm looking for. To put it simple, I want to see if a number on a die is favored, using 600 rolls, so the average appearances of every number (1 through 6) should be 100. And I want to use the chi square distribution to check if the die is fair. Help...
Suppose e[i] and o[i] are arrays holding the expected and observed count of rolls for each of the 6 possibilities. In your case, e[i] is 100 for each bin, and o[i] is the number of times i was rolled in your 600 trials. You then calculate the chi-squared statistic by summing (e[i]-o[i])2/e[i] over the 6 bins. Lets sa...
Distribution
2,079,937
10
Ok, so here's my problem. We are looking at purchasing a data set from a company to augment our existing data set. For the purposes of this question, let's say that this data set ranks places with an organic number (meaning that the number assigned to one place has no bearing on the number assigned to another). The ...
Look at distributions used in reliability analysis - they tend to have these long tails. A relatively simply possibility is the Weibull distribution with P(X>x)=exp[-(x/b)^a]. Fitting your values as P(X>1)=0.1 and P(X>10)=0.005, I get a=0.36 and b=0.1. This would imply that P(X>40)*10000=1.6, which is a bit too low, b...
Distribution
3,109,670
10
We are an iPhone Developer Program member. We've got a DUNS number but not the 500 employees necessary to join the iPhone Developer Enterprise Program. Therefore I can can't see how things exactly operate for the Enterprise level. But we have customers that are big enough to be Enterprise developers and we could distri...
Using an iOS Enterprise Program distribution deployment method does NOT require you to enter every device id. All you need is a distribution certificate for signing and a provisioning profile built for it. Note that ANYONE that has the profile can run the app on their device, although you can revoke the profile if n...
Distribution
3,251,291
10
I am about to upload an app to iTunes Connect. I am not Team Agent, nor does it seem the Team Agent can make me a Team Agent. So he logged onto Member Center and downloaded a Distribution Certificate, which is in my Keychain along with the WWDR Certificate. The bundle identifier is set to se."companyname"."appname". Wh...
"iPhone distribution no profiles match" is one of the most annoying issue that I have ever had with app development. This is how I sorted it out: In Developer under iOS Provisioning Portal I needed to generate 4 certificates and download the WWDR intermediate certificate to be able to submit my app to the App Store: U...
Distribution
3,608,851
10
I Configured a distribution in SQL Server 2008 using both Wizard and T-SQL but after it when I want to remove it Using Wizard (right clicking on Replication and choosing 'Disable Publishing and Distribution...') or executing following command with and without its parameters: exec sp_dropdistributor @no_checks = 1 -- no...
Try this: SELECT spid FROM sys.sysprocesses WHERE dbid = db_id('distribution') Kill the spid and try again. Now it should work.
Distribution
10,193,404
10
First, is this the correct C++ representation of the pdf gaussian function ? float pdf_gaussian = ( 1 / ( s * sqrt(2*M_PI) ) ) * exp( -0.5 * pow( (x-m)/s, 2.0 ) ); Second, does it make sense of we do something like this ? if(pdf_gaussian < uniform_random()) do something else do other thing EDIT: An example of w...
Technically, float pdf_gaussian = ( 1 / ( s * sqrt(2*M_PI) ) ) * exp( -0.5 * pow( (x-m)/s, 2.0 ) ); is not incorrect, but can be improved. First, 1 / sqrt(2 Pi) can be precomputed, and using pow with integers is not a good idea: it may use exp(2 * log x) or a routine specialized for floating point exponents instead of...
Distribution
10,847,007
10
I have a simple table BIRDCOUNT below, showing how many birds were counted on any given day: +----------+ | NUMBIRDS | +----------+ | 123 | | 573 | | 3 | | 234 | +----------+ I would like to create a frequency distribution graph, showing how many times a number of birds were counted. So I need M...
SELECT FLOOR( birds.bird_count / stat.diff ) * stat.diff as range_start, (FLOOR( birds.bird_count / stat.diff ) +1) * stat.diff -1 as range_end, count( birds.bird_count ) as times_seen FROM birds_table birds, (SELECT ROUND((MAX( bird_count ) - MIN( bird_count ))/10) AS diff FROM birds_ta...
Distribution
15,055,540
10
I am interested in using python to compute a confidence interval from a student t. I am using the StudentTCI() function in Mathematica and now need to code the same function in python http://reference.wolfram.com/mathematica/HypothesisTesting/ref/StudentTCI.html I am not quite sure how to build this function myself, bu...
I guess you could use scipy.stats.t and its interval method: In [1]: from scipy.stats import t In [2]: t.interval(0.95, 10, loc=1, scale=2) # 95% confidence interval Out[2]: (-3.4562777039298762, 5.4562777039298762) In [3]: t.interval(0.99, 10, loc=1, scale=2) # 99% confidence interval Out[3]: (-5.338545334351676, 7....
Distribution
17,203,403
10
I have frequency values changing with the time (x axis units), as presented on the picture below. After some normalization these values may be seen as data points of a density function for some distribution. Q: Assuming that these frequency points are from Weibull distribution T, how can I fit best Weibull density fun...
Here is a better attempt, like before it uses optim to find the best value constrained to a set of values in a box (defined by the lower and upper vectors in the optim call). Notice it scales x and y as part of the optimization in addition to the Weibull distribution shape parameter, so we have 3 parameters to optim...
Distribution
29,054,270
10
I would like to make a word frequency distribution, with the words on the x-axis and the frequency count on the y-axis. I have the following list: example_list = [('dhr', 17838), ('mw', 13675), ('wel', 5499), ('goed', 5080), ('contact', 4506), ('medicatie', 3797), ('uur', 3792), ('gaa...
Using pandas: import pandas as pd import matplotlib.pyplot as plt example_list = [('dhr', 17838), ('mw', 13675), ('wel', 5499), ('goed', 5080), ('contact', 4506), ('medicatie', 3797), ('uur', 3792), ('gaan', 3473), ('kwam', 3463), ('kamer', 3447), ('mee', 3278), ('gesprek', 2978)] df = pd.DataFrame(example_list, col...
Distribution
45,080,698
10
Suppose I have the variable x that was generated using the following approach: x <- rgamma(100,2,11) + rnorm(100,0,.01) #gamma distr + some gaussian noise head(x,20) [1] 0.35135058 0.12784251 0.23770365 0.13095612 0.18796901 0.18251968 [7] 0.20506117 0.25298286 0.11888596 0.07953969 0.09763770 0.28698417 [13] ...
A good alternative is the fitdistrplus package by ML Delignette-Muller et al. For instance, generating data using your approach: set.seed(2017) x <- rgamma(100,2,11) + rnorm(100,0,.01) library(fitdistrplus) fit.gamma <- fitdist(x, distr = "gamma", method = "mle") summary(fit.gamma) Fitting of the distribution ' gamma...
Distribution
45,536,234
10
Below is the describe output for both my clusterissuer and certificate reource. I am brand new to cert-manager so not 100% sure this is set up properly - we need to use http01 validation however we are not using an nginx controller. Right now we only have 2 microservices so the public-facing IP address simply belongs t...
I had the same issue and I followed the advice given in the comments by @Popopame suggesting to check out the troubleshooting guide of cert-manager to find out how to troubleshoot cert-manager. or [cert-managers troubleshooting guide for acme issues] to find out which part of the acme process breaks the setup. It seems...
cert-manager
63,346,728
54
I'm running into an issue handling tls certificates with cert-manager, I'm following the documentation and added some extras to work with Traefik as an ingress. Currently, I have this YAML files: cluster-issuer.yaml apiVersion: cert-manager.io/v1alpha2 kind: ClusterIssuer metadata: name: letsencrypt-staging namespa...
The typical problem with letsencrypt certs is the letsencrypt itself not being able to validate who you are and that you own the domain. In this case, alexguedes.com. With cert-manager you can do Domain Validation and HTTP Validation. Based on the posted ClusterIssuer you are doing HTTP Validation. So you need to make ...
cert-manager
63,432,101
18
I can't seem to get cert-manager working: $ kubectl get certificates -o wide NAME READY SECRET ISSUER STATUS AGE example-ingress False example-ingress letsencrypt-prod Waiting for CertificateRequest "example...
Your ingress is referring to an issuer, but the issuer is a ClusterIssuer. Could that be the reason? I have a similar setup with Issuer instead of a ClusterIssuer and it is working.
cert-manager
58,553,510
14
I am using cert-manager 0.5.2 to manage Let's Encrypt certificates on our Kubernetes cluster. I was using the Let's Encrypt staging environment, but have now moved to use their production certificates. The problem is that my applications aren't updating to the new, valid certificates. I must have screwed something up ...
in this case the problem went away after recreating the secret and the cert-manager certificate resource. generally what you want to check, annotations on your ingress resource (certmanager.k8s.io/cluster-issuer: letsencrypt), cert-manager certificate resource, ssl certificate secret in k8s and in ingress resource
cert-manager
54,038,028
12
In tensorflow the training from the scratch produced following 6 files: events.out.tfevents.1503494436.06L7-BRM738 model.ckpt-22480.meta checkpoint model.ckpt-22480.data-00000-of-00001 model.ckpt-22480.index graph.pbtxt I would like to convert them (or only the needed ones) into one file graph.pb to be able to...
You can use this simple script to do that. But you must specify the names of the output nodes. import tensorflow as tf meta_path = 'model.ckpt-22480.meta' # Your .meta file output_node_names = ['output:0'] # Output nodes with tf.Session() as sess: # Restore the graph saver = tf.train.import_meta_graph(meta...
Check Point
45,864,363
38
Using CheckPoint I'm trying to use a VPN access from work to my clients site, which worked fine in Windows 7 and 8. But in Windows 10 I'm getting the error "ssl network extender service is down..." I get the error message just at the beginning of the request, when CheckPoint is trying to connect. Trying to run Internet...
I resolved this issue by running IE 11 as an Administrator.
Check Point
32,646,572
23
When I run code such as the following: val newRDD = prevRDD.map(a => (a._1, 1L)).distinct.persist(StorageLevel.MEMORY_AND_DISK_SER) newRDD.checkpoint print(newRDD.count()) and watch the stages in Yarn, I notice that Spark is doing the DAG calculation TWICE -- once for the distinct+count that materializes the RDD and c...
Looks like this may be a known issue. See an older JIRA ticket, https://issues.apache.org/jira/browse/SPARK-8582
Check Point
31,078,350
10
I would like to provision with my three nodes from the last one by using Ansible. My host machine is Windows 10. My Vagrantfile looks like: Vagrant.configure("2") do |config| (1..3).each do |index| config.vm.define "node#{index}" do |node| node.vm.box = "ubuntu" node.vm.box = "../boxes/ubuntu_base.b...
Create a file ansible/ansible.cfg in your project directory (i.e. ansible.cfg in the provisioning_path on the target) with the following contents: [defaults] host_key_checking = false provided that your Vagrant box has sshpass already installed - it's unclear, because the error message in your question suggests it wa...
Ansible
42,462,435
57
In my system provisioning with Ansible, I don't want to specify become=yes in every task, so I created the following ansible.cfg in the project main directory, and Ansible automatically runs everything as root: [privilege_escalation] become = True But as the project kept growing, some new roles should not be run as ro...
I have found a solution, although I think a better solution should be implemented by the Ansible team. Rename main.yml to tasks.yml, and then write the following to main.yml: --- - { include: tasks.yml, become: yes } Another solution is to pass the parameter directly in site.yml, but the main idea of the question was ...
Ansible
39,183,100
57
I have a large Ansible playbook where Docker images are built when running it. I am using an increasing number as the tag to version them. Currently, I have to specify this in every hosts: section. I know there are global variables but from what I found by searching for "ansible" "global variables", they have to define...
Ansible has a default all group that, funnily enough, contains all the hosts in the inventory file. As such you can do like with any host groups and provide group_vars for the host group. As shown in the previous link these can be defined directly in the inventory file or they can be contained in a separate file named ...
Ansible
33,126,156
57
Does anyone know how to do something (like wait for port / boot of the managed node) BEFORE gathering facts? I know I can turn gathering facts off gather_facts: no and THEN wait for port but what if I need the facts while also still need to wait until the node boots up?
Gathering facts is equivalent to running the setup module. You can manually gather facts by running it. It's not documented, but simply add a task like this: - name: Gathering facts setup: In combination with gather_facts: no on playbook level the facts will only be fetched when above task is executed. Both in an ex...
Ansible
31,054,453
57
I want to abort execution of remaining task if certain condition is failed. and display proper error message. So instead of skipping remaining task I want to show error message and stop execution of ansible playbook. Lets say I am running below command $ ansible-playbook playbook.yml -e "param1=value1 param2=value" M...
You can use assert https://docs.ansible.com/ansible/latest/collections/ansible/builtin/assert_module.html or fail https://docs.ansible.com/ansible/latest/collections/ansible/builtin/fail_module.html It will go along with something like this #check if params are invalid then abort below all tasks. - ...
Ansible
22,758,925
57
I'm using Ansible to setup EC2 instances and deploy an application. There's a hosts script which gathers tags related servers and groups info. I'd like to run these actions as a single playbook, so New instances are created if needed Hosts script loads inventory (including servers' facts) Deployment playbook works Ho...
With Ansible 2.0+, you can refresh your inventory mid-play by running the task: - meta: refresh_inventory
Ansible
29,003,420
56
I'm running into the silliest issue. I cannot figure out how to test for boolean in an Ansible 2.2 task file. In vars/main.yml, I have: destroy: false In the playbook, I have: roles: - {'role': 'vmdeploy','destroy': true} In the task file, I have the following: - include: "create.yml" when: "{{ destroy|boo...
To run a task when destroy is true: --- - hosts: localhost connection: local vars: destroy: true tasks: - debug: when: destroy and when destroy is false: --- - hosts: localhost connection: local vars: destroy: false tasks: - debug: when: not destroy
Ansible
39,640,654
54
The question is simple: what is the difference between ansible_user (former ansible_ssh_user) and remote_user in Ansible, besides that the first one is set if configuration file and the latter one is set in plays / roles? How do they relate to -u / --user command line options?
They both seem to be the same. Take a look here: # the magic variable mapping dictionary below is used to translate # host/inventory variables to fields in the PlayContext # object. The dictionary values are tuples, to account for aliases # in variable names. MAGIC_VARIABLE_MAPPING = dict( connection = ('ansi...
Ansible
36,668,756
54
In Ansible 1.7, I can use --tags from the command-line to only run a subset of that playbooks tasks. But I'm wanting to bake into my playbook to run a set of roles with only tasks that match tags. That is, I don't want to have to pass this in via the command-line since it will be the same every time. At first I thoug...
You only have the following options with the current version of Ansible: Specify the tags on the command line Use a variable instead of a tag to conditionally run tasks Split your webserver role into multiple roles and use role dependencies for the common tasks This feature request has come up on the mailing list a f...
Ansible
25,674,649
54
I have a register task to test for the installation of a package: tasks: - name: test for nginx command: dpkg -s nginx-common register: nginx_installed Every run it gets reported as a "change": TASK: [test for nginx] ******************************************************** changed: [vm1] I don't regard this...
It’s described in official documentation here. tasks: - name: test for nginx command: dpkg -s nginx-common register: nginx_installed changed_when: false
Ansible
23,946,112
54
While doing clone, push or pull of a private git repository hosted internally (e.g. on a GitLab instance) with Ansible's Git module, how do I specify username and password to authenticate with the Git server? I don't see any way to do this in the documentation.
You can use something like this: --- - hosts: all gather_facts: no become: yes tasks: - name: install git package apt: name: git - name: Get updated files from git repository git: repo: "https://{{ githubuser | urlencode }}:{{ githubpassword | urlencode }}@github.com/privre...
Ansible
37,841,914
53
I am having a hard time understanding the logic of ansible with_subelements syntax, what exactly does with_subelements do? i took a look at ansible documentation on with_subelements here https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-subelements and was not very helpful. I also saw a playb...
This is really bad example of how subelements lookup works. (And has old, unsupported, syntax as well). Look at this one: --- - hosts: localhost gather_facts: no vars: families: - surname: Smith children: - name: Mike age: 4 - name: Kate age: 7 - s...
Ansible
41,908,715
52
I'm trying to organize my playbooks according to the Directory Layout structure. The documentation doesn't seem to have a recommendation for host-specific files/templates. I have 2 plays for a single site example.com-provision.yml example.com-deploy.yml These files are located in the root of my structure. The provisi...
Facing the same problem the cleanest way seems for me the following structure: In the top-level directory (same level as playbooks) I have a files folder (and if I needed also a templates folder). In the files folder there is a folder for every host with it's own files where the folder's name is the same as the host na...
Ansible
32,830,428
52
I'm trying to follow this Ansible tutorial while adjusting it for Ubuntu 16.04 with php7. Below this message you'll find my Ansible file. After running it and trying to visit the page in the browser I get a 404, and the following in the nginx error logs: 2016/10/15 13:13:20 [crit] 28771#28771: *7 connect() to unix:/...
Had the same problem. Solution is very easy. In nginx conf file you are trying upstreaming to unix:/var/run/php7.0-fpm.sock Correct path is unix:/var/run/php/php7.0-fpm.sock There is a mention about this in the documentation Nginx communicates with PHP-FPM using a Unix domain socket. Sockets map to a path on the fi...
Ansible
40,059,745
51
Here is the inventory file --- [de-servers] 192.26.32.32 [uk-servers] 172.21.1.23 172.32.2.11 and my playbook is look like this: - name: Install de-servers configurations hosts: de-servers roles: - de-server-setup - name: Install uk-servers configurations hosts: uk-servers roles: - uk-server-setu...
In the role de-server-setup add a task to change the ansible_port host variable. - name: Change ssh port to 8888 set_fact: ansible_port: 8888
Ansible
34,333,058
51
In the documentation, there is an example of using the lineinfile module to edit /etc/sudoers. - lineinfile: "dest=/etc/sudoers state=present regexp='^%wheel' line='%wheel ALL=(ALL) NOPASSWD: ALL'" Feels a bit hackish. I assumed there would be something in the user module to handle this but there doesn't appear to...
That line isn't actually adding an users to sudoers, merely making sure that the wheel group can have passwordless sudo for all command. As for adding users to /etc/sudoers this is best done by adding users to necessary groups and then giving these groups the relevant access to sudo. This holds true when you aren't usi...
Ansible
33,359,404
51
what I'm trying to accomplish is to run commands inside of a Docker container that has already been created on a Digital Ocean Ubuntu/Docker Droplet using Ansible. Can't seem to find anything on this, or I'm majorly missing something. This is my Ansible task in my play book. I'm very new to Ansible so any advice or wis...
After discussion with some very helpful developers on the ansible github project, a better way to do this is like so: - name: add container to inventory add_host: name: [container-name] ansible_connection: docker changed_when: false - name: run command in container delegate_to: [container-name] raw: ba...
Ansible
32,878,795
51
I am using [file lookup] which reads the whole file and stores the content in a variable. My play looks something like this: - name: Store foo.xml contents in a variable set_fact: foo_content: "{{ lookup('file', 'foo.xml' ) | replace('\n', '')}}" So the above code reads the foo.xml file and stores it in t...
Use the Jinja trim filter: "{{ lookup('file', 'foo.xml' ) | trim }}"
Ansible
32,016,123
51
I have created an autoscaling group for Amazon EC2 and I have added my public key when I created the AMI with packer, I can run ansible-playbook and ssh to the hosts. But there is a problem when I run the playbook like this ansible-playbook load.yml I am getting this message that I need to write my password Enter pass...
In ansible There is no option to store passphrase-protected private key For that we need to add the passphrase-protected private key in the ssh-agent Start the ssh-agent in the background. # eval "$(ssh-agent -s)" Add SSH private key to the ssh-agent # ssh-add ~/.ssh/id_rsa Now try running ansible-playbook and ssh to...
Ansible
50,277,495
50
I am using ansible to deploy my app. I am cloning the app from github using the following: - name: Deploy site files from Github repository sudo: yes git: repo=git@github.com:xyz/abc.git dest=/home/{{deploy_user}}/{{app_name}} key_file=/home/ubuntu/.ssh/id_rsa accept_hostkey=yes force=yes I want to clone a specifi...
From the documentation: version What version of the repository to check out. This can be the full 40-character SHA-1 hash, the literal string HEAD, a branch name, or a tag name. (emphasis mine)
Ansible
33,450,240
50
I was wondering what is the correct syntax for when statements? I have this playbook: - set_fact: sh_vlan_id: "{{ output.response|map(attribute='vlan_id')|list|join(',') }}" - name: create vlans ios_config: provider: "{{ provider }}" parents: vlan {{ item.id }} lines: name {{ item.name }} with_ite...
The correct syntax is to not include Jinja delimiters ({{ ... }}) as indicated by the warning. Your condition doesn't work otherwise because the types are not compatible. You could try type coercion: when: 'item.id | string not in sh_vlan_id' See: https://jinja.palletsprojects.com/en/3.1.x/templates/#builtin-filters
Ansible
42,673,045
49
When deploying with ansible, There's 1 specific case where I need to strip a string of a trailing -p substring. The string somemachine-prod-p should become somemachine-prod only if the -p is at the end. The substring function I saw I can use with Jinja does not fulfill my needs as I need to strip the end of the string,...
Found it. If anyone wants to know: {% if name.endswith('-p') %} {{ name[:-2] }} {% else %} {{ name }} {% endif %}
Ansible
41,791,055
49
I have this error when I launch my playbook against the localhost host. TASK [setup] ******************************************************************* fatal: [127.0.0.1]: UNREACHABLE! => {"changed": false, "msg": "SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv,...
Ansible by default tries to connect through ssh. For localhost you should set the connection to local. You can define this when calling the playbook: ansible-playbook playbook.yml --connection=local Define it in your playbook: - hosts: local connection: local Or, preferable, define it as a host var just for localho...
Ansible
37,184,699
49
Forgive my newbie question, but I would like to execute three tasks and use two roles in a playbook, in the order: task role task role task This is what I have so far (task, role, task): --- - name: Task Role Task hosts: 127.0.0.1 connection: local gather_facts: false pre_tasks: - name: Do this task firs...
--- - name: Task Role Task hosts: 127.0.0.1 connection: local gather_facts: false tasks: - name: task1 foo: - name: include role1 include_role: name: myrole1 - name: task2 foo: - name: include role2 include_role: name: myrole2 see official docs
Ansible
30,763,709
49
I have 2 app servers with a loadbalancer in front of them and 1 database server in my system. I'm provisioning them using Ansible. App servers has Nginx + Passenger and running for a Rails app. Will use capistrano for deployment but I have an issue about ssh keys. My git repo is in another server and I have to generat...
This does the trick for me, it collects the public ssh keys on the nodes and distributes it over all the nodes. This way they can communicate with each other. - hosts: controllers gather_facts: false remote_user: root tasks: - name: fetch all public ssh keys shell: cat ~/.ssh/id_rsa.pub register: ...
Ansible
25,629,933
49
Recently I'm looking at Ansible and want to use it in projects. And also there's another tool Rundeck can be used to do all kinds of Operations works. I have experience with neither tool and this is my current understanding about them: Similar points Both tools are agent-less and use SSH to execute commands on remote ...
TL;DR - given your environment of Jenkins for CI/CD I'd recommend using just Ansible. You've spotted that there is sizeable cross-over between Ansible & Rundeck, so it's probably best to concentrate on where each product focuses, it's style and use. Focus I believe Rundeck's focus is in enabling sysadmins to build a (w...
Ansible
31,152,102
48
I would like to set an ansible variable to some default value but only if the variable is undefined. Otherwise I would like to keep it unchanged. I tried these two approaches and both of them produce recursive loop: namespace: "{{namespace|default(default_namespace)}}" namespace: "{% if namespace is defined %}{{namespa...
It seems like you are taking a wrong approach. Take a look at the Ansible documentation concerning variable precedence. It is a built-in feature of Ansible to use the default variable if the variable is not defined. In Ansible 2.x the variable precedence starts like this: role defaults inventory vars So if you want t...
Ansible
35,083,756
48
Background My question seems simple, but it gets more complex really fast. Basically, I got really tired of maintaining my servers manually (screams in background) and I decided it was time to find a way to make being a server admin much more liveable. That's when I found Ansible. Great huh? Sure beats making bash scri...
You may find it useful to read the Hosts and Users section on Ansible's documentation site: http://docs.ansible.com/playbooks_intro.html#hosts-and-users In summary, ansible will run all commands in a playbook as the user specified in the remote_user variable (assuming you're using ansible >= 1.4, user before that). You...
Ansible
21,670,747
48
In my playbook, I have this: #More things - include: deploy_new.yml vars: service_type: "{{ expose_service == 'true' | ternary('NodePort', 'ClusterIP') }}" when: service_up|failed When expose_service is true, I want service_type to be set to NodePort, and ClusterIP otherwise. However, service_type is set to ...
Solved! service_type: "{{ 'NodePort' if expose_service == 'true' else 'ClusterIP' }}"
Ansible
37,160,668
47
I am running an Ansible play and would like to list all the hosts targeted by it. Ansible docs mentions that this is possible, but their method doesn't seem to work with a complex targeted group (targeting like hosts: web_servers:&data_center_primary) I'm sure this is doable, but cant seem to find any further document...
You are looking for 'play_hosts' variable --- - hosts: all tasks: - name: Create a group of all hosts by app_type group_by: key={{app_type}} - debug: msg="groups={{groups}}" run_once: true - hosts: web:&some_other_group tasks: - debug: msg="play_hosts={{play_hosts}}" run_once: true ...
Ansible
28,709,501
47