Response
stringlengths
15
2k
Instruction
stringlengths
37
2k
Prompt
stringlengths
14
160
I deleted the lambda function, IAM role, custom authorizer from API Gateway. Recreated all the above with the same settings and published the API. It started working and logging as expected. I do not know what was preventing earlier to log to cloud watch logs. Weird!!
How do get logging from custom authorizer lambda function in API Gateway? I do not want to enable logging for API. I need logging from authorizer lambda function. I use a python lambda function and have prints in the code. I want to view the prints inCloud Watchlogs. But logs are not seen in cloud watch. I do not get errors either. What am I missing?Lambda has execution rolerole/service-role/MyLambdaRole. This role has the policy to write to cloud watch.{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "logs:CreateLogGroup", "Resource": "arn:aws:logs:us-east-1:123456:*" }, { "Effect": "Allow", "Action": [ "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": [ "arn:aws:logs:us-east-1:123456:log-group:MyCustomAuthorizer:*" ] } ] }I also tested by adding CloudWatchLogsFullAccess policy torole/service-role/MyLambdaRolerole.{ "Version": "2012-10-17", "Statement": [ { "Action": [ "logs:*" ], "Effect": "Allow", "Resource": "*" } ] }
AWS API Gateway Custom Authorizer log
This error is stating that everything is running correctly, however in order to access the replica sets you need to first authenticate (you told it to use auth in your--setvalues withauth.enabled=true). To authenticate you need to tell mongo to use admin privileges and log in with the username and password you set up:use admin db.auth(username, password)This will get you authenticated and allowed to use the shell.
I created a cluster in google cloud, deployed mongodb using help:helm install my-release \ --set auth.rootPassword=password,auth.databases[0]="database",auth.usernames[0]="root",architecture=replicaset,auth.replicaSetKey="keykfjhewq",auth.enabled=true \ bitnami/mongodbAll is up, but when I exec into the pods and dors.status()I get:{ "ok" : 0, "errmsg" : "command replSetGetStatus requires authentication", "code" : 13, "codeName" : "Unauthorized", "$clusterTime" : { "clusterTime" : Timestamp(1653254244, 1), "signature" : { "hash" : BinData(0,"EZ4IdSOklvKSvSmWVYU6Rr/VcaM="), "keyId" : NumberLong("7100667090272518150") } }, "operationTime" : Timestamp(1653254244, 1) }What am I doing wrong?
deploy mongodb with helm : " command replSetGetStatus requires authentication"?
8 +25 Your question has two parts: First, the API Gateway using Cognito to authenticate your client; Second, assuming you are using an EC2 running Node.JS with Socket.IO using API Gateway as an endpoint for your clients. For the First part, you may use the following reference from AWS documentation. There are several sub-parts when you talk about AWS Cognito, for example including AIM permissions Method Execution to enable API resource endpoint HTTP method. For the second point, enable API Gateway to establish a synchronous connection with EC2 port running Socket.io you may read some references like this one. You should configure your API Gateway: Protocol WebSocket connection Select your Route Selection expression ,e.g. \$default Map the target backend for each $connect, $disconnect and $default Use integration type AWS Service Select EC2 and fill the rest of configs. Share Improve this answer Follow answered May 29, 2019 at 16:30 Rafael GorskiRafael Gorski 1,4831414 silver badges2222 bronze badges 2 3 how can it aws api socket gateway be integrated with client side socket.io? – Vishvendra Singh Oct 10, 2020 at 8:48 4 was anybody successful in connecting socket.io server via api gateway? – sallu Dec 28, 2020 at 4:07 Add a comment  | 
I want to map an API Gateway endpoint with a Socket.io server endpoint, in order to authenticate users through Cognito and, if successful, redirect to the Socket.io server and establish a socket with optional namespace and rooms. Is that makes sense? I didn't found any example, and API Gateway has only recently enabled a WebSocket API but without support for Socket.io
AWS API Gateway integration with Socket.io
I don't think so. One trick would be to do this work in an AppDomain. You could create a new AppDomain, do all of your work, report your results, then unload the AppDomain. Not a trivial task and fairly slow but it is the only way to effectively unload assemblies or reflection related caches (that I know of).
Per MSDN, calling Type.GetMethods() stores reflected method information in a MemberInfo cache so the expensive operation doesn't have to be performed again. I have an application that scans assemblies/types, looking for methods that match a given specification. The problem is that memory consumption increases significantly (especially with large numbers of referenced assemblies) since .NET hangs onto the method metadata. Is there any way to clear or disable this MemberInfo cache?
Can the .NET MethodInfo cache be cleared or disabled?
Right click on the file, go to "Git", and click "+ add".
I am currently coding a project in Android Studio and uploading all my code to GitHub via Android Studio. However, I am having trouble adding an xml file to the commit. When I commit and push, the file does not get pushed. It is glowing red in the file sidebar. How can I commit this file so I can push it to GitHub?
Android Studio adding a file to GitHub
GitHub as whole guide devoted toworking with forks.In short:you define a new remote repository that points to the original,you fetch and merge from that "upstream" remote repository to keep your repository in sync.
I use Vundle as plug-in manager in Vim and it happens that I want to make modifications to some plug-in to correct bugs or to implement personal changes.What I do in general isfork the original repoedit the.vimrcfile and change the linePlugin 'original-repo'toPlugin 'my-fork', run:so %and then:PluginInstallmake changes and commitpush to my forksend a PRAt this point the PR can be accepter or rejected. In the former case, everything's ok. What about the latter case?What I mean is that in general I can decide to keep the unaccepted edit in my fork (I've just committed it, after all), as well as in the local branch (that is, I keepPlugin 'my-fork'in my.vimrcfile), since I consider this edit to be important to me, for some reason. On the other hand, I don't want my fork to get old just because I diverged by one or a few commits; that is, I still want to have my fork include new commits of the original repo. In addition, I want to be still able to send PR of other commits I can do, paying attention to the PR best practice of sending PRs from a synced fork.I can imagine what the tools are fit for purpose, i.e.the web for creating the fork and send PRsgitto manage different branches of the local forkVundleto manage Vim pluginswhich I'm already using.So the question is: what is the workflow I should follow to manage Vim plugins to which I can possibly participate with PRs of commits (and I obviously can't know in advance which PRs are accepted and which are rejected)?
Manage own fork of Vim plugins with Vundle
This is currently being resolved by the jquery team. It appears to be a CDN provider issue.https://github.com/jquery/codeorigin.jquery.com/issues/34
I have a project, that uses jQuery CDN, but now I seeNET::ERR_CERT_COMMON_NAME_INVALIDin Chrome.Trying to get the jquery file using curl I see a strange domain in error message:curl https://code.jquery.com/jquery-3.1.1.js curl: (51) SSL: certificate subject name (*.ssl.hwcdn.net) does not match target host name 'code.jquery.com'Is it my system certificate issue or how on earth did another domain get into certificate?
jQuery ssl issues - why do I see hwcdn.net in the response?
I did find a solution, my problem was with php.ini setting, how lame of me to overlook it. I fixed it by adding these to the docker entry file.sed -i -e "s/upload_max_filesize = 2M/upload_max_filesize = 64M/g" $PHP_INI_DIR/php.ini sed -i -e "s/post_max_size = 8M/post_max_size = 64M/g" $PHP_INI_DIR/php.ini sed -i -e "s/memory_limit = 128M/memory_limit = 256M/g" $PHP_INI_DIR/php.ini
I am using laravel + twill inside docker containers with php7.4.3-fpm + nginx. Everything works fine appart from when I am trying to upload images of high resolution. If I upload image of 3000x3000px there are no problem as soon as I try to do the same with higher resolution (4500x4500px) I get the following error,message: "stream_copy_to_stream(): read of 8192 bytes failed with errno=21 Is a directory" exception: "ErrorException" file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php" line: 159 trace: [{function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"},…] 0: {function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"} function: "handleError" class: "Illuminate\Foundation\Bootstrap\HandleExceptions" type: "->" 1: {file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php", line: 159,…} file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php" line: 159 function: "stream_copy_to_stream"Is it a php-fpm configuration issue? Is it problem with php? Has anyone had similar problems?
High resolution image upload fails stream_copy_to_stream(): read of 8192 bytes
As noted in another answer, hard coding the ARN works. So intuitively, you might think something like this would work: authorizer: arn: Fn::GetAtt: [UserPool, Arn] Sadly, it does not. It looks like Serverless bumps your arn up against a couple of regular expressions to determine whether you're pointing at a lambda or a user pool. This approach doesn't seem to play nicely with approaches using things like Ref, Fn::Join, or Fn::GetAtt As of Serverless 1.27.3 (which was released since this question was asked), there is a workaround of sorts available. Essentially you declare your Authorizer in your resources section, instead of letting Serverless auto-magically create it for you. Then you use the new authorizerId key in your functions section to point at this authorizer. A minimal example: service: sls-cognitotest provider: name: aws runtime: nodejs6.10 functions: hello: handler: handler.hello events: - http: method: any path: /api/{proxy+} integration: lambda authorizer: type: COGNITO_USER_POOLS authorizerId: { Ref: MyApiGatewayAuthorizer } resources: Resources: CognitoUserPoolGeneral: Type: AWS::Cognito::UserPool Properties: UserPoolName: general MyApiGatewayAuthorizer: Type: AWS::ApiGateway::Authorizer Properties: AuthorizerResultTtlInSeconds: 10 IdentitySource: method.request.header.Authorization Name: MyCognitoAuthorizer RestApiId: Ref: ApiGatewayRestApi Type: COGNITO_USER_POOLS ProviderARNs: - {"Fn::Join": ["", ["arn:aws:cognito-idp:", {Ref: "AWS::Region"}, ":", {Ref: "AWS::AccountId"}, ":userpool/", Ref: CognitoUserPoolGeneral]]} It isn't great, but it's better than having to hard code the user pool ARN into your template.
In my serverless.yml, I have a Lambda function and I want to set it's authorizer to a Cognito User Pool that I have declared in the Resources section down below. I've seen examples where the authorizer is set to aws_iam but that seems wrong. Any help would be amazing :) I'm thinking I need to set the authorizer's ARN to the Pool's ARN, but how do I get that? Or is that even correct?
Using Serverless, how do you set a Lambda function's authorizer to a Cognito User Pool from the Resources?
After some time asking on github and travis-ci forums I found that it is a travis-ci issue. To solve it I ended up doing a “hard reset”: revocking all authorizations from GitHub to Travis, then adding them again: GitHub > Settings > Applications > Authorized OAuth Apps revoke Travis CI for Open Source. Then I visited my Travis dashboard, log out, login again with GitHub and reauthorized. I also had to create an additional commit to make a build with successful status.
I'm working on a simple app and got a problem with travis builds. I created a branch and a new pull-request with one commit and my build was failed as expected. When I fixed issues, I tried to push more commits and found that travis doesn't react on it. Then I push more commits with the same results - no travis reaction. I checked my app on travis-ci.org and found that travis successfully created build on each commit. But github shows me only first failed build (see image below). Here is my.travis.ymlfile:sudo: required language: node_js node_js: - '13' env: global: - PG_SQL_USER=hsxyxlxq - PG_SQL_HOST=balarama.db.elephantsql.com - PG_SQL_DB=hsxyxlxq - PG_SQL_TEST_USER=gskibphv - PG_SQL_TEST_HOST=drona.db.elephantsql.com - PG_SQL_TEST_DB=gskibphv - secure: ##### - secure: ##### before_script: - npm install script: - npm run migrate:test - npm run test deploy: provider: heroku app: richi-sh api_key: secure: ##### on: repo: lutaev/richiI'm new in CI, what should I do in this case?Thanks.
Github doesn't display new travis builds near the commits
1 You need to select Content type: application/json in your webhook in GitHub. Then you would be able to access any variable from the payload GitHub sends as follows: $. pull_request.url for pr url, for example. Share Follow edited Sep 6, 2021 at 10:07 answered Sep 5, 2021 at 23:36 user16838236user16838236 1 @bad_coder - thanks for the edit. I am new to this platform, still learning the nitty-gritties. – user16838236 Sep 6, 2021 at 10:06 Add a comment  | 
I have configured a Github web hook with the below settings: Payload URL: https:///github-webhook/ Content Type: application/x-www-form-urlencoded Events : Pushes, Pull Requests The Jenkins job that I have, is a pipeline job that has the below enabled: Build Trigger: GitHub hook trigger for GITScm polling With the above configuration, I see that in response to an event ie; push/PR in GitHub, the jenkins job gets triggered successfully. In GitHub, under Recent Deliveries for the web hook, I see the details of the payload and a successful Response of 200. I am trying to get the payload in Jenkins Pipeline for further processing. I need some details eg: PR URL/PR number, refs type, branch name etc for conditional processing in the Jenkins Pipeline. I tried accessing the "payload" variable (as mentioned in other stack overflow posts and the documentations available around) and printing it as part of the pipeline, but I have had no luck yet. So my question is, How can I get the payload from GitHub web hook trigger in my Jenkins Pipeline ?
Unable to get the payload from GitHub web hook trigger in jenkins pipeline
Having just tried it myself, it does seem you can set up a network load balancer to load balance your databases. My production setup usespatronito manage failover, and patroni provides an HTTP API for health checks. The master returns a 200 response, while the replicas return a 503. This works fine for my use case, where the replicas are there just for failover, not for replicated reads. I'm assuming you could come up with some code that returns a successful response for health checks based on your needs.I configured the load balancer to listen to port 5432 and the health checks to connect on port 8008. I modified the security group for the postgres instances to allow connections from my VPC's IP range, since the NLB doesn't have security groups. Connecting via psql to the NLB's DNS name worked as expected.Though it works, I think I'll stick with my current setup, which has a PgBouncer running on each application instance (so no need to worry managing a pool of bouncer instances) with consul-template updating pgbouncer.ini and reloading PgBouncer when the leader key changes in consul.
We have an application that has multiple postgres databases (that are guaranteed to be in sync) installed on AWS EC2 instances in different availability zones. I would like to abstract them behind a single DNS so that, if one of the EC2 instances crashes, the clients can still access the db. I am wondering if I can use an AWS network load balancer to load balance my databases? Why or why not? If not, is there any other standard, easy-to-implement solution that I can use? (I am aware ofhttp://www.pgpool.net/mediawiki/index.php/Main_Pagefor example. However, am leery of using something that I have to setup myself, especially since I would have to replicate pgpool instances as well...)
load balancing postgres instances via aws network balancer possible?
All cron files for all users are located at /var/spool/cron. Each user has its own file. Although, editing those files manually will work - its recommended that you will use 'crontab -e' to edit those.
I can't seem to find clear instructions on how crontab works on CentOS. When I (as root) edit my crontab using:crontab -eI see a list of cronjobs. However, when I edit /etc/crontab, nothing is listed there.What is the difference?
CentOS cronjobs location
First you would need to perform this command :git initthen :git remote add origin REPO_LINKREPO_LINK being the link to your repository.So this command will, "link" your folder to the repository, so when you will commit any changes, it will push the code from the remote (the folder you added the remote to) to the repository.Edit : It should fix your "Fatal : Not a git repository" error.
Please note that I read most of the suggestion othispage, but there are too many suggestions and I cannot find a proper way for my problem.I created a new repository calleddemo-projecton GitHub and I want to pushdemo-projectthat already on my local disk onD:\projectsfolder. I cloned the repo toD:\projectsdirectory (first I move my project to another location) and then copied my project to thatD:\projectsfolder. Then I connect to GitGub, but it shows lots of changes that I did not make and after pushing the changes to the GitHub, it uses my work account instead of private GitHub.So;1.How should I push my changes to the repo on GitHub? Should I first clone that repo and then copy my project to the clone directory (D:\projects)? Or is there an easier way e.g. connecting to repo and then push?2.How can I use my private GitHub account automatically for this repo when I run commends when I am in this repository (D:\projects\demo-project) on cmd? Should I run the following command for setting my private repo without--globaloption?git config user.name "[name]" git config user.email "[email]" git config user.password "[password]"
Setting user for private GitHub repository without using SSL?
2 Immutability of the class String has absolutely nothing to do with OutOfMemoryError. Immutability means that it cannot ever change, only that. If you run out of memory, it is simply because the garbage collector was unable to find any garbage to collect. In practice, it is likely that you are holding references to way too many Strings in memory (for instance, do you have any kind of collection holding strings, such as List, Set, Map?). You must destroy these references to allow the garbage collector to do its job and free up some memory. Share Follow edited Oct 16, 2012 at 8:33 answered Oct 16, 2012 at 8:28 Bruno ReisBruno Reis 37.4k1313 gold badges119119 silver badges157157 bronze badges 1 I have added a PS to my question. – Geek Oct 16, 2012 at 8:36 Add a comment  | 
I have written a simple Java program that reads a million rows from the Database and writes them to a File. The max memory that this program can use is 512M. I frequently notice that this program runs Out Of Memory for more than 500K rows. Since the program is a very simple program it is easy to find out that this doesn't have a memory leak. the way the program works is that it fetches a thousand rows from the Database, writes them to a file using Streams and then goes and fetches the next thousand rows. The size of each row varies but none of the rows is huge. On taking a dump while the program is running the older string are easily seen on the heap. These String in heap are unreachable which means they are waiting to get Garbage collected. I also believe that the GC doesn't necessarily run during the execution of this program which leaves String's in the heap longer than they should. I think the solution would be to use long Char Arrays(or Stringbuffer) instead of using String objects to store the lines that are returned by the DB. The assumption is that I can overwrite the contents of a Char Array which means the same Char Array can be used across multiple iterations without having to allocate new Space each time. Pseudocode : Create an Array of Arrays using new char[1000][1000]; Fill the thousand rows from DB to the Array. Write Array to File. Use the same Array for next thousand rows If the above pseudocode fixes my problem then in reality the Immutable nature of the String class hurts the Java programmer as there is no direct way to claim the space used up by a String even though the String is no longer in use. Are there any better alternatives to this problem ? P.S : I didn't do a static analysis alone. I used yourkit profiler to test a heap dump. The dump clearly says 96% of the Strings have NO GC Roots which means they are waiting to get Garbage collected. Also I don't use Substring in my code.
Does Immutability of Strings in Java cause Out Of Memory
In answer to your second question,Jenkinsis a robost and extensible continuous integration tool that can be integrated tightly with GitHub usinga plug-in(or loosely using standard Git support). It also supportsCMake via a plug-in. Whether it has disadvantages that will make it less useful for you depends on your organization and build process, but I've found it to be highly customizable to a wide variety of processes. I recommend taking a look at it.There's also a third-partyCtest pluginavailable for Jenkins.
We are looking for a software to run our test cases automatically.We want a software which will run on our server (or a commercial), which automatically gets the newest commit on github. Then compiles the commit of the project with CMake and run Ctest on our test cases. The results should then be visualized on a nice website.I had a look at CDash, but as the documentation is so bad I did not even get it to get the latest commit from github.So my questions are:Is there a good tutorial to CDash? Except the bad wiki page.What software is available for running tests on new commits to github, what are their advantages and drawbacks?
Continous- integration software for cmake project hosted on github
Did you try turning on debugging mode?You do that inwp-config.php.Locatedefine('WP_DEBUG', false);and set it to true.Another thing I would try is to make some simple php file and test that if it is working. Something like:<?php echo "test"; ?>UPDATE:Since you probably have problem with php itself, check this question on stackoverflowphp not working with nginx on ubuntu:ShareFolloweditedMay 23, 2017 at 12:30CommunityBot111 silver badgeansweredMar 19, 2013 at 7:32user850010user8500106,3511212 gold badges3939 silver badges6060 bronze badges10yes I did try that but still the issue persists. I have looked into my error.log and php5-fpm log but there is nothing there related to wordpress.–SaadMar 19, 2013 at 7:41that is not working I did try that. and also the last method proposed herevelvetblues.com/web-development-blog/my-wordpress-blog-is-blank–SaadMar 19, 2013 at 7:49So that simple php file (with echo "test") is also not working?–user850010Mar 19, 2013 at 7:53yes thats not working and it is strange because I have another website on different subdomain and it is written in php and that is working–SaadMar 19, 2013 at 8:21In that simple php file try removing php in <?php so that opening tag only consists of only <?–user850010Mar 19, 2013 at 8:25|Show5more comments
I have a Wordpress blog which was working fine until I updated my PHP 5.3 to 5.5. Now the whole blog is blank. I cannot view the admin page or even the log in page. I have tried to fix it after searching a lot on Google, but it is still not working.I have gone through these solutions:http://www.hongkiat.com/blog/common-wordpress-errors-with-solutions/http://www.velvetblues.com/web-development-blog/my-wordpress-blog-is-blank/As stated in these solution the main reason is either a faulty theme or a plugin. So I changed my plugin folder to plugins_temp but still got that blank page. Then I changed my themes folder to themes_temp and still I got that same problem.In the first link that I have submitted here there was this solution# 3 Warning: Cannot modify Header informationwhere they proposed a solution i.e wp-config.php will have a blank line after the php '?>' closing tag. I looked at my wp-config.php and there was no closing tag '?>'. So I added that tag without a blank line and that still didn't solve that blank page issue.I have another PHP website on a different subdomain and it is working fine. In my blog's root folder there is readme.html and when I use this url (myblog/readme.html) then that file gets displayed on the browser so only none of the PHP files are getting rendered.Lastly I did try to install a totally fresh Wordpress site but when I go to install.php then none of the files are being executed.I am using php5-fpm, Ubuntu 12.04 and NginX.
Getting a blank page on Wordpress blog
Excel is a binary file format. Use io.BytesIO(export) instead
In my effort to export Excel file in my private Github repository to Pandas data frame using the source code below: username= 'xxx' token = 'yyyy' github_session = requests.Session() github_session.auth = (username, token) url = 'correct path to raw file' export = requests.get(url).content df = pd.read_excel(io.StringIO(export.decode('utf-8'))) I have encountered an error while running the last line of the above chunk: TypeError: unsupported operand type(s) for <<: 'str' and 'int' The Excel raw data file from Github repository has combined numeric and string records.
Import Excel file to pandas from Github repository
You need a centralized logging solution. There are some common solutions out there. One of them is the ELK Stack (now named Elastic stack).It has 3 main components:Elasticsearch:To store the logs, index them, make them searchable etc.Logstash:To collect the logs from various sources (containers in your case), parse/filter them and push them to other systems. In ELK's case, push them to Elasticsearch.Kibana:A web GUI to visualize the data in Elasticsearch, allows searching, creating visual graphs and so on.See the official page ofElastic stackfor more information.You can also useFluentdorFluent Bitinstead of Logstash, so it'll be an EFK stack. I personally had pretty good experience with an EFK stack with Fluent Bit.For another, lighter alternative, you can check outGrafana Loki, which is kind of a logging extension to the popular monitoring setup of Prometheus+Grafana.
I am looking for a way to collect Java exceptions thrown by containers. I know the function from the logging system of GKE/GCP and would like to implement a similar logging system in our self-hosted cluster.I am using Prometheus and Grafana for monitoring metrics.
How do I collect Java exceptions from Kubernetes pods?
1) What docker is all about from a 10000 ft bird's eye point of view?From the website:Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere.Drill down a little bit more and a thorough explanation of the what/why docker addresses:https://www.docker.io/the_whole_story/https://www.docker.io/the_whole_story/#Why-Should-I-Care-(For-Developers)https://www.docker.io/the_whole_story/#Why-Should-I-Care-(For-Devops)Further depth can be found in the technology documentation:http://docs.docker.io/introduction/technology/2) What exactly is the meaning of a container ? Is it synonymn for image?An image is the set of layers that are built up and can be moved around. Images are read-only.http://docs.docker.io/en/latest/terms/image/http://docs.docker.io/en/latest/terms/layer/A container is an active (or inactive if exited) stateful instantiation of an image.http://docs.docker.io/en/latest/terms/container/See also:In Docker, what's the difference between a container and an image?3)I remember reading somewhere that it allows you to deploy applications. Is this correct ? In other words will it behave like IIS for deploying the .net applications?Yes, Docker can be used to deploy applications. You can deploy single components of the application stack or multiple components within a container. It depends on the use case. See theFirst steps with Dockerpage here:http://docs.docker.io/use/basics/See also:http://docs.docker.io/examples/nodejs_web_app/http://docs.docker.io/examples/python_web_app/http://docs.docker.io/examples/running_redis_service/http://docs.docker.io/examples/using_supervisord/
I am just one day old to docker , so it is relatively very new to me .I read the docker.io but could not get the answers to few basic questions . Here is what it is:Docker is basically a tool which allows you to make use of the images and spin up your own customised images by installing softwares so that you can use to create the VMs using that .Is this what docker is all about from a 10000 ft bird's eye piont of view?2 . What exactly is the meaning of a container ? Is it synonymn for image?3 . I remember reading somewhere that it allows you to deploy applications. Is this correct ? In other words will it behave like IIS for deploying the .net applications?Please answer my questions above , so that I can understand it better and take it forward.
Understanding docker from a layman point of view
a strange password request showed upThat means the SSH keys proposed by your local SSH client do not match the public key registered in your GitHub account.You can see what is used withssh -Tv[email protected](asLeGECsuggests inthe comments).Try, for testing, to generate one without passphrase:ssh-keygen -t rsa -P "" -f ~/.ssh/github export GIT_SSH_COMMAND="/usr/bin/ssh -o StrictHostKeyChecking=no -i /home/me/.ssh/github" git clone[email protected]:me/myRepo
On a linux ubuntu server, I have set up git/github already with ssh key-pair authorization. It was working before last week. However, suddenly when I usegit pullorgit push, or simplyssh -T[email protected], a strange password request showed up>git push[email protected]'s password: Permission denied, please try again. ...[email protected]: Permission denied (publickey,password).ssh -T[email protected][email protected]'s password: Permission denied, please try again. ...[email protected]: Permission denied (publickey,password).I tried thepassphraseused for ssh key-pair, and also tried re-generating ssh key-pair several times and updating them on github. I also tried typing theaccount passwordused to log into github.com. I even tried thepersonal tokengenerated from github.But none of these works.What could happen to the server that causes the strange issue? Anyone knows how to resolve it?Thank you!
Git keeps requiring password but none of my password/tokens/passphrase works
You should revert your SQL change, delete the directory data/es then delete the user through the standard way (administration console or web service). If you don't know what was the exact change, then a database backup should be restored.
Can someone explain to me how users are stored SonarQube's database (mysql)? I did a wrong query that corrupted a new user's account. I am trying to fix it but I can't get the user to show up again on the /users page so something must still not be quite right even though everything look correct in the "users" table. Is there any other table involved?The user is new so he has not activity in the DB (never logged in, nothing assigned etc.).Alternatively I am ok deleting the user and recreating, but I don't know how to do that since it doesn't show in the web ui. To do it in the DB I would need again to know the data model.
How does SonarQube users table work?
The best approach is to call the connect_xxx method once when your application starts and rely on boto to manage the connection from then on. The only exception to that rule is if you are using multiple threads. In that case, each thread should create it's own connection since boto uses httplib which is not threadsafe.Even if you call the connect_xxx method before each request, you really should be okay. Boto pools connection at the class level and should handle this in a pretty efficient manner.
If I call boto.connect_xxx, where xxx is some service (dynamodb, s3, etc) multiple times, does it create a new connection pool each time? What I'd like to do is something like this (example in Flask):@app.before_request def before_request(): g.db = connect_dynamodb()to make sure I always connect, but I don't want to do this before each request if it will create new security tokens, etc, the whole rigamarole, each time. Is it safe to just call connect_xxx() once when the application starts, and rely on boto to generate new connections as needed, etc.?
Boto connect_xxx method and connection pools
Instead of using WinSCP for your changes, you should do the following :Install a web server on your laptop (check for WAMP on Windows)Clone your Github repository on your laptop (inC:/wamp/wwwif you are on Windows)Now, you can make changes on your laptop (andlessthem) and see them onhttp://localhost/When you are satisfied with your modifications you can do the following :Push on your repository from your laptop to send the changes to GithubLog on your serverPull the changes from Github on your serverNow you can access your website with the applied changeswww.example/~myName/This is the proper way of using a configuration management system.ShareFollowansweredJul 7, 2013 at 0:12Maxime FafardMaxime Fafard37622 silver badges88 bronze badgesAdd a comment|
I am having a problem dealing with a website and trying to make changes to it.First of all, let's say that my website is www.example.com. I downloaded Putty, went to the session, and used the host name (or IP address) to be www.example.com and used the connection type to be SSH. I logged into my account with my username and password I have from the website admins and have myName@example:~$.Then, I went to github.com. This place is where the website's git repository is located at and my admins told me to go there. I cloned the repository to my unix account and currently have a website url of www.example.com/~myName/In putty, I have some of the css code for the website and wanted to change some part of the website. So in order to do that, I downloaded WinSCP and used that to transfer the css file of the website to my laptop, make a change to the css code, and then transfered the new code into putty account.I can see the change on my putty account when I doless filename.cssbut when I try to log on to my account website of www.example/~myName/ , the change does not appear. In order to fix this problem, am I supposed to do something dealing with github.com and make a new branch or something to the repository I am working on, or do I need to do something else? Thanks for all the help.
Making changes to website
Maybe not a real answer, but a point of view on the subject.The difference with the limit on CPU and Memory is what happens when the limit is reached. In case of the CPU, the container keeps running but the CPU usage is limited. If memory limit is reached, container gets killed and restarted.In my use case, I often set the memory request to the amount of memory my application uses on average, and the limit to +25%. This allows me to avoid container killing most of the time (which is good) but of course it exposes me to memory overallocation (and this could be a problem as you mentioned).
I understand the use case of setting CPU request less than limit - it allows for CPU bursts in each container if the instances has free CPU hence resulting in max CPU utilization. However, I cannot really find the use case for doing the same with memory. Most application don't release memory after allocating it, so effectively applications will request up to 'limit' memory (which has the same effect as setting request = limit). The only exception is containers running on an instance that already has all its memory allocated. I don't really see any pros in this, and the cons are more nondeterministic behaviour that is hard to monitor (one container having higher latencies than the other due to heavy GC). Only use case I can think of is a shaded in memory cache, where you want to allow for a spike in memory usage. But even in this case one would be running the risk of of one of the nodes underperforming.
What is the use case of setting memory request less than limit in . K8s
Use modify_attribute. See the documentation. import boto3 ec2 = boto3.resource('ec2') instances = ec2.instances.filter( Filters=[{'Name': 'instance-state-name', 'Values': ['stopped']}]) for instance in instances: print(instance.id) # after choosing the instances to terminate: ids = ['id1', 'id2'] for id in ids: ec2.Instance(id).modify_attribute( DisableApiTermination={ 'Value': False }) ec2.Instance(id).terminate()
I want to teminate many AWS ec2 instance,then i use boto3 like this: #!/usr/bin/env python #coding=utf8 import boto3 ec2 = boto3.resource( 'ec2', aws_access_key_id="<AK>", aws_secret_access_key="<SK>", region_name='eu-central-1' ) instances = ec2.instances.filter( Filters=[{'Name': 'instance-state-name', 'Values': ['stopped']}]) ids = ['id1','id2'.....'idn'] status = ec2.instances.filter(InstanceIds=ids).terminate() print(status) But I got a ERROR: botocore.exceptions.ClientError: An error occurred (OperationNotPermitted) when calling the TerminateInstances operation: The instance 'i-0f06b49c1f16dcfde' may not be terminated. Modify its 'disableApiTermination' instance attribute and try again. please tell me how to modify the disableApiTermination.
How to change termination protection by boto3
Unfortunately you cannot load agpuArraystored in a.matfile on a machine that cannot itself create agpuArray. (MATLAB requires that objects loaded from.matfiles become instances of the original class that they were saved as). Your best bet is to callgatheron yourgpuArrays beforesaveing them.(One reason why MATLAB supports saving and loadinggpuArraydata directly without enforcing thegatheris to be compatible with other parallel language features such asparfor,spmd, andparfeval).
I have a.matfile that was saved after some GPU functions (e.g.gpuArray) withsave(['foo.mat'], 'foo', '-v7.3');.Now, I am trying to load this.matfile, and I do not have a GPU. I get the following error:FATAL: Error inserting nvidia (/lib/modules/2.6.32-504.16.2.el6.x86_64/kernel/drivers/video/nvidia.ko): No such device Error using load No supported GPU device was found on this computer. To learn more about supported GPU devicesI have no problem loading the file while I have access to GPU. Is there any way to load this file without a GPU?
loading .mat file written by GPU
1 If you insist on using git submodules, then note that it works on a repository basis, i.e. you can only attach the full repository tree as a subfolder of another repository. You can't filter it, i.e. you get the full repository from the root folder with all the files and subfolders. Thus a clean way would be to create a repo3 with common files, and link it as a submodule to repo1 and repo2. Another possible way is if you treat repo1 as a provider of common files, and repo2 as a derivative project (consumer). Then you can link repo1 as a submodule of repo2, and then modify the repo2 to reference files inside repo1 subfolder. This can be either a modification of project files or build scripts, or just symlinks. A third way is to not use git submodules, but use some package manager. For example, some package managers support creating a package with just a few files out of a repository, and then you can reuse that package from another repo. Share Improve this answer Follow answered Jun 9, 2018 at 13:21 battlmonstrbattlmonstr 6,07011 gold badge2525 silver badges3333 bronze badges Add a comment  | 
I have two github repository similar to the below structure as an example: repo1: [folder_X] fileA fileB fileC fileD [folder_Y] fileE fileF repo2: [folder_M] fileB fileC fileK [folder_N] fileO fileP as you see in both repository we have some common files in folder_X and folder_M which are fileB and fileC. I need to have a common source for these files, so I don't need to modify them in two repository always. These common files (B and C) can be stored in a separate branch in repo1 as an example. Is there any solution for it without modifying the repo structure?
using git-submodule without repository structure modification
There is no recommended minimum size for kubernetes. The defaults are good for most cases but is you are creating e.g. many of empty files you might eventually run out of inodes. If you need more you need to manually adjust its number.
Is there a recommended minimum size (or minimum number of inodes) for the/tmpfile system (partition) on Kubernetes cluster nodes?What I am experiencing (on a bare-metal Kubernetes 1.16.3 cluster) is that cluster nodes hit 100% inodes used (according todf -i). This has some negative effects (as one would expect; e.g.kubectl exec ... bashinto pods on concerned nodes leads to "no space left on device") butkubectl get nodes(strangely) still reports these nodes as "Ready". The/tmpfile systems involved are relatively small, i.e. 2G (121920 inodes) and 524M (35120 inodes) respectively.
Kubernetes cluster nodes running out of inodes in /tmp
I've just faced with it. Just generate token and use inplace of password.ShareFollowansweredAug 18, 2021 at 18:01djdancedjdance3,1602727 silver badges3333 bronze badgesAdd a comment|
I am using netbeans 8.2 to push to github but now get messages sayingYou recently used a password to access the repository at XXX with git using JGit/3.6.2.201501210735-r.Basic authentication using a password to Git is deprecated and will soon no longer work. Visit >https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/for more > information around suggested workarounds and removal dates.Thanks, The GitHub TeamHow can I reset my authentication to enter a github token (https://github.com/settings/tokens) instead of my password?
Netbeans JGit github password authentication deprecated,. how to reset?
You already had the components of a correct solution. Use the scheme and hostname, together with the capture to construct the destination URL:rewrite ^/(.*)/$ https://$host/$1 permanent;
I want to redirect http to https and remove trailing slashes in nginx with one single redirect. The solution I have today is the following:server { listen 80; server_name www.example.com rewrite ^/(.*)/$ /$1 permanent; return 301 https://$host$request_uri; }The problem with this solution is that it will give two redirectsGives Two redirects:http://www.example.com/test/ --> http://www.example.com/test http://www.example.com/test --> https://www.example.com/testIs it possible to make a solution where you only get one single redirect like bellow?http://www.example.com/test/ --> https://www.example.com/testwhen I looked through the documentation of nginx rewrite and return methods I felt like it should be possible to do it with a single rewrite somehow:rewrite ^/(.*)/$ https://$host$request_uri permanent;But nothing I have tried have given me the correct results.
Nginx redirect http to https and remove trailing slashes with one single redirect
"Everything in this design sound doable, but also sounds like I "inventing the wheel" instead of using an existing solution that allow those option"Microsoft's ownDataFlowbasically provides this functionality with very convenient options to parallelize steps etc.Let's break it down:Solve an equationThat sounds like a job for aTransformBlock.You set it up to use a transformation method that will take an (let's call it)TInputtype and producesTOutput(Result of Equation).Send an EmailI'd break this up into two more Blocks:TransformTOutputto an EmailSend EmailSo you have one moreTransformblock<TOutput , Email>and oneActionBlock<Email>(I am using "Email" like a type here. It's just a placeholder. The exact type of course depends on Email Framework in use.)Put it all togetherYou then build your pipeline by "linking"TransformBlock<TInput, TOutput>=>TransformBlock<TOutput, Email>=>ActionBlock<Email>.Having done that, you have set up a complete Pipeline to wich you can submitTInputs and the framework will take care of the rest. Each block can beconveniently configuredto for example process severalTInputin parallel etc.It also let's you decide if you want to use synchronous or asynchronous (Task/await) API.
BackgroundI have set of tools\solution that can be combined together into a one single data processing\action flow.Each unit on my flow do a calculation or do an action.Example:Solve equation->send emailIn this example, theSolve equationunit is a type of calculation unit. While thesend emailunit is action.The point that I have 100 different units that can be combined together on a different order.The QuestionIn order to solve this problem, I planning to create a data flow for my application. Each flow will implement this interface:public interface IFlow { public IUnit[] UnitsChain{get;} public void Start(string input); }While my unit will implement this interface:public interface IUnit { public string /*output*/ Process(string input); }Everything in this design sound doable, but also sounds like I "inventing the wheel" instead of using an existing solution that allow those option.Looking to better solution to implement this kind of custom pipeline processing.Thanks!
Designing pipeline system
The Github API uses pagination to deal with large numbers of responses. You can request pages other than the first page by appending page=<n> to your request url. For example: page = 1 while True: response = requests.get( f"https://api.github.com/repos/{user}/{repo}/releases?per_page=100&page={page}", headers={"Authorization": "token " + ACCESS_TOKEN}, ) releases = response.json() if not releases: break print(json.dumps(releases, indent=2)) page += 1
I believe the PyGitHub libary can do this, but for the purposes of my project, I am calling the GitHub API directly with the requests library as I am caching the results of my API call with the requests-cache library. According to the documentation for the per_page parameter, the maximum number of releases you can retrieve is 100, but if I am dealing with a repository with over 100, how can I still get a list of all of them? Example code below. import requests ACCESS_TOKEN = '<insert token>' headers = { 'Authorization': 'token ' + ACCESS_TOKEN, 'Accept': 'application/vnd.github.v3+json' } response = requests.get('https://api.github.com/repos/{insert author}/{insert repository}/releases?per_page=100', headers={'Authorization': 'token ' + ACCESS_TOKEN}) print(response.json())
Is there a way to get a list of all the releases in a GitHub repository?
Unless you want to store the data persistently I'd say you should probably just use an Array. Databases are more for persistent storage (i.e. stuff you'll need over multiple runs of your app). That said, if you arrays start getting reeeeeeeeeealy* big, then yea you're going to want to move them onto disk (in which case they won't take up any memory). And probably the simplest way to do that is with a database. *On the order of magnitude of hundreds of thousands of entrys, maybe even more.
So, I am developing an app that at some point needs to choose random types of words. For example, a button will be pressed and it needs to retrieve maybe two adjectives, a noun, and three verbs, randomly. I have started looking at how to set-up a SQ LITE database, but I'm starting to wonder, would it take up more memory and be slightly slower to set up this database or instead could I just set-up a few basic String arrays? Thank you for the help in advance!
Which would use more memory? Array vs SQLite (Android)
PodAntiAffinity has more to do with other pods than nodes specifically. That is, PodAntiAffinity specifies which nodes to exclude based on what pods are already scheduled on that node. And even here you can make it a requirement vs. just a preference. To directly pick the node on which a pod is/is not scheduled, you want to use NodeAffinity.The guide.ShareFollowansweredAug 29, 2018 at 17:14Grant David BachmanGrant David Bachman2,21833 gold badges2323 silver badges3232 bronze badgesAdd a comment|
I have added podAntiAffinity to my DeploymentConfig template.However, pods are being scheduled on nodes that I expected would be excluded by the rules.How can I view logs of the kubernetes scheduler to understand why it chose the node it did for a given pod?
How do I debug kubernetes scheduling?
You are not able to do this via service and have to use ingress controller, but look atTenzer workaround. I t contains good solution with an explanation how to preporly configure both service and nginx-configuration configmap.Alternativelly you can use your approach withhttps://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/tasks/ssl_redirect/or lokk intoKubernetes HTTP to HTTPS Redirect on AWS with ELB terminating SSLpost
Frankly am not quite sure of the difference between an EKS Service and an IngressController. I have this service:apiVersion: v1 kind: Service metadata: namespace: entity-tools-integration annotations: service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-west-2:913xxx371:certificate/d98d8d07 service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443" labels: app: entity-tools-integration name: entity-tools-integration spec: type: LoadBalancer ports: - name: http protocol: TCP port: 80 targetPort: 80 - name: https protocol: TCP port: 443 targetPort: 80 selector: app: entity-tools-integrationI just want to redirect http traffic on port 80 to https on 443 - my question - is there way to configure myserviceto do that, or do I need an ingress-controller? for an ingress controller (which I would like to avoid if possible) the relevant config is something like this:https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/tasks/ssl_redirect/
Use aws-load-balancer to redirect to 301 - or do I need an ingress-controller
You're right about the service accounts, this way your users don't need to login to check out files. The service account will act on the user's behalf depending on the API called. Do note that files accessed will be from the service account's set email.More information about Service Accounts can be found on the Drive'sDomain-wide delegation of Authority(though its Drive v2), or the Google Identity'sService Accountpage.
Hi my company needs to create an iOS app that sends secure data to our own cloud services, such as our Google Drive or some REST web services. What is the best practice that does not require user login?I came upon some technical articles mentioning about client certificate for authentication of the service account. Or using 2 legged OAuth 2.0 with a service account. Although I am not exactly sure how to implement them.So just wondering perhaps there are some best practices that I should use?
Best practice for Service Account accessing Cloud Services from iOS app without user login?
Unfortunately, latest Mac OS have put additional layer of security and can't be bypassed.But I found following workaround. Since I am not changing system, so following solution works for me.I have to give full access to program via:System Preferences -> Security & Privacy -> Privacy -> Full Disk Access -> Add Program.
I am trying to automate crontab addition in Mac Catalina 10.15.5 via command:echo -e "* * * * * \run.sh"|crontab -this command replicatescrontab -ecommand and adds the required crontab in the system.But it asks for permission which is not removable via automation.a. Sudo command requires user to enter password, which is again not possible to be automated.b. Tried creating a file and then adding it to crontab viacrontab filepath, but that also requires above elevation.
"Terminal" would like to administer your computer. Administration can include passwords
tiangolo/uvicorn-gunicorn-fastapi is based on uvicorn-gunicorn-docker image, which by defaults creates multiple workers. Excerpt from gunicorn_conf.py: default_web_concurrency = workers_per_core * cores Thus, the described situation arises because the request is processed by different workers (processes). Each of which has its own copy of the global variable Update: If you want to change the count of workers, use the following environment variables: WORKERS_PER_CORE: It will set the number of workers to the number of CPU cores multiplied by this value. MAX_WORKERS: You can use it to let the image compute the number of workers automatically but making sure it's limited to a maximum. WEB_CONCURRENCY Override the automatic definition of number of workers. You can set it like: docker run -d -p 80:80 -e WEB_CONCURRENCY="2" myimage A more detailed description of these variables and examples here If you want to share data between workers, pay attention to this topic.
I have a simple fastApi demo app which achieve a function: get different response json by calling a post api named changeResponse. The changeResponse api just changed a global variable, another api return different response through the same global variable.On local env,it works correctly, but the response always changed after i just call changeResponse once when i build this on docker.The code is as follows: from typing import Optional from fastapi import FastAPI from util import read_json import enum app = FastAPI() type = "00" @app.post("/changeResponse") async def handle_change_download_response(param:Optional[str]): global type type = param print("type is "+type) return {"success":"true"} @app.post("/download") async def handle_download(param:Optional[str]): print("get download param: "+param) if legalDownload(param): print("type is "+type) return read_json.readDownloadSuccessRes(type) else: return read_json.readDownloadFailRes() def legalDownload(data:str)->bool: return True the dockerfile is as follows: FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7 COPY ./app /app what i except: call changeResponse param is 7, get response for 7, call changeResponse param is 8, get response for 8. what i get: call changeResponse param is 7,get reponse for 7,call changeReponse 8, sometime the response is 7, sometime is 8,impossible to predict
python global variable in fastApi not working as normal
Your link is so-calledS3 presigned URLand their expirationcan't be disabled. But you can make it longer. Themaximumexpiration time is7 daysprovided the URL is created using IAM user. If you use IAM role or instance role to make the URLs the max times are 36 and 6 hours respectively.If these times are not satisfactory, you havethree generaloptions:modify your app so that it auto-refreshes expired links.don't use pre-sgined URLs. Instead make the s3 object public which never expire.again don't use pre-sgined URL, but instead of making your objects public, create CloudFront distribution toserver your objectsfrom the CF. This way your bucket and objects are private (not accessible directly), but through CF which can also improve load times of the files.
I use S3 for media file storage on my Django project.DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'From my iOS project I receive image URLs from Django likehttps://my-bucket.s3.amazonaws.com/image-name.jpg?AWSAccessKeyId=<AccesKey>&Signature=<Signiture>It seems the image URLs are expired after a while(and they probably should). However this causes a problem. When iOS app user left the app and came back after a while and the app memory was alive, the app tries to load images from expired urls(ex. cell reuse) resulting request error.I wonder what is a right solution for this.
Image URL django media file using AWS S3 expires after a while
Before you share logs which is critical you have misconfiguration: Nginx worker_connections 3000 Reason: keep it 2-3x more than actual active connections number Nginx worker_rlimit_nofile 20000. Reason: each single connection requires 2 file descriptors for serving request via proxying Nginx absence of location that serves static files straight from file system bypass backend. Reason: if you pass any static file via backend it reach the limit very quick Unicorn worker_processes 4. Reason: 4 workers are not enough to serve 1K RPM System: I guess there is lack of kernel optimisation. Take a look Unicorn System Kernel tips
Some requests to my site are failed with "Server unexpectedly dropped the connection" and there is no errors in error logs. RPM is 1-1.2k. Do you have any ideas? Here is configs of haproxy, nginx and unicorn: https://gist.github.com/releu/59b7f1d649c681856320
Dropped connections to server. Haproxy + Nginx + Unicorn
Meanwhile, I resolved the issue.The zmq interface in host A was trying to connect to Host B. And above error is observed in Host A.And this issue started occuring once after restarting HostB. And I could notice, there is an ip6table rule got added in HostB as part of its restart. This rule was doing "reject with admin prohibited" in INPUT and forward chain in HostB. (I have to search my notes for exact rule.)As part of this, zmq client in HostA was ending up in above mentioned crash. I believe crash (SIGABRT) should not be solution for hitting such rule in peer end. Since SIGABRT exception is unable to handle in code.
I am using zmqPUSHandPULLsockets. And recently started observing SIGABRT crash, inzmq_poll()operation.The error/exit log is "Permission denied (src/tcp_connecter.cpp:361)"(gdb) bt #0 0x00007ffff76d053f in raise () from /lib64/libc.so.6 #1 0x00007ffff76ba895 in abort () from /lib64/libc.so.6 #2 0x00007ffff7f59ace in zmq::zmq_abort(char const*) () from /lib64/libzmq.so.5 #3 0x00007ffff7f9ef36 in zmq::tcp_connecter_t::connect() () from /lib64/libzmq.so.5 #4 0x00007ffff7f9f060 in zmq::tcp_connecter_t::out_event() () from /lib64/libzmq.so.5 #5 0x00007ffff7f6bc2c in zmq::epoll_t::loop() () from /lib64/libzmq.so.5 #6 0x00007ffff7f9ffba in thread_routine () from /lib64/libzmq.so.5 #7 0x00007ffff75d058e in start_thread () from /lib64/libpthread.so.0 #8 0x00007ffff77956a3 in clone () from /lib64/libc.so.6Could anyone help me here ??Process is a part of a container running in Kubernates. And this issue started occuring suddenly. And couldn't be able to recover.Thanks,
Why a SIGABRT permission denied error appeared during a zmq_poll()?
I think a good approach is to use different strategies for different environments:nocompression fordevelopment(for developing & debugging)runtimecompression fortest environment(flexible, not performance-critical)buildtimecompression forstaging and production(tested, performance-critical)I have some experience using theYUI compressorfor both Javascript and CSS and have learned (the hard way) that testing minified JS and CSS is indeed very important.Creating static minified JS and CSS files as part of your build for production has the following benefits:they are testedstatic files, can be served without ASP.NET overheadcan be browser cachedshould be webserver-gzippedShareFollowansweredJun 22, 2009 at 11:57Josef PflegerJosef Pfleger74.3k1616 gold badges9797 silver badges9999 bronze badgesAdd a comment|
I have to come up with a solution to compress, version (for caching purposes) and potentially combine our JS and CSS files and I've seen two dominant approaches so far:1) At build time: As an MSBuild task or similar. 2) Dynamically at run time: As a custom HTTPHandler (we are ASP.NET btw) for .js and .css files, with something like this ending up in your pages:<link rel="stylesheet" type="text/css" href="~/StyleSheetHandler.ashx?stylesheets=~stylesheets/master.css" />Can anyone provide information of pro's and con's of each? Personally, I can't see the point of doing it dynamically and wasting CPU cycles at the time of each request (I guess you'd only do with the work first time and then cache, but still) but I get the feeling I might be missing something?Thanks! Mark.
CSS compression & combining / js minification - Better to do at runtime or at build time?
Rate limiting works first, on request phase. Caching works later, on content phase (guess). So, when limiter works, there is no information about cache status yet.
I want to impose a request limit for uncached content on my NGINX reverse proxy. I have multiple locations defined and content can get cached or won't get cached due to other rules. So I can not set a request limit just for a location, I have to handle this differently. According to the documentation in https://www.nginx.com/blog/rate-limiting-nginx/#Advanced-Configuration-Examples, I can use the map feature in order to impose a request limit. So I tried this and created following configuration snippet: map $upstream_cache_status $limit { default 1; MISS 1; HIT 0; } map $limit $limit_key { 0 ""; 1 $binary_remote_addr; } limit_req_zone $limit_key zone=req_zone:10m rate=5r/s; So in order to test my map first, I have added following to my location: add_header X-Test $limit; And I see that it works! Every resource that is cached ($upstream_cache_status = HIT), $limit seems to be 0. Every uncached content ($upstream_cache_status = MISS), $limit is 1. Now comes the weird behaviour. As soon as I add limit_req zone=req_zone burst=10 nodelay; into my location, $limit seems to be stuck at 1, no matter if the $upstream_cache_status is HIT or MISS. The location looks like this: location ~* \.(jpg|jpeg|png|gif|webp|svg|svgz|ico|pdf|doc|docx|xls|xlsx|csv|zip|gz|woff|woff2|ttf|otf|eot)$ { limit_req zone=req_zone burst=10 nodelay; [...] add_header X-Test $limit; [...] } Is this a NGINX bug or am I missing something here? NGINX version is 1.20.1 on AlmaLinux 8.5.
nginx - request limits for uncached content not working, weird behavior
You should pass the HTTP request OutputStream as an argument and write to it directly inside your read loop, instead of buffering the entire request as a StringBuilder in memory.
I have .zip file which I have to Base64 encode before uploading to the server. Given file can be up to 20 mb, which causes OutOfMemory exception. I use this code: public String encodeZipToBase64(File zip) { StringBuffer sb = new StringBuffer(); byte fileContent[] = new byte[1024]; try { FileInputStream fin = new FileInputStream(zip); while(fin.read(fileContent) >= 0) { sb.append(Base64.encodeToString(fileContent, Base64.DEFAULT)); //exception here } } catch(OutOfMemoryError e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return sb.toString(); } Exception occurs on appending to StringBuilder. What can I do to resolve it? Thanks!
Base64 encode file and OutOfMemory error
3 If your goal is to push data from AWS Lambda into Amazon Redshift, you could use the AWS Lambda Redshift Loader. See: A Zero-Administration Amazon Redshift Database Loader Share Improve this answer Follow answered May 25, 2016 at 17:11 John RotensteinJohn Rotenstein 254k2626 gold badges408408 silver badges497497 bronze badges Add a comment  | 
I am trying to create a Lambda function which will connect to RedShift : var pg = require('pg'); var conString = 'postgresql://username:Password@JDBC-URL'; var client = new pg.Client(conString); client.connect(function(err) { if(err) { console.log('could not connect to redshift', err); } }); pgClient.end(); But I am getting this exception : Unable to import module 'index': Error at Function.Module._resolve Filename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/var/task/index.js:1:72) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) Can someone please help me with this. Thanks.
Push data from aws lambda to redshift
1 Two issues pop out: the spark.shuffle.memoryFraction is set to 1. Why did you choose that instead of leaving the default 0.2 ? That may starve other non shuffle operations You only have 11G available to 16 cores. With only 11G I would set the number of workers in your job to no more than 3 - and initially (to get past the executors lost issue) just try 1. With 16 executors each one gets like 700mb - which then no surprise they are getting OOME / executor lost. Share Improve this answer Follow answered Nov 11, 2015 at 5:37 WestCoastProjectsWestCoastProjects 60.8k9696 gold badges331331 silver badges583583 bronze badges 15 Initially I got this following error :Missing an output location for shuffle 0. So I got to know I need to increase my shuffle memory fraction. Ok thanks for your suggestions. I will try and get back to you. – Renien Nov 11, 2015 at 5:45 still it fails - Spark: Executor Lost Failure – Renien Nov 11, 2015 at 7:02 when I go through the stack it shows : spark java.lang.OutOfMemoryError: Java heap space exception. I think because of this reason it's loosing the executors. Any suggestions ? – Renien Nov 11, 2015 at 7:13 I mentioned that in the answer to try a single executor. You don't have enough memory available to the cluster in general. – WestCoastProjects Nov 11, 2015 at 13:17 Yes, I tried it. Even with single executor same issue. – Renien Nov 11, 2015 at 17:26  |  Show 10 more comments
I’m trying to run Spark job on Yarn client. I have two nodes and each node has the following configurations. I’m getting “ExecutorLostFailure (executor 1 lost)”. I have tried most of the Spark tuning configuration. I have reduced to one executor lost because initially I got like 6 executor failures. These are my configuration (my spark-submit) : HADOOP_USER_NAME=hdfs spark-submit --class genkvs.CreateFieldMappings --master yarn-client --driver-memory 11g --executor-memory 11G --total-executor-cores 16 --num-executors 15 --conf "spark.executor.extraJavaOptions=-XX:+UseCompressedOops -XX:+PrintGCDetails -XX:+PrintGCTimeStamps" --conf spark.akka.frameSize=1000 --conf spark.shuffle.memoryFraction=1 --conf spark.rdd.compress=true --conf spark.core.connection.ack.wait.timeout=800 my-data/lookup_cache_spark-assembly-1.0-SNAPSHOT.jar -h hdfs://hdp-node-1.zone24x7.lk:8020 -p 800 My data size is 6GB and I’m doing a groupBy in my job. def process(in: RDD[(String, String, Int, String)]) = { in.groupBy(_._4) } I’m new to Spark, please help me to find my mistake. I’m struggling for at least a week now. Thank you very much in advance.
Spark: Executor Lost Failure (After adding groupBy job)
Matching everything like.*is very slow as well as using lookaround regular expressions.To query some field by regex (exemplary query):{ "query": { "regexp":{ "somefield": "_error_[123]00" } } }https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html#regexp-syntax
I'm trying to filter out 3 sensu check values for templating.I'm using Elasticsearch as a datasourceQuery: {"find": "terms","field":"check_name.keyword"} Regex: /.*_error_100.*|.*_error_200.*|.*_error_300.*/Is my regex wrong?Thank you Devon
How do I grab multiple values in regex?
15 what works for me in these cases: sudo systemctl restart docker.socket docker.service sudo docker image rm -f $(sudo docker image ls -q) Share Improve this answer Follow answered Nov 7, 2022 at 14:34 danvitorianodanvitoriano 1,2411111 silver badges1313 bronze badges 1 It seems removing the containers is sufficient - no need to remove the images: sudo systemctl restart docker.socket docker.service; sudo docker rm $(sudo docker ps -a -q) -f – valiano Jan 30 at 10:38 Add a comment  | 
I'm trying to kill a docker container, but I got permission denied. I use Ubuntu 20.04, my docker version for client is 20.10.7 and the one for the server is 20.10.11. This is the log I got: Error response from daemon: Cannot kill container: fastapi_server: permission denied I read that I should use this comand for restarting docker. sudo systemctl restart docker.socket docker.service But the thing is that when I execute this command, all my containers and images dissapear, but If I try on localhost:8000 my port is occupied by the container that I wanted to delete. And if I run sudo netstat -anp | grep 8000, I get: tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 2493/docker-proxy tcp6 0 0 :::8000 :::* LISTEN 2500/docker-proxy So this confirms that my port is already taken by a docker container, but when I run docker ps -a, I get no container. I also tried docker kill, but it did not work. How should I kill this container & get my 8000 port free?
Error response from daemon: Cannot kill container: permission denied, how to kill docker containers on Ubuntu 20.04?
Since adata.frameis already a list and you know that each list element is the same length (X), the fastest thing would probably be to just update theclassandrow.namesattributes:set.seed(21) n <- 1e6 x <- list(x=rnorm(n), y=rnorm(n), z=rnorm(n)) x <- c(x,x,x,x,x,x) system.time(a <- as.data.frame(x)) system.time(b <- do.call(data.frame,x)) system.time({ d <- x # Skip 'c' so Joris doesn't down-vote me! ;-) class(d) <- "data.frame" rownames(d) <- 1:n names(d) <- make.unique(names(d)) }) identical(a, b) # TRUE identical(b, d) # TRUEUpdate- this is ~2x faster than creatingd:system.time({ e <- x attr(e, "row.names") <- c(NA_integer_,n) attr(e, "class") <- "data.frame" attr(e, "names") <- make.names(names(e), unique=TRUE) }) identical(d, e) # TRUEUpdate 2- I forgot about memory consumption. The last update makes two copies ofe. Using theattributesfunction reduces that to only one copy.set.seed(21) f <- list(x=rnorm(n), y=rnorm(n), z=rnorm(n)) f <- c(f,f,f,f,f,f) tracemem(f) system.time({ # makes 2 copies attr(f, "row.names") <- c(NA_integer_,n) attr(f, "class") <- "data.frame" attr(f, "names") <- make.names(names(f), unique=TRUE) }) set.seed(21) g <- list(x=rnorm(n), y=rnorm(n), z=rnorm(n)) g <- c(g,g,g,g,g,g) tracemem(g) system.time({ # only makes 1 copy attributes(g) <- list(row.names=c(NA_integer_,n), class="data.frame", names=make.names(names(g), unique=TRUE)) }) identical(f,g) # TRUE
Just had a conversation with coworkers about this, and we thought it'd be worth seeing what people out in SO land had to say. Suppose I had a list with N elements, where each element was a vector of length X. Now suppose I wanted to transform that into a data.frame. As with most things in R, there are multiple ways of skinning the proverbial cat, such asas.dataframe, using the plyr package, comboingdo.callwithcbind, pre-allocating the DF and filling it in, and others.The problem that was presented was what happens when either N or X (in our case it is X) becomes extremely large. Is there one cat skinning method that's notably superior when efficiency (particularly in terms of memory) is of the essence?
Most efficient list to data.frame method?
Mod_JK usages AJP protocol to connect Apache and backend Tomcat server. You can not use SSL connector in between Apache and tomcat, so Apache certificate is not required at the tomcat level. If you want to use mod_jk application in SSL VirtualHost then simply add JKMount in SSL VirtualHost.
I am trying to move my application from HTTP to HTTPS using SSL certificates. I have configured my Apache httpd conf. file to listen to HTTPS port along with the path where my certificates are placed.Now my HTTPD process is running fine. I am trying to connect my tomcat server using mod_jk connector. So should I have to mention the same SSL certificates which I configured in Apache httpd conf. to tomcat APR connector in server.xml in order to achieve secure connectivity between them?Can anyone help me to clear my doubts?Thanks, Anshu
SSL certificates configuration query for tomcat APR connector
If you just want to redirect/%E2%80%A6crabble-word-finderinto/scrabble-word-finder/then you can simply try this.htaccesscode:RewriteEngine on RewriteRule ^%E2%80%A6crabble-word-finder/?$ /scrabble-word-finder/ [R]Just considered the[R=301]flag with this link:https://stackoverflow.com/a/15999177/2007055
I have a link in my Google Webmaster Tools that is coming from a big website that posted my link incorrectly. With many attempts to get them to change it I am going to 301 the link to the right page because I want that link. Problem is that in my GWT it is showing the link ashttp://www.otherdomain.com/%E2%80%A6crabble-word-finderIf you put your mouse over the link it looks likehttp://www.otherdomain.com/...crabble-word-finderI tried in my htaccess file which didn't workRedirect 301 /...crabble-word-finder http://www.mydomain.com/scrabble-word-finder/ANDRedirect 301 /%E2%80%A6crabble-word-finder http://www.mydomain.com/scrabble-word-finder/Any idea how to get this redirect to work?
Trying to Redirect 301 %E2%80%A6 in htaccess file
There are couple of ways:First:Simply go to the respective folder (eg:E:\xampp\htdocs\composerTest) in command prompt and write:composer require "kronusme/dota2-api:*"Which will download the latest versions of dota1-api in the respective path you have provided. And this is probably the easiest way.Second:Save following things on composer.json file within the respective folder(eg:E:\xampp\htdocs\composerTest){ "require": { "kronusme/dota2-api": "2.2.1" } }And now just go to respective location from Command prompt and write:composer installThis will also download the file into the path you have provided.
Hi I just want to ask how would i install something i found in github that requires composer installation to cakephp? i already installed composer and (i think) it's working though i havent tested it because i don't know how. But basically my question is how i would use this ..{ "require": { "kronusme/dota2-api": "2.2.1" } }to install that repo to my project? i mean where should i type that or something. sorry if this is a very basic question. thanks for the answer!
GitHub - Composer Installation to Cakephp
If you refer to yourConfigMapin yourPodthis way:apiVersion: v1 kind: Pod metadata: name: mypod spec: containers: - name: myfrontend image: nginx volumeMounts: - mountPath: "/var/www/html" name: config-volume volumes: - name: config-volume configMap: name: some-configit will be available in yourPodas a file/var/www/html/key4with the content ofvalue1.If you rather want it to be available as anenvironment variableyou need to refer to it this way:apiVersion: v1 kind: Pod metadata: name: mypod spec: containers: - name: myfrontend image: nginx envFrom: - configMapRef: name: some-configAs you can see you don't need for it any volumes and volume mounts.Once you connect to suchPodby running:kubectl exec -ti mypod -- /bin/bashYou will see that your environment variable is defined:root@mypod:/# echo $key4 value1
I created configmap this way.kubectl create configmap some-config --from-literal=key4=value1After that i created pod which looks like this.I connect to this pod this wayk exec -it nginx-configmap -- /bin/shI found the folder/some/pathbut i could get value from key4.
Get value of configMap from mountPath
Missing Entropy Docker does not provide a virtual /dev/[u]random devices. If you haven't got enough entropy in the container, you haven't got enough entropy on the host. Check the contents of /proc/sys/kernel/random/entropy_avail, they should be pretty much the same on both the Docker host and container (if the number is slightly different, it just changes very frequently, otherwise recheck a few times). Possible reasons: Running the docker host in a virtual machine, for example because of boot2docker or a self-constructed virtual machine. Just make sure to get more entropy inside your virtual machine, havegd is a very easy solution for a developer machine, but might not be appropriate for production. Another container/application is using up all entropy. Realize which one and interrupt/terminate it, or generate more entropy. You're generally not having enough entropy. Do some work (mouse/keyboard movements, (hard) disk I/O). Externally Generating a Key Pair Anyway, it might be more reasonable to generate a key on a real machine, and only move a (private) subkey to the server. This way, you can exchange the subkey every now and then (and in case it was compromised). Read What is a good general purpose GnuPG key setup? for an introduction to different things to consider while setting up OpenPGP keys. While building the Docker image, use COPY to get the file into the machine, and then gpg --import it in the Dockerfile. Afterwards, it is available exactly the same way it would've been if you generated it inside the container using gpg --gen-key.
I need to dockerize an apt repository. The packages in it need to be signed, which is currently done by aptly publish snapshot -distribution="stable" -gpg-key="<key id>" my-snapshot Before that a key needs to be created using gpg --gen-key. But this way the private key will be crated inside the docker image, which doesn't seem to be a good practice. Besides, id doesn't even work; running gpg --gen-key --batch <gpg.in gets stuck: Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need 284 more bytes) I don't know if it's even possible to generate a gpg key inside a docker container, and even if it is, it may not be a good idea. Is there a way to sign the contents of the repo by an external key?
How to use GnuPG inside Docker containers, as it is missing entropy?
4 Windows do not allow the usage of : or \ in the filename as they are reserved keywords for windows. In your case : needs to be removed from the file name and it should work fine. Share Follow answered Jul 3, 2019 at 15:21 Akash TomarAkash Tomar 97011 gold badge1111 silver badges2323 bronze badges 1 Thank you very much I never knew stuff like this, But well we learn everyday. Any other special character I should beware of? – saas_joel Jul 5, 2019 at 0:02 Add a comment  | 
Trying to clone a repo to another local machine, but it keeps failing at a particular point (a folder). I want to clone a remote repo I have been working on in my other machine (Linux) into my windows machine (I dual boot) because I ran into some microphone problems in linux and the coding challenge is speech to text. I have tried again and again, but it keeps failing at a folder I titled 'Day 13' git clone "https://github.com/stealthman22/My-JavaScript30-Challenge.git" As always I expected a smooth cloning so i can begin working, but here is what I keep getting C:\Users\user\Documents>git clone "https://github.com/stealthman22/My-JavaScript30-Challenge.git" Cloning into 'My-JavaScript30-Challenge'... remote: Enumerating objects: 157, done. remote: Counting objects: 100% (157/157), done. remote: Compressing objects: 100% (140/140), done. Receiving objects: 68% (107/remote: Total 157 (delta 36), reused 132 (delta 14), pack-reused Receiving objects: 71% (112/157), 45.15 MiB | 118.00 KiB/s Receiving objects: 100% (157/157), 45.16 MiB | 69.00 KiB/s, done. Resolving deltas: 100% (36/36), done. fatal: cannot create directory at 'Day 13: Slide in on scroll': Invalid argument warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status' and retry the checkout with 'git checkout -f HEAD'
How do I bypass or repair this git clone error?
One of the major points of release branches is to allow for minor bug fixes. So while the release branch is active, you can make fixes directly on the release branch. After the release branch is finished, i.e. the release has been made, it is merged to master. After that commits should no longer be added to the release branch. Rather, urgent bugfixes done after a release are hotfixes, and should be merged to master. (Non-urgent bugfixes can be created as features, merged to the develop branch and released later) Conceptually the release branch is "dead" after the release has been made. Only master and develop branches live on continuously. You are of course free to have a different process, but then you are not strictly following the git-flow model.
In our project we are following repo model as per http://nvie.com/posts/a-successful-git-branching-model/ . I had been adding features into the develop branch until now, however now our project has created a release branch and I need to add a fix on that release branch. From what I have read , adding a hotfix will add the fix to my master branch and not the release branch. So how do I add a fix on my release branch ?
How to do add a fix in the release branch using git flow / hubflow
HttpResponse.RemoveOutputCacheItem?
Is it possible to clear one action's cache from another action? Let's say my Index action lists all my Widgets. There are lots of Widgets but new ones are not created very often. So I want to cache my Index action indefinitely but force it to render after a successful Create. public class WidgetController : Controller { [OutputCache(Duration = int.MaxValue, VaryByParam = "none")] public ActionResult Index() { return View(Widget.AllWidgets); } public ActionResult Create() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(string name) { Widget widget = new Widget(name); // Can I clear Index's cache at this point? // ClearCache("Index"); return View(widget); } }
ASP.NET MVC: Clear an action's cache from another action
As other people have pointed out, you can't do this in PHP (well, you can create an array of fixed length, but that's not really want you need). What you can do however is increase the amount of memory for the process. ini_set('memory_limit', '1024M'); Put that at the top of your PHP script and you should be ok. You can also set this in the php.ini file. This does not allocate 1GB of memory to PHP, but rather allows PHP to expand it's memory usage up to that point. A couple of things to point out though: This might not be allowed on some shared hosts If you're using this much memory, you might need to have a look at how you're doing things and see if they can be done more efficiently Look out for opportunities to clear out unneeded resources (do you really need to keep hold of $x that contains a huge object you've already used?) using unset($x);
How do I pre-allocate memory for an array in PHP? I want to pre-allocate space for 351k longs. The function works when I don't use the array, but if I try to save long values in the array, then it fails. If I try a simple test loop to fill up 351k values with a range(), it works. I suspect that the array is causing memory fragmentation and then running out of memory. In Java, I can use ArrayList al = new ArrayList(351000);. I saw array_fill and array_pad but those initialize the array to specific values. Solution: I used a combination of answers. Kevin's answer worked alone, but I was hoping to prevent problems in the future too as the size grows. ini_set('memory_limit','512M'); $foundAdIds = new \SplFixedArray(100000); # google doesn't return deleted ads. must keep track and assume everything else was deleted. $foundAdIdsIndex = 0; // $foundAdIds = array(); $result = $gaw->getAds(function ($googleAd) use ($adTemplates, &$foundAdIds, &$foundAdIdsIndex) { // use call back to avoid saving in memory if ($foundAdIdsIndex >= $foundAdIds->count()) $foundAdIds->setSize( $foundAdIds->count() * 1.10 ); // grow the array $foundAdIds[$foundAdIdsIndex++] = $googleAd->ad->id; # save ids to know which to not set deleted // $foundAdIds[] = $googleAd->ad->id;
How do I pre-allocate memory for an array in PHP?
The URL is nowhttps://github.com/someuser?tab=overview, and its presentation just changed (August 2018)See "Profile activity overview":A new beta section is available on your GitHub Profile: the “Activity Overview”.The “Activity Overview” provides a summary and graphical representation of your contributions to GitHub over time. It’s a fun new way of exploring your contributions and showing them off to others.Additionally, you can filter your contributions by organization.You can enable the “Activity Overview” in the Contribution Settings menu above your contribution calendar.
Previously, GitHub had a site layout where you could go to a user's profile, e.g.https://github.com/someuser, and then click on an 'Public activity' tab in the top right. This would send you to a URL of the formhttps://github.com/someuser?tab=activityto see their recent activity.However, GitHub has recently revamped their UI as ofGitHub Universe 2016. After this change, it looks like user's profile no longer includes a 'Public activity' tab. Even appending?tab=activityto the URL manually does nothing. However, the relevant data is still being returned by GitHub's API, for examplehttps://api.github.com/users/jamesqo/events.Is still there a way to view a user's recent activity after this change? Thanks.
How to see a user's recent activity with the new GitHub website?
You need to include the header definingclass Innerinto the file whereCont::~Cont()implementation is located. This way you still have a forward declaration in teh header definingclass Contand the compiler seesclass Innerdefinition and can call the destructor.//Cont.h class Inner; // is defined in Inner.h class Cont { virtual ~Cont(); std::auto_ptr<Inner> m_inner; }; // Cont.cpp #include <Cont.h> #include <Inner.h> Cont::~Cont() { }
I have a class like this:class Inner; class Cont { public: Cont(); virtual ~Cont(); private: Inner* m_inner; };in the .cpp, the constructor creates an instance ofInnerwithnewand the destructordeletes it. This is working pretty well.Now I want to change this code to useauto_ptrso I write:class Inner; class Cont { public: Cont(); virtual ~Cont(); private: std::auto_ptr<Inner> m_inner; };Now, the constructor initialized theauto_ptrand the destructor does nothing.But it doesn't work. the problem seem to arise when I'm instantiating this class. I get this warning:warning C4150: deletion of pointer to incomplete type 'Inner'; no destructor calledWell, this is obviously very bad and I understand why it happens, The compiler doesn't know about the d'tor ofInnerwhen instantiating the template ofauto_ptr<Inner>So my question: Is there a way to useauto_ptrwith a forward declaration like I did in the version that uses just plain pointers?Having to#includeevery class I declare a pointer to is a huge hassle and at times, just impossible. How is this problem usually handled?
C++: auto_ptr + forward declaration?
4 There are two potential solutions. Change the environment file by replacing all double quotes with single quotes and by wrapping these environment variables with a double quote (example - works with V2 as well as V1.x) Disable Docker Compose V2 in Docker Preferences > General > Uncheck "Use Docker Compose V2" or by running the command docker-compose disable-v2 Share Improve this answer Follow answered Nov 4, 2021 at 10:43 JansonJanson 10366 bronze badges 1 Solution 2 does not work unknown docker command: "compose disable-v2" – Dimitri Kopriwa Dec 27, 2022 at 23:45 Add a comment  | 
Docker Compose V2 has breaking changes due to which it throws an error (example given below), while parsing environment file. Example - Apache Druid Druid's docker compose fails with the below error when using the sample environment file. unexpected character "\"" in variable name near "\"druid-datasketches\"
Docker Compose V2 breaking changes - environment file handling issue
Not super easy, but you can do it by formatting the output fromdocker inspect. For a container started with this command:> docker run -d -v ~:/home -p 8080:80 -e NEW_VAR=x --name web3 nginx:alpine sleep 10mYou can pull out the volumes, port mapping, environment variables, container name, image name and command with:> docker inspect -f "V: {{.Mounts}} P: {{.HostConfig.PortBindings}} E:{{.Config.Env}} NAME: {{.Name }} IMAGE: {{.Config.Image}} COMMAND: {{.Path}} {{.Args}}" web3That gives you the output:V: [{ /home/scrapbook /home true rprivate}] P: map[80/tcp:[{ 8080}]] E:[NEW_VAR=x PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NGINX_VERSION=1.11.5] NAME: /web3 IMAGE: nginx:alpine COMMAND: sleep [10m]Which is a start.Docker CaptainAdrian Mouathas an excellent blog post on formatting the output:Docker Inspect Template Magic.
What's the best way to reconstructdocker runcommand parameters from existing docker container? I could usedocker inspectand use the info found there. Is there any better way?
Reconstruct docker run command parameters from container
It turn out that the answer was in one of the comments from , but it was not clear that this was my issue. As the author of the comment stated is due to the iptables policies from Docker versions > 1.13. To solve it, execute the following on both nodes: sudo iptables -A FORWARD -i cni0 -j ACCEPT sudo iptables -A FORWARD -o cni0 -j ACCEPT
I deploy a kubernetes cluster following the guide: https://blog.hypriot.com/post/setup-kubernetes-raspberry-pi-cluster/. It basically uses hypriotOS and kubernetes from the debian repository. After the deployment, all the pods were running and no faults were shown. However, the dns server was not working properly on the worker node. master $ kubectl -n kube-system get svc NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE kube-dns 10.96.0.10 <none> 53/UDP,53/TCP 34m kubernetes-dashboard 10.103.97.112 <nodes> 80:30518/TCP 31m # I installed the dnsutils to have the dig command $ dig @10.96.0.10 || echo "FAIL" # shows a valid response (note that we are not resolving anything) worker $ dig @10.96.0.10 || echo "FAIL" .... FAIL
kube-dns not working on kubernetes arm
I can't speak for CUDArt, but here is what finalize means in Julia: when the garbage collector detects that the program can no longer access the object, then it will run the finalizer, and then collect (free) the object. Note that the garbage collector can still access the object, even though the program cannot. Here is an example: julia> type X a end julia> j = X(1) # create new X(1) object, accessible as j julia> finalizer(j, println) # print the object when it's finalized julia> gc() # suggest garbage collection; nothing happens julia> j = 0 # now the original object is no longer accessible by the program julia> gc() # suggest carbage collection X(1) # object was collected... and finalizer was run This is useful so that external resources (such as file handles or malloced memory) are freed if an object is collected.
I am currently working with the CUDArt package. The GitHub documentation includes the following snippet of code when loading a ptx module containing a custom CUDA C kernel: md = CuModule("mycudamodule.ptx", false) # false means it will not be automatically finalized (comment in original) I am trying to understand what exactly this false option for finalizing means and when I would / would not want to use it. I came across this post on SO (What is the right way to write a module finalize method in Julia?). It quotes from Julia documentation as: finalizer(x, function) Register a function f(x) to be called when there are no program-accessible references to x. The behavior of this function is unpredictable if x is of a bits type. I don't really understand what this means though, or even whether the finalizing here is the same as that referred to in the CUDArt example. For example, it doesn't make sense to me to try to call a function on an argument x when that argument isn't accessible to the program - how could this even be possible? Thus, I would appreciate any help in clarifying: What it means to "finalize" in Julia and When I would/would not want to use it in the context of importing .ptx modules with CUDArt
What does it mean to "finalize" in Julia?
It depends on the repository's community workflow and maintainers. Some may ask that you rebase onto or merge with a more recent commit, some may handle it themselves, etc. But if you submit the pull request, this conversation should take place anyways, along with any other necessary modifications. So, to answer your question: you can always submit a pull request - it is up to the powers that be whether it is accepted.
I am working on a repo that sees a lot of action on a daily basis. What I am working on will require me to spend a few weeks on. Also the changes I'm introducing will in no way interfere with what's already in the repo - this will be a whole separate folder on the base level. I've created a branch and worked on my stuff in that branch. Is there any way for me to submit my work without having to pull and merge hundreds of other commits that will happen from other people working on the repo, since my changes will have nothing to do with theirs?
Github push changes that do not affect current repo status
Like FakeRainBrigand suggested, you can just save the html. However, one neat thing about react is that every component is represented with state/props. This means if you suitably represent your UI with those fields, you should be able to reproduce your page given the same state/props.This could possibly mean that if you stored the state/props somehow, and loaded it back up, you could effectively "cache" the components for later, and very cheaply at that. I'm thinking something similar to this below:componentDidMount: function () { if(this.props.id) { provider.load(this.props.id, function (result) { this.setState(result); }); } }
Is there any open source code or examples that try to do caching of rendered React components on memcached or something simillar? Anyone that has already dealt with this?
React caching rendered components
This becomes because the script hasn't run from git repository root, you need to specify correct git repository path, directly inphpcode:<?php shell_exec('git --work-tree=/full/path/to/git/repo --git-dir=/full/path/to/git/repo/.git pull'); ?>NOTE:for bare repository you shell to pass only--git-dirkey value.
I'm configuring a github web hook to call the below page:github.php:<?php shell_exec('git pull'); ?>I havechmod 777the file and evenchmod +xit. When I callphp github.phpfrom the server everything is good:remote: Counting objects: 5, done. remote: Compressing objects: 100% (1/1), done. remote: Total 3 (delta 2), reused 3 (delta 2) Unpacking objects: 100% (3/3), done. From https://github.com/mynameise/Octo afadfb8..1ad3b76 master -> origin/masterBut when I try to contact the page it from the outside world using http nothing happens. Also I get no errors in my log file. what is going on?
"git pull" not working from the outside world
0 I have this code below and the leaks application is saying 100% of the leak is from this line of code. It doesn't mean the leak is there mate. Share Improve this answer Follow edited Jul 26, 2011 at 16:38 rid 62.1k3131 gold badges154154 silver badges195195 bronze badges answered Jul 26, 2011 at 16:37 Rui PeresRui Peres 25.8k99 gold badges8989 silver badges139139 bronze badges Add a comment  | 
I have this code below and the leaks application is saying 100% of the leak is from this line of code. const unsigned char *value = sqlite3_column_text(statement, number); if(value) return [NSString stringWithUTF8String:(char *)value]; //100% return nil; Can someone offer some insight on how to fix this.
IOS memory leak from NSString
I am getting same errors on Pro M1. My app ruby version is 3.1.2, default MAC system verison is 2.6.8 I have add to~/.bash_profilefile this content:export RBENV_ROOT="${HOME}/.rbenv" if [ -d "${RBENV_ROOT}" ]; then export PATH="${RBENV_ROOT}/bin:${PATH}" eval "$(rbenv init -)" fiAnd then run. ~/.bash_profile.Add this line toschedule.rb:env :PATH, ENV["PATH"]=> Don't forget update crontab with:whenever --update-crontab --set environment='development'Crontab is working with rbenv.Refs:https://blog.eq8.eu/article/cronntab-rbenv-bundle-exec-rake-task.html
I wanted to set a cron tab which would execute a task located in my Rails app. In my config/schedule.rb:every 2.minutes do #do something endDespite putting this task successfully into my cron jobs list it never gets executed. When I try to manually launch the script saved in my cron jobs list, that is:/bin/bash -l -c 'cd /Users/me/Desktop/railsapp && RAILS_ENV=production bundle exec rake reports:fetch --silent'I get error about wrong Ruby version:Your Ruby version is 2.6.3, but your Gemfile specified 2.6.6I use rbenv and both my local and global versions are set to 2.6.6. Furthermore version 2.6.3 is not even present on the list of available ones.How can I change this version to proper one and make my cron jobs executable?
Cron tabs cannot find proper Ruby version via Whenever gem
Each repository is owned by a single individual or organization account. If you store your repository under your personal account, you would be the owner and your colleague can be made a collaborator. In this case, like you mention, the repository would be listed only in your account's repository list. To give equal "credit" to your collaborator, you could do one of the following:Pin the repository: Your collaborator can pin any repository they contributed to to their profile page. While the repository would still appear under your name, it will be prominently visible on your collaborator's profile.Create an organization: You could create an organization where both of you are owners. The repository will then appear in neither of your individual profiles, and both your individual accounts can be publicly listed as members of the organization.ShareFollowansweredMar 17, 2020 at 16:44GoodDeedsGoodDeeds8,24655 gold badges3535 silver badges6363 bronze badgesAdd a comment|
I created a repository and added a contributor, and this was our mutual work. In my GitHub account it appears as a repository and in his account is does not.We want that his account will have this exact same repository as shown in my repos.How can we do it? :)
GitHub repository as contributor
Define the path relative to the auto-prepend file itsef.init.phpdefine('WEBROOT', __DIR__);You should then be able to useWEBROOTwherever in your application. Or if you want to stick to your current approach:$_SERVER['WEB_ROOT'] = __DIR__;Just curious. Why not just use$_SERVER['DOCUMENT_ROOT']. Doesn't that refer to your web root?
I would like to prepend a PHP script automatically using.htaccess. I know that there is a directive to do this. I have the following in my.htaccessfile in the web root directory:php_value auto_prepend_file "./init.php"The contents of theinit.phpfile include:<?php $_SERVER['WEB_ROOT']= str_replace($_SERVER['SCRIPT_NAME'],'', $_SERVER['SCRIPT_FILENAME']);This calculates the path of the web root and puts it into the superglobal. It is the only practical way I can think of keep track of the web root for things like includes.The problem is that this only works for for PHP scripts also in the web root. If the script itself is in a sub directory I get an error, because theinit.phpfile is not in the current directory. Idon’twant to specify an absolute path toinit.phpbecause the current is a bit volatile at the moment.I can think of 2 solutions:include a.htaccessfile in the sub directories pointing to the parent directory using a relative path (../init.php)include ainit.phpfile in all of the subdirectoriesIs there another way to specify a prepended file which works for all subdirectories?Failing that, is there another way to put the web root into a superglobal without this nonsense?
PHP & .htaccess: prepend file for Multiple Directories
It is worded a little confusingly butMaximumBatchingWindowInSecondsis not compatible with FIFO queues.FIFO max batch size is 10 and the sentence that references theMaximumBatchingWindowInSecondssetting talks about batch sizes >10 which do not apply to FIFO queues.Just remove theMaximumBatchingWindowInSecondsand it should work.
Documentation says maximumBatchingWindowInSeconds is now supported and that:For a FIFO queue the maximum is 10. For a batch size over 10, you must also set the MaximumBatchingWindowInSeconds parameter to at least 1 second.However, I'm getting: "Invalid request provided: Batching window is not supported for FIFO queues" when trying to create an event source mapping.So is it supported or not and if it is how do I enable it?I need a FIFO Queue with a larger than 10 batch size.I'm using AWS CDK to create the resource stack. My EventSourceMapping looks like this:const cfnEventSourceMapping = new CfnEventSourceMapping(this, 'Auth0ImportQEventSourceMapping', { batchSize: 10, enabled: true, eventSourceArn: auth0ImportQ.queueArn, functionName: auth0ImportLambda.functionName, maximumBatchingWindowInSeconds: 10, });
AWS SQS FIFO Queue event source, is maximumBatchingWindowInSeconds supported?
Your question is a bit hard to understand. So here are two answers:You want onlydomain1to end up in the template variable:label_values(my_metric{my_label="domain1"}, my_label)I cannot imagine a reason why you would want this. So I assume you actually want to filter your dashboard / panels for this specific domain.You want to filter dashboard / panels for a specific domain:label_values(my_metric_that_has_label_with_all_domains, domain_label_name)Don't forget to set update on time range change.Now in a panel you can use the variable like this:rate(mymetric{domain_label_name=~"$cluster"}[5m])Examplary usage
So I have agrafanadashboard and I need to filter out some labels. So I am usinglabel_valuesfunction.My data source isprometheusSo, to thislabel_valuesfunction, i am passing a variabledomain_nameand it produces 3 results as:domain1 domain2 domain3But I need to only filter and get thedomain1, sodomain2anddomain3are removed.So I tried these and it says expressions are invalid.// 1 method, gives invalid expression error label_values(domain_name)[0] // 2 method, gives invalid expression error label_values(domain_name[0])So How can I do this?Here attached a screenshot as well.
How to filter using Grafana queries
If you want to automate the process, use AWS SDK.Like in following case use AWS PHP SDK:use Aws\Common\Aws; $aws = Aws::factory('/path/to/your/config.php'); $s3 = $aws->get('S3'); $s3->putObject(array( 'Bucket' => 'your-bucket-name', 'Key' => 'your-object-key', 'SourceFile' => '/path/to/your/file.ext' ));More details:http://blogs.aws.amazon.com/php/post/Tx9BDFNDYYU4VF/Transferring-Files-To-and-From-Amazon-S3http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-s3.htmlShareFollowansweredApr 17, 2014 at 2:00SumoanandSumoanand8,88133 gold badges4848 silver badges4646 bronze badgesAdd a comment|
I have about 15 gigs of data in 5 files that I need to transfer to an Amazon S3 bucket, they are currently hosted on a remote server that I have no scripting or shell access to - I can only download them VIA an httpd link.How can I transfer these files to my Amazon S3 bucket without first having to download them to my local machine then re-upload them to S3?
How to transfer files from a remote server to my Amazon S3 instance?
I had the same problem, that "some other IP" is the IP your machine has been assigned connecting with your VPN connection. If you set your Tomcat server to host applications from that IP which is the "Host name" under the Tomcat general information section (double clicking on the server in Eclipse displays this info) everything should work OK. It worked for me anyway.
Whenever I get connected to VPN, I have observed that my localhost becomes in-accessible.I have a local tomcat server and I want to execute my web application on this tomcat server, while being connected with VPN.However, doing so, the browser redirects the localhost to some other IP.Please help
Localhost not accessible with VPN
27 The only way I could fix this was by opening a powershell and switching daemons: & 'C:\Program Files\Docker\Docker\DockerCLI.exe' -SwitchDaemon Share Follow answered Apr 14, 2021 at 12:36 Mike CheelMike Cheel 12.9k1010 gold badges7575 silver badges103103 bronze badges 8 2 Congrats! You save my day – Sergio Gandrus Apr 19, 2021 at 7:29 The problem is that you must do this every time you want to use Docker Desktop. And today I can't see the link to my Ubuntu installation. Docker on Windows is a real pain. – Sergio Gandrus Apr 20, 2021 at 7:15 This i started facing after recent update came. But this command really worked, Thanks a lot. Could you please add little detail on what this command actually does and why we need to do this ? – Tushar Seth Apr 27, 2021 at 9:43 That solution worked for me. What causes this? I had a running daemon, what daemon am I switching to? – Woodsman May 27, 2021 at 20:16 1 This solution worked for me. But note, I could not see my docker images after running the switch command the first time. After repeating this command again, I could see my old docker images. As @MikeCheel mentioned, running this command may have changed the daemon to Windows one and in my case it had no docker images and running this command the second time switches it back to the Linux one and I could see my previous docker images. – vjgn Jun 4, 2021 at 23:36  |  Show 3 more comments
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered. Closed 2 years ago. Improve this question I have installed Docker desktop for Windows (docker 19.0.3 on windows 10). While I go to settings it hangs with status updating and never comes back. I have tried uninstalling and installing but doesnt help. Hyper-V and Container features are switched on in windows 10. Kindly help me in knowing what exactly might be wrong with this ?
Docker for windows hangs while trying to see settings [closed]
Answer to the first part of the question is Yes. Chromecast uses a PKI to secure communication. When Chromecast receiver app makes a secure http request (HTTPS/TLS), it is encrypted with a chromecast specific private key certificate (Which leads to Google). A server can use google's public key to decrypt the message and also extract information from the certificate if needed. This also means that you may not want to terminate the TLS on a load balancer and instead need the app server to do that. App server can store the google's public key and use it to decrypt it. There is a document which gives the details on how to decrypt and parse the certificate and what it has. I think if you have a developer account, you can get it.
As I need to restrict webserver content to chromecast devices, I was hoping that chromecast devices have a certificate bundle, which can be used for authentication. The Chromecast documentation does not really state anything with regards to certificates.So , my questions is does Chromecast come with a certificate bundle allowing the webserver to verify the client. iOS devices have sach a private/public certificate bundle, client verification/authentifcation using the public iOS certificate (.pem file).The following snippet is part of a apache server configuration, I was hoping to extend this with Chromecast.<Location /ios-hls-key> HLSEncryptHostCipherKey true HLSFmsDirPath ".." HLSEncryptKeyRepository "../media" SSLVerifyClient require SSLRequireSSL SSLRequire %{SSL_CLIENT_S_DN_CN} eq "iPhoneOS Device Certificate" </Location>Anybody, knows or have any other ideas on how to limit webserver content to only chromecast devices?
Does Chromecast come with a certificate bundle allowing simple webserver authentication/verification?
So apparently I missed an important restriction of the appcache. As mentioned inhttps://www.w3.org/TR/2011/WD-html5-20110525/offline.html:If the manifest's is https: or another scheme intended for encrypted data transfer, then all URLs in explicit sections must have the same origin as the manifest itself.
I have been trying to get my HTML5 offline cache manifest to work nicely in Safari when accessing the site with HTTPS.I have the following setup:index.html:<!doctype html> <html lang="en" dir="ltr" manifest="app.appcache"> <head> <base href="https://www.example.com"> <link rel="stylesheet" href="//some.cdn.com/styles.css" charset="utf-8"> <script src="//some.cdn.com/app.js"></script> </head> <body> </body> </html>app.appcacheCACHE MANIFEST //some.cdn.com/styles.css //some.cdn.com/app.js NETWORK: *Accessing my site over HTTPworks fine! Assets get loaded correctly and cached; I can use my app offlineAccessing my site over HTTPS in Chromeworks fine as wellAccessing my site over HTTPS in Safaribreaks :-( Assets get loaded normally, but won't cache. Debugging didn't got me any further. No useful information in the logsAccording to the specs, referring to another domain in the cache manifest is allowed.I have also tried using http:// or https:// explicitly in my HTML and manifest instead of the //-notation. Of no avail.In my search online I've found some comments about cross-domain requests and that it isn't allowed in the cache manifest, but according to the W3C specs this is allowed (and proved by the fact that the browsers I tested it cache all the assets correctly, except for the combinationhttps & safari.
Cache manifest not working in safari using cross-domain refs and SSL
Just figure out a way of boosting the queries:Before I was trying:import pandas as pd from pyathena import connect conn = connect(s3_staging_dir=STAGIN_DIR, region_name=REGION) pd.read_sql(QUERY, conn) # takes 160sFigured out that using aPandasCursorinstead of aconnectionis way fasterimport pandas as pd pyathena import connect from pyathena.pandas.cursor import PandasCursor cursor = connect(s3_staging_dir=STAGIN_DIR, region_name=REGION, cursor_class=PandasCursor).cursor() df = cursor.execute(QUERY).as_pandas() # takes 12sRef:https://github.com/laughingman7743/PyAthena/issues/46
I run a query from AWSAthena consoleand takes 10s. The same query run fromSagemakerusingPyAthenatakes 155s. Is PyAthena slowing it down or is the data transfer from Athena to sagemaker so time consuming?What could I do to speed this up?
Pyathena is super slow compared to querying from Athena
The simplest way isstd::aligned_storage, which takes alignment as a second parameter.If you don't have it yet, you might want to checkBoost's version.Then you can build your union:union vector { __m128 simd; std::aligned_storage<16, 16> alignment_only; }Finally, if it does not work, you can always create your own little class:template <typename Type, intptr_t Align> // Align must be a power of 2 class RawStorage { public: Type* operator->() { return reinterpret_cast<Type const*>(aligned()); } Type const* operator->() const { return reinterpret_cast<Type const*>(aligned()); } Type& operator*() { return *(operator->()); } Type const& operator*() const { return *(operator->()); } private: unsigned char* aligned() { if (data & ~(Align-1) == data) { return data; } return (data + Align) & ~(Align-1); } unsigned char data[sizeof(Type) + Align - 1]; };It will allocate a bit more storage than necessary, but this way alignment is guaranteed.int main(int argc, char* argv[]) { RawStorage<__m128, 16> simd; *simd = /* ... */; return 0; }With luck, the compiler might be able to optimize away the pointer alignment stuff if it detects the alignment is necessary right.
I am attempting to re-write a raytracer using Streaming SIMD Extensions. My original raytracer used inline assembly andmovupsinstructions to load data into the xmm registers. I have read that compiler intrinsics are not significantly slower than inline assembly (I suspect I may even gain speed by avoiding unaligned memory accesses), and much more portable, so I am attempting to migrate my SSE code to use the intrinsics in xmmintrin.h. The primary class affected is vector, which looks something like this:#include "xmmintrin.h" union vector { __m128 simd; float raw[4]; //some constructors //a bunch of functions and operators } __attribute__ ((aligned (16)));I have read previously that the g++ compiler will automatically allocate structs along memory boundaries equal to that of the size of the largest member variable, but this does not seem to be occurring, and the aligned attribute isn't helping. My research indicates that this is likely because I am allocating a whole bunch of function-local vectors on the stack, and that alignment on the stack is not guaranteed in x86. Is there any way to force this alignment? I should mention that this is running under native x86 Linux on a 32-bit machine, not Cygwin. I intend to implement multithreading in this application further down the line, so declaring the offending vector instances to be static isn't an option. I'm willing to increase the size of my vector data structure, if needed.
G++ SSE memory alignment on the stack
You need to make sure that the certificate is installed under the%JAVA_HOME%\lib\security\cacertsof the JVM that maven uses. If it is not there you need to import it.Command for checking whether the certificate is installed:keytool -list -keystore "%JAVA_HOME%/jre/lib/security/cacertscommand to importkeytool -import -noprompt -trustcacerts -alias <AliasName> -file <certificate> -keystore <KeystoreFile> -storepass <Password>
I set up repository for maven artefacts that allows only https/ssl access. When running a maven build I naturally get this exception:sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetIn an attempt to fix this I downloaded the certificate of my repository and imported it into my local keystore as trusted location. The certificate seems to be installed correctly, when I print the keystone's content.I rebooted my computer in the mean time, too. There should be anything that is in cache from before. When running the maven build again I still get this above security exception. Does anyone have an idea what the issue could be?
Maven: SunCertPathException when accessing self-signed repository
The main reason for SYCL 1.2 to require OpenCL 1.2 is because the Khronos intermediate representationSPIR 1.2 requiresit. Without SPIR, or any other intermediate representation, a SYCL implementation cannot compile C++ code into device binaries, and would need to convert C++ to OpenCL C, which is quite problematic.
I am a student. My question may be very silly but I want to clear it. I have a device with Vivante GPU with openCL 1.1 version. I want to run tensorflow sample code with SYCL support on GPU. But before trying Tensorflow sample code, I want to try SYCL sample code with openCL 1.1 on GPU.I have seen several SYCL implementations, like computeCPP, triSYCL,sycl-gtx.All the implementations support openCL 1.2 or above.Does anyone know the reason why SYCL doesn't support openCL 1.1?And how feasible will it be the attempt to modify the SYCL open-source code to support openCL 1.1?
Why SYCL supports openCL 1.2 or above?
Damien_The_Unbeliever in the comments posted what inevitably was the best solution. I apologize for not posting this sooner, in case anyone else has faced this issue. The idea is to use memory mapped files to make a block of memory visible outside of your application. Essentially, you create a block of memory and give it a string name (identifier). Any other application that knows this identifier can get read that block of memory as if it were their own (assuming they're using a memory mapped file to view the memory, as it is not just intrinsically visible). The caveat is that the application reading the memory must be able to parse the memory and understand it. I used this in creating a real-time memory viewer in C# for my engine. The engine has an underlying allocator and memory manager, which now writes to a block of memory that is also pointed to by a memory mapped file. The C# application reads this memory at a given interval and displays it in a relevant way to the user (the developer). The best part is that, because the native side doesn't have to change at all to use this implementation, this doesn't affect the performance of the application at all.
So I have two applications that work together. One is written in native c++ using a custom memory manager. This memory manager manages a contiguous block of bytes from a start address through startAddress + size. I also have a WPF application that reads text files (which are just the bytes from the memory manager poured into a text file) and displays all sorts of statistics about it. I wanted to know if there is a way that I can view the native c++ application's memory in the WPF app in real time. So some pseudo-logic might be: Native application could expose, in one way or another, the start address and size of the pool The WPF application gets all bytes from that start address through the start address plus the size I've explored the Process class in .NET but I didn't see anything like MemoryPool, and I think the StartAddress of that object points to the very beginning of the application, not the first heap allocation made. Any help here would be greatly appreciated!
.NET View Other Application's Memory
After reviewing your repository your commits are being made under the username "Administrator". So GitHub doesn't know who's who. You want to follow these tutorials on github1)Setup your username in git-scm2)Setup your email in git-scm
So I made a fork of a friends package and made edits and then requested a pull. The changes were made however I did not get listed on the contributors because its a pull from my fork. In the end I just ended up making a manual edit to his read me and i got listed as just a readme editor.I am wondering is there a way to amend this so my edits show correctly?
GIT Fork and Contributions
One of the core concepts behind signed URLs is that they are not vulnerable to tampering -- you can't change a signed URL and have it remain valid.CloudFront uses the public key to validate the signature and confirm that the URL hasn't been tampered with. If the signature is invalid, the request is rejected....Signed CloudFront URLs cannot contain extra query string arguments. If you add a query string to a signed URL after you create it, the URL returns an HTTP 403 status.https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.htmlTo add a query string parameter to a CloudFront signed URL, you need to add itbeforesigning the URL... because the addition will change the signature.
I would like to add a query string parameter to my Cloudfront Url to be able to get some additional info into the Cloudfront log. I have two distributions, one is signed and one is not signed, pointing to two different S3 buckets (one with audio, one with images). Access to both distributions works fine without added query strings, but if I add a query parameter like the test one below:https://x.cloudfront.net/audio.m4a?li=...62&Expires=1544430879&Signature=...QTQ__&Key-Pair-Id=xxx&test=fail https://y.cloudfront.net/image.jpg?test=allgoodThe first one fails (Access Denied) but the second one works fine. Neither one of the distributions forwards the query string to S3.The signed audio distribution has logging enabled while the image distribution doesn't have logging. Besides this, their setups are the same.What do I need to do in order to get the audio distribution to accept my custom query parameter? Thanks /o
How to add a query string parameter to Cloudfront?
4 It looks like this has gone stale, nevertheless, I was wondering whether by simply doing a python3.7 -m pip install --upgrade pip FROM ubuntu:18.04 # ... RUN apt-get update && apt-get install -y \ software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa RUN apt-get update && apt-get install -y \ python3.7 \ python3-pip RUN python3.7 -m pip install pip RUN apt-get update && apt-get install -y \ python3-distutils \ python3-setuptools RUN python3.7 -m pip install pip --upgrade pip Share Improve this answer Follow edited Dec 1, 2020 at 9:52 answered Dec 1, 2020 at 9:38 Carlos RTCarlos RT 17111 silver badge1010 bronze badges Add a comment  | 
I have to install Python3.7 and pip3 for Python3.7 on my Docker Ubuntu18.04. I can install the 3.7, but I cannot get rid of pip3 for Python3.6: FROM ubuntu:18.04 # ... RUN apt-get update && apt-get install -y \ software-properties-common RUN add-apt-repository ppa:deadsnakes/ppa RUN apt-get update && apt-get install -y \ python3.7 \ python3-pip RUN python3.7 -m pip install pip RUN apt-get update && apt-get install -y \ python3-distutils \ python3-setuptools and I have root@ef0c924ba7fa:/tornado_api# python3.7 --version Python 3.7.3 root@ef0c924ba7fa:/tornado_api# pip3 --version pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6) while it should be pip3 under /usr/lib/python3.7/ Currently, I get root@ef0c924ba7fa:/tornado_api# which pip3 /usr/bin/pip3 root@ef0c924ba7fa:/tornado_api# readlink $(which pip3) root@ef0c924ba7fa:/tornado_api#
Install PIP3 and PYTHON3.7 on Docker Ubuntu 18.04
You can use thetokenizerattribute to tell theCountVectorizerto each list as a single document and turn thelowercaseoption toFalselike thistext_clf = Pipeline([('vect', CountVectorizer(tokenizer=lambda single_doc: single_doc,stop_words='english',lowercase=False)), ('tfidf', TfidfTransformer(use_idf=True)), ('clf', SGDClassifier(loss='hinge', penalty='l2', alpha=1e-3, random_state=42, verbose=1)),])
I am trying to create a classifier using Python and Sklearn. I currently have all my data imported successfully. I have been trying to follow a tutorial fromhere, changing it a bit as I go. Later into the project I realized that their training and testing data was much different then mine. If I understand it right they had something like this:X_train = ['Article or News article here', 'Anther News Article or Article here', ...] y_train = ['Article Type', 'Article Type', ...] #Same for the X_test and y_testWhile I had something like this:X_train = [['Dylan went in the house. Robert left the house', 'Where is Dylan?'], ['Mary ate the apple. Tom ate the cake', 'Who ate the cake?'], ...] y_train = ['In the house.', 'Tom ate the cake'] #Same for the X_test and y_testWhen I tried to train the classifier with there pipeline:text_clf = Pipeline([('vect', CountVectorizer(stop_words='english')), ('tfidf', TfidfTransformer(use_idf=True)), ('clf', SGDClassifier(loss='hinge', penalty='l2', alpha=1e-3, random_state=42, verbose=1)),])I get the error:AttributeError: 'list' object has no attribute 'lower'At this line:text_clf.fit(X_train, y_train)After doing research I now know that is because I am inputting a array for myX_traindata instead of a string. So my question is, how do I construct a pipeline that will accept arrays for myX_traindata and a string for myy_traindata? Is this possible to do with a pipeline?
Python Sklearn Pipeline with array
I solved the issue. Actually Tensowflow version was requiring a lot of memory so I changed the Keras backend to Theano and that solved the issue there is nothing to do with VGG here I guess. Switching can be done in the .keras folder in keras.json file and change the backend to theano.
Resource exhausted: OOM when allocating tensor with shape[256,128,3,3] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfcHere I am trying to use vgg for learning concepts of deep learning using Fast.ai course. When I am trying to read a small data of 4 images also it shows the error given in the above space. Here is the link to the vgg16 file that I am using:https://github.com/fastai/courses/blob/master/deeplearning1/nbs/vgg16.pyHere my path in the below code is the path to the sample data which contains 4-5 images only.path = "data/dogscats/sample/" import vgg16 from vgg16 import Vgg16 batch_size = 4 vgg = Vgg16() # Grab a few images at a time for training and validation. # NB: They must be in subdirectories named based on their category #batches = vgg.get_batches(path+'train', batch_size=batch_size) val_batches = vgg.get_batches(path+'valid', batch_size=batch_size*2) vgg.finetune(batches) vgg.fit(batches, val_batches, nb_epoch=1)
GPUs out of memory even in reading small data? Using "Quadro m1000m 4GB GPU"
The certificate is issued to busybox.net, which is the root cause of your error.The simple solution is to just drop the https:// and use http://, as the URL is available athttp://git.buildroot.net/buildroot/info/refsShareFollowansweredAug 11, 2014 at 12:28Burhan KhalidBurhan Khalid172k1919 gold badges247247 silver badges287287 bronze badges2Thank you for the answer - changing to http resolved the issue–PandiAug 12, 2014 at 13:21There might be a case where github access is behind a proxy, especially in corporate dev environments. You might want to check that your ~/.gitconfig exists and that it uses correct IP address/protocol(HTTP) to access github .–Vishal KAug 10, 2017 at 8:51Add a comment|
While trying to clone from GIT repository as part of the ONL (open network Linux) build process, I receive the following error. Does anyone have an insight over this? This is on Ubuntu 13.10 box.error: gnutls_handshake() failed: A TLS warning alert has been received while accessing https://git.buildroot.net/buildroot/info/refs fatal: HTTP request failed Clone of 'git://git.buildroot.net/buildroot' into submodule path 'buildroot' failedFollowing is the output from gnutls utility. Looks like the hostname in the certificate does not match. Is there a way to skip this validation? I already tried setting sslverify to FALSE in the git config and it did not help.root@ubuntu:~/git-openssl/git-1.8.3.2# gnutls-cli -p 443 git.buildroot.net Resolving 'git.buildroot.net'... Connecting to '140.211.167.224:443'... *** Non fatal error: A TLS warning alert has been received. *** Received alert [112]: The server name sent was not recognized - Certificate type: X.509 - Got a certificate list of 1 certificates. - Certificate[0] info: - subject `C=US,ST=OR,L=Corvallis,O=OSU Open Source Lab,CN=busybox.net,[email protected]', issuer `C=US,ST=OR,O=OSU Open Source Lab,CN=OSU Open Source Lab CA,[email protected]', RSA key 2048 bits, signed using RSA-SHA1, activated `2013-01-25 01:31:38 UTC', expires `2015-01-25 01:31:38 UTC', SHA-1 fingerprint `e229f69e98cc9065e29cde829e79201dc0ad833c' - The hostname in the certificate does NOT match 'git.buildroot.net'
TLS error while cloning from git repository
I ended up using SmartGIT. Its a very cool GIT interface: if any files in your source code tree are updated/moved/renamed, it lets you know, so you can always be sure that GIT has all the source code you need to compile your project.ShareFolloweditedMay 22, 2011 at 11:22answeredMay 22, 2011 at 0:05ContangoContango78.1k5858 gold badges270270 silver badges315315 bronze badgesAdd a comment|
I've heard that with GIT, you can make it automatically track filename changes (i.e. if you change a filename, it automatically notices that the checksum is very similar, and updates the filename in the repository automatically).Does anyone have an example of how this is done?
How do I do automatic tracking of filename changes with GIT?
Adding a random parameter to your request will not sabotage your php in any way: loader = new URLLoader(); var request:URLRequest = new URLRequest( "http://www.mySite.com/getTime.php?action=getTime&bogus="+(Math.random() * 10000)); loader.load(request); Your php code will GET the action parameter, and will ignore the bogus parameter without any effect on your code. You can also use a time based random number to avoid being too unlucky and get the same value twice.
Good Day, I’ve encountered problems with the cache of the UrlLoader in Actionscript 3. I make a UrlRequest to a php site to get a timestamp. When I call initiate the class (which contains the function) a second time, the result is the same. I have to close the application and restart it to get a new request. I have tried "loader = new loader." and also using headers. The option of creating a unique URL for every request like here , does not work for me since it would sabotage my php action.. loader = new URLLoader(); var request:URLRequest = new URLRequest("http://www.mySite.com/getTime.php?action=getTime"); loader.load(request);
AS3 Resetting UrlLoader Cache
Docker-Compose is wrong at this place, when you're using ECS.You can configure multiple containers within a task definition, as seen here in theCloudFormation docs:ContainerDefinitionsis a property of theAWS::ECS::TaskDefinitionresource that describes the configuration of an Amazon EC2 Container Service (Amazon ECS) containerType: "AWS::ECS::TaskDefinition" Properties: Volumes: - Volume Definition Family: String NetworkMode: String PlacementConstraints: - TaskDefinitionPlacementConstraint TaskRoleArn: String ContainerDefinitions: - Container DefinitionJust list multiple containers there and all will be launched together on the same machine.
I have created a Docker containers using docker-compose. In my local environment, i am able to bring up my application without any issues.Now i wanted to deploy all my docker containers to the AWS EC2 (ECS). After going over the ECS documentation, i found out that we can make use of the same docker-compose to deploy in ECS using ECS-CLI. But ECS-CLI is not available for windows instances as of now. So now i am not sure how to use my docker-compose to build all my images using a single command and deploy it to the ECS from an windows instance.It seems like i have to deploy my docker containers one by one to ECS as like below steps,From the ECS Control Panel, create a Docker Image Repository.Connect your local Docker client with your Docker credentials in ECS:Copy and paste the Docker login command from the previous step. This will log you in for 24 hoursTag your image locally ready to push to your ECS repository – use the repo URI from the first stepPush the image to your ECS repoository\create tasks with the web UI, or manually as a JSON filecreate a cluster, using the web UI.Run your task specifying the EC2 cluster to run onIs there any other way of running the docker containers in ECS ?
Deploying multiple docker containers to AWS ECS
Attempting to simulate actions occurring within the samenanosecondis difficult and impractical in general, and I'm just going to make a blanket statement that it's simply impossible in either PHP or mySQLseparately, let alone in tandem.You can't insert two rows into a table simultaneously. Not ever. You can have two threads within an RDBMS inserting rows so fast and seamlessly that for all intents and purposes you canclaimthat it has happened simultaneously, but for a RDBMS to maintain consistency there must be on single, contiguous order of operations with no branching.Don't even worry about the situation you're attempting to simulate. I would have to do serious research to find an RDBMS thatcan'thandle the situation gracefully.ShareFollowansweredDec 9, 2015 at 0:37SammitchSammitch31.5k77 gold badges5252 silver badges8383 bronze badges1Yea, what he said, as he took the time to say it so much better than me–RiggsFollyDec 9, 2015 at 0:39Add a comment|
I want to run this php script multiple times concurrently.$db = new mysqli('localhost', 'me', 'pw', 'test'); $time = time(); $sql = " INSERT INTO test ( `test_created` ) VALUES( ". $time .") "; $result = $db->query($sql);I am doing this because I want to replicate a scenario in which many users submit database entries at exactly identical time up to nanosecond, which is what I mean by 'concurrent' insert.I tried using the virtual cron scheduler of my shared hosting provider by specifying the hour and minute of execution. Then I made five identical files containing the above-mentioned codes.However, when I look at the table entries, the inserted timestamp are not identical. Is this because mysql can't handle concurrent insert operations? If mysql can handle 'concurrent insert', is this the right way to test concurrent insert operations? If not, how should I do it for testing purposes in php environment with or without cron?
Testing concurrent mysql insert operations in php
You are trying to runbash, an interactive shell that requires a tty in order to operate. It doesn't really make sense to run this in "detached" mode with-d, but you can do this by adding-itto the command line, which ensures that the container has a valid tty associated with it and thatstdinremains connected:docker run -it -d -p 52022:22 basickarl/docker-git-testYou would more commonly run some sort of long-lived non-interactive process (likesshd, or a web server, or a database server, or a process manager likesystemdorsupervisor) when starting detached containers.If you are trying to run a service likesshd, you cannot simply runservice ssh start. This will -- depending on the distribution you're running inside your container -- do one of two things:It will try to contact a process manager likesystemdorupstartto start the service. Because there is no service manager running, this will fail.It will actually startsshd, but it will be started in the background. This means that (a) theservice sshd startcommand exits, which means that (b) Docker considers your container to have failed, so it cleans everything up.If you want to runjustssh in a container, consider an example likethis.If you want to runsshdand other processesinside the container, you will need to investigate some sort of process supervisor.
I created the container with the following command:docker run -d -p 52022:22 basickarl/docker-git-testHere are the commands:root@basickarl:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES root@basickarl:~# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e4ac54468455 basickarl/docker-git-test:latest "/bin/bash" 7 minutes ago Exited (0) 26 seconds ago adoring_lumiere 22d7c5d83871 basickarl/docker-git-test:latest "/bin/bash" 2 hours ago Exited (127) About an hour ago thirsty_wright root@basickarl:~# docker attach --sig-proxy=false e4 FATA[0000] You cannot attach to a stopped container, start it first root@basickarl:~# docker start e4 e4 root@basickarl:~# docker attach --sig-proxy=false e4 FATA[0000] You cannot attach to a stopped container, start it first root@basickarl:~#Not much to say really, I'm expecting the container to start and stay upp. Here are logs:root@basickarl:~# docker logs e4 root@basickarl:~#
Docker container not starting (docker start)
I think you need to type it as "| pattern" instead of "|~ pattern"ShareFollowansweredOct 14, 2022 at 5:14MCVL1911MCVL1911111 bronze badge1This does not provide an answer to the question. Once you have sufficientreputationyou will be able tocomment on any post; instead,provide answers that don't require clarification from the asker. -From Review–fauzimhOct 19, 2022 at 1:32Add a comment|
try to parse with pattern usingGrafana + Lokii am using{pod=~"backend-deployment-.*"} |~ pattern `<_> - - <_> "<method> <path> <_>" <status> <_> "<_>" "<_>" <_> <duration> [<service>] [<_>] <_> <_> <_> <_> <_>`to parse this log10.110.1.132 - - [27/Aug/2021:02:37:06 +0000] "GET /main.d8e010115d6aba1bd049.js.map HTTP/2.0" 200 10842370 "https://gym.com/students/edit/173" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15" 34 20.031 [gymauto-gymauto-frontend-service-v1-8080] [] 10.110.5.217:8080 10842370 20.035 200 a7c4299aaa7ea674e91d13315but there is errorparse error at line 1, col 35: syntax error: unexpected IDENTIFIER, expecting STRINGnot like backtick , what is best solution i try " " also ' ' but same error. can not use pattern
Grafana Loki pattern syntax error: unexpected IDENTIFIER
Since its made in Visual Studio does that mean I need to include: Solution file and .vcxproj file? Yes, you'll need to include solution and project files. You can see which files you can ignore at gitignore.io. Or, you can use cmake. I'd much prefer to throw them all into their respective folder, but if someone downloads my project does that mean they need to pull it out of that folder and throw it into the project file? Yes, each collaborator will have to download libraries and make it available to project on their end. And if you have lots of libraries and libraries depending on other libraries, updating them can be painful. I use cmake and vcpkg. It isn't as straight forward as keeping libraries in project folder but requires reasonable effort for keeping project organized and clean. I'll recommend this approach.
For example: I'm making an SFML game and I want to store my project on GitHub so my team members can have access to it. Since its made in Visual Studio does that mean I need to include: Solution file and .vcxproj file? Also, I've seen projects on GitHub have a "src" folder to organize their repository, since mine was created in Visual Studio does that mean I need to rename my folder that is named after my project to "src" and reupload it? Or are people doing some sort of organization trick I'm missing? Since the game is SFML, all my binaries (.dll) files are just thrown into my main folder of the project, I'd much prefer to throw them all into their respective folder, but if someone downloads my project does that mean they need to pull it out of that folder and throw it into the project file? (That way visual studio can find them) TLDR: I'm having trouble organizing my GitHub repo with a Visual Studio C++ Project.
How does Visual Studio and Github work together?
When youreceivemessages from the queue, they are marked as "in flight." After you successfully process them, you send a call to the queue todeletethem. This call will include IDs of each of the messages.When the queue is empty, the next read will have an emptyMessagesarray.Usually when I do this I wrap my call to read the queue in a loop (awhileloop) and only keep processing if I haveMessagesafter doing a read.It shouldn't make any difference if it's a FIFO queue or a standard one.
I want to get all the messages in the queue to process them. However the property for MaxNumberOfMessages is 10 (based on documentation)https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.htmlHow can I read in all messages so I can process them? Or how would I know when queue is empty?thanks
AWS SQS Receive Messages -- How to Know when Queue is Empty
Azure Devops Pipeline: Second parameter dependent on the first parameterI am afraid there is no such out of way to resolve this question at this moment.That because theconditionsdoes not support for parameters at present. We could not add condition to the second parameter to set the value based on the first parameter.As we know, theRuntime parametersis used to let you have more control over what values can be passed to a pipeline.Since the second parameter is depend on the first parameter, does not require us to manually control it.So, as workaround for this question, we could use theLogging Commandwith condition to set the second parameter based on the value of first parameter:parameters: - name: parametr1 displayName: example1 type: string default: first values: - first - second - third trigger: none jobs: - job: build displayName: build pool: name: MyPrivateAgent steps: - task: InlinePowershell@1 displayName: 'SetVariableV1' inputs: Script: 'Write-Host "##vso[task.setvariable variable=parametr2.1;]123456"' condition: and(succeeded(), eq('${{ parameters.parametr1 }}', 'first')) - task: InlinePowershell@1 displayName: 'SetVariableV2' inputs: Script: 'Write-Host "##vso[task.setvariable variable=parametr2.2;]true"' condition: and(succeeded(), eq('${{ parameters.parametr1 }}', 'second'))I test it on my side, it works fine.
Is it possible in azure devops that the choice of the first parameter by the user, determines the second parameter (type, displayName etc.)?For example:parameters: - name: parametr1 displayName: example1 type: string default: first values: - first - second - thirdAnd if the user selects "first" when starting the pipeline, the second parameter to enter:- name: parametr2.1 displayName: example2 type: numberBut if the user selects "second" when starting the pipeline, the second parameter to enter:- name: parametr2.2 displayName: example2.2 type: booleanThanks for any help :)
Azure Devops Pipeline: Second parameter dependent on the first parameter
0 As far as I'm aware, this isn't possible. Even if you make a comments from a normal GitHub user account, and then convert that user account to a GitHub Organization account, all of your existing comments/commits will no longer be associated with that account: Any commits made with the converted personal account will no longer be linked to that account. The commits themselves will remain intact. Any existing comments made by the converted personal account will no longer be linked to that account. The comments themselves will remain intact, but will be associated with the ghost user. Taken from https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-personal-account/converting-a-user-into-an-organization However, GitHub does have a public beta that allows you to document that you made a commit on behalf of an organization account. Similarly to how you can write co-authored-by: NAME <[email protected]> at the end of your git commit message, you can also write on-behalf-of: @ORG [email protected]. However, GitHub only registers it if you follow the following strict instructions: you must be a member of the organization indicated in the trailer you must sign the commit your commit email and the organization email must be in a domain verified by the organization Taken from https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-on-behalf-of-an-organization For more info, see the Creating a commit on behalf of an organization GitHub Docs page or the Creating a commit on behalf of an organization GitHub Blog post. Share Improve this answer Follow answered Sep 18, 2023 at 16:22 Alois KlinkAlois Klink 76688 silver badges1010 bronze badges Add a comment  | 
Any idea is it possible to open Issues and submit PRs in GitHub on behalf of organization. I would like to open an Issue and PR that would say opened by <orgname>. Currently it says opened by <person>.
Open GitHub Issues and Pull Request on behalf of organization