Response stringlengths 15 2k | Instruction stringlengths 37 2k | Prompt stringlengths 14 160 |
|---|---|---|
You'll need to get the results into a format that SonarQube can interpret. Assuming you are using Jasmine/Karma this would be an LCOV format.Modify your build script to include the following line:ng test --code-coverageThis should create a coverage folder in your angular project. However it will be in an html format. You'll also need to change the Karma runner so that it generates an lcov.info file:// karma.conf.js
// ....
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['lcovonly'],
fixWebpackSourcePaths: true
},
// ....Finally, Update the sonar-project.properties file with the following line so that SonarQube knows where to find the coverage:sonar.typescript.lcov.reportPaths=coverage/lcov/lcov.info | This is my dahsboard from Bamboo related to Sonarqube:https://i.stack.imgur.com/FU7c9.jpgThe project build result page looks like this:https://i.stack.imgur.com/DRltU.jpgSo, I want enable somehow test coverage in Bamboo to see unit tests reports.
I mention that we have local coverage for my angular project.Can you help me with this? | How to "Enable front-end code coverage in sonarqube" for a Angular project |
You have done all the steps correctly. I believe your goal here is to run docker commands without sudo.However after adding user to the docker (Or any) group,you have to refresh the user's group id.You can either login again or dosu - $USER.You can runidbefore and after to confirm. | I am unable to run Docker on AMI linux EC2 instance on AWS. My AMI linux instance isLinux ip-172-31-29-77 4.14.62-65.117.amzn1.x86_64 #1 SMP Fri Aug 10 20:03:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux.I am able to install docker and start the service using:sudo yum install -y docker
sudo service docker start
sudo usermod -aG docker ec2-userbut cmddocker psdoes not work?can anyone help me on this?Thanks,
Nidhi Arora | Unable to run Docker without sudo on AMI linux EC2 instance on AWS |
In addition to @Colwins answer, you should also add mandatory keynameinto container spec, otherwise you'll getdoes not contain declared merge key: nameSo, you kubectl command should look like:kubectl patch statefulset my-set -p '{"spec": {"template": {"spec":{"containers":[{"name":"nginx","imagePullPolicy":"Never"}]}}}}' | Need to understand exactly how patch works. How could I patch "imagePullPolicy" for instance. Could someone explain in simple details how patch works.kubectl patch statefulset my-set -p '{"spec":{"containers":{"imagePullPolicy":"IfNotPresent"}}}'This is not working what is wrong with it? | How to patch statefulset on kubernetes cluster and set imagePullPolicy |
I had the same doubts about the bookmarking months ago (October 2019) and since the documentation provided by Amazon is not very clear I opened a support case to understand more how it is implemented.
In my Glue Job there was:
A read function from S3 (glue_context.create_dynamic_frame.from_options)
A ResolveChoice.apply
A write function to Redshift (glue_context.write_dynamic_frame.from_jdbc_conf)
All of these operations has the transformation_ctx value, I tested different possible behaviours (same transformation_ctx for all, different, fixed values, dynamic values ecc).
After many message with the AWS support they confirm that the bookmarking works only on the read function (They also said with only S3 as a source but I didn't test it), so I ask if the transformation_ctx is useless in the ResolveChoice (and write function too) and they said YES! They confirmed that doesn't make any difference.
Futhermore for the write function it doesn't change anything, so there is no bookmark logic, no "avoid function" if it has been already run before.
|
The AWS Glue Bookmark document (https://docs.aws.amazon.com/glue/latest/dg/monitor-continuations.html) seems to suggest one has to pass a transformation_ctx parameter to source, transform and sink operation for the bookmark to work. This is reflected in the sample code in that page, where invocation of all of create_dynamic_frame.from_catalog(), ApplyMapping.apply() and write_dynamic_frame.from_options() are passed with a transformation_ctx value.
I can understand the point to pass such a transformation_ctx to create_dynamic_frame.from_catalog() method, as AWS Glue needs to store the information about files which have been read in the bookmark under the given transformation_ctx key.
However, I don't understand why this is also necessary for methods like ApplyMapping.apply() and write_dynamic_frame.from_options(). To put it another way, what is the state information these operations need to store in the bookmark? If I don't pass create_dynamic_frame.from_catalog()0 to these methods, what problems will this cause?
| Why do I need to set the `transformation_ctx` parameter when calling transformation and sink operations for AWS Glue bookmark to work? |
Yes, it is an error to make a UIViewController releasing in a background thread (or queue). In UIKit, dealloc is not thread safe. This is explicitly described in Apple's TN2109 doc:
When a secondary thread retains the target object, you have to ensure that the thread releases that reference before the main thread releases its last reference to the object. If you don't do this, the last reference to the object is released by the secondary thread, which means that the object's -dealloc method runs on that secondary thread. This is problematic if the object's -dealloc method does things that are not safe to do on a secondary thread, something that's common for UIKit objects like a view controller.
However, it's quite hard to respect this rule and if you put precondition(Thread.isMainThread) in all your view controller dealloc/deinit(), you probably would notice very weird (and hard to fix) cases in which this rule is not respected.
It seems that Apple is aware of this fragility and is moving away from this rule. In fact, when you annotate a class with @MainActor, everything is ensured to be executed in the Main Thread, except deinit(). In Swift 6, the compiler prevents you from calling main actor code from deinit().
Even if in the past we have been asked to ensure deallocation in the main thread, in the future we will be asked to ensure that deallocation can happen in any thread.
|
Is it an error to call dealloc on a UIViewController from a background thread? It seems that UITextView (can?) eventually call _WebTryThreadLock which results in:
bool _WebTryThreadLock(bool): Tried to obtain the web lock from a thread
other than the main thread or the web thread. This may be a result of calling
to UIKit from a secondary thread.
Background: I have a subclassed NSOperation that takes a selector and a target object to notify.
-(id)initWithTarget:(id)target {
if (self = [super init]) {
_target = [target retain];
}
return self;
}
-(void)dealloc {
[_target release];
[super dealloc];
}
If the UIViewController has already been dismissed when the NSOperation gets around to running, then the call to UIViewController0 triggers it's UIViewController1 on a background thread.
| dealloc on Background Thread |
You should use generic type or actual type for return type of method declarationpublic interface IAsyncTestService<T>
{
Future<T> submit(Runnable task);
}Orpublic interface IAsyncTestService
{
<T> Future<T> submit(Runnable task);
}Or specific type:public interface IAsyncTestService
{
Future<String> submit(Runnable task);
} | When I use SonarLint plugin to scan the Java code in IntelliJ IDEA, it shows warning like this:remove usage of generic wildcard type.This is the Java code:import java.util.concurrent.Future;
public interface IAsyncTestService
{
Future<?> submit(Runnable task);
}What should I do to avoid this warnings? | What should I do to fix SonarLint warning "remove usage of generic wildcard type" |
You can actually do a ref update instead of merge.status=$(curl --write-out %{http_code} -H "Content-Type: application/json" -H "Authorization: token ${GITHUB_TOKEN}" -X PATCH https://api.github.com/repos/:owner/${REPO}/git/refs/heads/${BASE} \
-d '{ "sha": $(curl -H "Content-Type: application/json" -H "Authorization: token ${GITHUB_TOKEN}" -X GET https://api.github.com/repos/:owner/${REPO}/git/refs/heads/${HEAD} | jq .object.sha ), "force": false }')
# In case of non-fast-forward case create a pull request
if (( $status != 200 )); then
curl -H "Content-Type: application/json" -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/:owner/${REPO}/pulls \
-d '{ "title": "Great pull request", "body": "Please check this non-fast-forward merge", "head": "${HEAD}", "base": "${BASE}" }'
fi;
params:
REPO, BASE, HEAD, GITHUB_TOKEN | I'm setting up a Jenkins pipeline script and using API calls to GitHub to perform merges and releases after tests pass.For my intended workflow, I need to use the Jenkinsfile to merge myrelease-candidatebranch into mybeta-releasebranch. This merge should always be a fast-forward merge, since this is the only way work ever gets onto thebeta-releasebranch. It's important that a merge commit is not created, because I check GitHub statuses on the latest commit in that branch to see if tests are up to date.I tried themerge API call, but it always creates a merge commit.I tried creating aPRand then merging it with the rebase strategy, but that created a merge commit as well.Is it possible to perform a fast-forward merge using the GitHub API? | How can I do a fast-forward merge using the GitHub API? |
1
%cd gives the committer date. If you just want the name, use %cn or %cN alone.
Without looking at your exact output, I am guessing the 400 500 you see if the timezone in the date.
Share
Improve this answer
Follow
answered Jun 13, 2019 at 11:45
manojldsmanojlds
295k6464 gold badges477477 silver badges423423 bronze badges
3
Hi Manojds,I have updated my query and also added the sampleoutput for reference
– Swati Jha
Jun 14, 2019 at 8:47
@SwatiJha - you can see that the fault is in the logic used to separate the fields that you are showing in the screenshot. The timezone is missing wherever you have the actual name.
– manojlds
Jun 14, 2019 at 8:50
Didnt really understand ,how do I fix this ?
– Swati Jha
Jun 14, 2019 at 8:54
Add a comment
|
|
Git log gives 400,500 as the committer name
I have a powershell script which run the git diff between 2 branches and gives me the output in a file.
git diff generates the diff file using git diff --summary --name-status --diff-filter=ADMRCT $branch1..$branch2 | Out-File $temp
$temp file is iterated and every line is read to get the last committer name and last committed date from git log since this info is not provided by git diff
foreach ($obj in $temp) {
$file =$obj.FileName
$gitoutput = git log -1 --format=%cd-%cn "$file" }
Output attached.SampleForReference
`
| Git log gives 400 500 as committer name |
Conceptually this isn't that far off from what amulti-stage builddoes. Docker can't create files or run commands on the host, but you can build your application in an intermediate image and then copy the results out of that image.# First stage: build the jar file.
FROM azul/zulu-openjdk-alpine:8 AS build
WORKDIR /app # avoid the root directory
COPY ./ . # same as "current way"
RUN ./gradlew clean build # same as "current way"
RUN mv oms-core-app-*-SNAPSHOT.jar oms-core-app.jar
# give the jar file a fixed name
# Second stage: actually run the jar file.
FROM azul/zulu-openjdk-alpine:8 # or some JRE-only image
WORKDIR /app
COPY --from=build /app/oms-core-app.jar .
CMD java -jar oms-core-app.jarSo the first stage runs the build from source; you don't need to run./gradlew buildon the host system. The second stage starts over from just the plain Java installation, andCOPYonly the jar file in. The second stage is what eventually runs, and if youdocker pushthe image it will not contain the source code.ShareFollowansweredNov 3, 2021 at 11:18David MazeDavid Maze143k3535 gold badges189189 silver badges237237 bronze badgesAdd a comment| | I have a git repository as my build context for a docker image, and i want to execute gradle build and copy the jar file into the docker image and run it on entrypoint.I know that we can copy the entire project into the image and run build and execute, however i want to run build first and copy only the jar executable into the image.Is it possible to execute commands in the build context before copying the files?Current way:FROM azul/zulu-openjdk-alpine:8
COPY ./ .
RUN ./gradlew clean build
ENTRYPOINT ["/bin/sh","-c","java -jar oms-core-app-*-SNAPSHOT.jar"]What i want:FROM azul/zulu-openjdk-alpine:8
RUN ./gradlew clean build
COPY ./oms-core-app-*-SNAPSHOT.jar .
ENTRYPOINT ["/bin/sh","-c","java -jar oms-core-app-*-SNAPSHOT.jar"]I cannot run the ./gradlew clean build before copying the project because the files don't exist in the image when running the command. But i want to run it in the source itself and then copy the jar.Any help would be highly appreciated thank you. | RUN a command on build context before copying files in Docker image |
Optionally match the last/. Change your .htaccess file to this:RewriteEngine On
RewriteRule ^(.*)/?$ public/$1 [L] | I have strange for me problem. I'm developing Zend Framework application and have this file structure:/
/application/
/public/
/public/.htaccess
/public/index.php
/public/js/
/public/style/
/public/profile/
/.htaccessMy domain point tofolder /When I enter the addressexample.com/profile/it goes to the controller profile and this is good.
When I enter the addressexample.com/profilethe server redirects me to:example.com/public/profile/I would like to have a solution that whenever I request:example.com/profile/orexample.com/profileThe same page will be rendered but second version gives me a redirect and I don't know why.The/.htaccessfile is:RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]The role of this file is to route all traffic from / to /public but without any redirects.The/public/.htaccessfile is:RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]Can anybody help me with this? Thanks.I fixed this. Here is the solution if somebody have the same problem:
To fix this you have to set the following options and disable DirectorySlashOptions -Indexes FollowSymLinks
DirectorySlash OffNow Apache shouldn't add trailing slashes at the end of uri when you pointing to directory.
This also disable redirect to the uri with trailing slash. | htaccess redirects unexpectedly to folder |
1
Git cache your credentials in memory. The default timeout is 900s i.e. 15 min.
You can invalidate git cache by this git credential-cache exit command.
The best practice would be configuring the ssh keys in github.
Share
Improve this answer
Follow
answered Nov 22, 2019 at 7:11
Premkumar chalmetiPremkumar chalmeti
87011 gold badge99 silver badges2424 bronze badges
Add a comment
|
|
I get an image of a key in terminal when I am prompted to add my password and it will not let me manually type a password. When I press enter it gives me an error that the password is incorrect.
I tried the following code with no success (I still get the key image):
git credential-osxkeychain erase
host=github.com
protocol=https
I also tried updating my password in the KeyChain Access app but I can not find anything for Github there.
| Updated my Github password and now I can not push to Github |
You need to add into Dockerfile.yml file including of gd and types format like :FROM php:7.2-apache
RUN apt-get update && \
apt-get install -y \
libfreetype6-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libpng-dev \
nano \
libgmp-dev \
libldap2-dev \
netcat \
sqlite3 \
libsqlite3-dev && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewriteThat must help. | I try to install my laravel 5.7.19 application under docker(version: '3.1', ) and running some pages I got error:Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg()I include jpeg support in web/Dockerfile.yml:FROM php:7.2-apache
RUN apt-get update -y && apt-get install -y libpng-dev libjpeg-dev libxpm-dev libfreetype6-dev nano \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ \
--with-xpm-dir=/usr/include/ \
--with-vpx-dir=/usr/include/
RUN docker-php-ext-install \
pdo_mysql \
&& a2enmod \
rewrite
RUN docker-php-ext-install gdBut I have the same error anyway. Is path “/usr/include/” valid and how to check it ?My working OS is Kubuntu 18...Thanks! | Under docker error Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg |
If you have already successfully unmerged the projects (which I assume you did through a git reset --hard HEAD~N), then you need to force the changes onto the "mainline" via a:
git push -f
Please note that this isn't generally advised unless you know for sure that no one pulled from the "mainline" after you accidentally made an undesired commit.
|
I accidently merged a project with another project that had nothing to do with it, which I didn't want to do. I successfully unmerged the projects. However, now I want to delete the erroneous commits. How do I do this.
I tried using git rebase, but it doesn't display the merge.
| How do I delete a merge from github, permanently? |
what was the function that you used in scapy and how did you open a port?
detection of the firewall depends to type of the firewall and term of network.traceroute in scapy ==>
traceroute("www.google.com", maxttl=10)ShareFollowansweredMar 29, 2013 at 13:35user1056124user10561241122 bronze badgesAdd a comment| | I open a port 4000 on computer A and send a packet from another remote computer B
but A didn't get the packet, I think maybe the enterprise firewall filtered the packet
how can I detect this?
are there any traceroute functions in scapy or other tools that can detect this?
thanks! | how to detect firewall with scapy |
2
A process can be attached to another process in such a way that it has access to that process's memory.
It is used for debugging programs.
A debugger needs to be attached to the process being debugged, and needs to be able to read any memory data, break execution, edit memory data, inject code, etc.
Cheat Engine just re-purposes these debugger functions in order to cheat in games.
Profilers also use this to see who is consuming what resources.
Share
Improve this answer
Follow
answered Jun 3, 2015 at 10:52
cruxion effuxcruxion effux
1,05433 gold badges1414 silver badges2727 bronze badges
Add a comment
|
|
Is there any way (OS-independent) for accessing an arbitrary process's virtual memory with i/o access?
Alternatively.. a way to launch such process in shared memory instance.
(Isn't that the way Cheat Engine works? Some sort of IPC as far as I can tell..)
| Entering program's internal memory area |
The only solution I know is to create a complete backup of your active database and restore this backup to a copy of the database in a 'warm backup' state. First create a backup from the active db:
backup database activedb to disk='somefile'
Then restore the backup on another sql server. If needed you can use the WITH REPLACE option to change the default storage directory
restore database warmbackup from disk='somefile'
with norecovery, replace ....
Now you can create backups of the logs and restore them to the warmbackup with the restore log statement.
|
We have a warm sql backup. full backup nightly, txn logs shipped every so often during the day and restored. I need to move the data files to another disk. These DB's are in a "warm backup" state (such that I can't unmark them as read-only - "Error 5063: Database '<dbname>' is in warm standby. A warm-standby database is read-only.
") and am worried about detaching and re-attaching.
How do we obtain the "warm backup" status after detach/attach operations are complete?
| Warm SQL Backup |
It's not a valid command, remove the "root".Since you edited the root crontab(sudo crontab -e), the command is already executed as a root.ShareFolloweditedSep 24, 2018 at 11:15Łukasz D. Tulikowski1,57011 gold badge1818 silver badges4040 bronze badgesansweredSep 24, 2018 at 9:39AlrikAlrik3622 bronze badges0Add a comment| | I've put the command*/5 * * * * root /sbin/shutdown -r nowInside "sudo crontab -e" on a Raspberry Pi, which should reboot the raspberry pi every 5 minutes. But instead nothing happens.I've looked in "/var/log/syslog" but all it says isSep 24 08:55:01 raspberrypi CRON[638]: (root) CMD (root /sbin/shutdown -r now)
Sep 24 08:55:01 raspberrypi CRON[634]: (CRON) info (No MTA installed, discarding output)Hoping someone can help me!
Thanks, Jake. | CronTab every 5 minutes reboot doesn't work |
I've updated the CORS configuration in AWS to and it worked
http://localhost:3000
https://example.com
GET
HEAD
DELETE
PUT
POST
*
| I'm new to AWS and usedElastic beanstalkto deploy my rest API (api.example.com) in nodeandS3 bucketwithcloudfrontfor my static website (example.com) in React.When calling the API endpoints from website, the browser is giving the CORS error. How can i prevent that?I'm using following code in the node project for CORSapp.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Credentials', true)
res.header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
next();
});Edit- based on arudzinska's commentI also configured CORS in the bucket
*
GET
POST
and the server is onnginxThanks in advance for any helpP.S - also, i have seen that few posts gives the reason as there would be some bug in the project code but all the endpoints are working correctly onPOSTMAN. | CORS on AWS Elastic beanstalk |
Under the Metrics tab, add new metric that will be hidden in the chart and is used for alerting only. Duplicate the query and remove all template variables (i.e.$somevar) from it. Replace the template variable with a hard-coded value you want to create alert for. Hide the metric by clicking on the “eye” icon.Source:https://community.grafana.com/t/template-variables-are-not-supported-in-alert-queries-while-setting-up-alert/2514/8 | Hi I want to create a simple alert in grafana to check whether there is no data for the last 5 minutes.But I get an errorTemplate variables are not supported in alert queriesWell, according to thisissuetemplates are not supporting in grafana yet.
I have two questions:What is templating?How can I avoid this error? | Grafana: Template variables are not supported in alert queries |
This is the correct way, use a regex to allow sub folders navigation and a perfect match on /app2 to redirect traffic on http://app2:
location ~ ^/app2/(.*)$ {
proxy_pass http://app2/$1;
}
location = /app2 {
proxy_pass http://app2/;
}
location / {
proxy_pass http://app1;
}
|
Summary
I created this simple example to correct and check the errors that I have in another more complex project.
So I've a docker-compose file with 1 web server and 2 app and a nginx conf file.
Please note, that I'm testing it with Docker Quick Start Terminal for Windows 10 Home Edition, but I've tested even on Ubuntu 18.04 and the outcome is the same.
Outcome
Going to: http://192.168.99.100:8080/
Default output:
It works!
The only issue here is with app2, since I'm not able to access app2.
Going to http://192.168.99.100:8080/app2.
Error:
Not Found
The requested URL was not found on this server.
I'm not understanding why I'm not able to do that, and where is the error.
What I've Tried
Switch the location order, so location /app2 after location /, but nothing changed
Change the location of location /app2 to location /foo, even here same outcome.
Change the path related to the previous example, anything different from location / does not works. (e.g. location /bar location /foobar location /test)
Change Ubuntu 18.040 in order to refer the app2 instead of app1, and it works but in this way I can't reach app1.
Ubuntu 18.041
location /app1 {
proxy_pass http://app1:80;
}
Code
Ubuntu 18.042
Ubuntu 18.043
Ubuntu 18.044
Ubuntu 18.045
| Nginx with docker, location different from slash not found |
The deleted/merged branch build will disappear after a period of time (<24 hours). It is not removed immediately to show the recently deleted/merged branches and give a chance to review the prior build statuses. It is relatively harmless since the jobs for these branches are deactivated (read-only).
Note that the removal is based on the branch indexing job running at regular interval, so if you have this disabled, it probably won't do it (not sure the SCM webhook calls are enough).
|
I'm setting up a new Jenkins job using multibranch pipeline and I have noticed that when a branch is deleted, it only has a strikethrough and isn't actually removed on Jenkins. This is solved by re-running branch indexing. However, I cannot really use this as it will also cause every other branch to rebuild (a consequence of how the repository is updated). Is there some custom code or pipeline/script I can run to re-index without building?
I've already looked at various UI methods such as suppressing SCM triggers, but this also negates push events from Github which is something we want to use.
| Using Multibranch Pipeline Jenkins job, is it possible to run branch indexing without re-running existing branch builds |
-1Assuming that you are using InfluxDB as your backend time series database, use the below configuration in Grafana's config.js file.datasources: {
influxdb: {
type: 'influxdb',
url: "http://localhost:8086/db/jmeter",
username: 'root',
password: 'root',
},
grafana: {
type: 'influxdb',
url: "http://localhost:8086/db/grafana",
username: 'root',
password: 'root',
grafanaDB: true
},
},Also make sure that your InfluxDB server is up and running by checking "http://localhost:8086". It should show you the login page to connect to the influxdb's web console.Lastly, enable "DEBUG" logging in JMeter in the jmeter.properties file(log_level.jmeter=DEBUG) and share more info about the errors you see in the log if the issue still persists. | i have working with Jmeter 2.13 and try a new listener Backend listener, I'm using windows.I have installed grafana/graphite in windows and run it from the web page
http:/localhost:8080 and run smoothly. Grafana shows standard dashboard "shared dashboards" and 'dashboards'.In jmeter a listener Backend listers was added and configured as default
as in pictureIn grafana i add a new data source:Name=jmeterType=Graphiteurl=http://localhost:2003access:proxy/direct ( i tested both)Basic auth: (no)When i run test in jmeter with Backend listener nothing is shown in grafana.
What did i miss, that jmeter results are not displaingThank you for help,
Dani | Jmeter 2.13 Backend Listener |
There are two options that I can think of:As user @krishna_mee2004 stated, you can use CloudWatch to listen on your EC2 instance and this in turn will trigger your lambda.On your EC2 instance, there is a field calledUser dataunder the Instance Details. InUser datayou can add commands that should be ran whenever your EC2 instance is deployed. From here you can invoke your lambda.Hereis documentation on EC2 user data.Hereis documentation on invoking your lambda from the CLI.Personally, I'd recommend option 1 because I prefer using AWS tools whenever I get the chance and CloudWatch is a perfect example of this. However, option 2 might give you more control over what payload is sent to the lambda. | I am compiling a fairly complex CloudFormation template and at some point I am creating anec2instance;I want to create alambdafunction that:takes as input parameter the public IP of the instance created in this CF stackopens a security group port for that particular IP (the security group isnotpart of the specific CF template and it belongs to adifferent region).Is this possible?Ι am asking because (among others)ec2is not listed as a potential lambda trigger in the console and wanted to see whether there is a simpler way around this than posting details about the creation in ansnsorsqswhich then in turn triggers the lambda. | AWS: Use EC2 instance creation to trigger lambda |
What I find works is to check in a version of the file with blanked or dummy values and then to run:git update-index --assume-unchanged [fileName]Git will then stop monitoring changes to that file allowing you to put the real config info into it without fear of checking it in.If you later make changes that you DO want to check in you can run:git update-index --no-assume-unchanged [fileName]ShareFollowansweredDec 21, 2010 at 11:09Rupert BatesRupert Bates3,0512727 silver badges2121 bronze badges31spot on! that's what i was looking for. no workarounds, just works!–kroeJun 5, 2013 at 10:121Very useful! I combined this approach with the other solution (configSource) to only hide connectionstrings but allow easy config changes.–fabsenetDec 23, 2014 at 19:051this approach resets the file content if you use git stash and git stash pop :(–fabsenetJan 22, 2015 at 13:38Add a comment| | I'm working on a small side-project and I'm using connection strings and also api keys and values that should not be seen or used by other people. I use a public GitHub account for source control. What is the usual method for using source control when these values are in plain text in web.config?Do I need to remove the values manually before checking in code? | How to hide connection string, user name, pw when using source control? |
Okay, I made it. How I made it for debian squeeze with nginx server: (all commands I execute from root user)First of all you need to install sendmailapt-get install sendmailnext, you must configure this file that was easier than I thoughtsendmailconfigokay, next step that I make was a php.ini configuration (I'm not a great admin, I'm a beginner, so I don't know is it necessary or not.)I setsendmail_path= /usr/sbin/sendmail -t -iOkay, from this moment, theoretically, you can send email, but for my case it led to 504 http error gateway time-out. But as I found much later the email already came to email box.
So, my test php file is:That's pretty clear.Next problem is 504 error. I go to the log filesnano /var/log/mail.logand here i find this error (that not the only one error, but that one is responsible for 504 error):sm-msp-queue[***]: My unqualified host name (myhostname) unknown; sleeping for retryThen, to find how I can solve this trouble:http://forums.fedoraforum.org/archive/index.php/t-85365.htmllast comment on that page.Or another words I made this:nano /etc/hostsand in that file I change the order of the hosts127.0.0.1 my_ip localhost myhostnamesave, done.
open your test php file, there is no any 504 error and emails is income to email you mention in mail function.
As I say, I'm a novice, and that may not work for you, but it work for me anyhow. This is not the end configuration, of course. Hope you find it helpful. | May be it's a dumb question, but I can't find the reason why php mail function doesn't work
I have a nginx server on debian squeeze, I moved to it recently. I tried simple mail execution but it return false.if(mail('[email protected]', 'test-subject', 'test-text-blablabla'))
echo 'ok';
else
echo 'bad';What can i do with it?Thanks.my mail section of php.ini:[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from =[email protected]; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log = | mail() doesn't work on new server |
The amount of IO is going to depend a lot on how you have MySQL configured and how your application uses the database. Caching, log file sizes, database engine, transactions, etc. will all affect how much IO you do. In other words, it's probably not possible to predict in advance although I'd guess that SQLite would have more disk IO simply because the database file has to be opened and closed all the time while MySQL writes and reads (in particular) can be cached in memory by MySQL itself.
This site, Estimating I/O requests, has a neat method for calculating your actual IO and using that to estimate your EBS costs. You could run your application on a test system under simulated loads and use this technique to measure the difference in IO between a MySQL solution and a SQLite solution.
In practice, it may not really matter. The cost is $0.10 per million IO requests. On a medium-traffic e-commerce site with heavy database access we were doing about 315 million IO requests per month, or $31. This was negligible compared to the EC2, storage, and bandwidth costs which ran into the thousands. You can use the AWS cost calculator to plug in estimates and calculate all of your AWS costs.
You should also keep in mind that the SQLite folks only recommend that you use it for low to medium traffic websites. MySQL is a better solution for high traffic sites.
|
I have a Java program and PHP website I plan to run on my Amazon EC2 instance with an EBS volume. The program writes to and reads from a database. The website only reads from the same database.
On AWS you pay for the amount of IOPS (I/O requests Per Second) to the volume. Which database has the least IOPS? Also, can SQLite handle queries from both the program and website simultaneously?
| MySQL vs SQLite on Amazon EC2 |
0
Not sure about through the webservice, but I know you can access the state of backup jobs by running the bpdbjobs command and parsing through the output.
Share
Follow
answered Feb 2, 2015 at 20:03
awesomeamygawesomeamyg
5155 bronze badges
Add a comment
|
|
I work with SharePoint. I was given a project where I need to call NetBackup web services and download all the failed Backup jobs. Backup Status = failed or something like it.
All I know they (backup team) gave me a url http://netbk004/Operation/opscenter.home.landing.action? I have worked with asmx before but I have no clue how to consume exceptions from NetBackup. Is there an API that comes with NetBackup that I can use to populate a SharePoint list? Or web services, it doesn't matter as long as I can download the exceptions to a SharePoint List.
| Web Services - How to get failed backup jobs from NetBackup |
No, the @Cache annotation goes on entities and on collections. Your composite key will be used as key for the cache entry.
|
my entity class is annotated with @Cache, my primary keys are combined of few table fields, primary keys are embedded into this class as embedded class. Do I need to put @Cache for the embedded class as well?
| jpa embedded class need cachable? |
I testet it. You must set thestride * 2to (stride * 2)! For my solution it worked well.if ((i % (stride*2)) == 0 && (i + stride) < size) {
array[i] += array[i+stride];
}ShareFolloweditedMay 12, 2016 at 12:13Dovydas Šopa2,29288 gold badges2727 silver badges3434 bronze badgesansweredMay 12, 2016 at 10:47CComRedCComRed1Add a comment| | i'm starting to learn OpenCl and as one of the tasks I have to write I program, that sums all elements of an array.The program is supposed to be simple and I don't know what's wrong with me today, but it's not working. Well, it does, but sometimes it shows wrong results (sometimes doesn't).The more elements we have, the bigger is the chance to get a wrong result (especially after 16536)
The number of elements always equals to the power of two.Could someone please tell me, what's wrong here?The kernel:__kernel void Reduction_InterleavedAddressing(__global uint* array, uint stride)
{
unsigned int i = get_global_id (0);
unsigned int size = get_global_size(0);
if ((i % stride*2) == 0 && (i + stride)<size){
array[i] += array[i+stride];
}
}Kernel call:unsigned int stride = 1;
clErr = clSetKernelArg(m_InterleavedAddressingKernel, 0, sizeof(cl_mem), (void*)&m_dPingArray);
for (; stride <= m_N / 2 ; stride*=2){
clErr = clSetKernelArg(m_InterleavedAddressingKernel, 1, sizeof(cl_int), (void*)&stride);
clErr = clEnqueueNDRangeKernel(CommandQueue, m_InterleavedAddressingKernel, 1, NULL, &globalWorkSize, LocalWorkSize, 0, NULL, NULL);
V_RETURN_CL(clErr, "Error executing kernel");
}Thank your for your tips in advance | Invalid results by summing an array, OpenCL, Interleaved Addressing |
From the error message, it looks likeapi.jsis part of your own coding (not a dependency).You reference asonar-requestmodule on your computer which, according to your error message, does not exist. Usually, you would need tonpm installit. But there is no such module on theregistry(at the time of this posting)Please check yourapi.jsfile for the mentioned require statement (you will find it on line 176). | When I run tests on my Sonarqube plugin, if a class call to the api, it returns an error but when there is no call to the api, it works great.
Here is the error:FAIL src\main\js\__tests__\Cards-test.js
Test suite failed to run
Cannot find module 'sonar-request' from 'api.js'
at Resolver.resolveModule (node_modules\jest-resolve\build\index.js:151:17)
at Object.<anonymous> (src\main\js\api.js:176:81)
at Object.<anonymous> (src\main\js\components\Cards.js:2:38)How can I correct this error? | Cannot find module 'sonar-request' from 'api.js' when I run npm run test |
Copy your commit (or set of commits) to a new commit (or set of commits) that comes after the latest commit the other person has.
This is a little confusing, so it might help to have three people's names here. You have your own commit(s), which we might label V for Viet. There are (at least) two other people involved: your employer E, and your upstream U.
Your upstream was the latest:
...--E--F--G--H--I <-- master (in U)
You cloned their repository, getting all their commits, then added your own:
...--E--F--G--H--I <-- upstream/master (in V)
\
J--K--L <-- master (in V)
Meanwhile your employer is behind:
...--E--F--G <-- master (in E)
If you make a pull request, your request says "take commits through L". For Mr U, that's your three commits, J--K--L, because his master ends at I. For Mr E, though, that's your three commits plus Mr U's two.
So if you now copy your original commits to new commits that come after E0:
E1
you can now send, to Mr E, a request that he pull commit E2. Since his string of commits ends at commit E3, that will send him E4, E5, and E6.
Mr E will, eventually, probably have to update to match E7. When he does, he must decide what to do with the fact that he ends up with both E8 and E9. You, too, must decide whether to keep both copies of your commits.
Note: you can do this commit copying operation using U0 (which is quite straightforward), or using U1 (which is a kind of automated cherry-pick with a final U2 at the end to move a branch name, so as to "forget" the original commits in favor of the new copies). The cherry-pick is conceptually simpler, and since this particular operation is "going backwards" (backporting), I would personally stick with it here unless some other (unforeseen / undisclosed) considerations override that.
|
So here's the problem at the moment.
So I grabbed the upstream branch and made some changes and created a commit.
I have an employer now telling me I need to make a PR to his branch. But his branch isn't updated to the latest commit like how my is.
So when I do make a PR, It's also bringing all of the commits in between his branch and the upstream. I just wanna use my latest commnit.
Assuming that the person is stubborn and doesn't want to update his branch. How would I go about this?
My solution at the moment is to just reset to his current branch and pretty much manually add all of my changes and then create the commit. It would take too long.
Is there a better way?
| Reset to git commit except for my recent commit |
Whilegit stashis not yet (Q4 2017) available for Visual Studio (seethis uservoice), you can still stash your currently modified files in command line:cd /path/to/your/repo
git stashThen your git pull can proceed. Typegit stash popto get back your current changes. | I am using Visual Studio 2017 and trying to sync push my local changes to remote repository using Git plug-in in VS 2017.
I staged my changes and committed them. Now when I try to push the changes I get below error-Error encountered while pushing to the remote repository: rejected
Updates were rejected because the tip of your current branch is behind
its remote counterpart. Integrate the remote changes before pushing
again.So I tried to fetch and pull the latest changes from the remote repository first. The fetch succeeded but when I pull the incoming commits it gives below error-Error: Your local changes to the following files would be overwritten
by merge: Error: merging of trees
73d9f5683703dbb7dede45aa858a9dc46a156f07 and
e59a44271f3ae2b73e397cdade39d4270e7a773c failedIdeally a pull should fetch and merge the changes. I tried searching for some resolution and came across this link-VS 2017 - Git failed with a fatal errorThis solution did not work for me. Any ideas how can I resolve this? | Unable to sync changes with Visual Studio Git plugin |
First of all you must be using a version 2 Compose file to use the new specifications for creating and using named volumes. TheCompose File Referenceincludes all you need to know, including examples.To summarize:Addversion: '2'to the top ofdocker-compose.yml.Place service units under aservices:key.Place volume units under avolumes:key.When referring to a named volume from a service unit, specifyvolumename:/pathwherevolumenameis the name given under thevolumes:key (in the example below it isdbdata) and/pathis the location inside the container of the mounted volume (e.g.,/var/lib/mysql).Here's a minimal example that creates a named volumedbdataand references it from thedbservice.version: '2'
services:
db:
image: mysql
volumes:
- dbdata:/var/lib/mysql
volumes:
dbdata:
driver: localShareFollowansweredFeb 27, 2016 at 21:18Quinn ComendantQuinn Comendant10.1k22 gold badges3333 silver badges3636 bronze badgesAdd a comment| | I'm building my containers withdocker-composeand I would like to use the new volume API from Docker, but I don't see how to.I want to be able to saydocker-compose up -dto:Create a volume, or use it if already created.Create services containers with data from previous volume container. | Replicate 'docker volume create --name data' command on docker-compose.yml |
I believe the commit should be gone for all new clones and fetches after you removed it, but there's an easy way to prove this: simply clone the repo again and see if it's still there. (It shouldn't be).Assuming it is gone when you clone, then the only people that could potentially still access it are those that had pulled it down locally while it existed, and if they had checked out the branch during that time it could potentially remain forever until they either delete their local branch, or reset it to match your latest version.If you created a Pull Request with the branch, you may also want to look at the PR history to see if the commit is still accessible there.ShareFollowansweredMay 17, 2020 at 4:27TTTTTT24.9k99 gold badges6464 silver badges7373 bronze badgesAdd a comment| | This question already has answers here:Remove sensitive files and their commits from Git history(12 answers)Closed3 years ago.I committed some stuff to github that I would prefer that I hadn't. It's not super sensitive. It's the domain name that I use to access my home IP address. It's not keys, certificates or credentials or anything.I have removed the domain name and rebased and squashed out the commit that contained the domain name.Is this commit still available on my public github site? Locally I am pretty sure I could get that commit back by usinggit reflogbut I am hoping that the data in github has been automatically pruned and is no longer accessible. | How do I ensure that commits I have removed from github are not retrievable by anyone else [duplicate] |
Finally figured it out. It was rather simple but on the server side of things.I had to addpublish_time_fix off;in the nginx config for rtmp server.Thanks to thisblog. | PS: First time gstreamer user here. :)Im trying to stream video from a logitech c920 webcam connected to a beaglebone using gstreamer to an nginx server. But somehow rtmpsink is failing on me. However, with filesink im able to save the video on the beaglebone. Though I still have some frame loss issues and no audio, I want the streaming part to be working first. The command Im using isGST_DEBUG=4 GST_DEBUG_FILE=gst2.log gst-launch-1.0 -v -e uvch264src device=/dev/video0 name=src auto-start=true average-bitrate=5000000 iframe-period=33 src.vidsrc ! queue ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! flvmux ! rtmpsink location="rtmp://192.168.1.104:1935/hls/movie"My debug output is here.gistgstreamer just quits within 5 seconds.I verified that the streaming server works. But from the client, gstreamer is not giving me any kind of error messages. Or I dont know how to debug it properly.Im stuck on this issue for the last so many days. Any help would be appreciated.Thank you.Update 1:
Im able to send a local file to my rtmp server with ffmpeg and server is handling it as expected.ffmpeg -re -i /Users/r3dsm0k3/10.mp4 -vprofile baseline -ar 44100 -ac 1 -c copy -f flv rtmp://192.168.1.4:1935/hls/exampleTried gstreamer with fakesink and it doesn't give any errors.Update 2Tried with v4l2src as well, without luck. | gstreamer streaming to nginx rtmp server |
Have a look athttps://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/#NarrowingtheFocus-IgnoreIssuesIt gives detailed information on how to ignore certain rules for certain files in SonarQube.Best way is to have all the POJOs under a package (eg 'model') and exclude that package from the Sonar scanning.ShareFollowansweredMar 18, 2019 at 15:15GarimaGarima13144 bronze badgesAdd a comment| | How to ignore duplicated blocks in SonarQube for getters/setters in POJOs?Example:@Entity
public class Clazz {
@Id
private int id;
private String abc;
}
public class ClazzDTO {
private int id;
private String abc;
} | Duplicated blocks in SonarQube between POJOs |
You need to add a second RewriteRule above your current one.
Here's an example:RewriteRule ^/(.*)/(.*)$ index.php?page=$1&p=$2 [L,QSA]This will rewrite/product/ford-mustangtoindex.php?page=product&p=ford-mustangRemember to add it above your current RewriteRule, because it first tries to match the first RewriteRule, when there's no match it will go on with the second RewriteRule and so further. | I have this .htaccess that I've been using to rewrite URLs like these:www.example.com/index.php?page=brand www.example.com/brand
www.example.com/index.php?page=contact www.example.com/contact
www.example.com/index.php?page=giveaways www.example.com/giveawaysRewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]I used a file called index.php to handle the redirects. Code used below:$page = trim($_GET['page']);
if($page == "giveaways")
require('pages/giveaways.php');Now, I would like to add another URL type like these:www.example.com/index.php?page=products&p=ford-mustangTOwww.example.com/products/ford-mustangHow will I accomplish this? Any suggestion would be greatly appreciated. | .htaccess rewriting |
How to get the tags?See "How to list all tags for a Docker image on a remote registry?".The API is enoughFor instance, visit:https://registry.hub.docker.com/v2/repositories/library/java/tags/?page_size=100&page=2Will the base image safe?As long as you save your own built image in a registry (eithe rpublic one, or a self-hosted one), yes: you will be able to at least build new images based on the one you have done.Or, even if the base image disappears, you still have its layers in your own image, and can re-tag it (provided the build cache is available).See for instance "Is there a way to tag a previous layer in a docker image or revert a commit?".See caveats in "can I run an intermediate layer of docker image?". | I have aDockerfilesomething like follows:FROM openjdk:8u151
# others hereI have 2 questions about the base image:1. How to get the tags?Usually, I get it from dockerhub, let's sayopenjdk:8u151, I can get it fromdockerhub's openjdk repository.If I could get all tags from any local docker command, then I no need to visit web to get the tags, really a little low efficiency?2. Will the base image safe?I mean if my base image always there?Look at the above openjdk repo, it is an offical repo.I found there is only8u151left for me to choose. But I think there should be a lots ofjdk8release during the process, so should also a lots ofjdk8images there, something like8u101,8u163etc.So can I guess the maintainer will delete some old images foropenjdk?
Then if this happen, how myDockerfilework? I should always change my base image if my upstream delete there image? Really terrible for me to maintain such kind of thing.Even if theopenjdkreally just generate one release ofjdk8. My puzzle still cannot be avoided, asdockerhubreally afford thedeletebutton for users.What's the best practice, please suggest, thanks. | Best practice for dockerfile maintain? |
Usually linked list implementation in nutshell looks similar to something like this:class LinkedList {
Node head; // head
class Node {
int data;
Node next; // link to the next node
Node(int d) {
data = d;
}
}
}So node class is areference typewhich is stored onheap(used for the dynamic memory allocation of Java objects at runtime) so theNodeinstances will be allocated in arbitrary places (determined by the memory allocation algorithm used by the JVM) among other object allocated during app lifetime (I assume you call this "slots") so they will not occupy continuous space in general case (like for example arrays will do1).1requires some discussion aboutprimitive types and objectsand what is stored where and how | While i was studying java and data structures, i learned what a LinkedList is and how it can increase it's maximum size even after declared. So i want to know how this works in the memory, does it just skip to the next available slot? For example, if it initially used slots 11, 12 and 13, and i increase it, does it just use the next available slot, for example 19?This might be pretty dumb, but i was studying c++ and learned some things about how the code interacts with the RAM, and how different types have different bytes that are going to be read, basic stuff. I got confused about how LinkedLists interact with the memory when i learned about it. | Linked List in RAM memory |
Git will only record 755 or 644 as permission.
See "How Git Treats Changes in File Permissions."And the local file owner isnotrecorded, which means if it is root when you clone/use a repo, it only reflects the local account you are using when doing those operation: Git knows nothing about it.So don't use the root account when cloning your repo. | I've created a new repository in GitHub.Then, I make a commit and push in my terminal.But all files I add to GitHub have as owner root.However, in my terminal when I check files permissions with "ls -la" they have 755 for folder and 644 for files with 1000:1000.Why the owner is root when I use that repository in other project? | git upload the files as root |
Each instruction must go though the four stages. Once the pipeline is full, the flow of instructions in and out is determined by the duration of the longest stage:Fetch|Decode|Exec|Write|
10ns | 6ns |8ns | 8ns |
-----+------+----+-----+
I7 I6 I5 --> I4 : I3 : I2 : I1 --> out
-----+------+----+-----+
I1..I7 are instructions. I1..I4 are in the pipeline, I5..I7 are
waiting to enter the pipeline.After 6ns I3 is ready to move from Decode to Exec, but cannot because the stage Exec is still occupied by I2After 2ns more (8ns total), I1 moves out of Write, I2 moves from Exec to Write, and I3 can finally move from Decode to ExecI4 is still blocking Fetch, so I5 cannot enterAfter 2ns more (10ns total) I4 moves from Fetch to Exec, and I5 can enter.You see that the pipeline stalls until the longest stage is completed; one instruction enters the pipeline every 10ns. (The Decode stage will be idle 40% percent of the time, and the Exec and Write stages 20% of the time.) | In a CPU with a four (4)-stage pipeline composed of fetch, decode, execute, and write
back, each stage takes 10, 6, 8, and 8 ns, respectively. Which of the following is an
approximate average instruction execution time in nanoseconds (ns) in the CPU? Here, the
number of instructions to be executed is sufficiently large. In addition, the overhead for the
pipelining process is negligible, and the latency impact from all hazards is ignored.a) 6
b) 8
c) 10
d) 32Answer is 10ns.But i thought it might be 8ns since execute stage takes 8ns.please explain simply.thanks | CPU Pipeline: How to find average instruction execution time |
Use git revert command to revert any commit you don't want.
git revert <commit id>
Additionally, if there was a PR raised to merge "PUSH B" then you also get "revert" option in the merged PR, which will ease your work.
Let me know if this helps!
|
This question already has answers here:
How to revert a merge commit with a newer commit after it?
(2 answers)
Closed 3 years ago.
Suppose I've working code in my master branch at PUSH A.
I've pushed some wrong code in my master, say PUSH B
Over my wrong commit, there is one more push. PUSH C
Now I want to revert my code, but keep the correct changes of PUSH C in the master.
| Git - How to Revert incorrect code between 2 push on master [duplicate] |
Take a look atRuntime.getRuntime().exec("contrab file.txt") | i want to execute the commandcrontab file.txtin java.What is the procedure...? | execute linux command in java |
(char*)malloc(sizeof(char) * (size+1)) would be more appropriate (the +1 is to account for the NULL at the end of string, if applicable).
If one is copying a string, strlen() doesn't account for the NULL terminating the string hence an additional memory char is required.
|
I have created a macro to make reserve memory for my strings in C. It looks like this:
#define newString(size) (char*)malloc(sizeof(char) + size)
So is there any reason I shouldn't use this macro in my own personal projects? I know I shouldn't do this in production code because it would require everyone to have that header file and everyone to know that newString was a macro.
| Which way to reserve memory for a string? |
To future readers: visiting somepage.php%3Fid=1234.html worked. (See the comments above.)
|
I've got some code that mirrors some pages using wget, and some of the pages to be mirrored are links like "http://example.com/somepage.php?id=1234". wget ends up saving those pages as "somepage.php?id=1234.html". When I try to visit that page, I get a 404.
I've tried adding "autoindex on;" to the config for that directory to make sure that the filename is correct, and I click on the link generated by nginx when I visit the directory that contains that page, and I still get a 404.
How can I get nginx to serve pages with a question mark in the name?
| View file with question mark in nginx |
As Barmar said, this option doesn't exist onkubectl cpIf you want to copy a directory into the container use the command below:kubectl cp /home/local-dir <pod-name>:/tmp/container-dirTo copy the directory to a specific container into the pod use:kubectl cp /home/local-dir <pod-name>:/tmp/container-dir -c container-name | I am getting Error: unknown shorthand flag: 'R' in -R error when I run the line below. I'm aware of the root cause. It is -R. How can I run this command without issue?kubectl -n $NAMESPACE -c vault cp -R /source /destinationP.S.: withour -R, I can run the command, but I want to copy the directories. Any help would be appreciated it. Thanks | How to solve unknown shorthand flag: 'R' error with CP command |
Picasso uses the HTTP client for disk caching and if one is already configured it will use that instead of installing its own.
For the built-in UrlConnection the docs for installing a cache are here: https://developer.android.com/reference/android/net/http/HttpResponseCache.html
If you are using OkHttp then you just call setCache:
http://square.github.io/okhttp/2.x/okhttp/com/squareup/okhttp/OkHttpClient.html#setCache-com.squareup.okhttp.Cache-
|
I'm using picasso library to load images for my app. But I don't how to implement my own disk (sdcard) caching with picasso library.
| How to implement my own disk cache with picasso library - Android? |
You should be able to do this using theSystem.Configuration.ConfigurationManagerclass.The OpenMappedConfiguration method can be used to open a instance of the System.Configuration.Configuration type based on your app/web config (or any other file in the right format, so someone else's app/web config). Then the Configuration type has a Save method and a SaveAs method.Can't say that I've used them to do exactly what you want but (to speak to @StingyJack's comment) I have used them in a Installer subtype (a ProjectInstaller for a service). | Are there any built in methods in System.Configuration that would allow one to backup the currently running apps XXX.exe.config file. Or if not, how would one retrieve the current applications config file name for backup. | Built-In methods to backup app.config |
What's the chance your code is not threadsafe? i.e., some concurrent runs of the script collide? The corrupted file you show looks like it could have incorrect dimensions.ShareFollowansweredMar 24, 2016 at 5:47some ideassome ideas6433 silver badges1414 bronze badges2i'm only running the script once per image, where I'm uploading an image one at a time.–HandonamMar 24, 2016 at 17:57It may be true, but I would be worried anyway. fs.writeFile('/tmp/object.jp2', response.Body, function(err) { the fille will exist across the calls and if one lambda is called twice it will damage the file.–petrchOct 19, 2019 at 10:46Add a comment| | I'm having an issue with AWS Lambda where my resized images become corrupted every few uploads. I wrote a script that pulls from S3 and resizes it into 3 sizes into another bucket, mostly with filestreams. Here is the code:https://github.com/handonam/AWS-Resizer/blob/493ff10c317e7150d1ac040f54065083963a9c67/createThumbnails.jsYou can see the larger 512px upscaled file (the resized) along with the original (200px)And another resizing to 120pxMy lambda consumption looks totally fine for the most part. It is set up on the same region with 768mb memory and 20s timeout. The scripts execute around 2 seconds using 90/768mb for small images (like 500px wide), or 14 seconds @ 648/768mb on much larger images such as 2000px wide. But even for a small image, the resize dies on me. If I abandon filestreams and just write to buffer (just like theaws example), then the image processing will end up with a buffer buffet, and lambda will use up way too many resources.Any guidance is appreciated! | AWS Lambda image corrupted |
I had the same issue. Locally my pytorch model would return a prediction in 25 ms and then on Kubernetes it would take 5 seconds. The problem had to do with how many threads torch had available to use. I'm not 100% sure why this works, but reducing the number of threads sped up performance significantly.Set the following environment variable on your kubernetes pod.OMP_NUM_THREADS=1After doing that it performed on kubernetes like it did running it locally ~30ms per call.These are my pod limits:cpu limits1mem limits:1500mI was led to discover this from this blog post:https://www.chunyangwen.com/blog/python/pytorch-slow-inference.html | I would like to make the result of a text classification model (finBERT pytorch model) available through an endpoint that is deployed on Kubernetes.The whole pipeline is working but it's super slow to process (30 seconds for one sentence) when deployed. If I time the same endpoint in local, I'm getting results in 1 or 2 seconds. Running the docker image in local, the endpoint also takes 2 seconds to return a result.When I'm checking the CPU usage of my kubernetes instance while the request is running, it doesn't go above 35% so I'm not sure it's related to a lack of computation power?Did anyone witness such performances issues when making a forward pass to a pytorch model? Any clues on what I should investigate?Any help is greatly appreciated, thank you!I am currently usinglimits:
cpu: "2"
requests:
cpu: "1"Python : 3.7
Pytorch : 1.8.1 | pytorch model evaluation slow when deployed on kubernetes |
The|>!operator you're describing is thestandard "map" patternthat can apply to just aboutany"wrapper" type, not justasync. If yourreturn f rhad beenreturn! f rthen you would have thestandard "bind" pattern, which by convention should be written as the operator>>=if you're defining an operator for it.And it is a good idea, but with one minor change. You've written it with the async value as the first parameter and the function as the second parameter, but the way you used it,fetchAsync() |>! work, requires the function to be thefirstparameter, e.g.let (|>!) f a = .... (If you look at the way Scott Wlaschin implements this in the first example I linked, he puts the function as the first parameter as well.) Also, I think most F# programmers would choose not to write this as an operator, but as a function calledAsync.map, so that its usage would look like this:let result =
fetchAsync()
|> Async.map step1
|> Async.map step2
|> Async.map step3 | What if we define a|>!operator like so:let (|>!) a f = async {
let! r = a
return f r
}Then instead of writinglet! r = fetchAsync()
work rwe could writefetchAsync() |>! workIs this a good idea or would it generate inefficient code? | Is this async pipelining operator ok |
A message only commit might help you :git commit --allow-empty | I've pushed some changes to repository on Github withgit push origin master, but one of webhooks was not triggered because of network failures. This webhooks is configured to send only "push" events. Is it possible to push nothing viagitCLI to retrigger webhooks for latest commit (which is already pushed)?I can't do that via Github settings web-page, because I'm not the admin in this repo. I know that I can push some commit and revert it back, but I don't want to pollute git history. Force push won't work because ofmasterbranch protection settings. | Push to git on GIthub to re-trigger missed 'push' webhook |
Update, since this was asked, docker has changed the paths for the volume mounts. See the current documentation athttps://github.com/docker-library/docs/blob/master/mariadb/README.md#where-to-store-dataUse the following to mount/path/on/hostfrom the host to/var/lib/mysqlin the container:- '/path/on/host:/var/lib/mysql' | I have a MariaDB container, to handle my database.Here is my problem, I execute :docker-compose exec mariadb mysql -u rootto enter MariaDB container and create a test database, then exit the container, and shut it down through command :docker-compose downAfter that, I start back all my containers through commanddocker-compose upgo back inside the MariaDB container to see if the database I added persisted but, I found out it did not. I thought I had correctly parameterized MariaDB volumes through this line in my docker-compose :- '/bitnami/mariadb/:/var/lib/mysql'Here is my complete docker-compose.yml file :version: '2'
services:
myapp:
image: 'bitnami/symfony:1'
ports:
- '8000:8000'
volumes:
- '.:/app'
environment:
- SYMFONY_PROJECT_NAME=backend
- MARIADB_HOST=mariadb
- MARIADB_PORT_NUMBER=3306
- MARIADB_USER=monty
- MARIADB_PASSWORD=monty
- MARIADB_DATABASE=test
container_name: symfony_container
depends_on:
- mariadb
mariadb:
image: 'bitnami/mariadb:10.3'
ports:
- '3306:3306'
volumes:
- '/bitnami/mariadb/:/var/lib/mysql'
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_DATABASE=test
- MARIADB_PORT_NUMBER=3306
- MARIADB_ROOT_USER=root
- MARIADB_USER=monty
- MARIADB_PASSWORD=monty
container_name: mariadbIf anyone have any leads for me I'll be greatfull. | docker container mariadb volumes |
I'm not certain if that is possible to do withhttps://kubernetes.io/docs/reference/access-authn-authz/webhook/but if you had a way to know with that request payload if it was a token then you could handle it that way.If not, you would probably need to use a like gateway/proxy in front of the API server to intercept requests and filter them before kubernetes receives them at all. | We need to disable logging in via service account token.We were thinking of having a webhook for login event and forwarding it to opa, opa will check if the login request uses token. If it does, it throw an error, if it does it will just continue the flow of forwarding the request to the authenticator/identity provider.We are using openshift 3. | How to filter authentication request before forwarding to authentication server? |
There are two issues I've identified so far. Maya G points out a third in the comments below.Incorrect conditional logicYou need to replace:if len(sys.argv) >= 2:
sys.exit('ERROR: Received 2 or more arguments. Expected 1: Input file name')With:if len(sys.argv) > 2:
sys.exit('ERROR: Received more than two arguments. Expected 1: Input file name')Bear in mind that the first argument given to the script is always its own name. This means you should be expecting either 1 or 2 arguments insys.argv.Issues with locating the default fileAnother problem is that your docker container's working directory is/home/aws, so when you execute your Python script it will try to resolve paths relative to this.This means that:with open('inputfile.txt') as f:Will be resolved as/home/aws/inputfile.txt, not/home/aws/myapplication/inputfile.txt.You can fix this by either changing the code to:with open('myapplication/inputfile.txt') as f:Or (preferred):with open(os.path.join(os.path.dirname(__file__), 'inputfile.txt')) as f:(Sourcefor the above variation)UsingCMDvs.ENTRYPOINTIt also seems like your script apparentlyisn'treceivingmyapplication/inputfile.txtas an argument. This might be a quirk withCMD.I'm not 100% clear on the distinction between these two operations, but I always useENTRYPOINTin my Dockerfiles and it's given me no grief. Seethis answerand try replacing:CMD ["python", "/myapplication/script.py", "/myapplication/inputfile.txt"]With:ENTRYPOINT ["python", "/myapplication/script.py", "/myapplication/inputfile.txt"](thanks Maya G) | I've successfully built a Docker container and copied my application's files into the container in the Dockerfile. However, I am trying to execute a Python script that references an input file (that was copied into the container during the Docker build). I can't seem to figure out why my script is telling me it cannot locate the input file. I am including the Dockerfile I used to build the container below, and the relevant portion of the Python script that is looking for the input file it cannot find.Dockerfile:FROM alpine:latest
RUN mkdir myapplication
COPY . /myapplication
RUN apk add --update \
python \
py2-pip && \
adduser -D aws
WORKDIR /home/aws
RUN mkdir aws && \
pip install --upgrade pip && \
pip install awscli && \
pip install -q --upgrade pip && \
pip install -q --upgrade setuptools && \
pip install -q -r /myapplication/requirements.txt
CMD ["python", "/myapplication/script.py", "/myapplication/inputfile.txt"]Relevant portion of the Python script:if len(sys.argv) >= 2:
sys.exit('ERROR: Received 2 or more arguments. Expected 1: Input file name')
elif len(sys.argv) == 2:
try:
with open(sys.argv[1]) as f:
topics = f.readlines()
except Exception:
sys.exit('ERROR: Expected input file %s not found' % sys.argv[1])
else:
try:
with open('inputfile.txt') as f:
topics = f.readlines()
except:
sys.exit('ERROR: Default inputfile.txt not found. No alternate input file was provided')Docker command on host resulting in error:sudo docker run -it -v $HOME/.aws:/home/aws/.aws discursive python \
/discursive/index_twitter_stream.pyThe error from the command above:ERROR: Default inputfile.txt not found. No alternate input file was providedThe AWS stuff is drawn from a tutorial on how to pass your host's AWS credentials into the Docker container for use in interacting with AWS services. I used elements from here:https://github.com/jdrago999/aws-cli-on-CoreOS | Docker Python script can't find file |
IDEA supports GutHub as a source of issues to create Task from.
It is not possible to do vice versa or create an issue on GitHub from IDE directly.AFAIK, there are no plugins to do so either, at least I was not able to find one in JetBrains plugin repo.A feature request is welcome athttps://youtrack.jetbrains.com/issues/IDEA | I know that IDEA (and AS) supports GitHub issues as contexts and we can watch them, create commits etc. But I wonder is it possible to create an issue directly from AS? | Is it possible to create a GitHub issue from Intellij IDEA (Android studio)? |
Found the answer and have been installing npm packages for fun every since ;) I followed this tutorial Node.js and npm into for VS2015
I found editing the packages.json file first fixed it for me. Cause after doing so then running the commands it installed perfectly fine. Thanks for the answers guys, did help me find the issue and the eventual solution.
|
I need to install this project/code as its required for a project I am working on.
Is the easiest way to just grab whats in the Dist folder and copy it into the project?
Do all projects have npm install commands? in the documentation this one doesn't appear to have any explanation for installing it?
| Install project from github |
Try to move the include fastcgi_params; higher, above the fastcgi_params
|
I'm trying to pass all the requests that hits a specific location, to a PHP file with the request URL via Nginx config file, I've almost done this but I cannot pass the URL to the PHP file.
I've tried var_dump($_REQUEST); var_dump($_ENV); var_dump($argv); but returns NULL or emtpy array results.
location /p/ {
try_files $uri $uri/ @php;
}
location @php {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/process/internal/t.php; # this script catches all requests
fastcgi_param QUERY_STRING $uri;
include fastcgi_params;
}
| Nginx passing parameters to a PHP file |
You can remove both perms from your url using a single rule, try :RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^news-(.*?)\.html$ /$1 [L,R=301]Clear your browser cache before testing this redirect. | I have a small question .htaccess perspective.I urls from the old site which is composed as follows:news- pecq_mur_quai_plateforme_bimodale_dechargement_inauguration_escaut.htmlthese URLs become :pecq_mur_quai_plateforme_bimodale_dechargement_inauguration_escautI have to delete 'news-' and '.html' of these urls .I have combined two rules and I do not see how. Here's my start code .<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^news-(.*)$ /$1 [L,R=301]
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
</IfModule> | .htaccess combine 2 RewriteRule |
Use web GUI, press button. Or drag and drop to webpage.Or create a new empty file put inside a folder:Reference:https://help.github.com/articles/adding-a-file-to-a-repository/https://github.com/blog/2105-upload-files-to-your-repositoriesShareFolloweditedDec 24, 2016 at 16:00answeredDec 24, 2016 at 15:53Vy DoVy Do49.3k6565 gold badges231231 silver badges345345 bronze badges4Thanks, but it's not just about adding an empty folder, but a folder with multiple files in it–teddavDec 24, 2016 at 15:551Drag and drop your folder (with many files inside) into Github webpage–Vy DoDec 24, 2016 at 15:58Ok. Thanks, didn't know you could do that. that could work for me.–teddavDec 24, 2016 at 15:593But if there is a way to do it in a clean way with Git that would probably be better–teddavDec 24, 2016 at 16:00Add a comment| | I'm looking for a way in Git to add new files to an existing remote repo without having to clone all of it.
I have a large repo on Github and I want to add a new folder at its root, but I don't want to clone the remote repo. Is there a way to do that?Or maybe just clone the structure of the repo to be able to add it to the new folder and then push it?Hope it's clear enough. I found some similar questions but no satisfying answer. Some directed to submodules, but not sure that's appropriate for me.
And even though it says hereHow do I add file to remote Git repo (Github) without cloning the whole repo firstthat it can't be done, Im sure there must be a way :)Thanks. | Add new files to existing repo without cloning |
In order to explain how to merge labels labels from two metrics, I'll take a common case:avaluemetricvalue{instance="foo",a_label="bar"} 42aninfometricinfo{instance="foo",version="1.2.3",another="bar"} 1Info metrics (such as version, compiler, ...) have value 1 such that you can apply operators between the metrics:value * on(instance) group_left(version) infoResult{instance="foo",a_label="bar",version="1.2.3"} 42The parameter(s) ofon()keywordspecify the criteria(s) for matching the info and the parameter(s) ofgroup_left()operatorspecify the labels to pull.It can happens that the metric you want to pull from doesn't have value 1. In that case, you can use theboolmodifierwith a comparison always true to obtain 1:other_metric{instance="foo",baz="void"} 0.5555
value * on(instance) group_left(baz) other_metric != bool NaNResult{instance="foo",a_label="bar",baz="void"} 42 | We have a situation where I want to add a MIB variable label to another query. This another query gives me the value result that I want but I need to add the label from first variable in order to then sort them by what I want (for example just as we do it withinstancelabel).E.g.variable1{alert,env, index, instance, ..., labelneeded}variable2{alert,env, index, instance}For example there I wanted to get the index of both and somehow add the label-needed by
I tried the following queries but they didnt work after they are giving me both variables with its labels but not concatenated together so my question is if there is a possibility to concatenate them together?Query example:max by {index, instance} (variable2 * 5) or max(variable2) by (labelneeded, index, instance)Thank you in advance :). | Concatenate MIB variable label to another query result from other two MIB variables in Prometheus |
Having read through these answers I'm astonished that so many take the stance that OP's computer memory belongs to others. It'shiscomputer andhismemory to do with as he sees fit, even if it breaks other systems taking a claim it. It's an interesting question. On a more primitive system I hadmemavail()which would tell me this. Why shouldn't the OP take as much memory as he wants without upsetting other systems?Here's a solution that allocates less than half the memory available, just to be kind. Output was:Required FFFFFFFFRequired 7FFFFFFFRequired 3FFFFFFFMemory size allocated = 1FFFFFFF#include <stdio.h>
#include <stdlib.h>
#define MINREQ 0xFFF // arbitrary minimum
int main(void)
{
unsigned int required = (unsigned int)-1; // adapt to native uint
char *mem = NULL;
while (mem == NULL) {
printf ("Required %X\n", required);
mem = malloc (required);
if ((required >>= 1) < MINREQ) {
if (mem) free (mem);
printf ("Cannot allocate enough memory\n");
return (1);
}
}
free (mem);
mem = malloc (required);
if (mem == NULL) {
printf ("Cannot enough allocate memory\n");
return (1);
}
printf ("Memory size allocated = %X\n", required);
free (mem);
return 0;
} | I want to allocate my buffers according to memory available. Such that, when I do processing and memory usage goes up, but still remains in available memory limits. Is there a way to get available memory (I don't know will virtual or physical memory status will make any difference ?). Method has to be platform Independent as its going to be used on Windows, OS X, Linux and AIX. (And if possible then I would also like to allocate some of available memory for my application, someone it doesn't change during the execution).Edit: I did it with configurable memory allocation.
I understand it is not good idea, as most OS manage memory for us, but my application was an ETL framework (intended to be used on server, but was also being used on desktop as a plugin for Adobe indesign). So, I was running in to issue of because instead of using swap, windows would return bad alloc and other applications start to fail. And as I was taught to avoid crashes and so, was just trying to degrade gracefully. | How to get available memory C++/g++? |
helm install myappwill always install latest available version of your chart from your chart repository.Fromdocumentation--version string specify the exact chart version to install.If this is not specified, the latest version is installedShareFollowansweredMar 26, 2019 at 11:10edbigheadedbighead5,96555 gold badges3131 silver badges3636 bronze badgesAdd a comment| | I got the following Chart.yaml file for kubernetes:apiVersion: v1
description: Chart for installing myapp
name: myapp
version: 1.5.0
namespace: my-appHow do I get the latest version without updating manually every new version? | Get latest version in Chart.yaml |
Your problem is caused by back-forward cache. It is supposed to save complete state of page when user navigates away. When user navigates back with back button page can be loaded from cache very quickly. This is different from normal cache which only caches HTML code.
When page is loaded for bfcache onload event wont be triggered. Instead you can check the persisted property of the onpageshow event. It is set to false on initial page load. When page is loaded from bfcache it is set to true.
Kludgish solution is to force a reload when page is loaded from bfcache.
window.onpageshow = function(event) {
if (event.persisted) {
window.location.reload()
}
};
If you are using jQuery then do:
$(window).bind("pageshow", function(event) {
if (event.originalEvent.persisted) {
window.location.reload()
}
});
|
Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here Preventing cache on back-button in Safari 5) to the body tag but it doesn't work in this case.
Is there any way to prevent safari loading from cache on a certain page?
| Prevent safari loading from cache when back button is clicked |
You forgot a *, and you've too many fields. It's the hour you need to care about
0 */6 * * * /path/to/mycommand
This means every sixth hour starting from 0, i.e. at hour 0, 6, 12 and 18 which you could write as
0 0,6,12,18 * * * /path/to/mycommand
|
How can I run command every six hours every day?
I tried the following, but it did not work:
/6 * * * * * mycommand
| Running a cron job on Linux every six hours |
There's nothing you can do except renew your certificate.The warning is opened by your browser,beforeany request is ever even sent to the server. When it tries to resolve an HTTPS request, it first establishes the SSL handshake with the server, this is where the server gives the browser the certificate and the browser sees that it's expired. The browser then displays a security exception/warning. That means there isnothingthat you can do on the server's end to prevent this from happening except addressing the certificate.After you've renewed your cert, you need to have a rule to redirect all HTTPS traffic to HTTP traffic using a 301 redirect. | In the past I had a ssl certificate but I don't have it anymore because I didn't use it. However, now I see that some of the my website's page are indexed on google with https. Clicking those links directs you to a security warning. How can I best solve this? I tried adjusting the htaccess file redirect https requests to the http protocol, but that doesn't remove the warning. Any help? | How to get rid of an ssl security warning with expired certificate |
Have you tried adding count to that? Like this:stats count(detail.finding-severity-counts.CRITICAL) as severity | i am getting the logs from the Cloud watch to Grafana dashboard.However i am not able to make it panel or dashboard out of it.What i tried is to go to Explore check for the Cloud watch logs and run the query"fields @messages"which is returning the value{
"version": "0",
"id": "sadfasdf-sdf-asfd-asdf-a3753e4aa9ae",
"detail-type": "ECR",
"source": "aws.ecr",
"account": "12345",
"time": "2020-23-29T02:36:48Z",
"region": "us-east-1",
"resources": [
"arn:aws:ecr:us-east-1:XXXXXXXXXXX:repository/repo"
],
"detail": {
"scan-status": "COMPLETE",
"repository-name": "my-repo",
"finding-severity-counts": {
"CRITICAL": 5,
"MEDIUM": 3
},
"image-digest": "sha256:xxxxxxxxxxx",
"image-tags": []
}
}so how to write query which can list the below details in dashboard or panel."finding-severity-counts": {
"CRITICAL": 5,
"MEDIUM": 3
},i tried something likestats (detail.finding-severity-counts.CRITICAL) as severitybut no luck so far dashboard not showing anything. also i think above once will only showCRITICALvalue not medium.Thanks in advance | Grafana query for cloud watch logs |
You can't limit when BitBucket fires its POST hook; but you can use thecontents of the POSTto make the decision about whether or not to proceed with the deployment. Just parse the JSON that BitBucket sends you and only continue if any of the"commits"elements have a"branch"of "master", for example. | Complicated title, let me explain.I want to limit an automatic POST hook when I push to themasterbranch; so it won't fire when I push to thedevbranch. This is so the app will only deploy to the live servers when the changes have been merged withmasterand the newmasterpasses the unit tests.Is this possible? | Limit POST Hook to git branch, not repository, on Bitbucket |
If you want to use the same certificate both for CloudFront and for
other AWS services, you must upload the certificate twice: once for
CloudFront and once for the other services.From here:http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/SecureConnections.html#CNAMEsAndHTTPSShareFollowansweredFeb 4, 2014 at 18:47datasagedatasage19.2k22 gold badges4848 silver badges5555 bronze badges11CloudFront: If you are uploading a server certificate specifically for use with Amazon CloudFront distributions, you must specify a path using the --path option. The path must begin with /cloudfront and must include a trailing slash (for example, /cloudfront/test/). Enter the following command:–mstDec 30, 2015 at 15:03Add a comment| | I'm trying to install a DigiCert Wildcard SSL on a CloudFront CDN.It worked immediately with all Elastic load balancers, but it's not showing up the CloudFront SSL certificate selection dropdown, even if the certificate is found in the IAM store.Any ideas what permissions could be conflicting? | AWS CloudFront: Not showing IAM SSL certificates |
You would use the name of the service in your fig.yml, in this case I think you're calling it flickrcrawler. So something like http://flickrcrawler:3100.
|
I have a docker container with an sinatra app inside, and another container with an node.js app. They are both linked through Fig. In my sinatra app I am making a HTTP Post request to the node.js app. For that I am using the Faraday gem.
My questions is now how can I make a HTTP request to another linked container.
Here's my fig.yml
db:
image: mongo:2.6.7
command: --smallfiles
api:
build: ./api
command: bundle exec rackup -p 3000
volumes:
- ./api:/code
ports:
- "3000:3000"
links:
- db
- flickrcrawler
flickrcrawler:
build: ./flickr-crawler
ports:
- "3100:3100"
links:
- db
and here's the method in the sinatra app I use to make a HTTP request with farady:
def crawler_call(url, tags)
tags.each do |t|
conn = Faraday.new(url: url) do |faraday|
faraday.request :url_encoded
faraday.response :logger
faraday.adapter Faraday.default_adapter
end
conn.post "#{t}"
end
end
what would I pass this method as url parameter?
| How can I make a HTTP request from one docker container to another linked container? |
We spent the last few weeks looking at this, too. I assume you are also also seeing big CPU spikes (or even a constant 100% iptables) in networks with large amounts of ingress rules/routes.That was identified a few releases ago and in the 1.5 cycle we got a few patches in that would reduce the number of iptables calls being made. In addition to that, we have introduced the min-sync-period flag which guarantees iptables will only run every X period.Our tests set iptables-min-sync-interval=30s but we haven't yet decided yet what to do by default in OpenShift. Hope to have some more formal position soon. | We are having problems on kube-proxy loading iptables. It locks docker when there's a large number of services. Is there a way to tune this with its parameters?From its documentation, I can only find --iptables-min-sync-period and --iptables-sync-period might be related? What's the recommended values for these in a large network? | what parameters can impove kube-proxy performance? |
@LinPy Thank you for u help.
https://www.x-cellent.com/blog/cgo-bindings/
I solved the problem. But build takes a long time, about 10 minutes, and I'm still looking for a better solution.
Images Dockerfile : https://github.com/sillyhatxu/alpine-build
FROM xushikuan/alpine-build:2.0 AS builder
ENV WORK_DIR=$GOPATH/src/github.com/sillyhatxu/mini-mq
WORKDIR $WORK_DIR
COPY . .
RUN go build -a -ldflags "-linkmode external -extldflags '-static' -s -w" -o main main.go
FROM xushikuan/alpine-build:1.0
ENV BUILDER_WORK_DIR=/go/src/github.com/sillyhatxu/mini-mq
ENV WORK_DIR=/app
ENV TIME_ZONE=Asia/Singapore
WORKDIR $WORK_DIR
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone
RUN mkdir -p logs
RUN mkdir -p db
RUN mkdir -p data
COPY --from=builder $BUILDER_WORK_DIR/main $WORK_DIR
COPY --from=builder $BUILDER_WORK_DIR/config.conf $WORK_DIR
COPY --from=builder $BUILDER_WORK_DIR/db $WORK_DIR/db
COPY --from=builder $BUILDER_WORK_DIR/basic.db $WORK_DIR/data
ENTRYPOINT ./main -c config.conf
|
I want to use sqlite3 in Golang project. But run it in docker container has some error.Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
this is my build script
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main main.go
I can't use CGO_ENABLED=1 in mac computer.
FROM golang:1.13-alpine
ENV WORK_DIR=/go
ENV TIME_ZONE=Asia/Singapore
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone
WORKDIR $WORK_DIR
RUN mkdir -p logs
COPY main .
COPY config.conf .
COPY basic.db ./data
COPY db db
ENTRYPOINT ./main -c config.conf
How can I use sqlite3 in the docker container. Or how can I build CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o main main.go Golang project
| Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub |
Currently this is impossible to add TSLint rules to SonarTS SonarQube plugin. | An existing TS project with a set of TSLint rules activated want to be analyzed with Sonarqube, therefore I installed the latest LTE version of sonarqube as well as TS plugin provided by Sonar.Despite the fact the TS plugin includes a good set of rules, the ones currently used by the project does not match one-to-one with TSPlugin rules.I want to import the rules used and defined in the project in Sonarqube, How can this be achieved? | How to add TSLint rules to Sonarqube Typescript plugin? |
git checkout develop
git cherry-pick <release-line commit>Note that if you're just looking to cherry-pick the latest commit on thereleasebranch, you can justgit cherry-pick release. | I have a develop branch and I need to cherry-pick a commit from my release branch.What are the steps to reproduce? | How to Cherry pick in Git if I have hash of particular commit? |
The problem is caused by violation of the same origin policy.
AFAICT there is no work around other than to insure that the XSLT file is available from the same domain as the source file. | I am getting the above error in Firefox 32.0, in Chrome Version 37.0.2062.120 I get a blank page but show page source displays the XML file (it is a schema).The details are that this is a stylesheet that I am developing and when I reference it locally, it is working as expected. Adding the reference to the schema from the website copy causes this error.The sylesheet is locatedhttp://www.mlhim.org/xmlns/mlhim2/2_4_5/ccd-description.xslAn examples of the source schema files are here:https://github.com/mlhim/specs/blob/2_4_5/2_4_5/examples/Care_CCD_245.xsdThey do not have the reference to the style sheet (yet) but adding:<?xml-stylesheet type="text/xsl" href="http://www.mlhim.org/xmlns/mlhim2/2_4_5/ccd-description.xsl"?>to one of those schemas should display the problem.I will add that the website is hosted by github and the full URL to the stylesheet ishttps://github.com/mlhim/mlhim.github.io/blob/master/xmlns/mlhim2/2_4_5/ccd-description.xslBut even using that I get an 'unknown error'.I know that GitHub redirects www.mlhim.org to mlhim.org But changing the reference to not use the 'www' also gives me a network error. | Error loading stylesheet: A network error occurred loading an XSLT stylesheet: |
+50You can use thebackupcommand provided by theReplicationHandler. It's an asynchronous operation and it takes time if your index is big. This way you don't need to shutdown Solr. Then you'll find within the index directory a new directory namedbackup.yyyymmddHHMMSSwith the backup date. You can also configure how many old backups you want to keep.After that of course it's better if you move the backup to a safe location, probably to a different server.I don't think it's possible to backup the spellchecker, not completely sure though.Of course the command is meant to be run while the application is running. The only problem is that you will probably lose in the backup the documents that you committed after you started the backup itself.You can also have a look at the lucene CheckIndex tool. Once you backed up the index you could check if the index is ok.I wouldn't personally use the backups to restore the index on the slaves if you already have a good index on the master. The copy of the index would be automatic using the standard replication process (it's really a copy of the index segments), you don't need to copy them manually unless the backup contains better data than the master. | We're usingsolr 3.6 replicationwith 2 servers -a master and a slave- and we're currently looking for the way to do clean backups.As the wiki says so, we can use a HTTP command to create a snapshot of the master like this:http://myMasterHost/solr/replication?command=backupBut we still have some questions:What is the benefit of thebackupcommand on a classic shell script copying the index files?The command only backups the indexes; is it possible to copy also thespellcheckerfolder? is it needed?Can we create the snapshot while the application is running, so while there are potential index updates?When we have to restore the servers from the backup, what do we have to do on the slave?just copy the snapshot in its index folder, and removing thereplication.propertiesfile (or not)?ask for a fetchindex through the HTTP commandhttp://mySlave/solr/replication?command=fetchindex?just empty the slave index folder, in order to force a full replication from the master? | Backup strategy with master-slave solr 3.6 servers |
To quickly test the JWT functionality you only need to include luciferous/JWT.phpYou include library files using the PHPrequire_onceorinclude_oncestatements.
Have a look at the luciferous/tests/Bootstrap.php and JWTTest.php for an usage example.The other files you mention are used to create the PEAR package (PEAR = PHP Extension and Application Repository). You can read more about PEARhere. | reading thishttps://developers.google.com/in-app-payments/docs/tutorialQuoted from the above page:
Because you sign the JWT using a secret key (the Seller Secret), you must generate the JWT using server-side code. It's simplest if you use a library.https://github.com/luciferous/jwtMust I somehow include this...? I so how? there is more than one file there and no read me of what they each do, I am very confused!The docs just don't say! | How to use goog.payments.inapp.buy with luciferous jwt? |
this works fine for me:http {
server {
listen 80;
server_name service1.domain.com;
location / {
proxy_pass http://192.168.0.2:8181;
proxy_set_header host service1.domain.com
}
}
server {
listen 80;
server_name service2.domain.com;
location / {
proxy_pass http://192.168.0.3:8080;
proxy_set_header host service2.domain.com;
}
}
}have a try? | I have 2 servers on my network:one linux machine (192.168.0.2) with a website listening on port 8181 for service1.domain.com
one windows machine (192.168.0.3) with a website listening on port 8080 for service2.domain.comI want to set up an nginx reverse proxy so that I can route requests like so:service1.domain.com --> 192.168.0.2:8181 with host header service1.domain.com
service2.domain.com --> 192.168.0.3:8080 with host header service2.domain.comI have tried with the following config:### General Server Settings ###
worker_processes 1;
events {
worker_connections 1024;
}
### Reverse Proxy Listener Definition ###
http {
server {
listen 80;
server_name service1.domain.com;
location / {
proxy_pass http://192.168.0.2:8181;
proxy_set_header host service1.domain.com;
}
}
server {
listen 80;
server_name service2.domain.com;
location / {
proxy_pass http://192.168.0.3:8080;
proxy_set_header host service2.domain.com;
}
}
}But that doesn't seem to work?Is there anything blindingly obvious that I might be doing wrong here? | NGinx config for redirecting domain |
Here is how to pipe it without a shell loop, and parse JSON natively, either withgh api -qbuilt-injqquery, orjqitself.#!/usr/bin/env sh
REPOSITORY_NAME=
OWNER=
gh api -H "Accept: application/vnd.github+json" \
"repos/${OWNER}/${REPOSITORY_NAME}/pulls" --cache 1h |
jq -j --arg curbranch "$(git rev-parse --abbrev-ref HEAD)" \
'
.[] | select(
(.base.ref == $curbranch) and
(.state == "open") and
(.draft == false)
) | .number | tostring + "\u0000"
' |
xargs -0 -I{} \
gh api -H "Accept: application/vnd.github+json" \
"repos/${OWNER}/${REPOSITORY_NAME}/pulls/{}" --cache 1h \
-q '
"PR #" + (.number | tostring) + ": " +
.title + " is " +
if .mergeable != false then "mergeable" else "not mergeable" end
'Altenatively using awhile read -rloop instead ofxargswhich seems problematic in some Windows environment:gh api -H "Accept: application/vnd.github+json" \
"repos/${OWNER}/${REPOSITORY_NAME}/pulls" --cache 1h |
jq -r --arg curbranch "$(git rev-parse --abbrev-ref HEAD)" \
'
.[] | select(
(.base.ref == $curbranch) and
(.state == "open") and
(.draft != true)
) | .number
' | while read -r pr; do
gh api -H "Accept: application/vnd.github+json" \
"repos/${OWNER}/${REPOSITORY_NAME}/pulls/${pr}" --cache 1h \
-q '
"PR #" + (.number | tostring) + ": " +
.title + " is " +
if .mergeable != false then "mergeable" else "not mergeable" end
'
done | I was wondering how to check if a pull request has conflicts on GitHub using a script from my PC?
There is a nice solution mentioned here to do it via GitHub actions:https://stackoverflow.com/a/71692270/4441211However, taking the same script from https://olivernybroe/action-conflict-finder and running it on my PC won't work unless I do a local merge. After identifying the conflicts I would have to discard the local merge. This process seems inefficient and I was looking for a "cleaner" and faster solution. | How to check if a pull request on GitHub has conflicts using a script? |
Given the size of the network (very small) I'm inclined to think this is a DMA issue: copying data from the CPU to the GPU is expensive, maybe expensive enough that it makes up for the GPU being much faster at doing larger matrix multiplications. | I have created aneural network classifierwith2hidden layers.Hidden Layersunits[50,25].The model is training much faster onCPUthanGPU.My questions are :Is this expected? I do see that the architecture is small but not that small to be faster on CPU :/How should I debug this?I tried increasing batch size, expecting that after somebatch_sizeGPU will overtake CPU. But I don't see that happening.My code is inTensorflow 1.4. | Tensorflow Neural Network faster on CPU than GPU |
+250While I can't definetly say it will help, I think it's worth trying to push the work to the GPU. You can either do that yourself by rendering a textured quad at a given size, or by usingGPUImageand its resizing capabilities. While it has some texture size limitations on older devices, itshouldhave much better performance than CPU based solution | In background thread, my application needs to read images from disk, downscale them to the size of screen (1024x768 or 2048x1536) and save them back to disk. Original images are mostly from the Camera Roll but some of them may have larger sizes (e.g. 3000x3000).Later, in a different thread, these images will frequently get downscaled to different sizes around 500x500 and saved to the disk again.This leads me to wonder: what is the most efficient way to do this in iOS, performance and memory-wise? I have used two different APIs:usingCGImageSourceandCGImageSourceCreateThumbnailAtIndexfrom ImageIO;drawing toCGBitmapContextand saving results to disk withCGImageDestination.Both worked for me but I'm wondering if they have any difference in performance and memory usage. And if there are better options, of course. | What is the most memory-efficient way of downscaling images on iOS? |
Create a .gitignore in the repo folder with one rule:
!*
This forgets the rules (with !) of all of the files (*) in the main .gitignore.
|
After looking at git ignore exception, I realized that one can ignore files in a repository from a global .gitignore file.
Is there any way that you can override all rules from the global .gitignore file, so that the repository will have everything in it and nothing ignored? (besides un-ignoring every file individually)
| Un-ignore all files in global .gitignore |
No, there is no such D package that I know of. Ideally it should behave like theJCache, but I am afraid that would be too much to ask. :) JCache is going to be an amazing addition to the already excellent Java API.D community would certainly benefit from something like that. | Is there a way in D to have a list that allows you to shift
around values? I'm creating a cache and I would like to keep a
log of when an item was last accessed so when the cache shrinks
or is about to overflow I can delete the items that haven't been
accessed in a while.I would like to be able to push to the back and pop from the
front. Do note that I would like to pop from the front, and not
from the back, as I want the oldest items to be popped out.I would like the be able to search if the item is actually in the
list. If no such functionality exists yet I could alternatively
implement it myself; it's not crucial.I would like to be able to switch items around. This allows me
when an item already in the list is accessed, I can put it back
at the back, where the most recent items reside.Does such a feature exist already in D, is there perhaps a better
approach about doing this? | Lists Allowing for Pushing, Popping & Switching Values |
It's nothing to do with Python. The files scanned will still be in the OS's file system cache, so don't require as much disk access as the first run...You could reproduce with something like:with open('a 100mb or so file') as fin:
filedata = fin.read()On the second run, it's likely the file is still in memory rather than disk, so the second run will be significantly faster. | I have made a simple program, that searches for a particular file in a particular directory.The problem with the program is that it runs very slow the first time, but very fast when you run it subsequently. I am pasting a screenshot of the same.I would like to know, why is it so? I have discovered the same thing on both windows 7 as well as ubuntu 12.04 LTS, but the speed difference (or time difference) is great on windows 7.See the time difference between the second and the third searches.
First takes 81.136 seconds and the second one takes 6.45 seconds, although we are searching the same directory. | Why do python programs run very slow the first time? |
2
This usually happens because there is a problem in the configuration of the ValidatingWebhookConfiguration. When you deploy the nginx controller it deploys multiple resources, one of those is this validation, which function is to validate all the ingress that you create later on. Sometimes it might happen that there is a communication problem and you get that error even having the correct structure for the ingress.
My recommendations:
Check if the structure of your ingress is correct
Backup the current validation and delete it, check if the problem is solved (even though this might not be the best solution for sure it will work)
You can achieve this by doing:
kubectl get ValidatingWebhookConfiguration -o yaml > ./validating-backup.yaml
kubectl delete ValidatingWebhookConfiguration <name of the resource>
be carefull since the ValidatingWebhookConfiguration is cluster wide
Finally, if you want to keep the ValidatingWebhookConfiguration, the best option might to redeploy the whole Ingress Controller using helm, so you ensure it gets correctly deployed. Here is they why that validation is used: link
Sources:
Personal experience
https://github.com/kubernetes/ingress-nginx/issues/5401
https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/
Share
Improve this answer
Follow
edited Jul 29, 2021 at 14:11
answered Jul 29, 2021 at 14:03
MauroMauro
12188 bronze badges
1
Thank you. I have been deleting the ValidatingWebhookConfiguration for the past month, but today I tried applying it without deleting it and it worked. I no longer got that error.
– nimramubashir
Aug 12, 2021 at 7:40
Add a comment
|
|
I'm creating my Kubernetes single node cluster using kubeadm. After applying the ingress ngnix controller, I'm getting the following error when I try to apply the ingress file.
I'm getting the following error while applying the ingress:
Error from server (InternalError): error when creating "ingress.yaml": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": Post "https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s": dial tcp 10.101.247.233:443: connect: connection refused
I'm currently using the ingress nginx controller. How can I resolve this issue?
| Failed calling webhook "validate.nginx.ingress.kubernetes.io": error while applying the ingress in Kubernetes |
The solution was to disable theLegacy Stackdriverand enableStackdriver Kubernetes Engine Monitoring:Go to the cluster page and click on edit;Disable both Legacy Stackdriver Monitoring and Logging;Enable Stackdriver Kubernetes Engine Monitoring using the option "System and workload logging and monitoring" | Recently I did an upgrade on my cluster that's running multiple containers for microservices written in Java (using default Spring Boot's log4j2 default configuration). Since then, the container log is not being updated anymore.
Thekubectl logscommand is working fine, all the recent logs can be seen using this command, but the logs that should be appearing in the GKE dashboard is simply not working anymore. I checked the Google's Loggin API and it's enabled.Does anyone know what's the possible reasons for this or how to solve it? | Container logs not working after cluster update on GKE |
OK, there was a lot in my original question, but the core of it really came down to: as a non-UI person, how do I make an OAuth workflow work with a React app? The callback URL in this case is a route, which doesn't exist if you unload the index.html page. If you're going directly against S3, this is solved by directing all errors to index.html, which reloads the routes and the callback works.
When fronted by nginx however, we lose this error->index.html routing. Fortunately, it's a pretty simple thing to add back:
location / {
proxy_intercept_errors on;
error_page 400 403 404 500 =200 /index.html;
Probably don't need all of those status codes - for S3, the big thing is the 403. When you request a page that doesn't exist, it will treat it as though you're trying to browse the bucket, and give you back a 403 forbidden rather than a 404 not found or something like that. So in this case a response from S3 that results in a 403 will get redirected to /index.html, which will recall the routes loaded there and the callback to /callback?token=... will work.
|
I may be twisting things about horribly, but... I was given a ReactJS application that has to be served out to multiple sub-domains, so
a.foo.bar
b.foo.bar
c.foo.bar
...
Each of these should point to a different instance of the application, but I don't want to run npm start for each one - that would be a crazy amount of server resources.
So I went to host these on S3. I have a bucket foo.bar and then directories under that for a b c... and set that bucket up to serve static web sites. So far so good - if I go to https://s3.amazonaws.com/foo.bar/a/ I will get the index page. However most things tend to break from there as there are non-relative links to things like /css/ or /somepath - those break because they aren't smart enough to realize they're being served from /foo.bar/a/. Plus we want a domain slapped on this anyway.
So now I need to map a.foo.bar -> https://s3.amazonaws.com/foo.bar/a/. We aren't hosting our domain with AWS, so I'm not sure if it's possible to front this with CloudFront or similar. Open to a solution along those lines, but I couldn't find it.
Instead, I stood up a simple nginx proxy. I also added in forcing to https and some other things while I had the proxy, something of the form:
npm start0
This works - I go to a.foo.bar, and I get the index page I expect, and clicking around works. However, part of the application also does an OAuth style login, and expects the browser to be redirected back to the page at /reentry?token=foo... The problem is that path only exists as a route in the React app, and that app isn't loaded by a static web server like S3, so you just get a 404 (or 403 because I don't have an error page defined or forwarded yet).
So.... All that for the question...
Can I serve a ReactJS application from a dumb/static server like S3, and have it understand callbacks to it's routes? Keep in mind that the index/error directives in S3 seem to be discarded when fronted with a proxy the way I have above.
| Can a ReactJS app with a router be hosted on S3 and fronted by an nginx proxy? |
Not sure you have created the service account and granted access to the adapter however there is two models of custom metrics adapter. Legacy adapter and new resource version.If adapter is up and running did you check the logs of POD ?New resource model to install :kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/k8s-stackdriver/master/custom-metrics-stackdriver-adapter/deploy/production/adapter_new_resource_model.yamlref yaml you can use this way further metricsapiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: pubsub
spec:
minReplicas: 1
maxReplicas: 5
metrics:
- external:
metric:
name: pubsub.googleapis.com|subscription|num_undelivered_messages
selector:
matchLabels:
resource.labels.subscription_id: echo-read
target:
type: AverageValue
averageValue: 2
type: External
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: pubsubRef :https://cloud.google.com/kubernetes-engine/docs/tutorials/autoscaling-metrics#pubsub_4 | I would like to scale my deployment based on a custom logging metric, but I'm not able to make that work, I created already the custom metric and I'm also able to see it in the metric explorer but for some reason the stackdriver adapter is not able to get the metric values.This is my hpa.yamlapiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: nginx-hpa
spec:
minReplicas: 1
maxReplicas: 5
metrics:
- external:
metricName: logging.googleapis.com|user|http_request_custom
targetValue: "20"
type: External
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: nginxBut i'm always getting the following error:"unable to get external metric default/logging.googleapis.com|user|http_request_custom/nil: unable to fetch metrics from external metrics API: the server could not find the requested resource (get logging.googleapis.com|user|http_request_custom.external.metrics.k8s.io)"Should i do something different?? any idea? | Horizontal pod autoscaling using a logging custom metric in GKE |
You could change the last 3 commits by interactive rebase.
git rebase -i HEAD~3
And change the commit to "edit".
See https://help.github.com/articles/about-git-rebase/
|
I made a "little" mistake and added a "little" (>100MB) file to my local repo.
Two commits later I'm trying to push to remote repo in github that have a limit of 100MB.
I can remove the file from my current commit with git rm --cached, but it still in previous commits.
How can I remove the file from all commits?
I've tried this answer about git filter-branch but don't work for my.
| Git remove file from all commits |
0
For a docker image, named "hello-world":
docker save --output hello-world.tar hello-world
sha256sum hello-world.tar
It should give you the content sha of image.
Share
Improve this answer
Follow
answered May 14, 2022 at 18:50
Prasad TamgalePrasad Tamgale
33511 silver badge1212 bronze badges
Add a comment
|
|
How can I calculate a deterministic and reproducible checksum of a docker image, locally, without pinging any registry?
The checksum should not depend on the image name or in which registry it lives. It should solely depend on the content of all layers.
For example, assume the following:
a given file a
a dockerfile with the content
FROM scratch
COPY a /a
Then building the image with docker build . --no-cache multiple times should always yield the same checksum.
The regular image ID does not cut it, as it somehow uses content from intermediate containers and hence always changes. I am also aware that since Docker 1.10, images have a "RepoDigest" attribute, which uniquely identifies images based on their layers' content. However, as far as I can tell, that digest is only calculated when pulling or pushing to a registry. Is there a way to get this field without contacting a registry? (and is it actually deterministic, regardless of image name, tag or repo?)
Basically, I'm looking for a way to run a good ol' sha256sum on a docker image. This would help me to achieve something similar to as what can be done with Bazel: a hermetic build environment, which in turn enables:
declaring dependencies between docker images, and have a CI system only rebuild what is needed without using docker's cache (assuming that I have a build tool which already manages caches)
allow me to "sign" images using the same approach as signing classic tarballs (that is, publish a checksum and somehow sign that)
the big one: enable reproducible builds!
| How can I calculate a deterministic and reproducible checksum of a docker image, locally, without pinging any registry? |
In order to authenticate you shoukd firstly be using the correct operator and executor in Airflow. In your case this would be the Kubernetes Executor. When using this executor you need to set up secret/s for use with k8s.
Refer to the documentation hereKubernetes ExecutorOverview | I have Apache Airflow on k8s.Earlier, when Airflow was running on my local server (not k8s) i didn't have troubles with oauth2 creds verification: when Google Operators (based on GoogleCloudHook) starts, my browser opens and redirects me to Google Auth page. It was one-time procedure.With Airflow on k8s my tasks running on separate pods and there are troubles with this oauth2 creds verification, i cant "open browser" inside pod, and i dont want to do it every time when my task will be running.Can I somehow disable this procedure or automatizate this?Is there any solution? | Airflow on k8s and Google Operators: creds verification |
Described situation by you is caused by fact that fill() fills data only if you do not have anything in your group by time() period in your query. If you get spread=0 then you probably have only one value in this period, so no fill() is used.
What I can suggest to you is to use subquery with lower group period time to prepare interpolation of your original signal. This is an example:SELECT spread("interpolated_value") FROM (
SELECT first("value") as "interpolated_value" from "gas"
WHERE $timeFilter
GROUP BY time(10s) fill(linear)
)
GROUP BY time(1d) fill(none)Subquery will prepare value for each 10s period (I recommend to set this value possibly as high as you can accept). If in 10s periods are values, it will pick the first one, if there is no value in this period, it will do an interpolation.In main query there is an usage from prepared interpolated set of values to calculate spread.All above only describes how you can get interpolated data within shorted periods. I strongly recommend to think about usability of this data. Calculating spread from lineary interpolated data may have questionable reliability. | How can I plot time-grouped increment data in a bar graph in Grafana, but with a sparse data source that needs interpolation BEFORE calculating the increment?My data source is an InfluxDB with a sparse time series of accumulated values (think: gas meter readings). The data points are usually a few days apart.
My goal is to create a bar graph with value increase per day. For the missing values, linear interpolation will do just fine.I've come up withSELECT spread("value") FROM "gas" WHERE $timeFilter GROUP BY time(1d) fill(linear)but this won't work as thefill(linear)command is executed AFTER thespread(value)command. If I use time periods much greater than my granularity of input data (e.g. time(14d)), it shows proper bars, but once I use smaller periods, the bars collapse to 0.How can I apply the interpolation BEFORE the difference operation? | How to plot daily increment data from a sparse data set with interpolation in Grafana? |
0
I can assure you that there is nothing wrong with the code you are showing.
Share
Improve this answer
Follow
answered Dec 22, 2012 at 6:41
CocoaneticsCocoanetics
8,18922 gold badges3030 silver badges5757 bronze badges
Add a comment
|
|
I'm using ARC and generic Cocoa and still hitting memory issues. With NSZombiesEnabled, the following line points to the crash:
[self.menu itemWithTag:MYMenuItemStatus].title = NSLocalizedString(@"DISCONNECTED", nil);
With the error:
*** -[CFString retain]: message sent to deallocated instance
self.menu is defined as follows:
@property (nonatomic, strong) IBOutlet NSMenu *menu;
MYMenuItemStatus is defined as follows:
typedef enum {
MYMenuItemStatus = 0,
// and so on...
} MYMenuItem;
This code executes in a Reachability reachability-changed callback, if that helps explain anything. I'm at a loss, though. What am I missing?
Update:
self.menu (and its items) are initialized from a nib file (the menu property is an outlet).
| ARC + NSLocalizedString + NSMenuItem#title == Memory Issue |
You seem to say your app crashes with an out of memory error, in this case you should provide JVM args to the app settings the heap size, not to eclipse
they look like this:
-Xms256M;-Xmx512M
|
Here is my eclipse.ini file:
-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.java.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx256m
Default stuff. However, I have an app that appears to be crashing with 64 mb of heap size. I'm printing out the heap size (in bytes) every few seconds until it crashes, and here's the last output:
66650112
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.lang etc
I'm using Sun's java. Is there another place I need to set the maximum ram available to java?
| Eclipse's .ini settings don't seem to be helping me change the max heap size |
These folders should be installed/populated via a dependency manager at install time (npm and bower, respectively).
You should create a .gitignore file in the root of your project as per this. This should be added to git so it is cloned with the repository on other machines too.
# cat .gitignore
node_modules
bower_components
There's also a webservice to generate .gitignore files, that's very comprehensive. This is for node and bower:
# Created by https://www.gitignore.io
### Node ###
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
### Bower ###
bower_components
.bower-cache
.bower-registry
.bower-tmp
|
When I load my project into Github, it writes me "Commit is failed". I use bower and nodeJS, and I think that problems is about it, but I need to download these catalogs. What I need to do, or may be it can be done in another way?
| How to load the project into Github |
Try using Springs Cache Abstraction,docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html.You can use this abstraction in the method which has the restTemplate call.Any method calls response can be cached using this abstraction, with the method parameters as the keys and the return type as the response.@Cacheable("username")
public UserResponse getUser(String username){
// Code to call your rest api
}This creates a Spring AOP advice around the method. Every time the method is called it checks if the data is available in the cache for this key(username), if yes then returns the response from the Cache and not calls the actual method. If the data is not available in the Cache then it calls the actual method and caches the data in the cache, so next time when the same method is called with same key the data can be picked from Cache.This cache abstraction can be backed by simple JVM caches like Guava or more sophisticated cache implementations like EHCache, Redis, HazelCast as well. | I am building an app in java.I hit api more than 15000 times in loop and get the response ( response is static only )Example**
username in for loop
GET api.someapi/username
processing
end loop
**It is taking hours to complete all the calls. Suggest me any way (any cache technology) to reduce the call time.P.S :1) i am hitting api from java rest client(Spring resttemplate)2) that api i am hitting is the public one, not developed by me3) gonna deploy in heroku | How to cache REST API response in java |
If you are running Docker Desktop for Windows 4.5.0 then you should be aware of an existing issue where the default backend selected after installing is not the correct one.You can switch to the correct backend manually by editing the file located at:%AppData%\Docker\settings.json(full path:C:\Users\%UserName%\AppData\Roaming\Docker\settings.json) and at the bottom of the file change the value for thewslEngineEnabledfield totrue. After that Docker Desktop should start correctly.Similar issue and solution is mentionedhereby the usermccaa25. | I'm trying to setup docker with WSL 2 to run a Dockerfile. I downloaded Docker Desktop, and when I tried to follow the quick start guide, I got the following error:docker: error during connect: This error may indicate that the docker daemon is not running.: Post "http://%2F%2F.%2Fpipe%d2Fdocker_engine/v1.24/containers/create?name=repo": open //./pipe/docker_enginer: The system cannot find the file specified.I set com.docker.service to run in the Task Manager, and have run:“c:\Program Files\Docker\Docker\DockerCli.exe” -SwitchDaemonI have also quit Docker Desktop and reopened it in admin mode, and I still get the message that Docker Desktop has stopped.Please let me know if there's any other options, thanks! | Docker not starting on Windows 11 with WSL 2 |
Sub-domain configuration starts with an entry in the DNS server of the parent domain and the lookup resolves the sub-domain to an IP address of the web server. The web server in turn delegates the requests based on its configuration for the sub-domain.If you don't have a DNS setup in your sub-domain, then the admin at example.com needs to set up a CNAME alias. The alias points the subdomain to the same web server, which hosts the website for the parent domain. The canonical names (CNAMES) are added for each of the subdomains. Once the subdomain is resolved to the IP address of the web server, the web server can route the request to a different website. | There are several questions on SO about nginx subdomain configuration but didn't find one that exactly the same as mine.Say I got a virtual hostsome.example.comfrom higher-level net adminexample.comat our organization. I want to usesome.example.comas my primary site and usefoo.some.example.comandbar.some.example.comfor auxiliary usage (proxy, etc). I tried this simple configuration and put it undersites-enabledbut didn't work:server {
listen 80;
server_name some.example.com;
root /home/me/public_html/some;
index index.html index.htm;
}
server {
listen 80;
server_name foo.some.example.com;
root /home/me/public_html/foo;
index index.html index.htm;
}
server {
listen 80;
server_name bar.some.example.com;
root /home/me/public_html/bar;
index index.html index.htm;
}In this settingsome.example.comworks fine, but for the other two browser return thatcould not find foo.some.example.com. I'm running it on a ubuntu server.Is there something wrong with this configuration? Or is it something I should talk to higher level net admin (makefoo.some.example.comandbar.some.example.comto be registered)? | nginx subdomain configuration on virtual host |
I found the accepted answer here to be incorrect & insecure, and Bao's answer above is very close - except you don't need NFS Inbound on your EC2 (mount target) security group. You just need a security group assigned to your EC2 (even with no rules) so that your EFS Security group can be limited to that security group... you know, for security! Here's what I found works:
Create a new security group for your EC2 instance. Name it EFS Target, and leave all the rules blank
Create a new security group for your EFS Mount. Name it EFS Mount, and in this one add the inbound rule for NFS. Set the SOURCE for this rule to the EFS Target security group you created above. This limits EFS to only being able to connect to EC2 instances that have the EFS Mount security group assigned (See below). If you're not worried about that, you can select "Any" from the Source dropdown and it'll work just the same, without the added level of security
Go to the EC2 console, and add the EFS Target group to your EC2 instance, assuming you're adding the extra security
Go to the EFS Console, select your EFS and choose Manage File System Access
For each EFS Mount Target (availability zone), you need to add the EFS Mount security group and remove the VPC Default group (if you haven't already)
The mount command in the AWS documentation should work now
I don't like how they mixed vernacular here in terms of EC2 being a mount-target, but also EFS has individual mount-targets for each availability zone. Makes their documentation very confusing, but following the steps above allowed me to mount an EFS securely on an Ubuntu server.
|
I am following this tutorial to mount efs on AWS EC2 instance but when Iam executing the mount command
sudo mount -t nfs4 -o vers=4.1 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).[EFS-ID].efs.[region].amazonaws.com:/ efs
I am getting connection time out every time.
mount.nfs4: Connection timed out
What may be the problem here?
Thanks in advance!
| aws efs connection timeout at mount |
Fix for code itself - this would work, but this is not clear naming that would be fixed -https://github.com/intel/scikit-learn-intelex/pull/1343patch_sklearn(['PCA','Linear'])patch_sklearn() would affect only your CPU code - i.e. regular scikit code.In case of GPU there is no notion of GPU support in scikit-learn itself.To run on GPU (note: only Intel GPUs support ) you ether have to use explicit definition with config_context or pass GPU data(dpctl tensor) to algorithmhttps://intel.github.io/scikit-learn-intelex/oneapi-gpu.html | I'm trying to usesklearnex/scikit-learn-intelexfor GPU accelaration. This is my code, learnt from 'Patching several algorithms:':try:
from sklearnex import patch_sklearn
patch_sklearn()
except:
pass
patch_sklearn(['PCA','LinearRegression'])Apparentlythe package suppports linear regression. However, it returns the following error on my machine:> Intel(R) Extension for Scikit-learn* enabled (https://github.com/intel/scikit-learn-intelex)
> Traceback (most recent call last):
> File "/home/path/tmp_test.py", line 16, in <module>
> patch_sklearn(['PCA','LinearRegression'])
> File "/usr/local/lib/python3.9/site-packages/sklearnex/dispatcher.py", line 177, in patch_sklearn
> patch_sklearn_orig(algorithm, verbose=False, deprecation=False,
> File "/usr/local/lib/python3.9/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py", line 127, in enable
> do_patch(name, get_map)
> File "/usr/local/lib/python3.9/site-packages/daal4py/sklearn/monkeypatch/dispatcher.py", line 111, in do_patch
> raise ValueError("Has no patch for: " + name)
> ValueError: Has no patch for: LinearRegressionWhat's wrong with my code? The packagesupportslinear regression and I did exactlythe way in the exampleWhen I patchPCAonly, the algo works normaly. I'm usingthe latest version of this package.. The original sklearn works fine if I don't import sklearnex. | Does sklearnex (sklearn-intel-extension) really support linear regression? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.