Response
stringlengths
15
2k
Instruction
stringlengths
37
2k
Prompt
stringlengths
14
160
Without more of your code, I can't tell for sure, but I have the feeling that you are redirecting to a page with theX-XSS-Protection: 0header set on theredirectionHTTP reply.If I understand the interpretation ofX-XSS-Protectioncorrectly, you will need this header set correctly on the page you are actually redirectedto.Caveat:X-XSS-Protectionis not a standard header. That said, I think Safari supports it.ShareFollowansweredMar 30, 2013 at 0:44bricebrice24.7k77 gold badges7979 silver badges9696 bronze badges1Yes, this also came to my mind tonight. So I somehow need to tell the server this is an "after POST" request, so it can send the header. FF does not throw this error.–closeMar 30, 2013 at 8:57Add a comment|
After submitting a form with a Vimeo video link, the video is not showing and Safari returns:Refused to execute a JavaScript script. Source code of script found within request.The video does show up after a refresh. This has been discussedbefore. Kendall Hopkins' solution works perfectly when I add this line in my .htaccess file:Header set X-XSS-Protection 0But obviously I prefer adding the header only once: after submitting the form. Unfortunately this doesn't work:header("X-XSS-Protection: 0"); header($redirect);Any idea what I am doing wrong?
Header 'X-XSS-Protection: 0' not preventing error
Something is wrong with your secret. Are you trying to store binary value or null byte in your secret?Please take a look:https://github.com/kubernetes/kubernetes/issues/89906
My Yaml file looks like thisapiVersion: apps/v1 kind: Deployment metadata: name: mongodb-deployment labels: app: mongodb spec: replicas: 1 selector: matchLabels: app: mongodb template: metadata: labels: app: mongodb spec: containers: - name: mongodb image: mongo ports: - name: mongodbport containerPort: 27017 protocol: TCP env: - name: MONGO_INITDB_ROOT_USERNAME valueFrom: secretKeyRef: name: mongodb-secret key: mongo-root-username - name: MONGO_INITDB_ROOT_PASSWORD valueFrom: secretKeyRef: name: mongodb-secret key: mongo-root-passwordMy secret yaml fileapiVersion: v1 kind: Secret metadata: name: mongodb-secret type: opaque data: mongo-root-username: JwB2AG8AbABoAGEAcgBkACcA mongo-root-password: JwBEAGgAYQBuAHUAcwBoACcAError image:Description of error could be found hereThere is also a reference for DB credentials if you observe ,if that's needed to debug then I would love to provide. Thanks in advance !
Why am I getting tis OCI runtime error even though deployment is created
I found a solution. It's described here. In kops 1.8.0-beta.1, master node requires you to tag the AWS volume with: KubernetesCluster: <clustername-here> So it's necessary to create EBS volume with that tag by using awscli: aws ec2 create-volume --size 10 --region eu-central-1 --availability-zone eu-central-1a --volume-type gp2 --tag-specifications 'ResourceType=volume,Tags=[{Key=KubernetesCluster,Value=<clustername-here>}]' or you can tag it by manually in EC2 -> Volumes -> Your volume -> Tags That's it. EDIT: The right cluster name can be found within EC2 instances tags which are part of cluster. Key is the same: KubernetesCluster.
I tested kubernetes deployment with EBS volume mounting on AWS cluster provisioned by kops. This is deployment yml file: apiVersion: extensions/v1beta1 kind: Deployment metadata: name: helloworld-deployment-volume spec: replicas: 1 template: metadata: labels: app: helloworld spec: containers: - name: k8s-demo image: wardviaene/k8s-demo ports: - name: nodejs-port containerPort: 3000 volumeMounts: - mountPath: /myvol name: myvolume volumes: - name: myvolume awsElasticBlockStore: volumeID: <volume_id> After kubectl create -f <path_to_this_yml>, I got the following message in pod description: Attach failed for volume "myvolume" : Error attaching EBS volume "XXX" to instance "YYY": "UnauthorizedOperation: You are not authorized to perform this operation. status code: 403 Looks like this is just a permission issue. Ok, I checked policy for node role IAM -> Roles -> nodes.<my_domain> and found that there where no actions which allow to manipulate volumes, there was only ec2:DescribeInstances action by default. So I added AttachVolume and DetachVolume actions: { "Sid": "kopsK8sEC2NodePerms", "Effect": "Allow", "Action": [ "ec2:DescribeInstances", "ec2:AttachVolume", "ec2:DetachVolume" ], "Resource": [ "*" ] }, And this didn't help. I'm still getting that error: kubectl create -f <path_to_this_yml>0 Am I missing something?
Kubernetes/kops: error attaching EBS volume to instance. You are not authorized to perform this operation. Error 403
my expose type is nodePort. modify the values.yaml file, "externalURL: https" change to "externalURL: http"before: externalURL:https://10.240.11.10:30002after: externalURL:http://10.240.11.10:30002and then reinstall the harbor
I am installed harbor v2.0.1 in kubernetes v1.18, now when I am login harbor, it give me this tips:{"errors":[{"code":"FORBIDDEN","message":"CSRF token invalid"}]}this is my traefik 2.2.1 ingress config(this is thedocsI am reference):spec: entryPoints: - web routes: - kind: Rule match: Host(`harbor-portal.dolphin.com`) && PathPrefix(`/c/`) services: - name: harbor-harbor-core port: 80 - kind: Rule match: Host(`harbor-portal.dolphin.com`) services: - name: harbor-harbor-portal port: 80I am check harbor core logs only show ping success message.Shoud I using https? I am learnging in local machine. Is https mandantory? I am searching from internet and find just a little resouce to talk aboout it.what should I do to make it work?I read the source code, and tried in harbor core pod like this:harbor [ /harbor ]$ curl --insecure -w '%{http_code}' -d 'principal=harbor&password=Harbor123456' http://localhost:8080/c/login {"errors":[{"code":"FORBIDDEN","message":"CSRF token invalid"}]}
403 forbidden when login in harbor 2.0.1 in kubernetes cluster
1 I assume that you are using Git for Windows client. In this case make sure that you are using the latest version. There was a relevant fix in Git for Windows 2.39.0(2): The Git Credential Manager version shipped with Git for Windows v2.39.0 could not always find its UI helper which was fixed by upgrading to a fixed version. And to answer your question: Which authentication method should I choose and how I push my GitHub repository? Choose the default method "Web browser". Normally, a web browser should open GitHub and prompt you to authenticate the client. It's more convenient than having to generate and enter your personal access token (PAT). Share Improve this answer Follow answered Jan 12, 2023 at 17:12 bahrepbahrep 30.2k1212 gold badges104104 silver badges152152 bronze badges Add a comment  | 
When I try to push my code to an existing GitHub repo, it shows the below error: Command: git push Result: warning: could not find UI helper 'GitHub.UI' Select an authentication method for 'https://github.com/': 1. Web browser (default) 2. Device code 3. Personal access token option (enter for default): Which authentication method should I choose and how I push my GitHub repository?
Can anyone solve this git and github problem?
I have figured it out how to do it! :DFirstPut in a PHP-generated directory for those without any index page:DirectoryIndex default.php index.php index.html /php_directory.phpThenjust password-protect thephp_directory.phpfile!AuthUserFile /full/path/here/.htpasswd AuthType Basic AuthName "Log in"Thank you for all your comments! (which helped me to get to this)
How can I password-protect directories that have noindexfile? I want only the index part to be password protected, not the files inside.For example:http://www.example.com/foo/ Password required http://www.example.com/foo/bar.html No password requiredI can make thoseforbiddenbyOptions -Indexesbut I don't want them to be forbidden, instead I want them to require a password.Is that possible? Thanks.
.htaccess password protect directories with no index file
API Gateway seems to be irrelevant to this discussion. If I understand your question, you're trying to make API requests from a Lambda function to a remote API server and you want those requests to originate from a known IP address so that you can whitelist that IP at the remote server.First thing I would say is don't use IP whitelisting; use authenticated API requests instead.If that's not possible then use VPC with an Internet Gateway (IGW). Create a NAT and an Elastic IP, launch the Lambda into a private subnet of that VPC, and route the subnet's non-local traffic to the NAT. Then whitelist the NAT's Elastic IP on the remote API server. Exampleshereandhere.I know that you said you "cannot put [...] Lambdas in a VPC", but if you don't then you have no control over the originating IP address.
I have provisioned an AWS API Gateway and created a Lambda function to connect to an external REST API. The API Gateway & Lambda is not in a VPC so the egress IP address is random. The challenge I have is the external REST API is behind a firewall, which requires the IP address or subnet of the Lambda to be whitelisted.I have looked at the AWS IP Address page (below), however there is no explicit mention of either API Gateway or Lambda.https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html#filter-json-fileHas anyone come across this before & found a resolution to it. For the purposes of this solution I cannot put the API Gateway & Lambdas in a VPC.Any help would be greatly appreciated!
Public IP address for AWS API Gateway & Lambda (no VPC)
You should not use certificate pinning for services/certificates which you don't own or control, because your app will be quickly broken when service update their certificate and you will have to *quickly* update your app on all clients. Moreover, you cannot rely on a specific issuer, because the owner may elect to change their SSL certificate provider.In your case, you should rely on general SSL certificate validation routine for such services.
I am writing an Android app that will make some http requests to external HTTPS restful resources -https://external_server/resources( I have no control of the external Servers )I am thinking to handle Certificate/Public Key Pinning for the external_server server.A question popup in my mind: What if the external_server changes the SSL certificate/public key? If the certificate/public key changed. I have to re-deploy my app?Any ideas? Thanks!
Should we handle Certificate/Public Key pinning for external https services?
So the thing is I was facing an issue because I couldn't able to produce the .pfx file from my machine using MMC, but DigiCert tool helped me to create the .pfx file from the .crt file I got from the Go Daddy. Instructions to create the file are on this linkhttps://www.digicert.com/kb/util/pfx-certificate-management-utility-import-export-instructions.htmLater I went to the MMC and to the intermediate certificate authority and I imported the .pfx file along with the password and the certificate got exported to the system and to the IIS and now it's visible in the IIS.
I am trying to install the SSL certificate on the IIS, I am following the exact step mentioned herehttps://pk.godaddy.com/help/manually-install-an-ssl-certificate-on-my-iis-10-server-27349.Steps I did:I purchased the SSL certificate from Go DaddyI configured that on Go Daddy by giving the domain nameSubmit the changes for getting the certificateAfter verification downloaded the certificateCreated .Cer file from the .crt fileImported the gd-g2_iis_intermediates.p7b in MMC under the intermediate certificate authorityCreate a request in IIS and import .Cer fileAfter refreshing that window, the certificate doesn't appearAm I doing something wrong in this?
Go Daddy SSL certificate disappear in IIS After Installing
At the end I used Redis as session store instead.gem 'redis-rails'and specify it in session store type:AppEx::Application.config.session_store :redis_store,I can then use Memcached as pure cache and clearing it without affecting user login status.This is also good because when using Memcached, users get kicked out when cache gets full. Now user sessions last much longer.
I use memcached/dalli for caching purposes in Rails. I also usedalli_storeas my session store.The problem is, when I clear view cache, users will be logged out of my system automatically. I think this is because all data in memcached is cleared, so the session data are lost.Is there a way to avoid this?
Preserve session when clearing cache in memcached
0 Have a look at this answer. Fetch all rows in cassandra It's just a matter of adding code to export let's say every row to csv or some similar format that would be fine for you. You will also have to write script to load this data, but those are just simple inserts. Share Follow edited May 23, 2017 at 12:10 CommunityBot 111 silver badge answered Apr 1, 2017 at 21:42 Marko ŠvaljekMarko Švaljek 2,08111 gold badge1515 silver badges2626 bronze badges Add a comment  | 
Is there a way that i can backup a single table in Apache Cassandra with java code. i want to run such code once every week using a scheduler. Can some one share links to such resources, if there any?
Cassandra back using java code
1 It depends on your context, OS, version. For instance, you will see various proxy issue in k3d-io/k3d issue 209 this could be related to the way k3d creates the docker network. Indeed, k3d creates a custom docker network for each cluster and when this happens resolving is done through the docker daemon. The requests are actually forwarded to the DNS servers configured in your host's resolv.conf. But through a single DNS server (the embedded one of docker). This means that if your daemon.json is, like mine, not configured to provide extra DNS servers it defaults to 8.8.8.8 which does not resolve any company address for example. It would be useful to have a custom options to provide to k3d when it starts the cluster and specify the DNS servers there Which is why there is "v3/networking: --network flag to attach to existing networks", referring to Networking. Before that new flag: For those who have the problem, a simple fix is to mount your /etc/resolve.conf onto the cluster: k3d cluster create --volume /etc/resolv.conf:/etc/resolv.conf Share Improve this answer Follow answered Mar 1, 2022 at 7:34 VonCVonC 1.3m539539 gold badges4.6k4.6k silver badges5.4k5.4k bronze badges Add a comment  | 
With k3d, I am receiving a DNS error when the pod tries to access a URL over the internet. ERROR: getaddrinfo EAI_AGAIN DNS could not be resolved How can I get past this error?
K3d DNS issue with pod
You can send the data to elastic search using HTTP interface. Here is the code sourced fromhttps://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-request-signing.htmlfrom requests_aws4auth import AWS4Auth import boto3 host = '' # For example, my-test-domain.us-east-1.es.amazonaws.com region = '' # e.g. us-west-1 service = 'es' credentials = boto3.Session().get_credentials() awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token) es = Elasticsearch( hosts = [{'host': host, 'port': 443}], http_auth = awsauth, use_ssl = True, verify_certs = True, connection_class = RequestsHttpConnection ) document = { "title": "Moneyball", "director": "Bennett Miller", "year": "2011" } es.index(index="movies", doc_type="_doc", id="5", body=document) print(es.get(index="movies", doc_type="_doc", id="5"))EDITTo confirm whether data is pushed to the elastic cache under your index, you can try to do an HTTP GET by replacing the domain and index namesearch-my-domain.us-west-1.es.amazonaws.com/_search?q=movies
I have a lot of data that I want to send to aws elasticsearch. by looking at thehttps://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.htmlaws website it uses curl -Xput However I want to use python to do this therefore I've looked into boto3 documentation but cannot find a way to input data.https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/es.htmlI cannot see any method that inserts data.This seems very basic job. Any help?
input data to aws elasticsearch using boto3 or es library
SonarQube Community member mentioned "Indeed mongoose.model is not a case the JS engine considers for that rule." and they created a ticket to implement ithttps://github.com/SonarSource/SonarJS/issues/3646
I am having an issue with Sonar Cloud and SonarQube, and I was hoping someone might be able to help me troubleshoot it.Here is a brief description of the problem:I am trying to create a new document in Mongoose, but SonarQube is giving me the error “Replace User with a constructor function.” I have already defined the User object as a constructor function using the mongoose.model() function, but the error persists.Here is the relevant code snippet:const testData = { ...userData, profileImage: { picture } }; const testSonarQube = new User(testData);Here is some additional information that might be helpful in troubleshooting the issue:Sonar Cloud Scan Version: sonarcloud-scan:1.4.0Sonar Cloud Quality Gate Version:0.1.6Programming language: jsError message: “Replace User with a constructor function.” I would really appreciate any help or advice that anyone might be able to offer. Thank you in advance for your assistance!
Sonar Cloud: “Replace X with a constructor function.”
After doing some more digging around, I found the correct thrust api.thrust::replace_copy_ifIt is an overload of replace_copy_if which takes as input a 'stencil' which acts as the condition based on which value is copied.In my case, 'b' is the stencil.The following code works now.struct is_less_than_zero { __host__ __device__ bool operator()(float x) { return x < 0; } }; is_less_than_zero pred{}; thrust::replace_copy_if(thrust::device, c.begin(), c.end(), b.begin(), a.begin(), pred(), 0);
I have a requirement where I want to parallelize the following using CUDA thrust.std::vector<float> a, b, c; // size of each is (size.x * size.y * size.z), kind of a 3D array.What I am trying to do is thisa[i] = 0 if b[i] < 0 a[i] = c[i] if b[i] > 0This is the host code.for (int i = 0; i < size.x; i++) for (int j = 0; j < size.y; j++) for (int z = 0; z < size.z; z++) { a.data[get_idx(i, j, z)] = (b.data[get_idx(i, j, z)] < 0) ? (0) : (1 * c.data[get_idx(i, j, z)]); }get_idx()just converts the loop indices to array indices.What I want is an equivalent thrust::api that does this. I have the thrust::device_vector ready with the values of the corresponding a, b, c cudaCopied to the host.thrust::device_vector<float> dev_a, dev_b, dev_c;What I have tried is to usethrust::for_eachbut I am unable to find a way to assigndev_c[i]todev_a[i].I would love a nudge in the right direction, maybe which thrust:api is the most suitable. Thanks in advance.
CUDA Thrust - Selective copy or replace with constant value
2 This is the only way I got it to work: by specifying the acme.domains like this [docker] endpoint = "unix:///var/run/docker.sock" watch = true exposedbydefault = false [entrypoints.traefik] address=":8080" [api] dashboard = true entryPoint = "traefik" defaultEntryPoints = ["http", "https"] [entryPoints] [entryPoints.http] address = ":80" [entryPoints.https] address = ":443" [entryPoints.https.tls] [acme] email = "[email protected]" storage = "acme.json" entryPoint = "https" acmeLogging = true [acme.httpChallenge] entryPoint = "http" [[acme.domains]] main = "domain1.com" sans = ["www.domain1.com","other.domain1.com"] [[acme.domains]] main = "domain2.com" sans = ["www.domain2.com","other.domain2.com"] Share Follow answered Mar 28, 2018 at 12:37 Jonas LewinJonas Lewin 30555 silver badges1212 bronze badges 2 2 Is there a way to do this without knowing the subdomains in advance? – aliciahsteen Mar 30, 2018 at 12:08 let's encrypt support wildcards cert now, and traefik config here – Narro Mar 30, 2020 at 9:02 Add a comment  | 
When using the docker backend for traefik, lets encrypt certs are only generated for the main domain but not for any subdomains. I have followed this guide: Docker and Lets Encrypt. The main domain has certs from lets encrypt. When running a docker container with labels no certificate is generated. Docker version = 17.10, Traefik version = traefik:1.5 Here is my traefik.toml configuration: defaultEntryPoints = ["http", "https"] [web] address = ":8080" [entryPoints] [entryPoints.http] address = ":80" [entryPoints.http.redirect] entryPoint = "https" [entryPoints.https] address = ":443" [entryPoints.https.tls] [acme] email = "[email protected]" storage = "acme.json" entryPoint = "https" [acme.httpChallenge] entryPoint = "http" OnHostRule = true [docker] endpoint = "unix:///var/run/docker.sock" domain = "example.com" watch = true exposedbydefault = false and here are the tags I am using: "traefik.backend": "test", "traefik.docker.network": "proxy", "traefik.enable": "true", "traefik.frontend.rule": "Host:test.example.com", "traefik.port": "8000" The certificate on example.com is: Issued to: example.com Issued by: Lets Encrypt Authority X3 and the certificate on test.example.com is: Issued to: TRAEFIK DEFAULT CERT Issued by: TRAEFIK DEFAULT CERT Does anyone know what I am doing wrong?
Traefik is not creating certs for subdomains using the docker backend
This is how I upload images to S3:CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider( context.getApplicationContext(), YOUR_IDENTITY_POOL_ID, Regions.US_EAST_1); AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider); TransferUtility transferUtility = new TransferUtility(s3Client, context. getApplicationContext()); TransferObserver observer = transferUtility.upload( MY_BUCKET, // The S3 bucket to upload to OBJECT_KEY, // The key for the uploaded object FILE_TO_UPLOAD // The location of the file to be uploaded );Have this in your manifest file:<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <service android:name= "com.amazonaws.mobileconnectors.s3.transferutility.TransferService" android:enabled="true" />Information source hereI made the folder in S3 bucket public and saved the file link in dynamoDB like this: "https://mybucket.s3.amazonaws.com/myfolder/myimage.jpg"-ShareFolloweditedFeb 18, 2016 at 13:03answeredFeb 18, 2016 at 12:13S bruceS bruce1,51433 gold badges1616 silver badges2424 bronze badgesAdd a comment|
How can I save image to AWS S3 bucket and then retrieve the image public url and save the url into dynamodb alongside other user input data without the user leaving the activity or fragment? Can all these be achieved at once? Any sample code example will help a lot. Thanks!!
How to upload image to AWS S3 and get the image file's S3 bucket url and save to dynamodb all at once - Android
I fixed it by temporarily setting opcache.optimization_level=0 in php.ini. Still according to this post, it's a known bug which should be fixed in PHP 8.0.1
I use the guzzlehttp/guzzle package in Laravel 8. After upgrading to PHP 8, I get: Symfony\Component\ErrorHandler\Error\FatalError: Invalid opcode 117/2/0. in file ../vendor/defuse/php-encryption/src/Core.php on line 412 nginx config: server { listen 80; root /var/www/finex_production/public/; index index.php; server_name ff.loc; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.0-fpm.sock; } client_max_body_size 256M; fastcgi_read_timeout 900; } PHP 7.4 is removed. If I call opcache_reset (); before, I don't get error.
Why is the opcache not flushed?
Invoking offloading compilation (which for GCC happens at link time) with-foffload-options=nvptx-none=-march=sm_53should get you what you desire -- at least for your user code.If you also need any potential GCC/nvptx runtime libraries built forsm_53, indeed that is a GCC build-time configuration; seehttps://gcc.gnu.org/install/specific.html#nvptx-x-none:The--with-archoption may be specified to override the default value for the-marchoption, and to also build corresponding target libraries. The default is--with-arch=sm_30.For example, if--with-arch=sm_70is specified,-march=sm_30and-march=sm_70target libraries are built, and code generation defaults to-march=sm_70.(Maybe you don't actually need the latter, depending on what exactly you're doing.)
Using the GCC compiler and OpenMP programming, I’m now working on a project that offloads data to an Nvidia GPU. I needed some help in figuring out an issue . The default setup uses a virtual GPU that emulates the Kepler architecture (compute capability 3.1) rather than the real GPU being utilised (Maxwell architecture, compute capability 5.3), which results in lower GPU utilisation. The production of the assembly code includes ways for overriding the default GCC configuration using “-march” and the PTX ISA version, “-mptx,” but none of these really change the setting, as can be seen from the generated assembly code. Does altering the default configuration in building GCC need any special GCC build configuration? Or anything else except this that I ought to be doing. If any of you have worked in a similar setting, please do let me know.I am getting this in the preamble of the generated assembly code .version 6.0 .target sm_30 .address_space 63whereas i require .target to sm_53
How should i ovverride the GCC runtime compiler options for specific GPU
That wasdiscussed before, and that thread references the documentation "Checkout multiple repos (private)"${{ github.token }}is scoped to the current repository, so if you want to checkout a different repository that is private you will need to provide your ownPAT.- name: Checkout uses: actions/checkout@v3 with: path: main - name: Checkout private tools uses: actions/checkout@v3 with: repository: my-org/my-private-tools token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT path: my-toolsSo as long as you can provide a token of an account which has read access to each of those target repository, you should be able to clone them.
In B repo, I have to clone other repos in same organization.like, in B's action I want to clone A/C/D/E... and other repos dynamically. I don't want to add each other private repo's PAT, because all repos are in same organization so I just want to use global organization secret.I tried this:- name: Use environment variables if: github.event.pull_request.merged env: SERVICE_NAME: ${{ env.SERVICE_NAME }} ENVIRONMENT: ${{ env.ENVIRONMENT }} VERSION: ${{ env.VERSION }} run: | echo "Service name: $SERVICE_NAME" echo "Environment: $ENVIRONMENT" echo "Version: $VERSION" - name: checkout deploy-metadata uses: actions/checkout@v3 with: ref: 'refs/heads/master' - name: clone deploying server uses: actions/checkout@v3 with: repository: private-repo/${{ env.SERVICE_NAME }} ref: v${{ env.VERSION }} token: ${{ secrets.GITHUB_TOKEN }}but this doesn't work. How to clone other private repo in same organization without using each repo's PAT?
How do I clone A repo in B repo github actions if two repo is in same organization, not using PAT?
There is no mechanism to get this data. operator new just allocates raw memory given a size, and only the new operator call knows the type to construct the object into the allocated memory.
Is there a way to get type of object being allocated in operator new? What I mean is: void* BaseClass::operator new(size_t size) { void* result = ::operator new(size); //Get type of object that's being allocated return result; }
Get type of object being allocated in operator new
AWS binaries won't work on docker images based on Alpine because they are compiling them against glibc. Two solutions: build it from ubuntu:latest Use this Dockerfile which adds glibc and then removes some stuff FROM alpine:3.11 ENV GLIBC_VER=2.31-r0 RUN apk --no-cache add \ binutils \ curl \ && curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \ && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \ && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \ && apk add --no-cache \ glibc-${GLIBC_VER}.apk \ glibc-bin-${GLIBC_VER}.apk \ && curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \ && unzip awscliv2.zip \ && aws/install \ && rm -rf \ awscliv2.zip \ aws \ /usr/local/aws-cli/v2/*/dist/aws_completer \ /usr/local/aws-cli/v2/*/dist/awscli/data/ac.index \ /usr/local/aws-cli/v2/*/dist/awscli/examples \ && apk --no-cache del \ binutils \ curl \ && rm glibc-${GLIBC_VER}.apk \ && rm glibc-bin-${GLIBC_VER}.apk \ && rm -rf /var/cache/apk/* RUN apk add docker RUN aws --version && docker --version
Hi I'm struggling creating a Docker image with aws-cli v2 and Docker, based on Alpine:3.11 I'm using the following commands: FROM docker:stable #docker is based on Alpine RUN apk add curl && \ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ unzip awscliv2.zip && \ ./aws/install RUN aws --version && docker -v I'm obtaining an output like this: Step 6/6 : RUN aws --version && docker -v ---> Running in 5015c32e62fe /bin/sh: aws: Permission denied The command '/bin/sh -c aws --version && docker -v' returned a non-zero code: 127 This is a strange behavior.
Docker image with aws-cli v2 and dind, based on Alpine:3.11
After using GPU for some time can I use the saved weights to train my model using TPU?Yes, if you saved your GPU-trained model with, saytorch.save(model.save_dict(), 'model.pt')you can load it again for use on a TPU (usinghttps://github.com/pytorch/xla) in a separate program run withimport torch_xla.utils.serialization as xser model.load_state_dict(xser.load('model.pt'))
After using a GPU for some to train a PyTorch model, can I use the saved weights to continue training my model on a TPU?
Are PyTorch-trained models transferable between GPUs and TPUs?
You may be able to implement this using GitHub's API.You can retrieve the content of a file given the path:https://developer.github.com/v3/repos/contents/#get-contentsThis method returns the contents of a file or directory in a repository.GET /repos/:owner/:repo/contents/:pathFiles and symlinks support a custom media type for retrieving the raw content or rendered HTML (when supported). All content types support a custom media type to ensure the content is returned in a consistent object format.And you can also update the content at a given path:https://developer.github.com/v3/repos/contents/#update-a-fileThis method updates a file in a repositoryPUT /repos/:owner/:repo/contents/:pathYou can also create new files, or delete files.https://developer.github.com/v3/repos/contents/#create-a-filehttps://developer.github.com/v3/repos/contents/#delete-a-fileThe API is extensive - you can find much more in the documentation.
Say I have a largish repo on GitHub, and I'm pushing from a computer with a very small amount of space. I'd like to push files one by one without having to keep every file from the remote. If I wanted to edit a file from the remote, I'd download it, make my changes, and then push back up to the remote. Is there any way to do this?I want to do thisprogrammaticallyfor a web service.
Git without complete local copy
When operating in-cluster you wantload_incluster_config()instead.
I am trying to get kubernetes api server from a pod.Here is my pod configurationapiVersion: batch/v1beta1 kind: CronJob metadata: name: test spec: schedule: "*/5 * * * *" jobTemplate: spec: template: spec: containers: - name: test image: test:v5 env: imagePullPolicy: IfNotPresent command: ['python3'] args: ['test.py'] restartPolicy: OnFailureAnd here is my kubernetes-client python code inside test.pyfrom kubernetes import client, config # Configs can be set in Configuration class directly or using helper utility config.load_kube_config() v1 = client.CoreV1Api() print("Listing pods with their IPs:") ret = v1.list_pod_for_all_namespaces(watch=False) for i in ret.items: print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))But i am getting this error:kubernetes.config.config_exception.ConfigException: Invalid kube-config file. No configuration found.
Invalid kube-config file. No configuration found when i use kubernetes client python in pod
You may simply use client-based caching withcache_control. Like:@cache_control(max_age=60 * 5) def view(request):
So I am using view based cache in django as I have some views that are not really suitable for caching and others that really are. However, in some of these views that I cache the output will be different for different users. Is there a way to have a view based cache separate for different users? The @vary_on_cookie decorator looked like exactly what I needed but it doesn't seem to work for view based cache's?At the moment around my view I have:@vary_on_cookie @cache_page(60 * 5) def view(request):If you log in as anonmymous you can see what was cache's by a logged in user.Any ideas? I know I could probably use the low level cache for this type of problem but I'm surprised if there wasn't an easier django way of doing it, seems like it would be a common problem.ThanksTom
Django view based cache with authed users
After installingDiffUtils for Windowson my local machine and restarting the machine everything works.
I have a problem using Kubectl on Windows:C:\> kubectl diff -f app.yml error: executable file not found in %PATH%Kubernetes is installed with the Docker Desktop. The same error comes independent of the file, I'm using as an argument (even if the .yml file doesn't contain anything).Version:C:\> kubectl version Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"windows/amd64"} Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:16Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
kubectl diff on windows returns an error: executable file not found in PATH
The idea of the freelist is to reduce the amount of dynamic memory allocations, by reusing object instances that have already been created. It works like this: When the first request is made the freelist is empty, therefore a new structures will be allocated on the heap. When these are no longer required they are put in the freelist for reuse. If you wouldn't have the freelist then the next request would need to create new Request/Response structures on the heap, which might be costly to do over-and-over again. With the freelist this is avoided, as the next request can simply reuse the already allocated (and parked) objects. I guess you are confused about this line: *req = Request{} Opposed to the case where the freelist is empty and a new object is created on the heap with req = new(Request), this does not allocate an object on the heap. It instead just resets the already allocated object (which was dequed from the freelist) to it's default state, by copying the default values. You could decompose the line into the following: r := Request{} // Create a request with default content on stack (not heap!) *req = r // Copy all fields from default request to req Whatever path is taken in getRequest(), it always returns a default initialized request object - with no leftovers from the previous request.
RPC server in net/rpc package holds two free lists for Request struct and Response struct. Request struct maintains this list via its next field. // Server represents an RPC Server. type Server struct { // ... freeReq *Request // header node of Request free list freeResp *Response // header node of Response free list } type Request struct { ServiceMethod string // format: "Service.Method" Seq uint64 // sequence number chosen by client next *Request // for free list in Server } The free list in rpc server seems to be a object pool. When handling rpc request, server calls getRequest to get a request instance from free list. After handling request, server calls freeRequest to put request instance back to free list. func (server *Server) getRequest() *Request { server.reqLock.Lock() req := server.freeReq if req == nil { req = new(Request) // free list is empty } else { server.freeReq = req.next // free list isn't empty *req = Request{} // Why not reuse instance directly? } server.reqLock.Unlock() return req } func (server *Server) freeRequest(req *Request) { server.reqLock.Lock() req.next = server.freeReq server.freeReq = req server.reqLock.Unlock() } I'm confused about the getRequest function. When free list is empty, it creates a new instance as expected. When free list isn't empty, it executes *req = Request{}. I think Response0 also creates a new insance. So what's the point of holding this free list? In addition, I wrote a demo to show the effect of the Response1 format statement. Response2 The output is: Response3 So statement Response4 doesn't change the address of pointer, but it does change the content.
golang: Why not the free list in rpc server reuse instance directly
The link provided by tbicr is in the wrong mime-type (text/plain) so the css will not load in flask.This link works better:http://bootstrapdocs.com/v1.4.0/bootstrap.cssand seems pretty permanent - at least for trying out legacy code before puting in the effort to update bootstrap.ShareFollowansweredMar 14, 2014 at 22:23FvDFvD3,74711 gold badge3737 silver badges5353 bronze badgesAdd a comment|
ive been developing on Flask and the css i am currently using is fromhttp://twitter.github.com/bootstrap/1.4.0/bootstrap.cssbut the site seems to be down, does anyone know where i can download this filethanks
Twitter bootstrap css down
The status that you are describing is weird: if you have deleted "someModule" from project A and managed to analyze successfully this project in SonarQube, then it should not show up in the UI any longer and you should be able to analyze it within project B.But as you can see this module in 'Project Configuration > Update Key', then you might have a workaround:Update the key of that module in project A (just append "-off" to the key for instance)Run an analysis of project B with "someModule": this should work
I use SonarQube to analyze two Maven projects A and B with several modules each (only one displayed here):projectA `- someModule projectBSince I moved someModule from project A into project B, I get an error like this during the analysis:Module "myGroupId:someModule" is already part of project "myGroupId:projectA"Project A clearly does not contain 'someModule' anymore. It doesn't even show up as a component in the Sonar GUI after a new analysis, however it's still listed under 'Project Configuration > Update Key'.How is it possible to delete such an obsolete component without deleting the entire project?As a work-around I now renamed the key 'projectA:someModule' to 'projectA:someModuleThatShouldNotExist', but I hope someone can suggest a better solution...
Why are deleted Maven modules not disappearing from SonarQube?
Since Oct. 2019,Nat Friedman(CEO of GitHub)declares that feature available(And, see below, since Feb. 2020, multi-lines comment reference is possible)🔥Multi-line comments are here!Click and drag to comment on multiple lines in a pull request diff. ✨These little quality-of-life improvements are at the heart of what we love doing at GitHub. 🥰Thanks to:John CaineMike SkalnikPat NakajimaMike ChlipalaJoel CalifaMatt ColyerMelanie GilmanNick Craverimmediately asks:Follow-up question: are there plans to support suggestions?It seems to apply to the last line at the moment:That would be, according to Nat, "Coming early next year".Update Feb. 2020: "A new interaction for multi-line pull request comments"To leave a comment referencing multiple lines, you can either:click on a line number in the diff view, hold Shift, click on a second line number and click the "+" button next to the second line number; orclick and hold to the right of a line number, drag and then release the mouse when you’ve reached the desired line.This wasannounced by Nat FriedmanShipping today on GitHub: multi-line suggestions!With, again,special thankstoMelanie Gilman,Pat Nakajima,Mike Chlipala,Joel Califa,John Caine,Matt Colyerand , andKelly Arwine.GitHub Changelogalso references this.Henryaddsan observationA smaller side effect, but I assume being able to share a multi-line diff in the PR is new too!Example:babel/babel PR 10511 diff-L261-L263But that wasavailable since July 2019
There is an option to comment on a range of lines in file on github, seeHow to refer to a specific line or range of lines in github?But is there similar option to comment on range of lines inside pull request?When I click on line, only single line is highlighted yellow and R### (e.g. R446) is appended to url, clicking another line with shift pressed doesn't do anything. I tried to change url to R446-450 but it didn't do anything. Changing it to #L450-458 also didn't do anything. Also even that single highlighted line doesn't seem to affect anything.Clicking blue plus that appears on hover creates comment window, but it only commenting on a single line.Commenting on single line results in thisComment on pull-request page shows only 4 lines above selected/commented line, but I'm interested in showing 7 lines, not 4
How to select/comment on a range of lines in github pull request?
I found this project that looks good as a solution for my case.https://containrrr.github.io/watchtower/
I'm trying to setup the deployment of docker images to Linux server (Debian 10). I looked over the internet to find an easy solution to deploy images from docker repository onto a server automatically. I know that Docker Hub has webhooks. Also, there is an option to use Kubernetes, but it seems to be a bit too much for a simple application running on one server. What I am looking for is a way for server to detect that docker image has been updated, so that it downloads it and runs the newest version.Currently, I have setup automatic build of docker images on Azure DevOps that are pushed to private repository on Docker Hub (I will most likely move to privately hosted Nexus repository). I am looking for suggestions on how to do it with relatively low complexity (e.g. should I use docker-compose for it or some sort of bash script on a server).The closest thing to what I am looking for is this solution:How to auto deploy Docker Image on own server with GitLab?I would like to know if this is the recommended way to do or are there any other, possibly easier ways to approach it.
How to automatically deploy and run docker images on server?
Good question. The rationale that I can think of is that there may be different APIs in the future that could be supported, for example,rbacv2.authorization.k8s.ioand you wouldn't like to restrict references and subjects to just one for compatibility reasons.My take on this is that it would be nice to have yet another optional global field forRoleBindingbesides 'subjects' called something like 'bindingApigroup'. Feel free to open anissue: kind/feature, sig/auth and/or sig/api-machinery.Also, there might be more rationale/details in thesig-authdesign proposals.
Why we need to write the apiGroup key in this definition again and again , if it is the same every time:kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: web-rw-deployment namespace: some-web-app-ns subjects: - kind: User name: "[email protected]" apiGroup: rbac.authorization.k8s.io - kind: Group name: "webdevs" apiGroup: rbac.authorization.k8s.io roleRef: kind: Role name: web-rw-deployment apiGroup: rbac.authorization.k8s.iothis looks so redudant , that is repeating for everythingif we need to write it , what are the other valuesif there are not other values for the field RBAC apiGroup , then k8s should assume that value automaticallyapiGroup: rbac.authorization.k8s.iothis makes the yaml too redundant , is there any way to work around this. can we just skip this key? OR can we declare this somewhere globally.
Kubernetes RBAC apiGroup field in RoleBinding and ClusterRoleBinding
The%{QUERY_STRING}is everything after the?, so your rules successfully block a URL like htis:http://domain.com/blah.php?../../../pathBut your URI won't be checked. You can check against both by amending your rule:RewriteCond %{QUERY_STRING} \.\./ [OR] RewriteCond %{REQUEST_URI} \.\./ RewriteRule .* - [F]ShareFollowansweredAug 25, 2012 at 15:10Jon LinJon Lin143k2929 gold badges221221 silver badges220220 bronze badges3Would{REQUEST_URI}include everthing after{HTTP_HOST}and before{QUERY_STRING}?http://mysite/../just takes me tohttp://mysite. Doesn't show forbidden.–Go3TeamAug 25, 2012 at 15:38@Go3Team Yes, in the above example,%{REQUEST_URI}would be/blah.php–Jon LinAug 25, 2012 at 15:38@Go3Team additionally you could replace both those conditions with just:RewriteCond %{THE_REQUEST} \.\./and that would cover both the URI and query strings–Jon LinAug 25, 2012 at 18:17Add a comment|
I recently had an RFI attack where the query string had a bunch of ../../../ and I'd like to modify .htaccess to prevent any ../ in the query string.I was trying this until I realized the period needed to be escaped:RewriteCond %{QUERY_STRING} ../ RewriteRule .* - [F]I then changed it to:RewriteCond %{QUERY_STRING} \.\./ RewriteRule .* - [F]But it still forbids any / in the query string.Also, If I have the rule in{REQUEST_URI}would that make the{QUERY_STRING}redundant?Thanks.EDIT:I have had success getting this to work by:RewriteCond %{QUERY_STRING} (\.\./)However,RewriteCond %{REQUEST_URI} \.\./orRewriteCond %{REQUEST_URI} (\.\./)does not. I've also tried/\.\./&(/\.\./)
.htaccess Escaping Periods
Generally speaking, batch size can be adjusted at any time without creating a problem. Each element of a batch is independent, but they are fed through the network together for efficiency reasons.Note that batch size does affect training quality, as the gradients from larger batches will average out and have less variance. But that is irrelevant when doing inference (actually using the model).You also asked what prevents you deploying a huge model on a small GPU, and the answer is simply performance. It is entirelypossibleto load part of a large model onto the GPU, run that part, load the next part, run it, and so on. You would need to balance the batch size and model part size, because if you only use a batch size of 1, the continual copying of model parameters will probably make it slower than running the whole model on the CPU.
Gonna ask a newbie question...If I finished training my model, or I am using trained model like YOLO. And I want to put the model on a robot that has a 6GB VRAM. In this case, do I need to concern about the batch size at all?I am trying to find out if models like YOLO will fit in my GPU. Thank you
Does Batch Size matter if I only care about deploying and not training?
No ! Kibana charts are generated on frontend usingelastic-charts.They were previously using D3.js for generating charts.For more insights you can refer :https://discuss.elastic.co/t/why-and-how-to-use-elastic-charts/298836ShareFolloweditedApr 8, 2022 at 3:24answeredMar 4, 2022 at 5:11SudarshanSudarshan72777 silver badges2525 bronze badges1somewhat helpful !–jackz_sparrowApr 8, 2022 at 3:28Add a comment|
I am new to kibana and I want to know how does kibana generates the visualization on dashboard ?i.e.Does it uses SSR for generating Graphics/Pie charts etc. ?Does it creates graphs on frontend using libraries like elastic-charts / charts.js /d3.js ?
Does kibana uses SSR?
Use the proxy pass directive. Example: server { listen 80; server_name source.com; location / { proxy_next_upstream error timeout invalid_header http_500; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host source.com; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://target.com/source/; } } There's more documentation on the nginx wiki here: http://wiki.nginx.org/HttpProxyModule#proxy_pass
I have a domain like so: http://source.com And I need to map it to a particular url from another domain on the same server: http://target.com/source Is this possible without redirecting the source? How do I specify this in a server directive in nginx? Thanks!
nginx: How do I map a domain to a path in another domain without redirects?
9 You could use MyGet's Build Services (that I helped co-found) for that and link your GitHub repository to your feed. This allows you to have each check-in being built and a package being pushed on your CI feed. From there, you could use the push upstream feature to push it to NuGet.org (or any other feed). Check this blog post for more information: http://blog.myget.org/post/2012/12/17/Add-packages-from-GitHub-BitBucket-and-CodePlex-using-MyGet-build-services.aspx Share Improve this answer Follow edited Sep 16, 2013 at 15:35 Eonasdan 7,63788 gold badges5757 silver badges8484 bronze badges answered Jan 6, 2013 at 9:28 Xavier DecosterXavier Decoster 14.7k55 gold badges3636 silver badges4646 bronze badges 3 What if the repo is a solution with multiple projects? How do I determine which project sould be packaged in the nuget (or even included in the build)? – Yngve B-Nilsen Sep 16, 2013 at 16:00 You could hook into our build services using any of the ways documented here: docs.myget.org/docs/reference/build-services-build.bat-examples – Xavier Decoster Sep 16, 2013 at 19:57 1 I managed to do it with the build-configuration for Release and a nuspec-file. Excellent service! :) Just what I needed – Yngve B-Nilsen Sep 17, 2013 at 5:58 Add a comment  | 
I have a Github repository that I'd like to use as a source for my nuget package. Currently, I push both repositories separately: 1. git push origin master 2. nuget pack and nuget push MyPackage.0.0.0.1.nupkg BUT I'd like to be able to simply call git push origin master Ideally, I'd use some kind of bridging/service hook that would up the nuget version and do the pushing automatically using the git source. Does anyone know of a good bridging mechanism for this kind of thing?
How can I properly integrate a git push with nuget?
It seems that the change is in github. Adding Sonarcloud GitHub app to the organization solved the problem. It is another check than the old one, so I had to update the branch protection rules as well.ShareFollowansweredFeb 9, 2019 at 13:00Árpád MagosányiÁrpád Magosányi1,41222 gold badges2222 silver badges3737 bronze badgesAdd a comment|
It seems that sonar no longer report for my pull requests. In october, it was working:https://github.com/edemo/PDEngine/pull/113That one was using 7.4.0, which is later than 7.2.0, for which some kind of deprecation was announced here:https://docs.sonarqube.org/latest/setup/upgrade-notes/Today it does not report:https://github.com/edemo/PDEngine/pull/118it uses 7.7.0, and no change in the build environment I am aware of. I have specifically checked that none of the files in the repo which have anything to do with sonar have any relevant changes.Where should I look for the problem's cause?
sonar does not report status on github pull request
2 DropBox does everything your asking. http://www.getdropbox.com/ Plus it's fully cross platform, Windows, Mac, Linux. Free up to 2GB. Share Improve this answer Follow answered Apr 20, 2009 at 5:33 Brian GianforcaroBrian Gianforcaro 26.8k1111 gold badges5858 silver badges7777 bronze badges Add a comment  | 
I'm working on some documents on a laptop which is sometimes offline (it runs winXP). I'd like to backup automatically the documents to a folder to a remote location so that it runs in the background. I want to edit the documents and forget about backuping and once online - have it all backuped to a remote location, or even better - to an svn server or something that supports versioning. I want something which is: 1. free 2. does not overload the network too much but only send the diff. 3. works 100% thanks in advance
sync automatic background offline
0 Launcher will always have lowest oom_score than the foreground Activity, because the launcher should not been closed ever. And the main reason behind this is launcher is the app/screen which get's launched (using ACTION_BOOT_COMPLETED intent) as first screen once device boots and also it's the screen where you go after everything is closed. Share Follow answered Aug 17, 2016 at 7:31 Shridutt KothariShridutt Kothari 7,35433 gold badges4343 silver badges6262 bronze badges 1 That's not true in my experience. I'm looking at the oom_scores of processes in my Nexus 5 with Marshmallow, and most foreground Activities have a lower oom_score than the launcher. Some, however, don't, until I kill the foreground process and restart it. – user1118764 Aug 17, 2016 at 7:58 Add a comment  | 
I'm reading into the out-of-memory (OOM) killer now, as well as how Android prioritizes processes (https://developer.android.com/guide/components/processes-and-threads.html#Lifecycle) It seems to be that foreground Activities should always have the lowest oom_score, and are hence always the last to be killed. However, I've come across cases where the launcher actually has a lower oom_score than the foreground Activity. Does anyone know why this behavior is so?
Does a foreground Activity always have the lowest OOM score?
If I were you, I would use plugin instead of implementing from zero. You can usethisplugin for multilingual wp site. This plugin provides you three types of url structure;?lang=en/en/foo/en.yoursite.comIf you want to use for custom site, you can use following rewrite rule;RewriteEngine On RewriteBase / RewriteRule ^(en|da)/(.*)$ /$2?language=$1 [QSA,L]I assume, you are usinglanguageparam for languageEdit:There is some bugs on qTranslate plugin. That bugs can be solvable with additional plugin calledqTranslate Slug. Do not forget to use this additional plugin, if you faced url pattern problems
I am building a Wordpress website with two language support English and Danish.I want to keep the language code stringenfor English anddafor Danish prepended in request uri.Like: (Currently this is working for me)http://example.com/daIf i visit post or page, it should be map like this: (This is not working, getting 404)http://example.com/da/post-name http://example.com/da/page-name http://example.com/da/post/is/too/longI have also triedWordpress Rewrite APIadd_rewrite_rule()(Rewrite rules currently i have)<?php add_action('init', function () { add_rewrite_rule( '^(da|en)/?', //Regex 'index.php?lang=$matches[1]', //request to 'top' //called earlier than wordpress rules ); });and alsoadd_rewrite_tag(), but i think Wordpress just provide anadd_rewrite_endpoint(and i don't need this at all).I think it may only be possible with htaccess%{QUERY_STRING}conditions? (Don't know).htaccess contents:<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPressEdit:I'm usingWP Native Dashboardfor translation on admin pages however on front i'm just using__()and_e()with.moand.pofiles and its working perfectly.P.S:This problem is not specific to Wordpress website, I also need this help with custom based websites in future. Provide me .htaccess rules/conditions if you can.
Keep the string prepended in request uri
CodeBuild nowprovides a cache featureyou can use to pre-load your dependencies.ShareFolloweditedDec 4, 2017 at 7:49answeredJul 5, 2017 at 16:39UnsignedUnsigned9,74844 gold badges4444 silver badges7474 bronze badgesAdd a comment|
Between 1 and 2 minutes of my AWS CodeBuilds are spent downloading dependencies from Maven Central.Short of building a pre-provisioned Docker container, is there any way to cache these between builds?
Is there any way to cache build dependencies using AWS CodeBuild?
The issue is that cron doesn't get your env. There are several ways of approaching this. Either running a bash script that includes your profile. Or a nice simple solution would be to include it with crontab. (change profile to whatever you are using)0 5 * * * . $HOME/.profile; /path/to/command/to/runcheck out thisthreadShareFolloweditedMay 23, 2017 at 12:16CommunityBot111 silver badgeansweredApr 29, 2016 at 13:18Shimon ToltsShimon Tolts1,6441414 silver badges1515 bronze badges6Thanks, I'm now trying that solution, the Home dir is set, the .profile was blank so I copied across .aws/config to .profile and am now waiting for the job to run–nullApr 29, 2016 at 13:24same error I'm afraid - this is the command: * * * * * . $HOME/.profile; /bin/script/script.sh >> /bin/script/cronlogs/cronscript.log 2>&1–nullApr 29, 2016 at 13:25although I notice that there mail message I receive is trying to use root@ip instead of my user, perhaps that's the issue–nullApr 29, 2016 at 13:26you should try to include $HOME/.bash_profile or $HOME/.bashrc depends on your system. or even /etc/profile.–Shimon ToltsApr 29, 2016 at 13:27so adding the lines in the was config (region, access key, secret, output) to the bash profile by exporting them I guess(?) should work?–nullApr 29, 2016 at 13:33|Show1more comment
I've created a linux box that has a very simple make bucket command : wass3 mb s3://bucketrunning this from the prompt works fine.I've run AWS configure as both the user I'm logged in as and sudo. The details are definitely correct as the above wouldn't create the bucket.The error message I'm getting from cron is:make_bucket failed: s3://cronbucket/ Unable to locate credentialsI've tried various things thus far with the crontab in trying to tell it where the credentials are, some of this is an amalgamation of other solutions which may be a cause of the issue.My crontab look like :AWS_CONFIG_FILE="/home/ec2-user/.aws/config" SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binx 0 0 * * * /usr/bin/env bash /opt/foo.sh &>> /tmp/foo.log * * * * * /usr/bin/uptime > /tmp/uptime * * * * * /bin/scripts/script.sh >> /bin/scripts/cronlogs/cronscript.log 2>&1initially I just had the two jobs that were making the bucket and then creating the uptime (as a sanity check), the rest of the crontab are solutions from other posts that do not seem to be working.Any advice is much appreciated, thank you.
Crontab cannot find AWS Credentials - linuxbox EC2
Our solution was to use PHP/MySQL to solve this. As normal, you should have the external domain/subdomain CNAME'd to your app, however as you will see, the CNAME entry doesn't need to be to the exact subdomain on the app. Next, you will build an area into your database where a user can tell you what external site they have CNAME'd from. At this point, you will perform most of your authentication on the website based on the HTTP host, either grabbing the subdomain and using it as a client, or checking if the HTTP host is in your list of CNAME's and then referencing the client from there.What the CNAME does is just point to a server location, so if you are using wildcards in your apache configuration, foo.myapp.com resolves to the same location as bar.myapp.com, but in the app can use the host to pull out the subdomain and find the client ("foo" and "bar"). When using a CNAME, like m.mywebsite.com --cnamed--> foo.myapp.com, the application no longer has that client information in the HTTP host, and as we mentioned, the apache wildcard setup (*.myapp.com) just tosses out the subdomain.. so because of this the client must tell us "I will be visiting from m.mywebsite.com, so make that a valid host name for my authentication as well."
I am having a bit of a struggle grasping how to use custom domains with my app. Its the common case of having an app that assigns users to subdomains, ex. user.theapp.com and they want to use a CNAME so m.theirsite.com resolves to the application. It seems that most services that do this require you to tell them what your custom domain is, and that just adding a CNAME record doesn't work. Steps:User creates an account.We tell them they can make a CNAME entry to yourstuff.theapp.com (which is the current location).This is my confusion. After 1&2 my custom domain still isnt working.. so once the client makes that CNAME record and provides us with "m.theirsite.com", what special magic do we do with it to make those sites "the same"?Thank you in advance.
Custom Subdomain with CNAME Problem
malloc does not guarantee returning physically contiguous memory yes It guarantees returning virtually contiguous memory yes Especially it is true when size > 4KB because 4KB is a size of page. ( On Linux systems). Being contiguous memory does not imply that it will also be page aligned. The allcated memory can start from any address in heap. So whatever OS uses the page size it does not affect the allocation nature of malloc.
I'm reading about virtual memory and my conclusions are the following: malloc(size); malloc does not guarantee to return physically contiguous memory. It guarantees to return virtually contiguous memory. Especially it is true when size > 4KB because 4KB is the size of page. (On Linux systems). Am I right or am I wrong? Please explain.
malloc does not guarantee returning physically contiguous memory
CoreOS has a read-only file system for a lot of critical parts of the OS.The way to solve it? Write to a non-read only part of the file system: /etc/kubernetes is read-write so you can put your SSL certs in/etc/kubernetes/ssl/for example and point to that location when looking up the certs.ShareFollowansweredJan 26, 2016 at 19:37MrEMrE20.2k1313 gold badges8888 silver badges107107 bronze badgesAdd a comment|
I have been followingthisguide to set up kubernetes HA cluster on AWS(CoreOS). Ideally kubelet should bring up api-server by reading the contents of /etc/kubernetes/manifests/kube-apiserver.yamlbutapi-service is not up, I trace using journalctl, it says cannot start container mkdir /etc/ssl: read-only file systemThe error is very much readable and understandable but how to resolve it ?
Creating kubernetes HA cluster on AWS
1 If you setup nginx by default http then you will get it port 80 or setup with ssl like https then it will set port 443. But if you set up port manually then you have to hit with external port in browser. your problem seems like you are using external port. so 1. you may use reverse proxy to use port 8000 but in backend port should be by 80/443 2. you can use soft firewall if your os have. Share Improve this answer Follow answered Sep 26, 2019 at 4:50 SaikatSaikat 1122 bronze badges 2 SSL certificate is not being added. I have used reverse proxy but that did not work. – Faiyaj Sep 26, 2019 at 5:11 reverse proxy might not properly set. you may see these links before applying: keycdn.com/support/nginx-reverse-proxy docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy dev.to/shameemreza/… serverfault.com/questions/242052/… digitalocean.com/community/questions/… – Saikat Sep 26, 2019 at 6:31 Add a comment  | 
I want to set 172.01.03.04:8000 to example.com and 172.01.03.04:9000 to subdomain.example.com Ubuntu_18.04 Nginx Laravel 5.5 Need_Help Advanced Thanks
How to set the domain name and subdomain name without port number for same ip address?
Your professor is correct - 2 GB of your virtual memory are kernel memory. This way, when a context switch occurs, these 2 GB can stay and only the other 2 need to be swapped. It helps performance. You can also see here an explanation by Microsoft, including explanations how to increase the user portion to 3 GB. By the way, the situation is different in 64-bit machines, where the virtual memory is much larger.
My professor said that regularly, we can only use about 2 GB out of 4 GB RAM because the other 2 GB is used by the OS. However, when running some tests, I see that with a 4 GB virtual memory space of a process, I can only allocate a maximum of just under 2 GB using VirtualAlloc() function. Why is that (I was expecting it to be about more than 3 GB)? As I know, the stack, data, and code segments only use a small amount of memory. One of my friend told me that the other 2 GB is used by OS just like the professor said. However, I think that the professor meant 2 GB of physical memory. It's not in the virtual memory of this process. Could anyone explain what happens here? Thanks. Some information: Physical memory: 4GB. Virtual memory: 4GB. OS: Windows 10.
Why can I only allocate 2 GB on a 4 GB virtual memory space?
Contrary to what theExceptionHandler#value()attribute indicatesClass<? extends Throwable>[] value() default {};and@ExceptionHandleris only meant to handleExceptionand its sub types.Spring usesExceptionHandlerExceptionResolverto resolve your annotated handlers, using the following methoddoResolveHandlerMethodException(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod, Exception exception)which as you can see only accepts anException.You cannot handleThrowableorErrortypes with@ExceptionHandlerwith this configuration.I would tell you to provide your ownHandlerExceptionResolverimplementation which does handleThrowableinstances, but you'd need to provide your ownDispatcherServlet(and most of the MVC stack) yourself sinceDispatcherServletdoes notcatchThrowableinstances at any place where you could make any significant difference.Update:Since 4.3, Spring MVC wraps a thrownThrowablevalue in aNestedServletExceptioninstance and exposes that to theExceptionHandlerExceptionResolver.
Ours is a Spring MVC based REST application. I am trying to use ExceptionHandler annotation to handle all errors and exceptions.I have@ExceptionHandler(Throwable.class) public @ResponseBody String handleErrors() { return "error"; }This works whenever there is an exception thrown and it doesn't work for any errors.I am using Spring 4.0. Is there any work-around?
Why @ExceptionHandler(value = Throwable.class) doesn't catch OutOfMemoryError? [duplicate]
Generally it doesn't. You have to work this out for yourself. If it really matters you may have to use JNI to get low level details about the system.Java on the other hand makes writing MT application easy by supporting it in the language from the start.
As per subject, if in C/C++ iseasyto find cache line size and deal with this issue whilst developing efficient MT code, how does Java VM deal with this?Cheers
How does Java VM deal with cache line and memory alignment in MT contexts?
The following solution solved my problem, when eventually Sourcetree loses git configuration.Try switch between system Git and Embedded in Sourcetree Preferences / GitSource:Atlassian Sourcetree For Mac Jira
I'm still new to sourcetree. Whenever I'm launching a project, I faced the following errors:When i select a project, it will show this error'git log' failed with code -1:'launch path not accessible"and'git status' failed with code -1:'launch path not accessible. When i tried to google it, i can't find any answers avaliable online.Error 1Error 2When i tried to clone a repository from a URL, I'm not able to clone it.Error 3Running on MacOS Catalina: version 10.15.7 Sourcetree: version 4.2.0 (246) Any help will be appreciated. Many thanks! :D
Unable to load sourcetree
In my case, GitHub is private repo and authentication is required to pull the charts. What I was doing? helm repo index CHART_NAME --url <Full URL to chart.tgz file> But helm repo add --username u_name --password token <name> https://github.com/raw/ORG/charts/master will add the helm repo, but helm install <name> won't use the same git token passed in previous step. How to fix it? helm package <CHART_NAME> -u -d .deploy helm repo index . In this case, index.yaml will contain the relative URL to chart not absolute url. Same auth tokens are used to fetch .tgz file as well while running helm install
I'm exploring various options to publish charts and referred How to add helm repo from an existing github project? to achieve it. But when I tried to install the chart, I got the error Error: file '/Users/my_home/Library/Caches/helm/repository/chart-1.0.0.tgz' does not appear to be a gzipped archive; got 'text/html; charset=utf-8' Tried chart-releaser to publish the chart to git. In this case also getting the same error. When I tried to do wget https://github.com/repo/charts/releases/download/app-1.0.0/chart-1.0.0.tgz content-type is text/html. What's going wrong in this case? How do I fix this issue?
Use git as helm repo throws "does not appear to be a gzipped archive; got 'text/html; charset=utf-8'"
To redirect/index.phpto/index.php?action=loginyou can use the following rule :RewriteEngine on RewriteCond %{QUERY_STRING} ^$ RewriteRule ^index\.php$ /index.php?action=login [L,R=301]The RewriteConditionRewriteCond %{QUERY_STRING} ^$checks to see if there is no query string in the old uri . Otherwise without the condition you will get a redirect loop error since both the old and the destination uri are identical.
I am trying to redirect my page from /index.php to /index?action=login but my .htaccess file is not working. I checked witha2enmod rewriteit returnedModule rewrite already enabledI wrote a simple expression to redirect from index.php to index. But this is even not workingRewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^index/$ /index.php [R=301,L]I can't understand the mistake I was doing thanks in advance
htaccess rewrite rules are not working
9 When running HEALTHCKECKS you can specify: --interval=DURATION (default 30s) --timeout=DURATION (default 30s) --retries=N (default 3) And the container can have three states: starting – Initial status when the container is still starting. healthy – When the command succeeds. unhealthy – When a single run of the HEALTHCHECK takes longer than the specified timeout. When this happens it will run retries and will be declared "unhealthy" if it still fails. When the check fails for a specified number of times in a row, the failed container will: stay in "unhealthy" state if it is in standaolne mode restart if it is in Swarm mode Otherwise it will exit with error code 0 which means it is considered "healthy". I hope it makes things more clear. Share Follow edited May 9, 2022 at 10:42 Franklin Piat 4,26133 gold badges3434 silver badges4646 bronze badges answered Jun 5, 2020 at 13:37 Wytrzymały WiktorWytrzymały Wiktor 12.4k55 gold badges2929 silver badges4242 bronze badges 2 1 This should be marked as the answer. Do you have any sources? For: > stay in "unhealthy" state if it is in standaolne mode – Marc Borni Jun 23, 2021 at 8:28 If it is in an "unhealthy" state, is the container down - can it respond to requests? – ryanwebjackson Sep 20, 2022 at 15:48 Add a comment  | 
The docker docs say what a HEALTHCHECK instruction is and how to check the health of a container. But I am not able to figure out what happens when healthcheck fails. Like will the container be restarted or stoped or any of these two as per user instruction. Further the example quoted is: HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost/ || exit 1 What is the exit 1 about?
What happens to a Docker Container when HEALTHCHECK fails
11 You can do this, now, with a bit of Italian-style plumbing. In newer versions of Docker, there is a GELF output driver, which you can configure to send the logs. Since logstash has a GELF input plugin, you can configure logstash to receive those same log messages, and do something useful with them. Another option, if you'd prefer to avoid the GELF translation round-trip, is to use logspout-logstash, a logstash output plugin for logspout, which reads log entries as they come out of Docker. Addendum: I've been active in this space since this answer was originally written, and have built mobystash as a more modern and manageable replacement for logspout-logstash, as well as syslogstash for taking syslog messages direct from the /dev/log socket and putting them in logstash. Share Improve this answer Follow edited Mar 20, 2019 at 20:29 answered Nov 12, 2015 at 0:49 womblewomble 12.2k55 gold badges5353 silver badges6767 bronze badges 2 1 It's important to notice that the GELF output driver only uses UDP (as of 20.04.2017) so packages might be lost if the logstash is on some other machine. – herm Apr 20, 2017 at 14:49 1 Also important to note that the Docker GELF driver is not supporting multiline messages, which is super annoying e.g. with Exception logging: github.com/moby/moby/issues/22920 – derFunk May 19, 2017 at 8:45 Add a comment  | 
I have an Nginx server running inside a Docker container. The access log and error logs are sent through STDOUT, in the Dockerfile : # forward request and error logs to docker log collector RUN ln -sf /dev/stdout /var/log/nginx/access.log RUN ln -sf /dev/stderr /var/log/nginx/error.log Logspout seems an elegant solution to send STDOUT of your container inside logstash (configured with a syslog input) input { syslog { type => syslog port => 5514 } } But logspout have no idea about the format of the log sent through STDOUT (Or am I missing something ?) So do I have to do something like : input { syslog { type => nginx-access port => 5514 } } But then what about nginx error log ? And what if I send php-fpm log through STDOUT too ? How does logspout manage this ? Another solution is to run rsyslog indose the container and send the collected logs to the input of logstatsh ... As you can see it is not really clear for me ... I would like to be able to send nginx and php-fpm logs to logstash so they can be interpreted as what they are ... but I don't find a "good practice" ... Can you help me please
Best way to send docker container logs to logstash
You can try this rule:RewriteRule ^([^/]+)/(Price_\d+)__(\d+.*)$ /$1/$2_2000_$3 [L,NC,R]
Can anyone tell me how to replacefirstdouble underscore('__') with a value like '_2000'.www.mysite.com/abc/Price_10000__10500__-- this should be changed towww.mysite.com/abc/Price_10000_2000_10500__Note that none of the data is static except 'Price_' in the URL.Thanks
Substitute missing parameter in Apache rewrite rules
0 I don't know if this will help, but it helped me to place the volume guid in single quotes, so if you wanted to backup to a target guid it would be as follows: wbadmin.exe start backup -BackupTarget:'\\?\Volume{fd4e0ba6-d375-4b48-820d-eeec7ac2024b}' -include:"C:\Users\administrator\Desktop\Exchange 2016" -quiet Surrounding all guid's with single quotes did the trick for me when trying to back up multiple partitions at once without letters Share Follow answered Feb 7, 2019 at 5:57 Matthew SeagleMatthew Seagle 133 bronze badges Add a comment  | 
How can I configure a backup job in a disk without letter using Windows Server Backup command line? I already tried this command: wbadmin.exe start backup -BackupTarget:\\?\Volume{fd4e0ba6-d375-4b48-820d-eeec7ac2024b} -include:"C:\Users\administrator\Desktop\Exchange 2016" -quiet This command is not recognized by powershell. The correct command is wbadmin.exe start backup -BackupTarget:E: -include:"C:\Users\administrator\Desktop\Exchange 2016" -quiet But I need make this backup in a disk without letter and I didn't found a proper command to make that. Has anyone had this problem?
Proper Command to make a Windows Server Backup without disk letter
I had the same issue where my local code repository was on a network share. To fix this I used the GIT Windows client to CLONE the repository on the network drive first. Than in VS2013 I selected the LOCAL option within Team Explorer.This error can happened if you don't launch VS2013 as admin.ShareFollowansweredJun 9, 2015 at 21:07dimontjodimontjo2122 bronze badgesAdd a comment|
im trying to pull the current branch of a project on github.When i click sync in Visual Studios Team explorer, I receive the following error:"An error occurred. Detailed message: Failed to inflate packfile"Any ideas on how I can fix this?Im using visual studio 2013 with update 4 by the way
Failed to inflate packfile Visual Studio Error
I don't think it's the DataGrid that is causing your out of memory exection, but rather your DataSet. We had this same problem where we had tens of thousands of records being populated into a treeview from a DataSet, resulting in slow load times. The reason is because the DataSet will load ALL of the data that is being queried, not just what is seen. There are two workarounds for this: create a just-in-time loader (using DataReader) that will retrieve your data as it is needed (of course, you then have the overhead of managing what data is or isn't local) or refine your DataSet query to reduce the number of records returned. I'm guessing the latter will be more appropriate for your current situation.
We use Excel for a number of ad-hoc pivots / reports. To get the data into Excel we have a general page with a simple DataGrid that we bind from a DataSet / DataTable. We "Import External Data" using this URL in Excel. Unfortunately we have a query that returns around 100 columns and 40k rows. The Application server only has 2GB of RAM and the used memory jumps up by 1 gig and then causes a System.OutOfMemoryException. I intend to rewrite the page that produces the DataGrid to manually create an HTML table by looping through a DataReader rather than loading it all into a DataTable. I also intend to put more memory into the server. My question is, how can I get this one spreadsheet to update right now? Is there any quick fix I can do to the DataGrid to temporarily let it work? I have already turned ViewState off for the DataGrid.
System.OutOfMemoryException importing Page with a single large DataGrid into Excel (Quick Fix)
1 No answer yet, but as I was struggling it might save some people some time as well. You cannot exec a shell within the image created that way as it is based on a distroless ubuntu. As of Spring Boot 3.0.x, the base image is this one : https://github.com/paketo-buildpacks/bionic-tiny-stack You have the info when you do docker inspect with the following line : "io.buildpacks.stack.homepage": "https://github.com/paketo-buildpacks/bionic-tiny-stack", If you want to change that, you have to change the base image used to build the native image. In your pom.xml in the <build><plugins> section : <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <image> <builder>paketobuildpacks/builder:full</builder> <env> <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE> </env> </image> </configuration> </plugin> Note the change from builder:tiny to builder:full. And then the docker exec will run fine. docker exec -it <your_container> /bin/bash Share Improve this answer Follow answered Aug 8, 2023 at 7:50 ChascaChasca 14511 silver badge99 bronze badges Add a comment  | 
I created the image following this: https://www.baeldung.com/spring-native-intro I started it via docker run image-name now I want to exec into it using docker exec -it containername bash(or sh , /bin/sh) all fails with: OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown (or with $PATH not found) running docker inspect image-name shows that "Cmd": null,
How to exec into a spring native image?
Actually you should usetypes.StrategicMergePatchTypeand remove leading ([) and trailing (]) brackets from patching string.Merge patch:With a JSON merge patch, if you want to update a list, you have to specify the entire new list. And the new list completely replaces the existing list.SourceStrategic merge patch:With a strategic merge patch, a list is either replaced or merged depending on its patch strategy. The patch strategy is specified by the value of thepatchStrategykey in a field tag in the Kubernetes source code. For example, theContainersfield ofPodSpecstruct has apatchStrategyofmerge:type PodSpec struct { ... Containers []Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name" ...`SourceN.B.kubectlby default uses strategic merge patch to patch Kubernetes resources.
Having trouble figuring out what is wrong. I have a remote kubernetes cluster up and have copied the config locally. I know it is correct because I have gotten other commands to work for me.The one I can't get to work is a deployment patch. My code:const namespace = "default" var clientset *kubernetes.Clientset func init() { kubeconfig := "/Users/$USER/go/k8s-api/config" config, err := clientcmd.BuildConfigFromFlags("", kubeconfig) if err != nil { log.Fatal(err) } // create the clientset clientset, err = kubernetes.NewForConfig(config) if err != nil { panic(err.Error()) } } func main() { deploymentsClient := clientset.ExtensionsV1beta1().Deployments("default") patch := []byte(`[{"spec":{"template":{"spec":{"containers":[{"name":"my-deploy-test","image":"$ORG/$REPO:my-deploy0.0.1"}]}}}}]`) res, err := deploymentsClient.Patch("my-deploy", types.JSONPatchType, patch) if err != nil { panic(err) } fmt.Println(res) }All I get back is:panic: the server rejected our request due to an error in our requestAny help appreciated, thanks!
Patching deployments via kubernetes/client-go
I would suggest reading theconditional caching sectionof the reference guide. Basically simply specify aunlessexpression to prevent the caching. (Theresultplaceholder is only available for theunlessstatement not theconditionstatement.@Cacheable("mycache", unless="#result.error") public ResponceBO getBigObject(String id) throws Exception { ... }Should do the trick.ShareFollowansweredJul 23, 2015 at 7:51M. DeinumM. Deinum119k2222 gold badges225225 silver badges231231 bronze badges5is it possible to check like :@Cacheable("mycache", unless="#result!=null && #result.error") ?–priliaJul 23, 2015 at 8:352If would be an or not an andunless=#result == null || #result.errorsomething like that, instead of||you could tryor.–M. DeinumJul 23, 2015 at 12:22@Deinum,Can we add Exception to the unless condition so that any exceptions/errors shouldn't be cached–PradeepJan 16, 2019 at 0:551Exceptions aren't cached so that wouldn't add anything.–M. DeinumJan 16, 2019 at 6:32what if it return rx.Single or rx.Observable?–sesDec 18, 2020 at 18:59Add a comment|
I am using spring caching, my question is:How can I control the caching in case the result is an error and the next request could be good?example:@Cacheable("mycache") public ResponceBO getBigObject(String id) throws Exception { boolean isError = false; *** load big object from other service, can be loaded with errors *** isError = true; if(error){ responceBO.setError(true); } return responceBO; }In case of an error I don't want to cache the object, what can I do instead?
Spring caching - do not cache in case of error
When we runkubectl version, we get information details for server and client.Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5+k3s1", GitCommit:"405bf79da97831749733ad99842da638c8ee4802", GitTreeState:"clean", BuildDate:"2021-12-18T00:43:30Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5+k3s1", GitCommit:"405bf79da97831749733ad99842da638c8ee4802", GitTreeState:"clean", BuildDate:"2021-12-18T00:43:30Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}Here,Server Versionrepresents version of Kubernetes control plane. Control plane includesapi-server,etcd, various controllers etc.Client Versionrepresents Kubectl tool's version. Kubectl is a client tool to interact with control plane.Kubectl can exist indepedent of Kubernetes cluster.According tokubectl docYou must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.23 client can communicate with v1.22, v1.23, and v1.24 control planes. Using the latest compatible version of kubectl helps avoid unforeseen issues.In your case, it seems your server version is far behind of client version.
I've read that Kubectl is the client version and that the Kubernetes API Server of the Kubernetes Cluster is the server version...but I still don't really understand this. Where is this client version? is it on the control plane? ..and do client and server versions actually both mean "kubectl" but in 2 different places. My client version says 1.23 and my Server version says 1.18.20...but when I dokubectl get nodesit says that the nodes are on 1.18.9 so basically what I think I'm asking is... do BOTH "client" and "server" versions both relate to the kubectl version?
Kubectl server and client versions
This happens if you try with a mix of xpack/commercial/non-open-source binaries of Elasticsearch and some nodes with the open-source binaries. Unfortunately Elasticsearch tries to "trick" you into using their non-open-source version nowadays and this causes many unintended non-open-source installations.A simple solution is to install the non-oss version everywhere, however you may not want to run the commercial version as you then need to adhere to the commercial license!In order to convert to the open-source license on all nodes you can do the following:You can set the following in /etc/elasticsearch/elasticsearch.yml and restart all nodes to disable some commercial features:xpack.security.enabled: false xpack.ml.enabled: falseThen you can change all nodes to the open-source binaries one by one in rolling fashion.See also the following similar discussions:https://discuss.elastic.co/t/elasticsearch-cluster-cant-join-new-node/126964https://discuss.elastic.co/t/adding-a-new-node-on-a-different-subnet/125377/2-https://github.com/codelibs/elasticsearch-module/issues/3https://discuss.elastic.co/t/transport-client-error-after-installing-x-pack-on-es-5-5-1/97021/4https://discuss.elastic.co/t/bulk-indexing-with-x-pack-exception/92086/5
We have a long running single node ELK cluster running (master/data). I have decided to add additional data node. However Im getting the below error on the data node30.X.XXX}{172.30.X.XXX:9300}{ml.enabled=true}], reason [RemoteTransportException[[master][172.30.X.XXX:9300][internal:discovery/zen/join]]; nested: IllegalStateException[failure when sending a validation request to node]; nested: RemoteTransportException[[data1][172.30.X.XXX:9300][internal:discovery/zen/join/validate]]; nested: IllegalArgumentException[Unknown NamedWriteable [org.elasticsearch.cluster.metadata.MetaData$Custom][licenses]]; ]Below are the config files on master and new data nodeMaster Node:cluster.name: my-application node.name: master node.master: true node.data: true path.data: /opt/elasticsearch network.host: ["172.30.X.XX1","localhost"] http.port: 9200 transport.tcp.port: 9300 discovery.zen.ping.unicast.hosts: ["172.30.X.XX1"] discovery.zen.minimum_master_nodes: 1Data1 Node:cluster.name: my-application node.name: data1 node.master: false node.data: true path.data: /opt/elasticsearch network.host: ["172.30.X.XX2","localhost"] http.port: 9200 transport.tcp.port: 9300 discovery.zen.ping.unicast.hosts: ["172.30.X.XX1"] discovery.zen.minimum_master_nodes: 1Tried pinging and checked telnet on 9200 and 9300 from master to data node and vice versa and it is working fineI have tried deleting the data from /var/lib/elasticsearch/nodes/0 and restarted the data1, it didnt work
Failed to send join request to master in Elasticsearch, Unknown NamedWriteable [org.elasticsearch.cluster.metadata.MetaData$Custom][licenses]]
Learn about.htaccessThere are a lot of generators for.htaccessand you can use one of them. The best thing to do is, using a.htaccessfile, create the paths this way:mywebsite.com/entry.php?title=My Title&content=This is my blogChange them to:mywebsite.com/My Title/This is my blogAnd the code for the same is:RewriteEngine On RewriteRule ^([^/]*)/([^/]*)\.html$ /entry.php?title=$1&content=$2 [L]Websites offering generators:.htaccess redirectMod Rewrite GeneratorSearch Engine Optimization Tools » mod_rewrite rewriterule generator
Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed11 years ago.Improve this questionI'm trying to create a blog ..and for every entry I have a template page called entry.php I create the pages by creating a link from my home page like thismywebsite.com/entry.php?title=My Title&content=This is my blogThis link is passed to entry.php and a page is generated on the fly based on the link i wrote but search engines wont index these.Do I really have to create a unique page for every entry I create?Do sites like youtube have individual pages for every single video or are they generated dynamically like im trying to do. If so how do the videos show up in search results?Ive heard something called .htaccess or sitemap.xml can be used for this I have no idea what these are though.
How can I get search engines to index dynamically generated pages [closed]
Yes. Just mount yourredis.confover the default with a volume:redis: image: redis volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf ports: - "6379"Alternatively, create a new image based on the redis image with your conf file copied in. Full instructions are at:https://registry.hub.docker.com/_/redis/However, the redis image does bind to0.0.0.0by default. To access it from the host, you need to use the port that Docker has mapped to the host for you which you find by usingdocker psor thedocker portcommand, you can then access it atlocalhost:32678where 32678 is the mapped port. Alternatively, you can specify a specific port to map to in thedocker-compose.yml.As you seem to be new to Docker, this might all make a bit more sense if you start by using raw Docker commands rather than starting with Compose.
My Redis container is defined as a standard image in mydocker_compose.yml:redis: image: redis ports: - "6379"I guess it's using standard settings like binding to Redis atlocalhost.I need to bind it to 0.0.0.0, is there any way to add a localredis.conffile to change the binding and letdocker-composeuse it?
Redis in docker-compose: any way to specify a redis.conf file?
Mike from Fabric here. We chatted over Fabric support as well, but to clarify for all. OOMs are detected on the server, but are processed in batch at the end of a current UTC day and will be visible in your Fabric Crashlytics' dashboard starting the next UTC day after our processing completes.
I've created OOM crashes by growing an infinitely large NSArray of NSStrings, and I've even tried calling exit(0) just to make it look like an OOM. While these things to have worked to terminate the app unexpectedly, I don't see any OOMs reported on Crashlytics and it doesn't call the delegate callback, crashlyticsDidDetectReportForLastExecution:, on the next run of the app. I'm running the app on a real device that is not connected to a simulator, and any other kind of crash/error it reports fine. Does anyone have any idea what the issue might be?
Crashlytics isn't reporting any foreground OOMs
For most Promtheus targets, metrics are computed at scrape time. Based onkube-state-metrics' github, it looks like Kubernetes' implementation is no different. This means that the metrics are not cached, but rather calculated each time that the Prometheus server scrapes the endpoint (or each time you visit /metrics in your browser)
From what I understand, kube-state-metrics keeps an in-memory cache of all the kubernetes events related to deployments, nodes and pods and more, and exposes them to/metricsfor Prometheus to scrape.How long does the kube-state-metrics keep these metrics in-memory? Is it indefinitely? Or does it internally clean the cache once a while?
For how long does kube-state-metrics keep the metrics in its memory?
If you just need the information contained in the config.yaml to be present in the pod from the time it is created, use a configMap instead.Create a configMap that contains all the data stored in the config.yaml and mount that into the correct path in the pod. This would not work for read/write, but works wonderfully for read-only dataShareFollowansweredMay 16, 2020 at 6:39Patrick WPatrick W4,70111 gold badge1313 silver badges2727 bronze badges3The problem on using a configMap is that my Config.yaml is not just a key / value config, ot has a slightly more complex structure, so I don't think I'm going to be able to create the configMap.–RodolfoMay 16, 2020 at 11:131You can put arbitrary content and even whole files into ConfigMap content (up to a modest-but-practical size limit).–David MazeMay 16, 2020 at 11:401Your 'key' in this case would be the name of the file and the value is the full content of said file–Patrick WMay 16, 2020 at 14:54Add a comment|
I'm writing akubectlconfiguration to start an image and copy a file to the container. I need the fileConfig.yamlin the/so/Config.yamlneeds to be a valid file. I need that file in the Pod before it starts, sokubectl cpdoes not work. I have theConfig2.yamlin my local folder, and I'm starting the pod like:kubectl apply -f pod.ymlHere follows my pod.yml file.apiVersion: v1 kind: Pod metadata: name: python spec: containers: - name: python image: mypython volumeMounts: - name: config mountPath: /Config.yaml volumes: - name: config hostPath: path: Config2.yaml type: FileIf I try to use like this it also fails:- name: config-yaml mountPath: / subPath: Config.yaml #readOnly: true
Mount / copy a file from host to Pod in kubernetes using minikube
There's really nothingwrongwith running a process every minute ... except the usual pitfalls [which I include with ways to mitigate]. I do want to say that a minute is a really really long time for a modern computer. If you are short of cycles, a few extra system calls per minute is thewrongplace to look.pitfall #1 is that something goes "wrong" with the script and for some reason it doesn't exit. Symptom: box crashes as it can't create anymore processes and/or open a file descriptor, etc.How to solve: make the script grab an exclusive lock to a file. You could write your pid to a file, but that's hacky. If you can't grab the exclusive lock, a previous version is running, so you should just exit.Here's the PHP interface to flock():PHP flock()pitfall #2: it really should be a daemon.If something needs to be "done all the time", maybe it should really be "done all the time". You can use the file locking recipe to make sure your script stays up, or you can use something like monit to start it. But you can also just insure it stays up by using cron, and file locking.Pitfall #3: you convert to a daemon, but there's a memory leak and the thing just keeps expanding up like the girl in Willie Wonka on too many blueberries. Symptom: OOM error, swapping, etc. This is PHP after all.Solution: exit after 1000 [or some #] iterations, and then use cron and the file locking model to start a new version [or monit or equivalent].
I have a php script designed to check a certain folder for xml files and then import the information from each file to a MySQL database.I would like to set up a cronjob to run every minute so that anytime new files are added they will almost instantly be imported without me having to manually ssh in and run the script.I have an if statement which checks if files exist and only runs the code if they do, otherwise 'No files' is echoed.I would like to know if there are any risks to having this run constantly, will excessive resources be taken up? etc
Risks of running a cronjob every minute
Memory request is the amount of memory that kubernetes holds for pod. If pod requests some amount of memory, there is a strong guarantee that it will get it. This is why you can't create pod1 with 1.5Gi and pod2 with 1.5Gi request on 2Gi node because if kubernetes would allow it and these pods start using this memory kubernetes won't be able to satisfy the requirements and this is unacceptable.This is why sum of all pod requests running an specific node cannot exceed this specific node's memory."But what happens If I try to start pod2 after that? [...] How k8s will rule this situation?"If you have only one node with 2Gi of memory then pod2 won't start. You would see that this pod is in Pending state, waiting for resources. If you have spare resources on different node then kubernetes would schedule pod2 to this node.Let me know if something is not clear and needs more explanation.ShareFolloweditedApr 5, 2021 at 20:06marc_s742k178178 gold badges1.4k1.4k silver badges1.5k1.5k bronze badgesansweredApr 9, 2020 at 8:15MattMatt7,81711 gold badge1313 silver badges2424 bronze badges0Add a comment|
I am trying understand memory requests in k8s. I have observed that when I set memory request for pod, e.g. nginx, equals 1Gi, it actually consume only 1Mi (I have checked it withkubectl top pods). My question. I have 2Gi RAM on node and set memory requests for pod1 and pod2 equal 1.5Gi, but they actually consume only 1Mi of memory. I start pod1 and it should be started, cause node has 2Gi memory and pod1 requests only 1.5Gi. But what happens If I try to start pod2 after that? Would it be started? I am not sure, cause pod1 consumes only 1Mi of memory but has request for 1.5Gi. Do memory request of pod1 influences on execution of pod2? How k8s will rule this situation?
K8s memory request handling for 2 and more pods
Write it like this:<ifmodule mod_expires.c> <FilesMatch "(?i)^.*\.(js|css)$"> ExpiresActive On ExpiresDefault A2592000 </FilesMatch> </ifmodule>If it will be working it means mod_expires is not active on your server
This is about fixing an issue: LEVERAGE BROWSER CACHING(expiration not specified)I added the following lines of code in .htaccess<FilesMatch "(?i)^.*\.(js|css)$"> ExpiresActive On ExpiresDefault A2592000 </FilesMatch>It works perfectly on server but on localhost, it saysThe server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI scriptAm I missing anything?
Error when trying to fix
14 You should use a HTTP debbuging proxy server (i.e. fiddler), and try to synchronize your commit with Visual Studio (Visual Studio Tools for Git extension). In my case I realized that I was logged with another git account and VS tries to login with that account (Request: Permission to repo/repo.git denied to UserX). So I run 'rundll32.exe keymgr.dll,KRShowKeyMgr' and erase my credentials (maybe only update could works). When I tried to sync again, VS ask for credentials and everything works fine. Share Follow answered Apr 1, 2015 at 21:49 UUHHIVSUUHHIVS 1,1891111 silver badges1919 bronze badges 2 @Natrium what is fiddler log when you try to synchronize? – UUHHIVS Jun 9, 2017 at 17:55 @UUHHIVS thanks for your reply. I was doing it wrong. I had to fork first – Natrium Jun 12, 2017 at 19:42 Add a comment  | 
I sync sources to GitHub using Visual Studio 2013 with a particular account, but the following error when trying to come up with another account occurs. An error occurred. Detailed message: An error was raised by libgit2. Category = Net (Error). Response status code does not Indicate success: 403 Forbidden). Please someone you idea what it is?
Visual Studio 2013 GitHub
-1 I assume 'll' is 'ls -l' opendir("/storage/mount_usb") will work since the directory exists even if nothing is mounted on it. 'll /storage/mount_usb/movie.mp4 ' works if the required data is still in file system caches. 'll /storage/mount_usb' does not work since you want to list all files in the directory. To do this, the file system tries to access the device which you have unplugged without telling the file system. Share Improve this answer Follow answered Jan 30, 2018 at 10:29 Reine StenbergReine Stenberg 9644 bronze badges 3 how can i clear file system caches to get proper information – MIke Jan 30, 2018 at 10:39 You should unmount the device before unplugging it. If you don't unmount file systems before unpluggin them you risk corrupting the files – Reine Stenberg Jan 30, 2018 at 10:41 This command will clear directory entries and inodes 'sync; echo 2 > /proc/sys/vm/drop_caches' – Reine Stenberg Jan 30, 2018 at 10:54 Add a comment  | 
i'm working on linux centos 7.4,where i mounting USB device with '/dev/sdxn'. mounted directory present in '/storage/mount_usb'(ex:inside one file is present like movie.mp4). if i manually unplugged (without unmounting it) and i check command 'lsblk' their '/dev/sdxn' is not present, so here looks like ok for me. but when i run command 'll /storage/mount_usb/movie.mp4' then it's still showing some of the data and we can also able to open file in read mode(using open,fopen systemcall). command 'll /storage/mount_usb/movie.mp4 '. i.e -rwxrwxrwx. 1 root root 1506417406 Jan 29 16:17 /storage/mount_usb/movie.mp4 but when i run command 'll /storage/mount_usb'. i.e- ls: reading directory /storage/mount_usb: Input/output error total 0 and if i use opendir("/storage/mount_usb") then it will also open successfully and not return any error code. i'm not able to understand why data is still showing after unplugged USB.
mount directory still showing data after remove USB manually
NGINX provides parser written in C, these are fileshttp_parse.candhttp_parser.h, provided by theparser.By defining callbacks, one can easily use the parser. Here is an extract from my current project:http_parser_settings parser_settings; http_parser parser; http_parser_init(&parser, HTTP_BOTH); parser_settings.on_message_begin = [](http_parser *parser) { // Here goes the implementation } parser_settings.on_url = [](http_parser* parser, const char* at, size_t len) { // here goes the implementation } parser_settings.on_header_field = [](http_parser* parser, const char* at, size_t len) { // here goes the implementation } parser_settings.on_header_value = [](http_parser* parser, const char* at, size_t len) { // here goes the implementation } parser_settings.on_headers_complete = [](http_parser* parser) { // here goes the implementation } parser_settings.on_body = [](http_parser* parser, const char* at, size_t len) { // here goes the implementation } parser_settings.on_message_complete = [](http_parser* parser) { // here goes the implementation }To start the parser usesize_t read = http_parser_execute(&parser, &parser_settings, message, length);To parse URL there ishttp_parser_parse_url().ShareFolloweditedMar 7, 2016 at 7:19s4eed7,5031010 gold badges6969 silver badges110110 bronze badgesansweredDec 28, 2015 at 5:58karastojkokarastojko1,16699 silver badges1414 bronze badges1nginx is not nodejs–cliffordheathMar 29, 2022 at 2:09Add a comment|
If I am building a custom web server and really want to avoid writing code for parsing the HTTP requests can I use some other HTTP parser such as the Nginx HTTP parser (any other parser is completely fine, I suggested this because of its speed) to parse the HTTP request for me?If yes then could someone explain with an example how I can extract the parsed values from the HTTP request? I am planning to write this in C++.Thank you!
API to use Nginx HTTP Parser
1 There might be a misunderstanding of the process. You should open a pull request to merge a branch into master. The branch you are merging from should not be master. It should be a topic branch. Remember that merging requires two branches: the source branch and the destination branch. In the case of a pull request the destination branch is master. The source branch should not be master in your fork. It should be a topic branch in your fork. The proper flow is: Pull the latest from the original repository's master branch into the master branch in your fork # Configure remote from where you forked your repo (do this only once) git remote add upstream https://github.com/foo/bar.git # Do these steps before starting on a new feature git fetch upstream git checkout master git merge upstream/master git push origin HEAD Create a topic branch off of master on your fork git checkout -b feature master Do work and commit as often as you like git commit -m "..." Push your topic branch to your fork on GitHub git push origin -u HEAD Submit pull request on the original repository to merge the topic branch in your fork into the master branch on their repository Repeat steps 1-5 for as many pull requests as you deem necessary. It should be obvious by the history in the pull request whether or not your topic branch is up to date. If their repository requires you to merge your master into their master for a pull request, their process is broken. They are doing it wrong, and for the very reason you are asking a question on StackOverflow. Share Improve this answer Follow answered Jun 16, 2020 at 12:18 Greg BurghardtGreg Burghardt 18.3k99 gold badges5050 silver badges9494 bronze badges Add a comment  | 
I have been working with an open source project which requires to push all pull requests (PR) into the master branch. All PRs won’t be merged until releasing a new version. Suppose I have pushed a PR and want to work with a new one. I need to remove all codes of the previous one. I can’t create a new branch since the project requirements. However, if I do anything with those code and push to my fork, it will reflect immediately to my previous PR. To avoid affecting, I have to delete my current fork first, fork again for the new PR. It works for me but needed many steps, quite frustrating and hard to be back to work with previous PRs. Any better way? Thanks
GitHub better way to work with multi pull requests?
When mixing pipeline operators and curried arguments be aware of the order you pass arguments with.let size = 4 let photosInMB_pipeforward = size, @"C:\Users\chrsmith\Pictures\" ||> filesUnderFolder |> Seq.map fileInfo |> Seq.map fileSize |> Seq.fold (+) 0L |> bytesToMBThink about it as if the compiler is putting parentheses around the function and its parameters like this.@"C:\Users\chrsmith\Pictures\" |> filesUnderFolder sizebecomes@"C:\Users\chrsmith\Pictures\" |> (filesUnderFolder size)or(filesUnderFolder size) @"C:\Users\chrsmith\Pictures\"Out of order examplelet print2 x y = printfn "%A - %A" x y;; (1, 2) ||> print2;; 1 - 2 1 |> print2 2;; 2 - 1With three argumentslet print3 x y z = printfn "%A - %A - %A" x y z;; (1, 2, 3) |||> print3;; 1 - 2 - 3 (2, 3) ||> print3 1;; 1 - 2 - 3 3 |> print3 1 2;; 1 - 2 - 3Definitionslet inline (|>) x f = f x let inline (||>) (x1,x2) f = f x1 x2 let inline (|||>) (x1,x2,x3) f = f x1 x2 x3
Is piping parameter into line is working only for functions that accept one parameter? If we look at the example atChris Smiths' page,// Using the Pipe-Forward operator (|>) let photosInMB_pipeforward = @"C:\Users\chrsmith\Pictures\" |> filesUnderFolder |> Seq.map fileInfo |> Seq.map fileSize |> Seq.fold (+) 0L |> bytesToMBwhere his filesUnderFolder function was expecting only rootFolder parameter, what if the function was expecting two parameters, i.e.let filesUnderFolder size rootFolderThen this does not work:// Using the Pipe-Forward operator (|>) let size= 4 let photosInMB_pipeforward = @"C:\Users\chrsmith\Pictures\" |> filesUnderFolder size |> Seq.map fileInfo |> Seq.map fileSize |> Seq.fold (+) 0L |> bytesToMBSince I can definelet inline (>>) f g x y = g(f x y)I think I should be able to use pipeline operator with functions having multiple input parameters, right? What am I missing?
Piping another parameter into the line in F#
Thisblog link seems to explain in good detail. Does it help?
I have succeeded in establishing connection without SSL with the following command:java -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false DemoAppBut how do I connect through SSL? I have created a self signed certificate certreq.csr. How do I use this to establish SSL connection from VisualVM. The official documentation is not clear. Please advise me on the steps.
Configure VisualVM for SSL through JMX
You can use the double dot annotation to find all commits which are reachable from one reference but not the other. In your case you could use the following command: git log origin/master..master This effectively tells git to print all commits that are reachable from master but not from origin/master, so all commits which weren't pushed to the remote. You can read more about the double dot annotation in the Revision Selection chapter of the gitpro book. Or in the official documentation about git revisions.
On my master branch, when I run git status, I got : # Your branch is ahead of 'origin/master' by 1 commit. # (use "git push" to publish your local commits) # I would like to know what exactly is that commit which is ahead the remote master branch. How to achieve this? I tried git log command, compared my local commitment history with the remote repo commitment history, they look exactly the same....
Check which commit is ahead the origin/master
I solved the issue using aScannerinstead of anInputStream.The scanner takes the GZIPInputStream and reads the unzipped file line by line:fileObj = s3Client.getObject(new GetObjectRequest(oSummary.getBucketName(), oSummary.getKey())); fileIn = new Scanner(new GZIPInputStream(fileObj.getObjectContent()));
I have looked at bothAWS S3 Java SDK - Download file helpandWorking with Zip and GZip files in Java.While they provide ways to download and deal with files from S3 and GZipped files respectively, these do not help in dealing with a GZipped file located in S3. How would I do this?Currently I have:try { AmazonS3 s3Client = new AmazonS3Client( new ProfileCredentialsProvider()); String URL = downloadURL.getPrimitiveJavaObject(arg0[0].get()); S3Object fileObj = s3Client.getObject(getBucket(URL), getFile(URL)); BufferedReader fileIn = new BufferedReader(new InputStreamReader( fileObj.getObjectContent())); String fileContent = ""; String line = fileIn.readLine(); while (line != null){ fileContent += line + "\n"; line = fileIn.readLine(); } fileObj.close(); return fileContent; } catch (IOException e) { e.printStackTrace(); return "ERROR IOEXCEPTION"; }Clearly, I am not handling the compressed nature of the file, and my output is:����sU�3204�50�5010�20�24��L,(���O�V�M-.NLOU�R�U�����<s��<#�^�.wߐX�%w���������}C=�%�J3��.�����둚�S�ᜑ���ZQ�T�e��#sr�cdN#瘐:&� S�BǔJ����P�<��However, I cannot implement the example in thesecond questiongiven above because the file is not located locally, it requires downloading from S3.What should I do?
How to download GZip file from S3?
What's your reasoning for not wanting a htaccess file?The htaccess files provide an extension to the central configuration file for the httpd - anything which goes in there can go in a <directory> or <location> block in the httpd.conf or vhost configuration (and vice versa).which will be stored in a MySQL tableApache won't read its config directly from MySQL. Nor will lots of other things you might use to manage access (e.g. a second webserver instance on a different port). While I suppose you could deploy squid as a reverse proxy with a url-rewriter which reads from the database, this looks like a lot of work.Relying on IP addresses for authentication is generally considered a bad idea in the first place.I would recommend either usingclient certsor restrict the access to 127.0.0.1 and connect with an ssh tunnel.
I want to create a subdomain to be used as a staging environment. I don't want it to be publicly accessible and I want to avoid using htaccess. (e.g. dev.example.com)The subdomain should be restricted to certain IP addresses, which will be stored in a MySQL table and regularly updated. (I'm running PHP 5.6/Apache/Centos 7)What is the best way to do this?I could add a PHP check for$_SERVER['REMOTE_ADDR']in my config, however, images and javascript files would still be publicly accessible.
How to prevent access to subdomain without htaccess?
Cloudfront supports alternate domain names. For example, you can set your Cloudfront distribution to have an alternate domain name of mycloudfrontsubdomain.mywebsite.com. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/LinkFormat.html#LinkFormat_OwnDomain Now you can set a cookie from mywebsite.com with a domain of mywebsite.com. Cookie with that domain will also include all subdomains (so also including cloudfront). https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
I am looking into using aws cloudfront with signed cookies to serve static protected content on my webpage. AWS documentation here says we should set 3 cookies which should be passed those to our cloudfront urls (images/css/html/js/etc). Its not clear how do to this as cloudfront will be a separate domain than the one which served the page. mywebsite.com will server a page which has links to static CDN content on mycloudfrontsubdomain.cloudfront.net and should pass the signed cookies to gain access. How do I set cookies on cloudfront.net from my own domain or is there some way AWS can do this for you. Im not great with front end web development (Im mostly backend) but my understanding is we cant set cookies for a different domain that did not serve up the current page. I would assume AWS has some endpoint we could call to have cloudfront set cookies?
How do I set cloudfront signed cookies when its a different domain?
You can do this, but, in my opinion, it will lead to confusing behavior and possibly strange error cases.For example:echo.groovydef call(String string) { steps.echo "Calling step echo: $string" }Jenkinsfileecho 'hello'Output:Calling step echo: helloThere is ablog post herethat demonstrates this a little more in depthPaid support for some pipeline restriction tools are offered byCloudBeesthat might solve your use caseThe heaviest way to accomplish this is to of course write a plugin.
My company has a small pipeline library that we implicitly load for every build. Is there a way to overload thenode {block of every build transparently?My specific case is that I'm provisioning kubernetes slaves with the kubernetes plugin, and I want to provide a default YAML template, while allowing users to pick another template or override specific values. Eg:node { // Gets you a Pod with a DinD engine with a low CPU/Mem request/limit }Optionally overridden by name:node('2-core') { // Gets you a Pod with a DinD engine with 2 CPU/ more Mem request/limit }Or overridden with a template:import com.foo.utils.PodTemplates slaveTemplates = new PodTemplates() slaveTemplates.bigPod { node { // Big node } }Or:def label = "mypod-${UUID.randomUUID().toString()}" podTemplate(label: label, yaml: """ apiVersion: v1 kind: Pod metadata: labels: some-label: some-label-value spec: containers: - name: redis image: redis """ ) { node (label) { // Same small pod as before PLUS a redis container } }This seems trickiest, since you want the values of the parent to override the values of the child.
Override Default Jenkins Pipeline Node Block
you can use sonarqube client lib :Builder builder = HttpConnector.newBuilder(); builder.url("http://xxxx:9000/sonar/"); builder.connectTimeoutMilliseconds(10000); HttpConnector httpConnector = builder.build(); SearchWsRequest searchWsRequest = new org.sonarqube.ws.client.issue.SearchWsRequest(); List<String> projectKeys = new ArrayList<String>(1); projectKeys.add("project_key"); searchWsRequest.setProjectKeys(projectKeys); final WsClient wsClient = WsClientFactories.getDefault().newClient(httpConnector); List<Issue> issues = wsClient.issues().search(searchWsRequest).getIssuesList();and use<dependency> <groupId>org.sonarsource.sonarqube</groupId> <artifactId>sonar-ws</artifactId> <version>5.6</version> </dependency>
I need sample java client code for accessing the issues of a project in sonar Qube?I will pass the project key as input and get the list of issues in output.
Sample client for accessing sonar Qube issues of a project
Officially is not production ready yet, but I've been successful setting up 1.10 and later clusters with no problems.If you want to create an HA cluster with multiple masters there's also a kubeadm guidehere. But use it at your own risk.Also, keep in mind if your master(s) go down your workloads will keep running, you just won't be able to make changes or schedule new pods until the master(s) comes back up.You can also use any of the other solutions depending on your environment as pointed out in the other answer here.
I'm here to know about kubeadm. I'm planing to create kubernetes cluster using kubeadm on my production environment. So, I wanted to know is kubeadm production is ready to deploy in my product?
Is kubeadm production ready now?
Maybe not GKE as my clusters are on AWS, but I assume logic will be similar. When youkubectl get svcyou can select output format and it will show more then just the "normal" get. For me, with ELB based services to het LB hostname it's enough to run ie.kubectl -n kube-system get svc cluster-nginx-ingress-controller -o json | jq .status.loadBalancer.ingress.hostname
I am running an application with GKE. It works fine but I can not figure out how to get the external IP of the service in a machine readable format. So i am searching a gcloud or kubectl command that gives me only the external IP or a url of the formathttp://192.168.0.2:80so that I can cut out the IP.
How do I get the External IP of a Kubernetes service as a raw value?
1 static analysis: request the compiler / linker for static analysis if the stack size of your application (check compiler option -fstack-usage ). dynamic analysis / approach: use the debugger and set a conditional (write access) breakpoint to the end of your stack. If application writes to the end of the stack, the debugger will stop and present you the call stack and the function which leads to the memory violation . Share Improve this answer Follow answered Jun 19, 2017 at 12:56 tomtom 1111 bronze badge 1 How to set conditional breakpoint to the end of the stack (within gdb)? – Dr. Debasish Jana Jun 20, 2017 at 13:00 Add a comment  | 
I am using g++ on Solaris. Is there any way internally or externally to know how much stack size aI have used till now while within a function call? This is required to diagnose a suspected stack overflow.
Querying runtime stack size on Solaris using C++
What I misunderstood I thought that SSH keys are used to make commits with different accounts on Github and Gitlab, so that it overrides the config. But thats not the case. They are only used to get access from different accounts to different platforms, without typing in the credentials of an account. Solution I needed to create different folders for Github and Gitlab to load a different config for Git, when I'm working on Github and Gitlab projects at the same time. So only repositorys from Github are in the Github-folder and only Gitlab repositorys are in the Gitlab-folder. I edited my ~/.gitconfig to that: [includeIf "gitdir/i:~/Desktop/Github/"] path=.gitconfig-Github [includeIf "gitdir/i:~/Desktop/Gitlab/"] path=.gitconfig-Gitlab And in the same directory as the .gitconfig i created the .gitconfig-Github: [user] name=Dewey [email protected] and also a .gitconfig-Gitlab: [user] name=Dewey [email protected] I'm using VSCode so it was essential that the includeIf starts with gitdir/i: to turn off case-sensitive. If you don't do this step your config will not be loaded when you use VSCode. I've found the solution to that on the issue board for VSCode: https://github.com/Microsoft/vscode/issues/62921 Now everything works as I wanted it to.
My Problem I wanted to do commits on Github with my private email [email protected] and commits to our companys Gitlab with the company email [email protected], without changing the config of Git with every commit. So when I do commits on Github, it's linked to my Github-account and the same for Gitlab. What I already made Therefore I've created two different SSH keys and connected them with Github and Gitlab. I also have a file called config in my folder ~/.ssh/ with this in it: Host github.com HostName github.com IdentityFile ~/.ssh/github IdentitiesOnly yes User KonstantinSchuette Host gitlab.company.com HostName gitlab.company.com IdentityFile ~/.ssh/gitlab IdentitiesOnly yes User KonstantinSchuette But my commits are not connected to the account that I've linked the keys to.
Using Github and Gitlab
Your stylesheet ”pack” is called ”application” (not ”styles”). Replace stylesheet_pack_tag ’styles’ with stylesheet_pack_tag ’application’.
I am trying to run my rails 6 application in production, but facing internal server errors. When I check the logs this is what I see: ActionView::Template::Error (Webpacker can't find styles in /home/****/public/packs/manifest.json. Possible causes: 1. You want to set webpacker.yml value of compile to true for your environment unless you are using the `webpack -w` or the webpack-dev-server. 2. webpack has not yet re-run to reflect updates. 3. You have misconfigured Webpacker's config/webpacker.yml file. 4. Your webpack configuration is not creating a manifest. Your manifest contains: { "application.css": "/packs/css/application-8364df35.css", "application.js": "/packs/js/application-2789a226d9ddcf2c59d1.js", "application.js.map": "/packs/js/application-2789a226d9ddcf2c59d1.js.map", "entrypoints": { "application": { "css": [ "/packs/css/application-8364df35.css" ], "js": [ "/packs/js/application-2789a226d9ddcf2c59d1.js" ], "js.map": [ "/packs/js/application-2789a226d9ddcf2c59d1.js.map" ] } } } When I check the server files everything is in there actually. I am deploying via Capistrano and my server setup is nginx+puma. Although everything works on localhost, I was not able to run server in production. Is there something I am missing?
Rails 6 Production - Webpacker can't find styles in manifest.json
Per this linkhttps://github.com/prometheus/client_python/issues/626have you tried creating a separate registry instead of the default one?registry = CollectorRegistry() graphs = {} graphs['helpful'] = Counter('python_request_helpful_total', 'the total of helpful interactions', registry=registry) graphs['nothelpful'] = Counter('python_request_nothelpful_total', 'the total of not helpful interactions', registry=registry) graphs['othersasked'] = Counter('python_request_othersasked_total', 'The total of fallbacks in others Asked', registry=registry) graphs['fallback'] = Counter('python_request_fallback_total', 'The total number of total fallbacks', registry=registry)
I created a Python project for monitoring with prometheus. But when i try to get the dictionary to my file where the flask server rund i get a ValueError: Duplicated timeseries in CollectorRegistry: error. I don't know where it comes from.i import the dictionary like this:import actions.actions as ai need to reload the import so that the data gets synced between both files:from imp import reloadthe haul webserver file looks like this:import sys from flask import Flask, Response import prometheus_client from prometheus_client import Summary, Counter, Histogram, Gauge import actions.actions as a from imp import reload #################### Monitoring #################### app = Flask(__name__) @app.route("/metrics") def requests_count(): data = a.graphs reload(a) res = [] for k,v in data.items(): res.append(prometheus_client.generate_latest(v)) return Response(res, mimetype="text/plain") if __name__ == '__main__': app.run(host='0.0.0.0', port='5000', debug=True)in the other file i use prometheus like this:graphs = {} graphs['helpful'] = Counter('python_request_helpful_total', 'the total of helpful interactions') graphs['nothelpful'] = Counter('python_request_nothelpful_total', 'the total of not helpful interactions') graphs['othersasked'] = Counter('python_request_othersasked_total', 'The total of fallbacks in others Asked') graphs['fallback'] = Counter('python_request_fallback_total', 'The total number of total fallbacks')
I get the ValueError: Duplicated timeseries in CollectorRegistry error, when i try to import the Dict where the childs are stored
I'm not sure what causes this problem, but what fixed it for me was to stash everything withgit stash, and then get it all back viagit stash pop, after which I could once again commit the merged changes (I'm guessing the stash / pop thing resets HEAD and the merge state, replacing the file that got corrupted).The only downside is that you'll lose the default commit message with the list of merge conflicts, so might be worth cutting and pasting this somewhere first if you do want to use it.
When i tried to merge withmasterbranch fromGitHub, i got lots of conflict. I have fixed all of them and tried to commit. But i got following message:fatal: Corrupt MERGE_HEAD file (0da861af91a7df624577f1aa4ee0716b3dffa4af)When i tried by GUI mode i gotHEAD file not existtype message. I have added the screenshot as following:Now im confused how to solve it! I have searched in google and stackoverflow. But i dont get any solution. Please help me.
GIT: Corrupt MERGE_HEAD file when merging with master
In general, under windows, there is no mechanism for ordinary user access to reset or restart of the GPU. However if you have not modified the windows vista/7/8 TDR mechanism on your machine, you may be able to take advantage of it in this case to force a GPU reset by the OS. You should be able to write a CUDA program that spins forever (e.g. a while loop that never exits). Compile it to an executable. Make a shortcut to that executable on your desktop. Whenever your display gets corrupted like this, try running that executable. It should cause the display to freeze, which will trigger the Windows TDR mechanism, which will cause a GPU reset and driver reload.
I am doing some programming with cuda. I screw up with the GPU memory somehow and the following is what I see on my screen, which is driving me crazy!! Have anybody ever came across a similar problem before. Is there a way to fix the problem other than restarting the computer? As I am debugging, I don't want to restart my computer ever single time I launch the program. I will appreciate whatever advice you can provide. By the way, the black and white dots are flashing like stars! And that's making me very dizzy!!
Is it possible to reset or restart the GPU
I suggest you to mount the network volumes on your system as local disks (or folder in a local disk) and then change your configuration to write on them.One of the possible ways to achieve a similar result is adapting and using this command:mklink /d "C:\GitlabConfig" "\\power\Benutzer\hgul\GitlabConfig"Then your config will look like this:volumes: - 'C:\GitlabConfig:/etc/gitlab'BonusMore solutions about mounting the network drive:https://superuser.com/questions/244562/how-do-i-mount-a-network-drive-to-a-folder
I have docker installed on windows with a gitlab container running. Currently, I am mounting volumes to C drive but I want to mount the volumes to a folder on my network which is a server. Mydocker-composefile looks like this:version: "3.6" services: web: image: 'gitlab/gitlab-ce' container_name: 'gitlab' restart: always hostname: 'localhost' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://localhost:9090' gitlab_rails['gitlab_shell_ssh_port'] = 2224 networks: - gitlab-network ports: - '80:80' - '443:443' - '9090:9090' - '2224:22' volumes: - 'C:\GitlabConfig:/etc/gitlab' - 'gitlab-logs:/var/log/gitlab' - 'gitlab-data:/var/opt/gitlab'If whenever I want to create a backup then the backup should be stored in the folder on the network path. I want to store the backup on this path:\\power\Benutzer\hgul\GitlabConfig. Anyone has any idea if it is possible like that?
How to mount docker volumes to a folder on a network
First of all, you need to understand what is virtual environments, when you understand what it is for, the order of actions will be more clear. Python applications will often use packages and modules that don’t come as part of the standard library. Applications will sometimes need a specific version of a library, because the application may require that a particular bug has been fixed or the application may be written using an obsolete version of the library’s interface. This means it may not be possible for one Python installation to meet the requirements of every application. If application A needs version 1.0 of a particular module but application B needs version 2.0, then the requirements are in conflict and installing either version 1.0 or 2.0 will leave one application unable to run. The solution for this problem is to create a virtual environment, a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages. Different applications can then use different virtual environments. To resolve the earlier example of conflicting requirements, application A can have its own virtual environment with version 1.0 installed while application B has another virtual environment with version 2.0. If application B requires a library be upgraded to version 3.0, this will not affect application A’s environment. ※ Reference: 12. Virtual Environments and Packages Generally, the following order is the most appropriated. $ git clone <Project A> # Cloning project repository $ cd <Project A> # Enter to project directory $ python3 -m venv my_venv # If not created, creating virtualenv $ source ./my_venv/bin/activate # Activating virtualenv (my_venv)$ pip3 install -r ./requirements.txt # Installing dependencies (my_venv)$ deactivate # When you want to leave virtual environment All installed dependencies at step 5 will be unavailable after you leave virtual environment.
I'm relatively new in all that and I have a problem with the row of the actions. Say that you created a directory and you want a python virtual environment for some project and clone a few git repos (say, from GitHub). Then you cd in that directory and create a virtual environment using the venv module (for python3). To do so you run the following command, python3 -m venv my_venv which will create in your directory a virtual environment called my_env. To activate this environment you run the following. source ./my_env/bin/activate If in addition inside that directory you have a requirements.txt file you can run, pip3 install -r ./requirements.txt to install your various dependencies and packages with pip3. Now this is where I'm getting confused. If you want to clone git repos where exactly you do that? In the same directory you just run git clone and creates the git repos or you need to cd in another folder. In order to let python venv pick up the cloned repos is the above enough, or venv must be installed after you have cloned the repos in your directory?
Actions for creating venv in python and clone a git repo
2 The issue got resolved when I put #!/bin/bash in the the build steps in Jenkins. Share Improve this answer Follow answered Aug 3, 2015 at 10:22 Chirag DhyaniChirag Dhyani 9631111 silver badges2626 bronze badges Add a comment  | 
This appears to be a really weird issue. I am using Jenkins for automating compilation and build creation. I have a shell script which when I execute manually on gitserver, it is fine but the same script through Jenkins displays error: Error: /tmp/hudson829990263989049539.sh: 2: build/envsetup.sh: Syntax error: "(" unexpected Content of the shell script(envsetup.sh): #!/bin/sh function hmm() { cat <<EOF .................. Command used for manual as well as with Jenkins: . build/envsetup.sh I tried various methods e.g. changing the path for script execution, chown and then execute, dos2unix etc but nothing appears to work till now. Any idea on this? Thanks in advance.
Shell script wont execute on jenkins however manually it will
Yes, you can attach to a container in a pod. Using Kubernetes 1.0 issue the following command:Do:kubectl get poto get the POD namekubectl describe po POD-NAMEto find container nameThen:kubectl exec -it POD-NAME -c CONTAINER-NAME bashAssuming you have bashIts similar todocker exec -it CONTAINER-NAME WHAT_EVER_LOCAL_COMMAND
I have a containerized app running on a VM. It consists of two docker containers. The first contains the WebSphere Liberty server and the web app. The second contains PostgreSQL and the app's DB.On my local VM, I just usedocker runto start the two containers and then I usedocker attachto attach to the web server container so I can edit the server.xml file to specify the public host IP for the DB and then start the web server in the container. The app runs fine.Now I'm trying to deploy the app on Google Cloud Platform.I set up my gcloud configuration (project, compute/zone).I created a cluster.I created a JSON pod config file which specifies both containers.I created the pod.I opened the firewall for the port specified in the pod config file.At this point:I look at the pod (gcloud preview container kubectl get pods), it shows both containers are running.I SSH to the cluster (gcloud compute ssh xxx-mycluster-node-1) and issuesudo docker psand it shows the database container running, but not the web server container. Withsudo docker ps -lI can see the web server container that is not running, but it keeps trying to start and exiting every 10 seconds or so.So now I need to update the server.xml and start the Liberty server, but I have no idea how to do that in this realm. Can I attach to the web server container like I do in my local VM? Any help would be greatly appreciated. Thanks.
How to docker attach to a container - Google Cloud Platform / Kubernetes
I found that removing the linebuild:from the container's block in the docker compose file, resolved the issue for me.
When I command "docker compose up" after finishing docker compose build, the follow error occured.> exporting to image: ------ failed to solve: rpc error: code = Unknown desc = refusing to create a tag with a digest referenceI looked at the reason, but I don't understand why this error occurs.
"failed to solve: rpc error: code = Unknown desc = refusing to create a tag with a digest reference" When "docker compose up"
You can usegit rerereTo enable rerere functionality, you simply have to run this config setting:$ git config --global rerere.enabled trueWhen we merge the two branches together, we’ll get a merge conflict:$ git merge i18n-world Auto-merging hello.rb CONFLICT (content): Merge conflict in hello.rb Recorded preimage for 'hello.rb' Automatic merge failed; fix conflicts and then commit the result.Now you can resolve it to just be puts 'hola mundo' and you can run git rerere diff again to see what rerere will remember:$ git rerere diff --- a/hello.rb +++ b/hello.rb @@ -1,11 +1,7 @@ #! /usr/bin/env ruby def hello -<<<<<<< - puts 'hello mundo' -======= - puts 'hola world' ->>>>>>> + puts 'hola mundo' endSo that basically says, when Git sees a hunk conflict in a hello.rb file that has “hello mundo” on one side and “hola world” on the other, it will resolve it to “hola mundo”.ShareFollowansweredFeb 23, 2018 at 15:55L Y E S - C H I O U K HL Y E S - C H I O U K H4,88288 gold badges4141 silver badges5959 bronze badgesAdd a comment|
I merged changes from another repo to my repo and resulted in one conflict that is a copyright comment in all Java classes:<<<<<<< HEAD * Copyright (C) 2010-2017 Peter, Sofi, and Others ======= * Copyright (C) 2010-2018 Peter, Sofi, and Others >>>>>>> 01e35t13155963q84e8e05b7101235488c50f4e639eew3c4The conflict is trivial and easy to solve but the issue is that this conflict appears on more than 50 Java classes which I think is difficult to go through all of them and resolve the conflict manually.Is there a quick way to resolve this conflict in all the classes automatically? BTW, I use Eclipse.
How to resolve the same conflict in all the files
Github recently decided to rename all its main branches from master to main by default. Git Bash still uses master as the default main branch. To simply fix the problem, you can rename your branch from master to main on Git Bash using the following command: $ git branch -M main (This command allows you to rename the current branch in which you are working) So, after deleting the master branch on Github and applying the command suggested above, push your code again: you will now have only one main branch called main on both Github and Git Bash.
This question already has answers here: Why does "git push main" work on GitHub when "git push master" does not? Also what is difference between "Main branch" and "Master branch"? (7 answers) Closed 2 years ago. Im new to github and Im trying to push some files to my repository. But I have the 'main' branch with the README file but all my files are being pushed to the new 'master' branch added using GIT bash. So when somebody enters this repository it will just see the main branch with a README file, and all the project files will be at the master branch. Is there a problem with it? I hope I made myself clear. Also if you have any tips for this newbie user, they are all welcome. Thank you in advance!
New to GitHub - New repository and Questions [duplicate]