Response stringlengths 15 2k | Instruction stringlengths 37 2k | Prompt stringlengths 14 160 |
|---|---|---|
If you just care about version control on your local machine, then you do not need a GitHub account.
If you ever want to work on multiple machines, then you will need a place to host your remote repository. GitHub is the most popular option, but there are other online providers like Bitbucket or GitLab.
If you want all the fancy features of an online repository host like Github, but you don't want your code on someone else's servers, then you could host your own remote repository using something like GitLab CE, which is a free version of GitLab's local Git hosting solution.
|
If I'm just a solo dev working on a personal project but still want to use Git for local versioning, do I need a Github account?
| Using Netbeans on solo project, new to Git/GitHub, do I need an account? |
There is no difference in squashing if the both commits are from the office or one of them is from a different computer. You can follow your normal squashing procedure as if all commits were done from your desk.Please note that you don't need to squash the commits in the feature branch. You could squash when merging:git checkout main;
git merge --squash feature_branchThis would create a single commit inmainand keep all the intermediate commit infeature_branch. | Since I started to work on the same project from both my desktop and laptop, I've been facing a super annoying problem regarding the master branch history:So I create a feature branch on the desktop, do work, and commit to remote.
Later that day, let's say when I'm at the train, I pull the branch on my laptop and commit more stuff, and when I finish I want to squash all the commits and merge the branch to master.
The problem is that squashing everything is impossible because some originated from A and some from B...Of course I can simply merge the branch to master, but then it would be filled with "Continuing X branch" commits - and that's why I want to squash them all. | How to squash commits on that came from 2 different places? |
Came across a similar issue, one thing I don't see mentioned here is you need to start docker to listen to both the network and a unix socket. All regular docker (command-line) commands on the host assume the socket.sudo docker -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -d &will start docker listening to any ip address on your host, as well as the typical unix socket. | I'm trying to use the Docker API to connect to docker daemon from another machine. I am able to do this command successfully:docker -H=tcp://127.0.0.1:4243 imagesBut NOT when I use the real IP address:docker -H=tcp://192.168.2.123:4243 images
2013/08/04 01:35:53 dial tcp 192.168.2.123:4243: connection refusedWhy can't I connect when using a non-local IP?I'm using a Vagrant VM with the following in Vagrantfile:config.vm.network :private_network, ip: "192.168.2.123"The following is iptables:# Generated by iptables-save v1.4.12 on Sun Aug 4 01:24:46 2013
*filter
:INPUT ACCEPT [1974:252013]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1511:932565]
-A INPUT -p tcp -m tcp --dport 4243 -j ACCEPT
COMMIT
# Completed on Sun Aug 4 01:24:46 2013
# Generated by iptables-save v1.4.12 on Sun Aug 4 01:24:46 2013
*nat
:PREROUTING ACCEPT [118:8562]
:INPUT ACCEPT [91:6204]
:OUTPUT ACCEPT [102:7211]
:POSTROUTING ACCEPT [102:7211]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.16.42.0/24 ! -d 172.16.42.0/24 -j MASQUERADE | How to connect to Docker API from another machine? |
Hope you your load balancer forward the traffic from 443 to the backend target port 3190 in case of Istio. Check your Istio gateway file wether you have 443 port mapped with the targets. | I have my app running on EKS which is using istio-ingressgateway service for load balancer and Knative serving I have added ACM to my ELB, but after patching the service withmetadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: "arn:aws:acm:xx-xxxx-1:1234567890:certificate/xxxxxx-xxx-dddd-xxxx-xxxxxxxx"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"my domain is not opening on HTTPS but works fine on HTTP giving this error on HTTPS< HTTP/1.1 408 REQUEST_TIMEOUT
HTTP/1.1 408 REQUEST_TIMEOUT
< Content-Length:0
Content-Length:0
< Connection: Close
Connection: Close | After adding AWS ACM EKS ELB is not opening on HTTPS |
NSURLIsExcludedFromBackupKeyshould compile fine on 5.1+ SDK.As the key is not available for 5.0, the following snippet could act as a workaround.if (SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(@"5.0.1"))
{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"5.1"))
{
NSError *error = nil;
//[URL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
[URL setResourceValue:[NSNumber numberWithBool:YES] forKey:@"NSURLIsExcludedFromBackupKey" error:&error];
return error == nil;
} | My iPhone application contains approx 500 MB data. and application will use this data offline. So i mark the folder to do not backup/copy on iTunes. so i am using below url :https://gist.github.com/1999985But it says 'NSURLIsExcludedFromBackupKey' undeclared. and i also tried to usedhttps://developer.apple.com/library/ios/#qa/qa1719/_index.htmlbut i always return false..So please let me know how it will works??Thx | 'NSURLIsExcludedFromBackupKey' undeclared |
To use buildx, make sure your Docker runtime is at least version 19.03. buildx actually comes bundled with Docker by default, but needs to be enabled by setting the environment variable DOCKER_CLI_EXPERIMENTAL.
export DOCKER_CLI_EXPERIMENTAL=enabled
If you're on Linux, you need to set up binfmt_misc. This is pretty easy in most distributions, but is even easier now that you can just run a privileged Docker container to set it up for you.
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
Create a new builder which gives access to the new multi-architecture features:
docker buildx create --use --name multi-arch-builder
Then you'll be able to build the containers with:
docker buildx build --platform=[your target platform] ...
This is the setup I use on my Jenkins pipeline.
Relevant documentation:
https://docs.docker.com/desktop/multi-arch/
In-depth tutorial: https://medium.com/@artur.klauser/building-multi-architecture-docker-images-with-buildx-27d80f7e2408
In-depth tutorial without medium paywall: https://nexus.eddiesinentropy.net/2020/01/12/Building-Multi-architecture-Docker-Images-With-Buildx/
|
I am running a Jenkins Alpine Linux AMD64 docker image, which I'm building myself and want to add linux/arm64 docker buildx support to it, in order to generate multi-platform images and I do not know how it supposed to work.
When I check the supported platform I get:
+ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS PLATFORMS
default * docker
default default running linux/amd64, linux/386
since I'm within an AMD64 image. I read that I need to install qemu for this, but I have no clue how buildx will recognize that.
The documentation is relatively bare on this at: https://docs.docker.com/buildx/working-with-buildx/
Anyone an idea how to add linux/arm64 build capability within a linux/amd64 image?
The only solution I see right now is to build an image on an actual arm64 system.
| Build linux/arm64 docker image on linux/amd64 host |
10
You can do it like this:
protected void onCreate(Bundle savedInstanceState)
{
setContentView(R.layout.high_scores);
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inPreferredConfig = Config.RGB_565;
BitmapDrawable highScoresBg = BitmapFactory.decodeResource(getResources(), R.drawable.achievements, opts);
findViewById(R.id.high_scores_root).setBackgroundDrawable(highScoresBg);
Pixels of your image will be stored on 2 bytes, instead of 4 when using ARGB_8888. 50% saved memory, but of course less quality.
This article tells us that on Android < 2.3 the images are in RGB_565 by default. However, if the image has alpha channel (PNG for instance), it will be loaded in ARGB_8888. On Android >= 2.3 all the images are loaded in ARGB_8888 by default.
Share
Follow
edited Jun 14, 2013 at 13:25
answered Jun 13, 2013 at 18:56
Adam StelmaszczykAdam Stelmaszczyk
19.8k44 gold badges7171 silver badges111111 bronze badges
1
4
Yes, as I said I know it can be done this way, but I'm looking for a way to tell Android to directly load specific layout images in RGB565 so I don't have to do it for each programmatically.
– Jukurrpa
Jun 13, 2013 at 22:06
Add a comment
|
|
I'm trying to lower the memory usage of my app, and I noticed most of it is caused by the activities' backgrounds: in XHDPI, 720*1280*4 = 3.6Mbytes each, and Android doesn't seem to release them as soon as they're not in use anymore.
Is there any way to tell Android to load certain resource images as RGB 565 instead of RGB 8888 in order to save some memory on those larger images without alpha channel ?
I know this can be done programmatically, but I was wondering if this can also be done with images and backgrounds used in the activities' layouts or with setBackgroundResource().
| Loading image resources as RGB 565 |
GetFinalFireTimehasn't beenimplemented yet.GetNextValidTimeAftershould be working if you're using one of the latest versions.If you want to generatecron expressionsin c# you can useCronScheduleBuilder.UPDATE:You can find a simple projecthere(QuartzNetCronExpressions.zip) where you can see how it works.NOTE: I've used VS 2013, Framework 4.5.1 and Quartz.net 2.2.1 (nuget package). | I have one problem which refers to quartz.net cron expressions. I have read many articles and tried many pieces of code but without any results, so I feel little bit hopeless and that's why I decided to ask You. Maybe somebody also had similar problem.
Is any way to parse cron expression for Quartz.Net to DateTime format?
For example I have a cron:var cron = new Quartz.CronExpression("0 * 8-22 * * ?");I have tried use GetFinalFireTime() GetTimeAfter() GetNextValidTimeAfter() but application still throws exception:An unhandled exception of type 'System.AccessViolationException' occurred. Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.Here is my code:CronExpression cron = new Quartz.CronExpression("0 * 8-22 * * ?");
DateTimeOffset? nextFire = cron.GetNextValidTimeAfter(dt);I also will be very thankful if you can tell me if is there any cron parser library which allows to create crons easy. Something similar to cronMaker.com but proper working with Quartz.Net. | Parse cron expression in Quartz.Net |
4
First add the library project as module.
File->New->Import module
then add this line to your dependencies in gradle
compile project(':yourmodule')
Share
Improve this answer
Follow
answered Dec 18, 2015 at 5:42
Veer3383Veer3383
1,80566 gold badges3030 silver badges4949 bronze badges
0
Add a comment
|
|
I am going to use cognalys (third party library) in my app for mobile verification..I cloned that from git hub and i imported that cognalys in my app as module.How to use that module as library in my project(how to convert that as library)..I dont know how to use that..By using that only i can create a class for mobile verification of user...
Please help me to find out the solution
This is my build.gradle of cognalys project
apply plugin: 'com.android.library'
android {
compileSdkVersion 10
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
}
| How to use module as library in android |
Well the gcp created for you in the background. I assume you pushed your docker image or CI to cluster and from there you just did few clicks right? same stuff you can do it on openshift environment. but in the background yaml file get's generated. if you edit the pod on your UI you will see that yaml file.as above @Volodymyr Bilyachat said you can create deployment via imparative way or using declarative way(yaml). I would suggest always use declarative way.you can see your deployment yaml file which you created from UI by doingkubectl get deployment <deployment_name> -o yaml
kubectl get deployment <deployment_name> -o yaml > name.yaml #This will output your yaml file into name.yaml fileShareFolloweditedJul 30, 2020 at 13:51answeredJul 30, 2020 at 13:45Dashrath MundkarDashrath Mundkar8,46622 gold badges3030 silver badges4444 bronze badgesAdd a comment| | TLDR: My understanding from learning all about K8s is that you need lots and lots of yaml files, however, I just deployed an app to a K8s clusters with 0 yaml files and it succeeded. Why is that? Does google cloud or K8s have defaults it uses when the app does not have any yaml file settings?Longer:I have a dockerized spring app that I deployed to a google cloud cluster I created via the UI.It had 0 yaml files in there, so my expectation that kubectl deploy would fail, however, it succeeded and my stateless app is up there chugging away.How does that work? | No YAML Files in K8s Deployment |
In my opinion, this is a bad idea to use the Google Drive synchronisation with a Git folder. Git's purpose is to sync your projects already, you should not let another program do that before git !
You have to clone your project and then do commit - push - pull between your PCs.
Why do you want to use Google Drive if you commit your code on GitHub ?
Anyway, you just have to click on "Add" and locate your local git repository. Then it should take a minute to display your branch commit and all the files.
Let me know if it helped :)
|
So I tried to work on a project in two laptops. I've committed this project folder into Git via Github. Then I move this project folder into local Google Drive folder, and let the Google Drive sync it into the new laptop. On the new laptop, I have downloaded Github Desktop and have signed in to my account. Now, the folder is already synced from Google Drive, but I don't see any repo on the Github Desktop. When I click on the + button on Github Desktop, I see "Add", "Create", or "Clone" only. How can I have the same Github repo entries like on the previous laptop without cloning (as the files to be cloned is already here via Google Drive) ? If there's no way to do that, I know that I can just always clone from the repo, and then overwrite the local repo with the files from the Google Drive so that the most recent changes (which I still haven't ready to commit yet) is there. But I'm just curious if it's possible. Thanks.
PS: I've already open terminal on the folder, run ls -aef, and see the .git hidden folder is there.
| Github Desktop doesn't recognise my copied folder from external source which contain .git files |
Ah well, got the answer myself, after a bit more tries.
The key was to encompass the whole app with a firewall rule for the^/pattern, that contains ananonymous: ~as well as aform_loginblock.ShareFollowansweredApr 9, 2015 at 6:48user2335286user2335286111 silver badge22 bronze badgesAdd a comment| | In my Symfony2 project, I want only secured access to any URL under the /user pattern; while the index page (/) and a few other pages (eg. /about ) should be available without signing in. And all this works fine currently.
However, after a user has logged in, if he visits the index page, or the about page, he gets signed out! How do I prevent this from happening?I tried adding asecurity: false, as well as ananonymous: ~firewall rule for the "/" and "/about" patterns, after the 'secured area' rule for the "/user" pattern. But it still doesn't work.The answer given to the following question is probably very close to what I want:symfony 2: get current logged in user on non secured pages through firewall. The only thing missing from that answer is: how to redirect any '/user' URL to the login page, upon being denied by access control? | Symfony2 prevent logout on main page |
Theuploadedsample.pdf, when downloaded... is opened as a blank page by the pdf reader in Chromium.Check if you have a directive likegit config core.autocrlfset to true. That could have changed eol (end of line) characters in the file.Clone the repository, and check thesha1 of the cloned pdf:git ls-files -s sample.pdfCompare it with your original PDF (the one you can open with a content in it instead of a blank page)git hash-object original/sample.pdfThat way, you will know if the file was somehow altered, when it was added/committed/pushed.I have clone the repository, and do see the content of the pdf file when I open it with an Adobe Acrobat Reader.As noted by the OP, the issue was with thetxt2pdf (pdfdump) tools:remove the "T*" from each text block (Text positioning operator from thePDF32000_2008.pdfISO 32000-1:2008specification): it moves to the start of the next line.Use capital letter "/F1" instead of "/f1"That being said, I would recommendgit config --global core.autocrlf falseto be sure that Git does not add any other modification. | With reference toPDF to Github Flavored MarkdownNow with PDF support on GitHub, I have a PDF file (generated by my own txt2pdf converter) not shown correctly on GitHub, but okay when using Adobe Reader or Google Chrome.Is it an issue with GitHub PDF preview, or my own converter?
(I do not know which channel to report to, hence this post on SO)My PDF file is v1.4.Example PDF file:https://github.com/txt2pdf/pdfdump/blob/master/sample.pdfThanks @VonC and @mkl for both of your kind feedback. I have fixed the program and recalculate the xref table, but thissample2.pdfstill has some unknown issue where online PDF repair tool could not detect.https://github.com/txt2pdf/pdfdump/blob/master/sample2.pdfLATEST UPDATE:I remove the "T*" from each text block (EDIT: and also use capital letter "/F1" instead of "/f1") when generating the output PDF file. Now it is shown correctly on GitHub.
So the issue was with my converter,notGitHub's.https://github.com/txt2pdf/pdfdump/blob/master/sample3.pdf | PDF not shown correctly on GitHub |
0
This solves the space issue, and should copy the files including folders.
@echo off
cd\
xcopy "C:\test back\*.*" "D:\new" /s/h/e/k/f/c
Share
Improve this answer
Follow
answered Apr 9, 2014 at 6:42
foxidrivefoxidrive
40.7k1010 gold badges5656 silver badges6969 bronze badges
Add a comment
|
|
i want to backup file from C:\ to D:\ but i have some problem about the name of folder .name of folder is "C:\test back" and "D:\new"
this is my code
@echo off
cd\
xcopy C:\test back D:\new
a error is invalid number of parameter.
when i change name of folder test back to test_back it still ok
xcopy C:\test_back D:\new
Can you tell me why and how can i do to batch file xcopy if name of folder have space bar.
Thank you . i'm new to backup file.
| invalid number of parameter Backup file |
You can limit what attribute can be edited with a conditional:{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1471613026000",
"Effect": "Allow",
"Action": [
"ec2:ModifyInstanceAttribute"
],
"Resource": [
"*"
],
"Condition": {
"StringEquals": {
"ec2:Attribute": "InstanceType"
}
}
}
]
}EC2 policy docs:https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-policy-structure.html#amazon-ec2-keysShareFollowansweredJun 17, 2022 at 6:09Julio CorzoJulio Corzo37922 silver badges1212 bronze badgesAdd a comment| | I'm trying to write a policy that would allow a group of users to change the instance type of any instance, but no other attributes.I currently have:{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1471613026000",
"Effect": "Allow",
"Action": [
"ec2:ModifyInstanceAttribute"
],
"Resource": [
"*"
]
}
]
}but this would allow them to change any of the instances' attributes. Is there a way to restrict this to allow changing the instanceType attribute only? | AWS IAM: allow IAM user to change EC2 instance type only |
Gitignore files are a specific file type.
When you’re working in your copy, Git watches every file in and considers it in three ways:
Tracked: You’ve already staged or committed the file.
Untracked: You’ve not staged or committed.
Ignored: You’ve explicitly told Git to ignore the file(s).
The .gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo.
The .gitignore file itself is a plain text document.
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
vendor/
* is used as a wildcard match *.exe will ignore any file with the .exe extension
/ will ignore directories with the name. vendor/ ignores the vendor directory.
# will comment the line
[…] will ignore values with any of the values.
*.[abc] ignores files file.a, file.b, file.c.
.[a-.[oa]d] the dash will include a range, in this case, file extensions a-d.
You may want to ignore certain files for multiple reasons:
The files contain sensitive data.
The files are system specific and do not need to exist on every machine’s copy.
Excluding the files maintains system security rules and privileges. (Remember, Git repos only contain the files necessary to get tech support—not to share the entire software.)
Binary, build assets, environment related..
Source: https://www.bmc.com/blogs/gitignore
|
I'm new to github and recently created my first repo. I was wondering if gitignore is a completely different file type, or can it be added on to other files.
If gitignores can be added on to other files: I have a .txt file called words.txt. How do I change this into a .gitignore.txt file?
If gitignores are a completely different file type: How are gitignores helpful and where can they be used?
Thanks!
| Is gitignore a file types or something that can be added on to files? Can I change a .txt file to .gitignore? |
I wouldn't say it's a necessity to use firewalld, however, there's a guide to help you migrate from iptables to firewalld followed by theRHEL 6 --> RHEL 7 guideTL;DR - If you have configured yoursystem-config-firewallafter upgrading to CentOS 7 and installing firewalld, you can use thefirewall-cmd-offlinetool
to migrate the config in/etc/sysconfig/system-config-firewallinto the default zone of firewalld/etc/firewalldOther option would be to disable firewalld and continue to use the old iptables and ip6tables services. This would allow you to keep the existing firewall rules. Copy theiptables-saveexport and load it with iptables-restore.ORJust create a new configuration with firewall-cmd or firewall-config.ShareFollowansweredSep 6, 2019 at 1:49Reece CooperReece Cooper933 bronze badges1Infortunately i had problem with enable iptables , i installed but couldn't enable it with any commands like :sudo systemctl enable iptablessudo systemctl start iptables'systemctl unmask iptables---> responses are :Failed to start iptables.service: Unit is maskedorFailed to execute operation: Cannot send after transport endpoint shutdown–AlexSep 6, 2019 at 13:53Add a comment| | I'm working on setting up vpnserver and I have IPTables rules that need to be converted to Firewalld rulesEnable nat and postrouting:iptables -t nat -A POSTROUTING -s 192.168.7.0/24 -j SNAT --to-source [YOUR SERVER IP ADDRESS]
iptables-save > /etc/sysconfig/iptablesThanks for any help! | How to convert iptables-service rules into firewalld rules? |
Surely, you should set the core.autocrlf. Git-documentation
And to fix the problem, you may need to revert your commit first. Revert to previous Git commit
Then, configure it and make a commit again.
|
This question already has answers here:
diff returning entire file for identical files
(6 answers)
Closed 10 years ago.
I'm working on a Mac and pulling a repo from GitHub.
I've made a series of changes and GitTower or GIT in general is telling me:
410 files changed, 68615 lines added, 70606 lines deleted
This is completely incorrect other than the files changed number.
I edited at most 20 to 30 lines of code in each file, yet for each file edited GIT says I replaced the entire contents of the file.
I'm assuming this is because the line endings are from a different OS? I normally don't have this issue, this is the first time I'm working on a public repo.
I looked around at some other answers which led me to try and discover my current config via:
git config core.autocrlf
This returns nothing when I run it.
So I'm assuming I need to set it? GitHub recommends "input" for Mac users, will this make sure that my files don't show the entire file was changed?
Also, is there a way to fix the commit I mentioned so that it only shows the correct number of lines changed?
| Line Ending Problems in GIT [duplicate] |
You could use wget on some of the PDFs and look at the headers:wget -S http://host/something.pdfShareFollowansweredApr 12, 2012 at 23:07RobRob1,14377 silver badges1414 bronze badges1Thanks, that's exactly the flag I was looking for.–John DoucetteApr 13, 2012 at 1:24Add a comment| | I want to prevent google from indexing pdf's on my website.I have modified my .htaccess file to include the following lines, as suggested by google's webmaster tools:<Files ~ "\.pdf$">
Header set X-Robots-Tag "noindex, nofollow"
</Files>I know that apache is running properly and reading my .htaccess file, because I can block access to the file entirely, but I cannot tell whether the above command is working.The google webmaster tools claim that the crawlers can still see the pdfs, but they seem to be intended for only use with robots.txt. Is there a 3rd party tool (for linux) that I can use to check the meta tags with? | How can I tell whether Apache is using my .htaccess as intended? |
In the end, I resolved this by moving the drop processor to the input configuration file from the configuration file. | I’m trying to collect logs from Kubernetes nodes using Filebeat and ONLY ship them to ELK IF the logs originate from a specific Kubernetes Namespace.So far I’ve discovered that you can defineProcessorswhich I think accomplish this. However, no matter what I do I can not get the shipped logs to be constrained. Does this look right?Hm, does this look correct then?filebeat.config:
inputs:
path: ${path.config}/inputs.d/*.yml
reload.enabled: true
reload.period: 10s
when.contains:
kubernetes.namespace: "NAMESPACE"
modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
processors:
- add_kubernetes_metadata:
namespace: "NAMESPACE"
xpack.monitoring.enabled: true
output.elasticsearch:
hosts: ['elasticsearch:9200']Despite this configuration I still get logs from all of the namespaces.Filebeat is running as a DaemonSet on Kubernetes. Here is an example of an expanded log entry:https://i.stack.imgur.com/HWMqF.png | How to constrain Filebeat to only ship logs to ELK if they contain a specific field? |
Each instance of Microservice runs as a container in a Pod. Is it possible to deploy MongoDB as another container in the same Pod?Nope, then your data would be gone when you upgrade your application.Or what is the best practice for this use case?Databases in a modern production environment are run asclusters- for availability reasons. It is best practice to either use a managed service for the database or run it as a cluster with e.g. 3 instances on different nodes.If two or more instances of the same Microservice are running in different Pods, do I need to deploy 2 or more instances of MongoDB or single MongoDb is referenced by the multiple instances of the same Microservice?All your instances of the microservice should access the same database cluster, otherwise they would see different data.Each Microservice is Spring Boot application. Do I need to do anything special in the Spring Boot application source code just because it will be run as Microservice as opposed to traditional Spring Boot application?Spring Boot is designed according toThe Twelve Factor Appand hence is designed to be run in a cloud environment like e.g. Kubernetes. | I have 2 API backends Microservices in which each Microservice has MongoDB database. I want to deploy 2 or more instances of each of these in Kubernetes cluster on Cloud provider such as AWS.Each instance of Microservice runs as a container in a Pod. Is it possible to deploy MongoDB as another container in the same Pod? Or what is the best practice for this use case?If two or more instances of the same Microservice are running in different Pods, do I need to deploy 2 or more instances of MongoDB or single MongoDb is referenced by the multiple instances of the same Microservice? What is the best practice for this use case?Each Microservice is Spring Boot application. Do I need to do anything special in the Spring Boot application source code just because it will be run as Microservice as opposed to traditional Spring Boot application? | How to deploy Microservices with MongoDB dependency on Kubernetes? |
When you do a rebase what git does is use the last common commit on both the branches and applies the upstream changes firstand thenit puts all the local commits that were madeafterthe diverge on top of the upstream changes. During this rebase process, git applies the commits one by one onto the upstream changes.So it is possible that all the changes in your feature branch may in some way conflict with the develop branch unless they are part of a file that does not exist in the develop branch | Here's my situation:
Made various changes to feature-branch with ~ 30 commits
Need to pull develop-branch from Github and merge it with the changes on feature-branch.This is what I've attempted:git pull --rebase origin develop
CONFLICT (content): Merge conflict in users.pyI resolve the conflict then,git add users.py
git status # everything looks clean, couple of untracked files
git rebase --continue
return: No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.
git rebase --skipCONFLICT # this time, same file but different commit!So basically, as I resolved conflicts and staged each file, other conflicts were introduced. I noticed that there was a conflict between feature-branch and develop-branch oneverycommit I had made to feature-branch!
How can I resolve this?? | git rebase: I'm getting conflicts on the same files from different commits |
I highly suggest you use an IntPtr and Marshal.Copy. Here is some code to get you started.
memAddr is the memory address you are given, and bufSize is the size.
IntPtr bufPtr = new IntPtr(memAddr);
byte[] data = new byte[bufSize];
Marshal.Copy(bufPtr, data, 0, bufSize);
This doesn't require you to use unsafe code which requires the the /unsafe compiler option and is not verifiable by the CLR.
If you need an array of something other than bytes, just change the second line. Marshal.Copy has a bunch of overloads.
|
I am interfacing with an ActiveX component that gives me a memory address and the number of bytes.
How can I write a C# program that will access the bytes starting at a given memory address? Is there a way to do it natively, or am I going to have to interface to C++? Does the ActiveX component and my program share the same memory/address space?
| Access memory address in c# |
With SonarQube 5.1.1 you are for sure not using the SCM Activity plugin that was used for 4.5.x and earlier. Instead it is using a standalone SonarQube Git plugin that internally rely on a pure Java implementation (JGit). Unfortunately JGit doesn't support mailmap files. This is a known issuehttp://jira.sonarsource.com/browse/SONARSCGIT-4.But in SQ 5.x this is less an issue since you can explicitly associate one or more SCM account to a single SQ account. So even if a single user has several SCM account you can have the issues properly assigned to him. Remaining issue is when you are using commercial developer cockpit plugin since aggregation by developer doesn't take into account (yet) this configuration. This should be fixed in 5.2. | I'm using:SonarQube Server 5.1.1Sonar Ant Tasks 2.3I have a couple of authors in a Git repository that I want to change the name that is displayed in Sonar.In the log I can see this:Trying to guess scm provider from project layout...
Found SCM type: git
...
Sensor SCM Sensor (done) | time=5ms"In the SonarQube documentation site, they recommended to have the .mailmap file to map the authors, however it doesn't seem to work:http://docs.sonarqube.org/display/PLUG/SCM+Activity+PluginI confirmed that the .mailmap is correct since I can see the modified author in the log, by running (for instance):git shortlog -snegit log --use-mailmapWhat might be the problem? | SonarQube ignores .mailmap during SCM blame |
Your view0 will stay in memory as long as the DOM element #right-block exists. Because the event handlers on the DOM element is pointing to methods of your view, so it won't be garbage collected.
Ideally you should invoke view0.remove(), which will remove the element from DOM and also calls stopListening().
But in your sample code, if you do that, the element #right-block will be removed from DOM, and view1.setElement("#right-block"); won't work as expected.
In this case try invoking view0.undelegateEvents(); view0.stopListening();, and if nothing else is referring to the view instance, it'll be garbage collected
|
Consider the following:
SomeView = Backbone.View.extend({
render0: function () {
var view0 = new View0();
view0.setElement("#right-block");
view0.render();
},
render1: function(event) {
var view1 = new View1();
view1.setElement("#right-block");
view1.render();
},
});
If I call render0() and then render1, what will happen to the object view0? Do I have to explicitly destroy the old view?
| Memory Management in Backbone.js |
In the first case, you have a single ArrayList instance and you keep adding to it new Object instances until you run out of memory.
In the second case, you create a new ArrayList in each iteration of the while loop and add 1000000 Object instances to it, which means the ArrayList created in the previous iteration and the 1000000 Object instances it contains can be garbage collected, since the program no longer has references to them.
Note that the second snippet can also cause out of memory error if the new Objects are created faster than the garbage collector can release the old ones, but that depends on the JVM implementation.
|
Why does this following code
List<Object> list = new ArrayList<>();
while (true) {
for(int i = 0; i < 1000000; i++){
list.add(new Object());
}
}
produce an out of memory error
But this code doesn't
while(true) {
List<Object> list = new ArrayList<>();
for(int i = 0; i < 1000000; i++){
list.add(new Object());
}
}
I can see that it has something to do with the list being created either inside the while loop or outside of it obviously, but I am unsure on the reason why this happens.
| Java out of memory errors |
CUDA brings together several things:
Massively parallel hardware designed to run generic (non-graphic) code, with appropriate drivers for doing so.
A programming language based on C for programming said hardware, and an assembly language that other programming languages can use as a target.
A software development kit that includes libraries, various debugging, profiling and compiling tools, and bindings that let CPU-side programming languages invoke GPU-side code.
The point of CUDA is to write code that can run on compatible massively parallel SIMD architectures: this includes several GPU types as well as non-GPU hardware such as nVidia Tesla. Massively parallel hardware can run a significantly larger number of operations per second than the CPU, at a fairly similar financial cost, yielding performance improvements of 50× or more in situations that allow it.
One of the benefits of CUDA over the earlier methods is that a general-purpose language is available, instead of having to use pixel and vertex shaders to emulate general-purpose computers. That language is based on C with a few additional keywords and concepts, which makes it fairly easy for non-GPU programmers to pick up.
It's also a sign that nVidia is willing to support general-purpose parallelization on their hardware: it now sounds less like "hacking around with the GPU" and more like "using a vendor-supported technology", and that makes its adoption easier in presence of non-technical stakeholders.
To start using CUDA, download the SDK, read the manual (seriously, it's not that complicated if you already know C) and buy CUDA-compatible hardware (you can use the emulator at first, but performance being the ultimate point of this, it's better if you can actually try your code out)
|
I am interested in developing under some new technology and I was thinking in trying out CUDA. Now... their documentation is too technical and doesn't provide the answers I'm looking for. Also, I'd like to hear those answers from people that've had some experience with CUDA already.
Basically my questions are those in the title:
What exactly IS CUDA? (is it a framework? Or an API? What?)
What is it for? (is there something more than just programming to the GPU?)
What is it like?
What are the benefits of programming against CUDA instead of programming to the CPU?
What is a good place to start programming with CUDA?
| What is CUDA like? What is it for? What are the benefits? And how to start? |
When used like this (i. e. by accessing the instance variable directly), then no, it won't. However, if you use the property's accessor method ([self setS:nil]; or self.s = nil;), then yes, it will.
Also note that releasing an object and freeing its memory are two completely different things. An object is deallocated only when it has no more strong references - i. e. you have the last reference to it and then you release it. If you release it but it has other references (by having been retained previously), then it won't be deallocated yet, only its reference count will be decremented by one.
Furthermore, if you have a retained property, such the one in your example, you must not do 1. access the underlying instance variable directly, 2. do stuff like
NSString *m = [NSString stringWithString:@"Hellow, World"];
s = [m retain];
Why? Because the first line is simply unnecessary - really, why - [NSString stringWithString:]? You're creating a constant string, then create an exact copy of it - it's just superfluous. If Cocoa's designers were noobs, this line would also waste memory - two exact copies of the same immutable string. Fortunately, whoever implemented NSString was prepared for this situation and made this method check its argument for being a constant and returning it without doing anything if it is - so you get back the same pointer, but with a few extra calls to objc_msgSend - that's not something you want.
The second line is also wrong - again, you don't use the backing ivar as-is. Also, the property is declared retain for a reason - if you set an object to your property, that object will be retained by the setter method - no need to manually retain it.
All in all, you'd better write
self.s = @"Hello World";
// ...
self.s = nil;
instead.
|
when not under ARC, for the following code,
.h
@property (nonatomic, retain) NSString *s;
.m
NSString *m = [NSString stringWithString:@"Hellow, World"];
s = [m retain];
// later on
s = nil; <-- will this release the ref count on the string and hence get the string released?
| Will assigning nil to a retained property release the object associated to it? |
If you don't need to run docker container on your local machine, but still on the same remote machine, you can change this in your docker setting.On the local machine:You can control remote host with -H parameterdocker -H tcp://remote:2375 pull ubuntuTo use it with docker-compose, you should add this parameter in /etc/default/dockerOn the remote machineYou should change listen from external adress and not only unix socket.SeeBind Docker to another host/port or a Unix socketfor more details.If you need to run container on multiple remote hoste, you should configure Docker Swarm | I have compose file locally. How to run bundle of containers on remote host likedocker-compose up -dwithDOCKER_HOST=<some ip>? | How to run docker-compose on remote host? |
Change folder nameCodeIgniter-3.1.6tociSet yourbase_urlto$config['base_url'] = 'http://localhost/ci/Use this.htaccessRewriteEngine On
RewriteBase /ci
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L] | I am working on codeigniter 3.1.6.I added the .htaccess file.
I also changed thebase_urlpath to my project path, removed theindex.phpfromindex_pageand changed theurl_protocoltoREQUEST_URI.Still, while I am redirecting the url to any controllers method it throwing an error as 'The page you requested was not found.'I also searched and applied different .htaccess but its not working.
If I am addling/index.phpat end of base_url then its working but its wrong though. It should work without index.php.Only 3.1.6 giving this issue.note: codeigniter-3.1.4 is working properly only this version is giving an issue | Codeigniter 3.1.6 - How to remove index.php from url |
When you do git merge origin/development while having master checked out, you merge the origin/development branch into your master branch. This is why changes you did on github's development branch have appeared in your local master
If you want to have changes from github's development to appear on your local development do
git fetch origin development
git checkout development
git merge origin/development
or
git fetch origin development:development
git checkout development
|
I am going through various tutorials in Git to understand it.
I have a remote 'Origin' which has two branches 'master' and 'development'.
I made certain changes in development from GitHub and committed it. Then I went to my local master branch using
git checkout master
and used
git fetch origin development:development
Now if i create a merge request using
git merge origin/development
or
git git merge origin/development development
then also both the branches are getting updated on my local.
I do not know what is happening.
| Git Fetch/Merge Confusion |
kubectl proxywon't give you any way to run a one-off request and terminate the proxy.Generic way to start a command in the background, run a command and terminate the initially started command finally would be to write a bash script like:#!/usr/bin/env bash
set -eu
kubectl proxy &
proxy_pid=$!
echo $proxy_pid
until curl -fsSL http://localhost:8001/ > /dev/null; do
echo "waiting for kubectl proxy" >&2
sleep 5
# TODO add max retries so you can break out of this
done
curl http://localhost:8001/api/v1/namespaces/default
function cleanup {
echo "killing kubectl proxy" >&2
kill $proxy_pid
}
trap cleanup EXITIf you actually want to use sockets:Start the unix domain socket likekubectl proxy -u ./foo.sockMake sure your cURL supports unix domain sockets and callcurl --unix-socket ./foo.sock http:/api/v1/namespaces/defaultetc. | Is there any way to runkubectl proxy, giving it a command as input, and shutting it down when the response is received?I'm imagining something with the-u(unix socket) flag, like this:kubectl proxy -u - < $(echo "GET /api/v1/namespaces/default")I don't think it's possible, but maybe my socket fu just isn't strong enough. | Running “kubectl proxy” for a single request |
docker stack logsis actually a requested feature inissue 31458request for a docker stack logs which can show the logs for a docker stack much likedocker service logswork in 1.13.docker-composeworks similarly today, showing the interleaved logs for all containers deployed from a compose file.This will be useful for troubleshooting any kind of errors that span across heterogeneous services.This is still pending though, because, asDrew Erny (dperny)details:there are some changes that have to be made to the API before we can pursue this, because right now we can only get the logs for 1 service at a time unless you make multiple calls (which is silly, because we can get the logs for multiple services in the same stream on swarmkit's side).After I finish those API changes, this can be done entirely on the client side, and should be really straightforward. I don't know when the API changes will be in because I have started yet, but I can let you know as soon as I have them!ShareFolloweditedJun 20, 2020 at 9:12CommunityBot111 silver badgeansweredMar 23, 2017 at 5:30VonCVonC1.3m539539 gold badges4.6k4.6k silver badges5.4k5.4k bronze badges0Add a comment| | In Docker 17.03, when executingdocker stack deploy -c docker-compose.yml [stack-name]the only info that is output is:Creating network <stack-name>_myprivatenet
Creating service <stack-name>_mysql
Creating service <stack-name>_appIs there a way to have Docker output more detailed info about what is happening during deployment?For example, the following information would be extremely helpful:image (i.e. 'mysql' image) is being downloaded from the registry (and provide the registry's info)if say the 'app' image is unable to be downloaded from its private registry, that an error message (i.e. due to incorrect or omitted credentials - registry login required) be outputPerhaps it could be provided via either of the following ways:docker stack deploy --logsdocker stack logThanks! | Is there any way to obtain detailed logging info when executing 'docker stack deploy'? |
We faced a similar issue long time back. Here's what we ended up doing:
We generalized the config files, with ample examples and comments to indicate what each item will represent. Trying to make it easy for someone trying it out for the first time, to understand what each stands for, and how it affects the behaviour of the application.
Then we maintained a separate repo, lets say deployment-configs, just for the config files that will go into deployment. It contains all the xml files and properties files that contains configuration data, usernames and passwords, etc.
Then we worked on the app with local variables. During deployment, the deployment scripts would pull out the config files from deployment-configs repo and replace it with the config files from the application repository.
At the end of the day, we didn't open source it. But we successfully ended up separating config files with actual values out of the app repo.
|
We have developed a java website/platform for one of our customers.
The database properties (username, password, etc), are stored in the project's src/main/resources/*.properties e.g database-live.properties, database-dev.properties, database-local.properties
The customer has decided that they would like to open-source their platform, and move from a private bitbucket repository to a open github repository.
This poses a problem, as the private repository has private database properties, that shouldn't be public.
We will therefore not transfer the history from bitbucket, and instead create a clean repo on github, with the users, passwords, etc in the src/main/resources/*.properties as blank properties. The bitbucket repo will then be closed, and the local machine's and live/dev machine's origin will be changed to the github repo.
On the live and dev boxes however, we would still like to be able to git pull from github, and run mvn clean install, but use the correct db details.
What is the best way to go about doing this?
Should we just be adding the properties files to .gitignore, and then on the various machine's local repositories, edit the files with the correct details for that environment?
or should we somehow externalize the configuration, and somehow include it when doing the maven build? what would be the best way to do that?
This seems like a common use case, but maybe I am just going about it the wrong way.
| java webapps and opensourcing existing project to github - properties files |
0
I think you are missing configuring the permissions inside your dyno for your Github account. Check this Github integration article to see how to do that.
Share
Improve this answer
Follow
answered May 3, 2022 at 11:07
João LenonJoão Lenon
4744 bronze badges
Add a comment
|
|
This question already has answers here:
Heroku and GitHub: "Items could not be retrieved, Internal server error"
(12 answers)
Closed 1 year ago.
Whenever i try to Deploy, I am getting an error saying
*Item could not be retrieved:
Unauthorized*
Why i can't deploy private repository Web Applications on Heroku.
| Can't Deploy Github Private Repo in Heroku [duplicate] |
You cannot read /dev/mem if you are not root.
There is no reason for an ordinary application to access /dev/mem, i.e. the physical RAM, since applications are running in virtual memory !
If you change the permission of /dev/mem to enable that (you should not), you will open a huge security hole in your system. Only trusted root processes should access /dev/mem. See mem(4)
(you could use setuid techniques if so wanted, or run your program with sudo)
If you need to access virtual memory in the address space of some other process, consider proc(5) e.g. /proc/1234/mem for process of pid 1234.
|
I am working on ubuntu.
I am trying to open /dev/mem and i am getting permission denied
int32_t open_memdev()
{
int32_t fd;
fd = open("/dev/mem", O_RDONLY);
if (fd < 0) {
printf("Failed to open /dev/mem : %s\n", strerror(errno));
return-EINVAL;
}
return fd;
}
This code always prints "Failed to open /dev/mem : Operation not permitted"
I have searched for this on SO
access-permissions-of-dev-mem
accessing-mmaped-dev-mem
These q's seem to discuss the issue of not being able to access above 1 MB, but my problem is that i am unable to open even once.
Addtitional details if they help:
1) I checked my configuration that CONFIG_STRICT_DEVMEM is enabled.
2) ls -l /dev/mem
crw-r----- 1 root kmem 1, 1 2014-03-13 13:57 /dev/mem
Please let me know if additional information is required.
| open /dev/mem - Operation not permitted |
What kind of coding standards do you want to enforce?If you want to prevent possible problems that can be found with static code analysis with tools likePMDandcheckstyle, you can integrate these checks within your continuous integration server and make the build fail if specific checks fail.[edit] sorry, my answer is very similar to the one of the other question - in which point does your question differ from the other one? | We are using Github as VCS for our Java project. I am figuring out ways to enforce coding standards before pushing to remote repositories for members of my team.On researching, I came across this github pre-commit web hooks.But after research found out that it isn't possible to maintain the scripts centrally within the repository. So I have few questions at this point.Is pre-commit hooks a right way to enforce coding standards across team ? (I know it definitely isn't but wanna hear it from the experienced guys)If enforcing coding standards is feasible only at the Continous integration stage then with what tools do I achieve that to enforce Java coding standards for my projects across the team ?My question is something similar on the lines of this one 'How to enforce Coding Standard for the repository located in GIthub | Enforcing Coding standards for Github repositories across team |
The default Kubernetes way of doing this is to use an operator.In a nutshell, you have a software running that is watching resources (Namespacesin your case) and react when some namespace changes (deleted in your case).You might want to addfinalizersto Namespaces for proper cleanup.Please refer tothe documentationfor more details. | Is there any default options in kubernetes, to trigger some actions when the resource gets deleted from the cluster? | How to trigger some action when K8 namespace is deleted |
You can use aStatefulSetin conjunction with aHeadless Service. One of the features of a StatefulSet is a unique consistent naming convention:For a StatefulSet with N replicas, each Pod in the StatefulSet will be
assigned an integer ordinal, from 0 up through N-1, that is unique
over the Set.So, if you have three copies of MyPod, you know the names will beMyPod-0,MyPod-1,MyPod-2. Then if you tie them to a Headless Service calledMyHeadlessService, you will be able to reach your pods via:MyPod-0.MyHeadlessService
MyPod-1.MyHeadlessService
MyPod-2.MyHeadlessServiceTo see this you can exec intoMyPod-0kubectl exec -it MyPod-0 /bin/bashAnd then pingMyPod-1ping MyPod-1.MyHeadlessServiceThere's lots of examples online of this pattern, and you can decide if it fits your use case. As an anecdote, Cluster related technologies like ElasticSearch and Vault use this pattern for inter-node communication. | What is the recommended way to communicate between the pods belonging to the same replica-set (deployment)? Is it possible to lookup what are the urls of other pods from a given pod?Or is replica-set not a right approach to follow for that?Looking for a right k8s way to do this. Thanks! | k8s: Communicating between pods of same deployment |
This will help you:(?:INTERNET) | I have installed Grafana and integrated into my zabbix server.
I need to filter host groups so they don't contain any of the specified groups.In zabbix a host corresponds to several groups, in grafana I want them not to be displayed if they belong to at least one specified group.I tried with the regex:/^((?!INTERNET).)*$/But if a host also has other group than the INTERNET it is displayed | Grafana + Zabbix: Filter Host multiple host group |
No, you can't do that -CNAMErecords can only exist as single records and not combined with any other resource record (DNSSEC records excepted).There are explicitSOAandNSrecords always present at the top of each domain, so that prevents the use of theCNAMEat the same part of the hierarchy. | Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed12 years ago.Improve this questionWe are hosting the page of many of our customers. We want to be able to provide our customers with a subdomain of our own domain like customerpages.ourdomain.com so they can create a CNAME to this subdomain.www.customer1.com CNAME customerpages.ourdomain.com. {This will work just fine.}But the situation is I don't know if all our customers will be able to place the following CNAMEcustomer1.com CNAME customerpages.ourdomain.comThis last CNAME looks like it's against the RFC of DNS.Any thoughts will be appreciated. | Is Root domain CNAME to other domain allowed by DNS RFC? [closed] |
The current OpenSSH is using SHA256 hashes instead of the ancient MD5 you expect on the first line of your code. To get the legacy fingerprint, there is the-Eswitch to select a hash algorithm:ssh-keygen -E md5 -lf ~/.ssh/key.pub | Looking at the fingerprints on github and of my public ssh key they have different formats (e.g. colon separator) and differGithub
a6:f2:09:40...etc
As generated by: ssh-keygen -lf ~/.ssh/key.pub
4096 SHA256:neLNT0...etcI can login so can anyone explain what I'm missing? | RSA fingerprints on github don't match ssh-keygen |
The file is already inside the container. If you read carefully through the CI/CD build log, you will see at the very top after pulling the image and starting it, your repository is cloned into the running container.You can find it under/builds/<organization>/<repository>(note that these are examples, and you have to adjust to your actual organization and repository name)Or with the variable$CI_PROJECT_DIRIn fact, that is the directoryyouare in when starting the job.For example, this .gitlab-ci.yml:image: alpine
test:
script:
- echo "the project directory is - $CI_PROJECT_DIR"
- cat $CI_PROJECT_DIR/README.md ; echo
- echo "and where am I? - $PWD"returns this pipeline output:As you can see, I could print out the content of the README.md, inside the container. | How can I add a file from my project into a Docker using in agitlab-cijob. Suppose I have below job in my.gitlab-ci.yml.build:master:
image: ubuntu:latest
script:
- cp sample.txt /sample.txt
stage: build
only:
- masterHow to copy a sample.txt inside Ubuntu image? I was thinking as it is already a running container so we can't perform copy command directly but have to rundocker cp sample.txt mycontainerID:/sample.txtbut again how will I get mycontainerID? because it will be running inside a Gitlab runner and any random id will be assigned for every run. Is my assumption is wrong? | How to copy a file from the repository, into the Docker container used for a job, in gitlab-ci.yml |
to pass this to a helm chart you should use values.Instead of{{env SUPER_SECRET | quote }}use{{ .Values.secret }}and then when you run helm run it as for examplehelm install chart --set secret=${SUPER_SECRET} | I'm pretty new to helm and go templates so please bear with meI have a template called secrets.yaml:apiVersion: v1
kind: Secret
metadata:
name: fooo-secrets
labels:
app: {{ template "fooo.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque # TODO
data:
SUPER_SECRET: {{env SUPER_SECRET | quote }} <--- the problem lineI gotenvfromsprig. The idea is that I can load up my secrets into my local environment and then deploy from there.But when I lint my chart:> helm lint fooo [13:29]
==> Linting fooo
[INFO] Chart.yaml: icon is recommended
[ERROR] templates/: parse error in "drone_ci/templates/secrets.yaml": template: drone_ci/templates/secrets.yaml:12: function "env" not definedWhat am I doing wrong here? | function "env" not defined |
It's dynamically allocated if the shared memory size is specified at run time. It is statically allocated if the size of the shared memory is determined at compile time. Your example is static shared memory allocation. | I want to know what is the difference between statically allocated shared memory and dynamically allocated shared memory on the GPU? In my device code, I have the following line:__shared__ int temp[THREADS_PER_BLOCK];Is this static or dynamic allocation of shared memory? | Shared Memory Allocation on GPU (Static or Dynamic) |
Kubernetes is doing exactly what you are asking, probing the http url but your application pod web server is redirecting it to https, that is causing the error.You can either fix that in pod or useTCP probeapiVersion: v1
kind: Pod
metadata:
name: goproxy
labels:
app: goproxy
spec:
containers:
- name: goproxy
image: k8s.gcr.io/goproxy:0.1
ports:
- containerPort: 8080
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20 | We have an http livenessProbe setuplivenessProbe:
httpGet:
path: /admin
port: http
initialDelaySeconds: 180
periodSeconds: 20but why in the description the connection is via httpsLiveness probe failed: Get https://10.11.1.7:80/admin: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) | Kubernetes http livenessProbe use https? |
If this problem appears, you have to :1 -Go to the Atom menu.2 -Select "Install Shell Commands".3 -Restart the terminalIt's magic it works :D | When I give the command "$git commit" to git bash, then$ git commit
hint: Waiting for your editor to close the file... atom --wait: atom: command not found
error: There was a problem with the editor 'atom --wait'.
Please supply the message using either -m or -F option.this error is thrown by git. I have configured atom in git using this command :-$ git config --global core.editor "atom --wait" | Git commit command is not working properly with atom editor |
Try with removing the./-config/databases.phpand if thevendoris in same folder thenvendor/phpmailer/phpmailer/PHPMailerAutoload.php. No need of./. | INCLUDE './config/databases.php';
require './vendor/phpmailer/phpmailer/PHPMailerAutoload.php';When i execute this script from browser i get no warning / issues .
but when i put same script for Cron jobWarning: include(./config/databases.php): failed to open stream: No such file or directory in /home/webdir/public_html/corn_mail.php on line 2
Warning: include(): Failed opening './config/databases.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/webdir/public_html/corn_mail.php on line 2
Warning: require(./vendor/phpmailer/phpmailer/PHPMailerAutoload.php): failed to open stream: No such file or directory in /home/webdir/public_html/corn_mail.php on line 3
Fatal error: require(): Failed opening required './vendor/phpmailer/phpmailer/PHPMailerAutoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/webdir/public_html/corn_mail.php on line 3also tried to change from./config/databases.phpto/home/webdir/public_html/config/databases.phpStill the same.any suggestions ? | Cron Job failed to open stream: No such file or directory |
In the Openshift Console you can stop the POD using Deployments Menu.In the left side Menu bar, Expand Workloads menu.
Workloads -> DeploymentsIn the right pane for deployments, select relevant project and then under the "Details" tab You see the Colored circle, you can take down the pod using the down arrow symbol next to that circle.
Similarly use teh Up arrow symbol to start the pod if you have stopped that. | I am a newbie to the Kubernetes world and don't have much context on openshift/Kubernetes.Here is the requirement: when I run the below command which lists the all running jobs:$ oc get podsName READY STATUS RESTARTS AVGabc-job1-dev 1/1 Running 0 38habc-job2-dev 0/1 Completed 0 7dHere one job1 is running 24/7 then how can pause/stop it for some time when job 2 starts running and then resume it once the job2 task is completed? | How to stop a pod job in openshift platform? |
Take a look at the assets_version parameter, so every asset get a version string without doing extra things in the template
|
I'd like to force client's cache refresh for modified assets.
Is there already a native way to do it with asset() like
<script src="{{ asset('js/main.js')|autoversion }}"></script>
?
If not, I found this really elegant solution (based on file timestamp & url rewrite) to manage it.
Did someone already faced this question and would know how to extend asset() for example?
| Symfony - Assets cache auto versioning |
Looks like the connection pool is getting exhausted for some reason. You can monitor the Druid connection pool ( your stacktrace suggests you are using Alibaba Druid connection pool) by configuringDruidStatInterceptoras mentionedhere. Worth checking for any connection leaks happening. | I added Prometheus monitoring to my service.java -server -Xms512m -Xmx512m -XX:SurvivorRatio=8
-javaagent:${base_dir}/jmx_exporter/jmx_prometheus_javaagent-0.11.0.jar=7030:${base_dir}/jmx_exporter/exporter_config.yml
-jar ${base_dir}/my-service.jar --spring.profiles.active=testexporter_config.yml--- username: password:rules:
- pattern: ".*"The service started to report error after running for a period of time.Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 2000, active 20, maxActive 20Turn off monitoring and return to normal.Before I added monitoring, I confirmed that my service is normal.Would you do me a favor? | prometheus occupies the JDBC connection |
This feature is known asVLAor variable length array. This is not supported in all C standards. In recent C standards likeC11andC99, it is supported, but not in older C Standards as 'C89'.If you're usinggcc, please have a look at thecompiler documentationregarding this.ShareFolloweditedDec 4, 2014 at 4:50arahan56723722 silver badges1010 bronze badgesansweredDec 3, 2014 at 7:04Natasha DuttaNatasha Dutta3,2622222 silver badges2323 bronze badges11What is also worth to mention: this feature is not suported by MSVC they simply deny to support VLA's in their compiler. This is one of the reasons why the Visual C of Microsoft isn't allowed to call it self plain C.–dheinDec 3, 2014 at 7:40Add a comment| | I wrote a simple code where I am creating array without a fixed size. I tried compiling the code ingccand it is working fine. Please explain why this is working array size should be supposed to be known at compile time.Here's the code I have used.void f(int k)
{
int a[k];
.....//some operation
}
int main()
{
int i = 10;
f(10);
return 0;
} | Array size should be known at compile time |
+25An important point, that if you need to provide quick access to these files, then Glacier can give you access to the file inup to 12 hours. So the best you can do is to useS3 Standard – Infrequent Access(0,0125 USD per GB with millisecond access) instead ofS3 Standard. And maybe for some really not using dataGlacier. But it still depends on how fast do you need that data.Having that I'd suggest following:as html (text) files have a good level of compression, you cancompress historical data in big zip files(daily, weekly or monthly) as together they can have even better compression;make some index file or databaseto know where each html-file is stored;read only desired html-files from archiveswithout unpacking whole zip-file. Seeexample in pythonhow to implement that. | I have 2 million zipped HTML files (100-150KB) being added each day that I need to store for a long time.
Hot data (70-150 million) is accessed semi regularly, anything older than that is barely ever accessed.This means each day I'm storing an additional 200-300GB worth of files.Now, Standard storage costs $0.023 per GB and $0.004 for Glacier.While Glacier is cheap, the problem with it is that it has additional costs, so it would be a bad idea to dump 2 million files into Glacier:PUT requests to Glacier $0.05 per 1,000 requestsLifecycle Transition Requests into Glacier $0.05 per 1,000 requestsIs there a way of gluing the files together, but keeping them accessible individually? | Storing many small files (on S3)? |
You'll need the SSH key-pair for the parent, and for each submodules (if they are private or if you want to make new commits in those submodules).See for instance "Pagoda Box":Private Submodule ReposIf your submodule is in a private repo you'll need to grant Pagoda Box access to pull from that repo. You can do so by adding Pagoda Box's public SSH Key to the repo.If it's a GitHub repo, you can accomplish the same thing by simply adding 'pagodabox' as a collaborator. | If I want to access a private github repo with its deploy keys system. Do I need a ssh key-pair for the main git repo and all its submodules or just the parent one? | Github deploy keys, submodules, ssh |
Chrome does not allow you to export the certificate anymore. You need to either use another browser that supports this feature (e.g. firefox) or just simply copy the generated certificate to the shared directory from your homestead machine, so then you can import and trust it in the keychain.# where I share all homestead certs with the host machine
mkdir /home/vagrant/Code/.certs/
cp -vf /etc/nginx/ssl/homestead.app.cert /home/vagrant/Code/.certsOn your local host machine, open the certificate file and import it to theSystemkeychain. Once imported, open it and set its trust level to"Always trust".Restart Chrome and you're done. | I followed the following details on creating an SSL certificate, so I can run local test sites via Laravel's Homestead, using https.Adding https cert on homestead vmAll is well but when viewing the test domain overhttps://, I get a red cross on Chrome's address bar. It says that the certificate is untrusted due to being self-signed and not verified by third-party.Is there a way that I can sort this out? So that I can get my HTTPS local domains to be trusted by Chrome and work as if online? | Verifying a self-signed certificate on local Laravel Homestead server |
Prometheus doesn't call phone numbers. (Nor does it send SMS, for that matter.) You need to either write your ownwebhook handler(i.e. an HTTP server) that then makes an API call to a 3rd party provider.The other option is to hook up your Alertmanager to a service like Opsgenie/Pagerduty that includes phone calls as an option to get notifications.That being said, I don't think any of these options will be free (as in beer). | im setting Prometheus as a monitoring system, with Alertmanager. As an alert i need service that will call on selected number or group of numbers.Best solution for us would be not to have an 3rd party provider who is gonna be covering this for us.Thanks a lot. | Call alerts integration with Prometheus Alertmanager |
The S3 VPC Endpoint is configured via the routing of the VPC. For this reason you will not be able to resolve to it outside of the VPC.However, you could run a private EC2 instance with a proxy in front to forward traffic to your S3 bucket, then set a resolveable hostname to the EC2 instance itself.Additional linkshttps://docs.aws.amazon.com/vpc/latest/userguide/vpce-gateway.html#vpc-endpoints-routing | I've been looking for a solution to host internal S3 website that's accessible over VPN. Clearly I don't wanna use CLoudFront + WAF to restrict the IP range.I tried setting up the following,Created a VPC Endpoint for S3 servicesCreated a static S3 website bucket with bucket policy restricting access only through VPC Endpoints.Created a private hosted zone and configured an Alias record set to S3 website addressThe above solution exposes HTTP endpoint and I wanna secure it with SSL and I'm looking for options.Have also been looking to setup reverse proxy infront of S3, but couldn't find a clear implementation reference.Does the above solution would work? Or I'm missing something big? | Hosting internal S3 Website that's accessible over VPN and is secured with HTTPS |
0
If you plan to keep both endpoints you could do git remote set-url --add origin https://new.url/path/to/repo.git and this will make it so when you push, you will push to both endpoints at the same time. However pulling only comes from one source. If pulling is a concern then I recommend using a new remote. Your steps are similar to the ones you previous mentioned:
To push your current history to a new endpoint, completely unrelated to the current endpoint, follow these steps. Note that this will disconnect your local repository from the current endpoint and join it to your new endpoint.
1) git pull --all
2) git pull -t or git pull --tags
3) git remote set-url origin [email protected]:user/repo.git
4) git push --all
5) git push --tags
and if anything goes wrong, all you need to do is clone from your original repo.git that origin is currently set to
Share
Improve this answer
Follow
answered Nov 8, 2016 at 5:13
OxymoronOxymoron
1,41022 gold badges2020 silver badges4848 bronze badges
Add a comment
|
|
I have a GitHub repo that I want to copy and push to a new remote URL under a different organization. I'd like to preserve as much history as possible, such as branches and commits, but I'm not sure how to do this. My local copy doesn't have all branches.
I've seen similar questions, but I wanted to confirm since it's somewhat of a risky task.
Are the steps something like this?
git fetch origin
git branch -a
git remote add new-origin [email protected]:user/repo.git
git push --all new-origin
git push --tags new-origin
git remote -v
git remote rm origin
git remote rename new-origin origin
| Copying GitHub repo to new remote URL |
With recent versions of Docker you can see the space used with:
docker system df
and prune it with:
docker system prune
The above command combines the prune command that exists for volumes, containers, images and networks:
docker volume prune
docker container prune
docker image prune
docker network prune
Each command has a --help option documenting a -f (--force) option to avoid asking you questions. It must be used with care.
-o-
On older versions of Docker I ran the script:
#!/bin/bash
# Remove dead containers (and their volumes)
docker ps -f status=dead --format '{{ .ID }}' | xargs -r docker rm -v
# Remove dangling volumes
docker volume ls -qf dangling=true | xargs -r docker volume rm
# Remove untagged ("<none>") images
docker images --digests --format '{{.Repository}}:{{.Tag}}@{{.Digest}}' | sed -rne 's/([^>]):<none>@/\1@/p' | xargs -r docker rmi
# Remove dangling images
docker images -qf dangling=true | xargs -r docker rmi
# Remove temporary files
rm -f /var/lib/docker/tmp/*
|
I have some problem about the storage. The folder /var/lib/docker/devicemapper/ is taking 50% of my storage.
In the folder /var/lib/docker/devicemapper/mnt, I have many empty folders.
How can I properly clean docker devicemapper and remove all unused mapping ?
| How to clean docker devicemapper folder properly ? |
Try having this, remember to restart after insertion:location / {
try_files $uri $uri.html $uri/ @extensionless-php;
index index.html index.htm index.php;
}
location ~ \.php$ {
try_files $uri =404;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
} | I'm new in this site and new with NGINX, so be nice, please. I rencently switched to AWS Elasticbeanstalk and need help with NGINX configuration. I wanna do some redirection that I know and tested that works in apache2 with .htaccess but I'm not able to acomplish with NGINX.I want all my URL to end with trainling slash, check if $uri is a directory if so use index.php if not use last name as the name of the script as follows:I want that this URL: uses this script:https://localhost/ -> ./index.phphttps://localhost/page/ -> ./page.phphttps://localhost/folder/page/ -> ./folder/page.phphttps://localhost/folder/page/?param=foo -> ./folder/page.php?param=fooI made it behave like this in apache2 with this config in .htaccess:# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1/ [R,L]
# add a trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteRule . %{REQUEST_URI}/ [L,R=301]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]How can I translate this .htaccess into NGINX config file?Thanks in advance. | Externally redirect URL in NGINX conf to add slashes and use php files |
0
Maybe you use pausing or something like this and you target file is locking. It is possible that your security software is scanning and locking the file, which may still be in the system temporary folder after you pause the download.
Share
Improve this answer
Follow
answered Dec 23, 2016 at 13:05
Alex K.Alex K.
1822 bronze badges
Add a comment
|
|
I have a very simple script for downloading a pdf:
$path = __DIR__.'/sample_file.pdf';
$pathinfo = pathinfo($path);
$fsize = filesize($path);
$filename = $pathinfo['basename'];
header('Content-Type: application/pdf');
header("Pragma:public");
header("Content-Disposition:attachment;filename=" . $filename);
header('Content-Length: ' . $fsize);
header("Pragma: no-cache");
@readfile($path);
exit;
This works fine for files smaller than 10mb. But anything over that I get an error and the download fails. Have tried in a number of browsers and get similar results. In all cases the download fails.
Chrome: Failed: Network error
Firefox: [filename].pdf.part could not be saved, because the source file could not be read.
Opera: Interrupted: Network error
IE (10): [filename].pdf couldn't be downloaded.
I know the filepaths are correct, or else it wouldn't work with files smaller than 5mb.
Reading the php docs (http://php.net/manual/en/function.readfile.php) on readfile some have suggested disabling output_buffering (currently set to 4096 in php.ini) before calling readfile. I have yet to try this but I'm not convinced it is the solution.
10mb0 is disabled. I am not seeing any errors in my logs. I am also not seeing any errors in the network pane in Chrome inspector.
I have tried downloading with chunks but get the same result. I have researched similar answers but all seem to be browser specific, i.e. working in some browsers but not others.
| Download PDF - Failed: Network error, PHP-FPM and Nginx |
Depending on the nature (confidential or public) of your project, you could use aGitHub ActionslikeSonarSource/sonarcloud-github-actionThat way, on each push, you would scan your code withSonarCloud.io.But if you have a local SonarQube instance running, then you need theDeveloper edition, and check if your GitHub credentials are correct. | I have a repository in my github account and i want to analyse it with sonarqube after each commit
I put the repository url in my sonar scanner properties :
sonar.sources=https://github.com/rahma/JavaTestbut does not work .
any idea about this please ? | sonarqube github project analysis |
The problem there is that you started working from a branch that is different from the branch that you are asking your PR to be merged into.... that's why you see those other revisions. You might skip this problem by rebasing your branch... suppose that it's called X and you want to merge it into origin/master:
git rebase --onto origin/master X~1 X
git push --force origin X # replace the old X on the server with the new X
Now the PR should only contain your revision.
|
I would like the ability to build a Pull Request that includes commits from each developer or a specific work item. I typically create a branch for each work item that I am addressing. But I often find that additional commits (from other developers and work items) appear when I create a Pull Request.
For example, I have a commit that consists of changes to one-and-only-one file. When I do a Pull-Request, the Pull-Request balloons to an additional four commits with an additional 40 files.
My steps are below.
Create a new local branch from my remote master branch.
I edit one-and-only-one existing file.
I save my changes to the edited file.
I Push my change from my local branch to the origin branch. This creates a commit with changes to the one-and-only-one file.
I do a Pull Request.
I now have four additional commits and a total of 41 files.
Is there a way to build Pull Requests to include only commits for an individual developer?
I would also like to use a separate branch; specifically for merging commits from multiple developers and work items.
Are there third-party tools that are especially good at allowing developers to remove commits from a Pull Request? I'm especially interested in a tool that would simplify Git and reduce the time lost to Git issues.
| Can I create a Git Pull Request that only includes commits for an individual developer or work item? |
You are nearly there.
In Docker when a container is run, the docker daemon mounts the images layers using a unionfs. It adds a layer on top of the images layers to track changes that are happening inside of that container. Say a log file is written that is tracked as part of this layer.By removing a container you remove the resources use to track this layer of changes that the container has done on top of the image.When a container is running it consumes CPU, memory and the HDD space associated with this layer.When a container is stopped, the CPU and memory are released but the HDD space is still used. (You can check stopped containers usingdocker ps -a; this will show you all the containers across all states)When a stopped container is removed the HDD space is also freed up.
Docker also removes all the meta-data(when it was started, where its files are etc) associated with the container when you remove the container.To have some more fun with this do this:docker inspect <image_name>:<tag>and see its output.docker inspect <containerid>and see its output, here containerid should be of a container running off the above image. And see if you can figure out the layers and cross relate them across the image and container. | I am getting my hands dirty with Containers and Docker. In the world of Docker (or the world of Containers in general), I am trying to understand what "removing a container" means. The mental model I have of a container is that it is a running instance of an image. If a container has stopped executing, what resources is it consuming that need to be freed? I can understand removing the associated image(s) as they consume disk space. Maybe my mental model of a container as "a running instance of an image" is not correct, and there is more to it. If someone could shed some light, I would greatly appreciate it. | What does remove container mean/do? |
If you are really want to do it all manually you should checkKubernetes The Hard Way. This tutorial does not have any automation process, you need to do all manually. Honestly I would recommend it after a few days/weeks of practicing withKubernetes.Second good place to learnKubernetesisKatakoda. You can find thereKubernetesandDockertutorials. If you want to learn Kubernetes you alsoneed to learn something about containers before.Another place isKubernetes Tutorials. Also here you can find some Tasks or Concepts. The same site contains whole K8s documentation with real examples.For environment to runKubernetesI would advise youMinikube. It will create you one-node cluster. Before you will need instalDockerandKubectl.
As for beginner I would suggest to use Minikube with--vm-driver=none.Last source I wanted to mentioned isMedium. You will be able to find many tutorials for Kubernetes/Kubeadm/Minikube. | I am sorry if this question sounds silly.I would like to know any place where I can learn the kubernetes simple to hard way where a beginner can get the whole idea of kubernetes, from scratch until you deploy an application to aws with other tools such asprometheus,stackstormetc.I know there are many Youtube videos and Udemy courses, but, I need a different source, maybe aGithub Repository, or aBlogthat teaches a newbie about Kubernetes from scratch to at least to the intermediate level withcommandsusingminikube.Thank you so much for your patience with me for a question like this butI really appreciate this.It is hard to find a good tutorial, videos are really boring or out of the scope sometimes. | Where I can learn the Kubernetes with Hands on |
You can use semantic model to get information about symbols (classes, methods, ...) defined in the project. When you analyze class, you have access toClassTree, so you can test if annotation is present on its superclass like thisClassTree classTree = (ClassTree) tree;
Symbol.TypeSymbol classSymbol = classTree.symbol();
Type superClass = classSymbol.superClass();
SymbolMetadata superClassMetadata = superClass.symbol().metadata();
if (superClassMetadata.isAnnotatedWith("org.acme.MyAnnotation")) {
//...
}See for example this checkimplementation, which uses the API | So, im currently developing a SonarQube Java Plugin with some custom rules.One of them needs to analyze the Java file for a specific annotation, and if it's missing, it should report an issue UNLESS that annotation is on its superclass.The problem is that i can't analyze another file (the superclass) DURING the current analysis (on the class).Is there a way to do this?Obs: I'm using SonarQube Server 5.6.3 and Sonar Java Plugin 4.9. | Analyze another file during SonarQube analysis (custom rule) |
According tohttps://multimediacommons.wordpress.com/yfcc100m-core-dataset/, although the dataset is hosted in an S3 bucket, access to it is restricted, so you need tosubmit a requestand follow further email instructions for access:Getting the YFCC100M: The dataset can be requested atYahoo Webscope. You will need to create a Yahoo account if you do not have one already, and once logged in you will find it straightforward to submit the request for the YFCC100M. Webscope will ask you to tell them what your plans are with the dataset, which helps them justify the existence of their academic outreach program and allows them to keep offering datasets in the future. Unlike other datasets available at Webscope, the YFCC100M does not require you to be a student or faculty at an accredited university, so you will be automatically approved. | I am trying to download a dataset hosted in AWS.
I am trying to uses3cmdand configured it with my access key and secret key.
I can list the the files in the bucket properly using:s3cmd ls s3://yahoo-webscope/I3set13/I usedgetto download the dataset:s3cmd get --recursive s3://yahoo-webscope/I3set13/But the following error is shown:ERROR: S3 error: 403 (Forbidden)A few solutions I found suggested to change the bucket policy, but I can't change it because I am not the owner.Please let me know the reason behind the problem and how I can solve it. | Downloading yfcc100m from aws s3 bucket |
2
Try to add the full path to the docker-compose inside the script
which docker-compose
>/usr/bin/some/path/docker-compose
Then add this to your script
#!/bin/sh
set -e
/usr/bin/some/path/docker-compose up -d
Your local PATH settings are unknown to the script called by docker. Therefore you have to name the full path.
Share
Improve this answer
Follow
answered Jun 27, 2016 at 12:52
cb0cb0
8,51599 gold badges5555 silver badges8181 bronze badges
0
Add a comment
|
|
I have a Dockerfile which is basically the following:
FROM mhart/alpine-node:5
COPY . /project
WORKDIR /project
ENTRYPOINT ["./startup.sh"]
And my startup.sh is quite simple too:
#!/bin/sh
set -e
docker-compose up -d
I do have a docker-compose.yml, but there is no point to describe it here.
First thing I do is to build the docker image by using my Dockerfile, so:
docker build -t test .
Then run this image:
docker run -d test
Which will launch the startup.sh
Unfortunately, I have the following error showing up:
./startup.sh: line 10: docker-compose: not found
And if I do only ./startup.sh without the docker stuff, it works like a charm.
Where the issue can be possibly coming from?
| docker-compose not found from script |
On windows you can find the containers logs inside:C:\ProgramData\docker\containers\[Your_container_ID]\[Your_container_ID]-json.log | I want to locate a container's log location.I useDocker Desktop for WindowsI know that on linux they are at/var/lib/docker/containers/But where is it. Is it hidden away somewhere in an inaccessible VM? | Docker log (driver json-file) location for Docker for windows |
You could try and add a matching '#', followed by one extra '#':### C# #ShareFollowansweredAug 25, 2015 at 6:03VonCVonC1.3m539539 gold badges4.6k4.6k silver badges5.4k5.4k bronze badges16@Maxpm Ascommented above: "because without the extra hash, the parser was mistaking the hash in C# for a closing hash."–VonCMar 26, 2019 at 7:19Add a comment| | I have the following code on aREADME.mdfile on GitHub, where I am trying to display the hash sign on a header (I am trying to escape it using the\symbol) like so:### C\#
* [Beginning Game Programming with C#](https://www.coursera.org/course/gameprogramming)However it renders like so:I obviously want the hash sign to appear on the header, and I also tried to use a double backslash, but it didn't work. How do I get the pound sign to appear?EDIT: the linked question deals with GitHub links, my question is to do with headers on a.mdfile. | How to escape the (hash) # sign in a GitHub markdown header? (backslash is not working) |
2
The numbers returned by java.lang.Runtime are not worth much - ignore them.
You'll get better results from the Management API, e.g.
MemoryUsage memoryUsage = ManagementFactory.getMemoryMXBean().getMemoryUsage();
... and related methods, which will likely give you far more information than you ever wanted to know.
Share
Improve this answer
Follow
edited Dec 6, 2010 at 15:34
answered Dec 6, 2010 at 15:29
skaffmanskaffman
401k9696 gold badges821821 silver badges773773 bronze badges
Add a comment
|
|
I want to gather the heap usage of a program. In particular from a specific start event up to an end event, and with a set interval for example every 10ms.
I tried to implement something like this myself, which is the following code. It works for slow intervals, like 1second, but for lower intervals, like 100ms, it becomes buggy.
Does the System.gc() method block all threads until it finishes? I'm currently assuming so.
public void startAsync()
{
running = true;
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
while (running)
{
measure();
try
{
Thread.sleep(wait);
} catch (InterruptedException e)
{
throw new RuntimeException();
}
}
}
});
thread.start();
}
public void measure()
{
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
memoryBean.gc();
long currentTime = System.currentTimeMillis();
MemoryUsage memoryUsage = memoryBean.getHeapMemoryUsage();
writer.exec(currentTime - startTime, memoryUsage.getUsed());
}
| Java heap profiling between two events |
It's fairly simple actually.
If you just want to print stuff using in the build proccess you could just add the following line to your Dockerfile:RUN echo "hello there"And then add these options to yourdocker buildcommand:--progress=plain --no-cacheEDIT:as noted by @SoftwareEngineer, when used for logging or tooling purposes you should append the echo command to the one you want to check if were successful. for example when downloading packages and wanting to get a print statement when finished:example from nginx official image dockerfileRUN apt-get install -y whatever && echo "installed package" | Suppose you have some Dockerfile. What needs to be added to that file such that a string (ie "Hello World") is printed to the console during build?docker build .RESEARCHThis question is a top hit in Google for this topic. I have researched by googling and landing here.WHAT I HAVE TRIEDFrom the accepted answer:RUN echo "hello there"This actually doesn't work. | How do you print to console from a docker file during build? |
I would suggest Web sockets as a method to push the notification back to the browser, instead of let the browser polls (i.e, periodically sending GetObject API call) for the PDF file in S3. This approach will help you to notify the browser if an error occurred when PDF generation.For more details could you please watchhttps://www.youtube.com/watch?v=3SCdzzD0PdQ(from 6:40).At 10:27 you will find a diagram that matches to what you are trying to achieve (replace DynamoDB component with S3).I also think the Websocket based approach is cheaper compared to the polling approach by comparing S3 pricing [1] vs Web socket pricing [2]. But you will need to conduct a test (which reflects a production workload) and validate this.[1]https://aws.amazon.com/s3/pricing/#Request_pricing[2] "WebSocket APIs" inhttps://aws.amazon.com/api-gateway/pricing/ | I would like to know if AWS SQS is the right service for doing browser polling.For example :1) User acesses application through browser, and requests a large PDF to be generated2) API responds back with "OK" to user and forwards the request to SQS3) SQS queue is being read by a lambda which generates the PDF and stores it to S3.Now, at some point between steps 2 and 3, the user browser wants to know when the PDF is done (no email), it could do this by polling SQS for a specific message ID (is this possible even?), but I have some questions :a) Is it "okay" for both the user and lambda to be reading the same message from SQS? And what about too many users overloading SQS with polling requests?b) Can a SQS message be edited/updated? How would the user know that lambda finished the PDF and get the download link? Can lambda edit the message to that it contains the link to S3? If not what would be the recommended way/AWS service for the user to know when the PDF is done without wasting too much resources?And preferably without needing a database just for this... We really don't have too much users but we're trying to make things right and future proof.Tagging boto as i'm doing all this in Python... eventually. | Amazon SQS for browser polling? |
Currently maximum only 512MB is allowed for eclipse in your ini (-Xmx512m), if you have enough RAM you shall try increasing it to 1GB. More info herehttp://wiki.eclipse.org/FAQ_How_do_I_increase_the_heap_size_available_to_Eclipse%3F | I m using Eclipse Indigo. It becomes unresponsive often and finally prompts saying out of memory error and asks me to exit workbench. I increased the Perm Gen space as told in one of the eclipse forums by editing my eclipse.ini file.Eclipse.ini file contents now is as below,-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-vm C:/Java/jdk1.5.0_15I mostly do Javascript development in eclipse. And I am not able to edit JS file in eclipse.
What can I do to solve this problem? | Eclipse becomes unresponsive |
It is likely that the GitHub web interface has a limit on the size of data that can be uploaded. What you can do is create a gist with some data that you want (such as a README or a portion of the data), clone it, and then add the rest of the data via Git and push.Note that if your log is very large, GitHub may not display it all in the web interface for performance reasons.Having said that, while it is fine to create a gist to share a particular log snippet, in general Git repositories are not a good way to store logs or other automated data, so you wouldn't want to continually push new logs to that gist or otherwise update it in an automated way to show new log entries. | Is there a limit in the size of a GitHub gist or a maximum number of lines?I am trying to make a gist with a generated file from logs, and receive a 422 validation error once in a while when the logs are getting relatively large. | Limits in Github gists |
5
Answering my question. The cleanest approach I end up with is to have a separate Report-To header, taking JSON between single quote.
add_header Report-To '{"max_age":31536000,"endpoints":[{"url":"https://example.com/csp-report"}]}';
Then the Content-Security-Policy header reference the report-to groupname, which is default by default.
add_header Content-Security-Policy
"default-src 'self';
report-uri https://example.com/csp-report;
report-to default";
Share
Improve this answer
Follow
answered May 26, 2020 at 14:08
Janaka-StephJanaka-Steph
13111 silver badge88 bronze badges
Add a comment
|
|
According to CSP MDN documentation, report-to takes a JSON object, but I can't find a way to embed JSON in Nginx configuration.
I tried this code and all the variants I can think of, escaping the quotes, adding single quotes, etc.
add_header Content-Security-Policy
"default-src 'self';
report-uri https://example.com/csp-report;
report-to {"group":"csp-endpoint","max_age":10886400,"endpoints":[{"url":"https://example.com/csp-reports"}]}";
Is it possible to embed JSON in add_header directive with or without additional Nginx modules?
| How can I set Content-Security-Policy Report-To header in Nginx +1.17? |
1
If you want Phabricator to host the master, you can add a URI with IO type of Mirror for your github repository under Manage Repository / URIs / Add New URI.
Phabricator will then automatically push to the mirror when new changes are committed. You will need to be careful with access to the GitHub repository though - if anyone pushes to GitHub, the changes will be lost, so if possible it should be read-only except for the user that Phabricator is authenticating as.
Share
Follow
answered Dec 21, 2016 at 6:58
JSONJSON
4,5562323 silver badges2626 bronze badges
Add a comment
|
|
I'm using Phabricator in order to manage a project. Thus I have several repos, hosted on a personnal server, on Phabricator. I push (or arc diff) directly in them in order to have information on Phabricator.
However this project is opensource, thus I would like to host it on my Github profile at the same time. Indeed I don't want to be able to push directly from the Github repo, I just need to have a synchronized copy of the Phabricator repo on Github to let the community see the project.
I have searched on the Internet and in the Git doc, however I still don't have a working solution.
For instance, I have tried the following, but without success:
create a repo on Github
clone a bare repo of my phabricator repo on my computer
in this bare repo, add the remote github repo
I'm able to push via this repo to Github, but any change on Phabricator does not appear with "git fetch" ...
Do you have any idea, or a working solution ? Thanks :)
| Synchronize Phabricator repo with Github |
4
Vagrant is a utility to help you automate setting up VMs. Docker is a utility that helps you use containerization in linux.
A virtual machine runs a whole system, and emulates hardware. Containers section off processes in a single running kernel without emulating hardware.
Both a VM and a Docker image may be Ubuntu 14.04, but with the Docker image you don't need to run the whole OS.
For example, if I want to run an nginx container based on ubuntu, I'd end up with only the nginx process running. No upstart/systemd/init is needed. A VM would run an init system, manage its own networking, and run other services as well. The container image approach that uses a linux distro base is mostly for convenience.
It is entirely possible to run Docker containers with very minimal images. A statically compiled binary alone in an image is all you'd need to run a container.
Share
Improve this answer
Follow
answered May 22, 2015 at 20:13
programmerqprogrammerq
6,3822525 silver badges4141 bronze badges
1
>Both a VM and a Docker image may be Ubuntu 14.04 So, Docker can run ubuntu with hardware emulation? How, for example, Docker launches nginx container? It run Ubuntu base image and after runs nginx container as subprocess of docker's ubuntu?
– Alex Ushakov
May 23, 2015 at 8:48
Add a comment
|
|
Every Docker image, as I understand, is based on base image - for example, Ubuntu.
And if I want to isolate any process I should deploy ubuntu docker base image (where is difference with Vagrant here?), and create a necessary subimage after it installing on ubuntu image?
So, if Ubuntu is launched on Vagrant and on Docker, where is practice difference?
And if to use docker provider in Vagrant - where here is difference between Vagrant and Docker?
And, in Docker is it possible to isolate processes on some PC without base image without it's sharing to another PC?
| Docker vs Vagrant |
I just stumbled on this 4 month old question. It really should be listed on a different StackExchange (such as ServerFault), but sometimes even a developer needs to configure a firewall. As it is, I'm here with an answer for you.For your firewall rules, you'll want to accept packets from your safe IPs first and then drop the rest. Here's how I did it:Let's assume you only want to accept one safe IP for pings and that IP address is '127.0.0.1'. Of course, this IP could be any address you want (just create more rules or define subnets for additional addresses).Step 1First thing is to check is the following in /etc/ufw/sysctl.confnet/ipv4/icmp_echo_ignore_all=1...should be rewritten as with a 0 if it is not already...net/ipv4/icmp_echo_ignore_all=0Step 2Add rules for IPv4 into /etc/ufw/before.rules-A ufw-before-input -p icmp --icmp-type echo-request -s 127.0.0.1 -m state --state ESTABLISHED -j ACCEPTStep 3 (for IPv6 support)Add rules for IPv6 into /etc/ufw/before6.rules-A ufw6-before-input -p icmpv6 --icmpv6-type echo-request -s 127.0.0.1 -m state --state ESTABLISHED -j ACCEPTStep 4Now, restart your firewall and drink a beverage of your choice.service ufw restart | I am setuping my server and I must disable the ping requests for everyone except me and a list of hosts (aaa.bbb.ccc.ddd).I am using the tool ufw, on ubuntu server, I read that I have to comment those lines:ok icmp codes-A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT
-A ufw-before-input -p icmp --icmp-type source-quench -j ACCEPT
-A ufw-before-input -p icmp --icmp-type time-exceeded -j ACCEPT
-A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT
-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT,However, by doing that It will disallow everyone to ping, which is a problem because I need "aaa.bbb.ccc.ddd" to have a response to is ping requests.Can you help me to write the correct command?Thank you a lot in advance. | UFW: Allow ping requests only for specific host |
I find out what is probably happening.The problem is Docker Desktop for Mac. It seems it stops container sometimes like in the situation that you Mac goes to sleep. And it interrupts the listener so it stops receiving new data chunks.
I started same container on Ubuntu in VirtualBox and it works fine all the time. | I have following code written in nodejs usinghttpmodule.
It's basically listens to event stream (so the connection is permanent).http.get(EVENT_STREAM_ADDRESS, res => {
res.on('data', (buf) => {
const str = Buffer.from(buf).toString();
console.log(str);
});
res.on('error', err => console.log("err: ", err));
});If I run the above code on my Mac it works fine and I getdatalogged to console after many hours.
But in the Docker, which has pretty basic configuration it stops receiving data after some time without any error. Other endpoints in the app are working fine (eg. Express endpoints) but this onehttp.get listeneris just hanging.DockerfileFROM node:current-alpine
WORKDIR /app
EXPOSE 4000
CMD npm install && npm run startDo you have any ideas how I can overcome this?It's really hard to debug as to reproduce the situation I sometimes need to wait a few hours.Cheers | Node.js HTTP Get stream freezes inside docker container |
It is described in the question. The memory is the actuarial size of the photo and UIImage will not do optimization.
|
I'd like to know the memory size for a UIImageView object as I need to show some large image and I need to handle the memory. I guess it is decided by the image property. But I'm not sure how to calculate the actuarial memory size,and below is the code I write to test:
//1.jpg has a size of 4016X2657 and 2.1MB
NSData *imageData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"1" ofType:@"jpg"]];
NSLog(@"imageData:%d",[imageData length]);
The console shows:
imageData:2070461
This is exactly the size of 2.1MB.
However, in my opinion the UIImageViewshould know the each pixel to show the image and in other words it should have a memory of :
4016*2657*4/1024/1024 = 40.7+MB
It is so large and I don't know whether iOS will do some optimization or not.And I also can't find any relevant in the document.
Could anyone help me what is the exactly memory size of a UIImageView object?
| memory size of UIImageView |
As said by @torek:press ENTER (or RETURN or whatever the key is labeled) on your keyboard twice, so that you are using the no-passphrase case [...]It worked!ShareFollowansweredOct 11, 2021 at 9:42montwmontw10511 silver badge1010 bronze badges0Add a comment| | I am tying to generate a SSH key on Git, but I'm stuck in the passphrase part:I'm unable to type it. The passphrase field appears without any characters, even though I'm typing them.$ ssh-keygen -t ed25519 -C "[email protected]"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/c/Users/me/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Passphrases do not match. Try again.As you can see, I can't type anything. There are some similar questions where people say that the text is hidden, but that tecnically you can still type it. The thing is that Git says that the passphrase is not matching on both fields, even though I'm tecnically typing the same characters on both of them. Im on Windows 10, with the latest 64 bits Git release installed.Just to make it clear, this is my goal:Create a SSH key so I do not need to type my GitHub credentials every time I want to push files to to my GitHub repo. | How can I type the passphrase for a Git SSH key? |
An argument for including databases and other downstream dependencies in the health check is the following:Assume you have a load balancer exposing some number of micro-services to the outside world. If due to a large amount of load the database of one of these micro-services goes down, and this is not included in the health check of the micro-service, the load balancer will still try to direct traffic to micro-service, further increasing the problem the database is experiencing.If instead the health-check included downstream dependencies, the load-balancer would stop directing traffic to the micro-service (and hopefully show a nice error message to the user). This would give the database time to restore from the increase in load (and ops time to react).So I would argue that using a basic/versionis not a good idea. | We are developing tons of micro-services. They all run in Kubernetes. As ops, I need to define probes for each micro-service. So we will create a health check API for each micro-service. What are the best practices for this API? What are the best practices for probes? Do we need to check the service's health only or the database connection too (and more)? Is it redundant? The databases are in Kubernetes too, and have their own probes too. Can we just use the /version API as the probe?I'm looking for feedback and documentation. Thank you. | What are the best practices for a health check API and probes in micro-services Kubernetes environment? |
In Jekyll _layout is where the layout for your Jekyll website is stored. When using a theme it uses the layout file for that theme. Any file which you add in the _layout folder will override the theme layout files.To modify the default layout which came with the theme you are using you need to first make a _layout folder and then create a blank default.html.Then find the github repository of your theme and copy the html from _layout/default.html into your fileAdd the LaTex script code you need to the header.The github docs on customizing a Jekyll theme.https://help.github.com/articles/customizing-css-and-html-in-your-jekyll-theme/#customizing-your-jekyll-themes-html-layout | Bothhttps://jekyllrb.com/docs/extras/andhttp://www.gastonsanchez.com/visually-enforced/opinion/2014/02/16/Mathjax-with-jekyll/require_layoutdirectory, which couldn't found. Kramdownhttps://kramdown.gettalong.org/syntax.html#block-boundariesalthough has been set in_config.ymldoesn't work either.Can anyone help? | How to use Latex in new Jekyll? (Gem-based theme minima) |
I had to change ./db/data user:group to 999:999, so docker user is who is making the changes.
sudo chown 999:999 ./db/data
|
I'm having an issue when starting the db service with docker compose:
version: '3'
services:
# Mysql DB
db:
image: percona:5.7
#build: ./docker/mysql
volumes:
- "./db/data:/var/lib/mysql"
- "./db/init:/docker-entrypoint-initdb.d"
- "./db/backups:/tmp/backups"
- "./shared/home:/home"
- "./shared/root:/home"
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: db_name
MYSQL_USER: user
MYSQL_PASSWORD: pass
ports:
- "3307:3306"
I have tried everything with no luck:
"./db/data:/var/lib/mysql:rw"
Creating a dockerfile and create from build instead of image:
FROM percona:5.7
RUN adduser mysql
RUN sudo chown mysql /var/lib/mysql
RUN sudo chgrp mysql /var/lib/mysql
Also I have tried to add a user on db service:
user: "1000:50"
But any of those could solve that.. What I'm missing?
MySQL 5.7 installation error `mysqld: Can't create/write to file '/var/lib/mysql/is_writable'`
| Docker-compose : mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied) |
Yes, that should work fine. As long as your data (all tablespaces) and pg_xlog are on the same device, it should just work. No need for any flushes or locking. | I foundthis articleexplaining how to run MySQL on Amazon EC2. It talks about using XFS as the filesystem and then leveraging EBS snapshots to create backups of the data. Does anyone know if I can do something similar using PostgreSQL? Are there changes to the SQL commands to FLUSH and LOCK the tables? Thanks! | PostgreSQL and Amazon EBS Snapshots? |
In github (and in git's mental framework) you clone and fork repositories.
There's no way to fork a branch; that doesn't make sense. Just fork the project, and work off the branch you're interested in. You don't lose anything by doing so.
"Working off a branch" usually means you
clone a repository (e.g. git clone http://repository), then
check out the branch you're interested in (git checkout awesome-branchname),
and create a new branch based of that (git checkout -b new-even-more-awesome-branch-name)
|
How can I fork a branch instead of a complete repository?
I wish to copy only the branch https://github.com/COMSYS/contiki/tree/split-buffer and not the complete repository https://github.com/jenshiller/contiki.
How to fork a branch in Git? won't work in my case. I don't want to clone the branch.
| How to fork a branch and not the repository? |
I suggest you run:openssl s_client -connect remoteserver:443Assuming the remote server requires or requests client certificate authentication, it should send you a list of acceptable CAs.You should send a certificate ultimately signed by one of these CAs.
The ssl specification does not require that you send the CA, however you should send the certificate and the full intermediate chain to that CA.
My experience is that two CA certificates may look extremely similar to each other. The move to 2048 bits has not helped in this regard. Double check.As a side note, your clientreceivedthe bad certificate alert. The problem lies with the certificates your client is sending, not the validation of the server certificates.(Edit)
Did I mention that the certificates you send must be valid ? in particular,non expired end date and sensible start datea CN which matches the public DNS server name of the machine your are connecting from: the server may be performing a reverse DNS lookup on the client IP and matching it to the CN of the sent certificate. | I am having trouble connecting to a secure site using a Java program. I have imported 3 certificates given from the server that I will be connecting to; public, inter and root certificate. I have properly imported the 3 certs to the java cacerts. And also specified in calling the Java class with the following parameters:java -Djavax.net.debug=ssl
Djavax.net.ssl.keystore=JAVACACERTS -Djavax.net.ssl.keystorePassword=changeit -server -cp $CLASSPTH -Xmx500m SendOrderResponseHowever, I'm getting a "bad_certificate" error. I looked at the details of the logs and it seems like the root certificate is not in the certificate chain.Any idea why it happened? when I have imported the 3 certs in the Java cacerts? I assume that the bad certificate was thrown because of the certificate chain error. | SSL Bad Certificate error |
The error is in your port mapping in the original docker run command, you just need to provide the ports, not the IP address:
docker run -e MYSQL_ROOT_PASSWORD=password -d -p 3308:3306 mysql
You can run docker ps -a to check for the port mapping in the running containers.
You should now be able to connect to MySQL using
mysql -uroot -ppassword -h192.168.99.100 -P3308
|
First I run mysql image:
docker run -e MYSQL_ROOT_PASSWORD=password -d -p 127.0.0.1:3308:3306 mysql
Then I use container bash:
docker exec -it my_container_name bash
In Bash I can successfully connect to MySQL server via command:
mysql -uroot -ppassword
But when I try to connect to MySQL container from Windows cmd:
mysql -uroot -ppassword -h127.0.0.1 -P3308
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (10061)
If I connect to 192.168.99.100 instead (this ip is returned by docker-machine ip), then the result is the same.
The question is: How do I correctly expose my MySQL port inside Docker to outside Windows?
| Cannot connect to MySQL server inside Docker |
4
The line you mention will compile fine in C++, save for that fact that if buffer is not a void *, then you may need to cast the return value of malloc in C++, which you don't need to do in C (and probably should not do).
EG:
uint32_t *buffer = (uint32_t *) malloc(sizeof(uint32_t)*CACHE_LEN*2);
However, you may wish to convert to a new / delete paradigm; that will require more than just changing that line.
EG:
uint32_t *buffer = new uint32_t[CACHE_LEN*2];
...
delete[] buffer;
If you want to be more C++-like still, then use std::vector or similar:
std::vector<uint32_t> buffer(CACHE_LEN*2);
Share
Improve this answer
Follow
edited Jan 29, 2015 at 22:54
answered Jan 29, 2015 at 22:41
ablighabligh
24.8k44 gold badges4949 silver badges8686 bronze badges
8
I thought that std::vector actually granted the C memory layout... Am I wrong?
– Paolo.Bolzoni
Jan 29, 2015 at 22:49
1
@Paolo.Bolzoni really? I didn't know that. Do you have a reference?
– abligh
Jan 29, 2015 at 22:50
1
Don't get confused by the title, read the whole thing: herbsutter.com/2008/04/07/…
– Paolo.Bolzoni
Jan 29, 2015 at 22:52
You learn a new thing every day. My C++ days were pre void *0. I will amend.
– abligh
Jan 29, 2015 at 22:53
When I need C functions for any reason (I used void *1 recently) I always use void *2 for the arrays. It is quite useful. In the C++11 you even get the void *3 member function that returns the pointer to the first element. I like it more than the older void *4 I had to use before.
– Paolo.Bolzoni
Jan 29, 2015 at 22:58
|
Show 3 more comments
|
I have a buffer in C with this code
buffer = malloc(sizeof(uint32_t)*CACHE_LEN*2);
How can I change this line to C++?
Is it better with malloc or with new[]?
I cannot understand the meaning of this sizeof(uint32_t).
| How to convert a C statement using malloc() to C++? |
In order to know your container runtime version, you can either login to your aks cluster and do akubectl get nodes -o wideFrom portal,To view the container runtime version of an AKS cluster from the Azure portal, click on the name of the AKS cluster for which you want to view the container runtime version. Check Under Node Pools.Click onNode poolsin the left-hand menu under theSettingssection. This will list the node pools associated with your AKS cluster. Inspect the Node Pool.Select a node pool to view its details. The container runtime version is typically tied to thenode image versionas shown belowReference docK8s list details | I am new to azure k8s. I am trying to verify if my container runtime on my aks cluster, I can only see the node detailsnodepoolHow can I get the container runtime details on my aks cluster?I tried checking the nodepool details under the setting section but not able to find the container runtime details | How to know container runtime version in AKS cluster |
0
You have created a query and not executed it, try running executeUpdate() on the created query
Session session = DatabaseUtil.getSessionFactory().openSession();
session.beginTransaction();
Query query = session.createSQLQuery("BACKUP TO '" + file.getCanonicalPath() + "'");
query.executeUpdate();
session.getTransaction().commit();
session.close();
Share
Improve this answer
Follow
answered Jul 11, 2020 at 15:14
vamsikurrevamsikurre
30933 silver badges55 bronze badges
Add a comment
|
|
I'm little bit confused of how to perform h2 database "BACKUP" & "RESTORE".
I have write some code using hibernate and java, but this not working for now.
So, how to do backup & restore when database is used by the application.
File file = fileChooser.showSaveDialog(tbTabPaneHome.getScene().getWindow());
if (file != null) {
// Save file
try {
Session session = DatabaseUtil.getSessionFactory().openSession();
session.beginTransaction();
session.createSQLQuery("BACKUP TO '" + file.getCanonicalPath() + "'");
session.getTransaction().commit();
session.close();
} catch (IOException e) {
e.printStackTrace();
}
}
| Backup & Restore h2 database |
You are explicitly setting the cache to never expire by usingCache.NoAbsoluteExpiration. You want to useCache.NoSlidingExpirationinstead:When used, this field sets theslidingExpirationparameter to theTimeSpan.Zerofield, which has a constant value of zero. The cached
item expires in accordance with theabsoluteExpirationparameter
associated with theInsertorAddmethod call. | _cache.Insert(cacheKey, userList, null,
Cache.NoAbsoluteExpiration,
new TimeSpan(0, 15, 0),
CacheItemPriority.High, null);My code above doesn't seem to be expiring the cache after 3 minutes, the userList object pulls data from the database that was updated, but the cache doesn't expire it after 15 minutes.What is wrong? | Will the following cached item expire after 15 minutes? |
Yes, you can just copy your Firefox/Iceweasel profile over. For Firefox your profiles are in $HOME/.mozilla/firefox, and it's similar for Iceweasel.
|
I have destroyed my Debian Jessie installation and I need to reinstall it. I want to back up my Iceweasel passwords and bookmarks, but I can't start the desktop environment anymore, so I have to do it from the command line. Will it work if I just copy the iceweasel directories and paste them into my new installation? If not, is there another way? I don't want to take any chances, so I'm asking here.
| Backup Iceweasel Bookmarks and Passwords from CL |
Assuming you're happy to use Terraform, you can use this:https://github.com/GoogleCloudPlatform/terraform-google-nat-gatewayHowever, there's one caveat and that is it may inbound traffic to other clusters in that same region/zone.ShareFollowansweredAug 8, 2018 at 7:10Blender FoxBlender Fox4,99222 gold badges2121 silver badges3333 bronze badgesAdd a comment| | I am trying to build a service that needs to be connected to a socket over the internet without downtime. The service will be reading and publishing info to a message queue, messages should be published only once and in the order received.For this reason I thought of deploying it into Kubernetes where I can automatically have multiple replicas in case one process fails, i.e. just one process (pod) should be runningalltime, not multiple pods publishing the same messages to the queue.These requests need to be routed through a proxy with a static IP, otherwise I cannot connect to the socket. I understand this may not be a standard use case as areverse proxyas it is normally use with load balancers such as Nginx.How is it possible to build this kind offorward proxyin Kubernetes?I will be deploying this onGoogle Container Engine. | Proxy outgoing traffic of Kubernetes cluster through a static IP |
You could uselerna.Lerna will also help you in case you have dependencies between your packages.Basically you just have to add a lerna.json in your root directory and install your dependencies using lerna.lerna.json:{
"lerna": "2.11.0",
"packages": [
"lambda-functions/*"
],
"version": "0.0.0"
}I assume you are using AWS CodeBuild, so here are some examples on how you could configure your install phase:buildspec.yml with lerna:version: 0.2
phases:
install:
commands:
- echo Entered the install phase...
- npm install --global lerna
- lerna bootstrap --concurrency=1 -- --production
...lerna bootstrapwill createnode_modulesfor every single package.If you don't want to use lerna, you could add one command for each package. Something like:buildspec.yml with yarn:version: 0.2
phases:
install:
commands:
- echo Entered the install phase...
- npm install --global yarn
- yarn --cwd lambda-functions/function-1 --production install
- yarn --cwd lambda-functions/function-2 --production install
- yarn --cwd lambda-functions/function-3 --production install
...or:buildspec.yml with npm:version: 0.2
phases:
install:
commands:
- echo Entered the install phase...
- cd lambda-functions/function-1 && npm install --production
- cd lambda-functions/function-2 && npm install --production
- cd lambda-functions/function-3 && npm install --production
... | I am using AWS Cloud Formation for my backend with the following project files structure:| template.yaml
| lambda-functions
| ---- function-1
|----function.js
|----package.json
| ---- function-2
|----function.js
|----package.jsonIn the AWS buildspec I doaws cloudformation packagefollowed by aaws cloudformation deploy.If I want it to work, I need to donpm installon bothfunction-1andfunction-2subfolders and commitnode_modulessubfolders to git repo.How can I run npm install on all my subfolders directly from the buildspec so I don't have to commit node_modules subfolders? | How to npm install all functions directories with AWS CodeBuild |
You should use the storage-agnostic Storage.exists() method.
The storage object should be available on the FieldFile itself, so something like
return self.file.storage.exists(self.file.name)
should do the trick.
|
My question is simple as the title clearly describes it.
I have FileField in some models, I added a property method to check the existence of file:
@property
def file_exists(self):
# Because sometimes, the field may contain the string path
# but the file doesn't exist at all in the server
if file: # if the string path exists
return os.path.exists(self.file.path) # If the file exists in server
This works perfectly in development, but when I migrate all my files on AWS, it raises an Error such I don't have permission to do that.
I wonder what's wrong, or Is there another way to test whether a file exists?
| How to ensure file exists in Django project? |
Ok, stupid me, I found the answer in the docs for boot2dockerhttps://docs.docker.com/installation/mac/#container-port-redirectionI needed to use the ip address of the boot2docker vm, rather than the ip of the container, i.e.$ boot2docker ip
192.168.59.103and I am able to browse my site from the host athttp://192.168.59.103:49159/I did not need to add anyrouteon the host | I'm running under boot2docker 1.3.1.I have a Docker container running a web server viauwsgi --http :8080.If I attach to the container I can browse the web site usinglynx http://127.0.0.1:8080so I know the server is working.I ran my container with:$ docker run -itP --expose 8080 uwsgi_app:0.2It has the following details:$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5248ad86596d uwsgi_app:0.2 "bash" 11 minutes ago Up 11 minutes 0.0.0.0:49159->8080/tcp cocky_hypatia
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' 5248ad86596d
172.17.0.107I thought I could access that web site from my host by going tohttp://172.17.0.107:49159.This does not work. I just see 'connecting...' in Chrome, getting nowhere.What am I doing wrong? | How to access Docker container's web server from host |
Go tommc.exe. Follow the steps:MMC > File > Add/remove snap-in > Certificates > You get three options:My user accountService accountComputer accountI don't know what it means, so I took My user account. It seems to be my lucky card in other problems.Finish.Then you will need to activate IIS server manager on your system:control panel > programs and features > turn windows features on or off > IIS, the full name > okOnce done, it can be seen inmmc.exe. In IIS server, under IIS list, click server certificates > create self signed certificate. Enter some stuff and you should be done.ShareFolloweditedMar 11, 2014 at 15:05admdrew3,80344 gold badges2727 silver badges3939 bronze badgesansweredMar 11, 2014 at 6:09SteamSteam9,5682727 gold badges8585 silver badges123123 bronze badges0Add a comment| | I followed the steps in my answer to create a certificate. I will use this cert on my own computer. The command succeeded, but I see no personal certificate in cert manager (certmgr.msc). Answer -How do I create client certificates for local testing of two-way authentication over SSL?Steps:Launch Vs2010 Command Prompt: Start ► All Programs ► Visual Studio 2010 ► Visual Studio Tools ► Visual Studio Command Prompt (right click and Run as Administrator)Create a self-signed (-r), private key exportable (-pe), saving to personal folder (-ss my) under local machine (Local Computer, sr localmachine), named (-n) "YangsoftCA",common name (-in) "Yangsoft.com" with private key file (-sv) as "YangsoftCA.pvk" and public key file "YangsoftCA.cer"Command:C:\Windows\system32>makecert -r -pe -ss my -sr LocalMachine -n "CN=YangsoftCA" -sv "YangsoftCA.pvk" YangsoftCA.cerAbove succeededPassword was prompted to secure the private key fileThis is what my cert manager looks like. There is nothing under personal certificates.
I was hoping that yangsoft would appear there.How do I find out what happened and how do I see my cert ? | Cannot see self created certificate in certmanager? |
It seems like a recent update of the AWS CLI for windows possibly removed something.Can you try this as a workaround?[credential]
helper = !'C:\\Program Files\\Amazon\\AWSCLI\\bin\\aws.cmd' codecommit credential-helper $@
UseHttpPath = true | I have a CodeCommit repo that I'm trying to connect to from the command line of Windows 7.My intention is to use the aws configure / aws credential helper method as I prefer this, in this context, to a username / password.When attempting any git operations I get:aws codecommit credential-helper $@ get: aws: command not foundI'm then able to then use a username and password but this invalidates the point of using aws configure to set up access keys.The credentials section of my .gitconfig file looks like this:[credential]
helper = !aws codecommit credential-helper $@
UseHttpPath = trueIt looks like git can't access aws.cmd but the full path to it is on the system and user path environment settings.Any ideas? | Amazon CodeCommit credential helper - command not found |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.