Posts by zwitterion • 2,876 points
171 posts
-
0
votes1
answer40
viewsQ: What is the correct way to use AWS Iot.describeCertificate()? I cannot access the function asynchronously
I need to regain the status of an AWS-Iot-Core certificate using a Lambda function with Nodejs. According to the official documentation would need to use the function describeCertificate(). This is…
-
0
votes1
answer73
viewsQ: How to apply filters in a belongsToMany relation in Laravel 5.8?
I have a table posts, a table categorias and a pivot table categoria_post, where a post may be associated with many or no category. In my model categoria and post I have the methods respectively…
-
1
votes1
answer133
viewsQ: Regex - How to recover the first occurrence of two uppercase letters after a comma in Mysql?
I have the following text:: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sodales porta tempor. Praesent eleifend volutpat nulla, BA at aliquet libero. Vivamus est eros, convallis…
-
0
votes0
answers39
viewsQ: Mysql - What would be the pure sql query that would be equivalent to Laravel Sync in a pivot table?
When I work with Laravel in a pivot table where we have only the fields user_id and post_id we use something similar to $user->posts()->sync([3,4]) and the pivot table will be updated with…
-
1
votes2
answers504
viewsQ: Laravel 5.8 - Can we make Sync in a pivot table without the id field?
I have a table pivot with the countryside user_id and article_id (much for many), let’s say I have the following records: 1-2, 1-3, 1-4, 2-1, 2-2. At a certain point user 1 no longer wants to be…
-
0
votes1
answer39
viewsQ: Php 7.1, How to make a REGEX of the following standard:<div class='inline-render' data-type='credit-card' data-Listing-id='1234'>?
I have a text where the following pattern can repeat many or no times and with different values of data-type: <div class='inline-render' data-type='ALGUM TIPO' data-listing-id='VALOR'> I need…
-
0
votes1
answer1146
viewsQ: Laravel 5.7 (Blade) - Ternary operator on two levels is not working
The following code works: if($cc->is_removed){ $status = 'Removed'; } elseif (! $cc->isActive){ $status = 'Inactive'; } elseif ($cc->isActive){ $status = 'Active'; } and on the same page…
-
1
votes2
answers194
viewsA: How to recover all occurrences [[xxx]] of a string in PHP?
I found the answer: $str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquet imperdiet sapien, [[xx]] vitae luctus augue convallis quis. Pellentesque felis eros, dignissim vitae…
-
1
votes2
answers194
viewsQ: How to recover all occurrences [[xxx]] of a string in PHP?
I have a text with placeholders [[xx]], [[ccvf]], [[dfg]], etc. The text inside the placeholder is undetermined and the number of placeholders is variable. Then in the following text as I could have…
-
2
votes1
answer158
viewsQ: How to receive the result of an asynchronous function and move to Return?
I have the following code in nodejs in a lambda function in AWS that has been defined using serverless. The goal of this function is to read a URL that will return an XML, transform into JSON and…
-
-1
votes1
answer504
viewsA: How to upload a Flask server in 0.0.0.0:80 on Ubuntu 16.04 Linux with python3 on an AWS EC2?
I found the solution: Open door 80 as already done and use: //flaskserver.py from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" and upload the server…
-
0
votes1
answer504
viewsQ: How to upload a Flask server in 0.0.0.0:80 on Ubuntu 16.04 Linux with python3 on an AWS EC2?
I need to run a Flask server in an EC2 instance. For this we need to solve these two steps: Open that door in EC2 Make Flask rotate in 0.0.0.0:80 The first step is ok. The door is open to interet:…
-
0
votes1
answer80
viewsQ: Mysql query - How to select products that were returned before they were purchased using sql only
I have the following table of a mysql product movement database which contains the following fields: id | prod_id | prod_name | movimento_tipo | data_transaction 1 | idProd1 | tv | ordemCompra |…
-
0
votes0
answers25
viewsQ: Hierarchical data. What would be the most appropriate ER Diagram to implement a Labels system like Gmail?
Something related to hierarchical data. I am implementing a Labels system for messaging a website that is similar to the gmail Labels system. This is the short ER. A message may have one or more…
-
2
votes2
answers44
viewsQ: Column 'discount' cannot be resolved. How to use a column that is the result of a calculation to calculate another column in the same query?
I have the following query: Select price, col2, col3*7.5 AS desconto, (price*desconto) AS finalprice From tab1. When I run I get the following message: Column 'desconto' cannot be resolved. How to…
sqlasked zwitterion 2,876 -
-1
votes1
answer71
viewsQ: Disable download link while downloading
How to implement this functionality? When the user presses the Download link he will receive a download confirmation message and where he wants to save the file. This download takes on average about…
-
0
votes1
answer365
viewsQ: How to format cells in excel through php?
I have a php code that retrieves data in a database and generates a CSV file. The client opens this CSV in excel to view the data. So far so good. The demand of the client is that he wants to open…
-
0
votes1
answer31
viewsQ: What is the purpose and application of the AWS Athena service?
Reading the documentation of AWS Athena - It is noticed that this service offers a way to make queries in files stored in S3 through traditional SQL and without going through an ETL. That’s the…
awsasked zwitterion 2,876 -
1
votes1
answer137
viewsQ: Why use nodejs with asynchronous functions with AWS-Lambda?
AWS-Lambda services can be developed in Java, C#, Python, Go, Powershell and finally Nodejs (DOC). Nodejs is currently used as a backend of applications with the advantage of natively developing…
-
0
votes1
answer33
viewsQ: How do I save the user session to a website stored on AWS - S3?
At AWS we may use the S3 service to provide static websites. Seundo to documentation static means not using back-end like php, Asp.net, etc. However, I can load content dynamically through…
-
0
votes1
answer39
viewsQ: Nameerror when entering the value read by the input function
I’m running version 2.7 of Python: Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 When I try to spin that code line: x = input('Enter your name:') print('Hello, ' + x)…
-
0
votes1
answer386
viewsQ: How to make Tyscript read a JSON file that is on disk?
I have a code in Typescript (Nodejs-10.6.0) and need to create a variable that will recover the contents of a JSON file. I have tried to import the contents from the file in the following ways: 1.…
-
0
votes1
answer134
viewsQ: What are the advantages of using AWS-Stepfunctions?
Since there is already a system or processes in progress (all functional) with AWS - Lambda functions what would be the advantages or disadvantages of bringing these processes to step functions,…
-
1
votes0
answers46
viewsQ: When we use async don’t you need to use callback?
I have the following function in V10.6 nodejs: #func-1 module.exports.funcOne = (event, context, callback) => { callback(null, { message: 'funcOne', event }); }; #func-2 module.exports.funcTwo =…
-
0
votes1
answer29
viewsQ: Lamda functions - How do I loop AWS-Stepfunctions - with Nodejs?
I have a function lambda, F1, in Nodejs whose main objective is to read the contents of a file that is deposited in S3 through another process. Let’s say in this file there are 10 products. I need…
-
3
votes1
answer129
viewsQ: How to make a recursive sum on a JSON object in Angular 6?
Using Angular 6, how could fill the field total representing the total number of direct and indirect bosses of each employee? I have the following data: const employees = [ { id: 1, firstName: 'a',…
-
1
votes2
answers662
viewsQ: How to convert a date format to ISO 8601 in Javascript?
I have here a code that performs a Javascript operation. It determines the maximum date of birth that can be entered in a form. The rule is that you can only register if you are 18 and older. var d…
-
0
votes1
answer95
viewsQ: How to block users based on their location?
I have an application where users type A post information. By default these posts will be available to any user on the web, anywhere in the world. But there is the possibility for the user to…
-
0
votes1
answer1310
viewsQ: Is there any way to recover the history of all queries executed on a Mysql server?
I have a transaction in a table of a Mysql and (php+apache) database. I wanted to know if I could recover (either in apache log or Mysql log) the ip from which the query that made this insertion was…
-
0
votes1
answer36
viewsQ: How to do a git push to bitbucket programmatically using BASH on Ubuntu16.04?
I have a bash script running in Ubuntu 16.04 whose goal is to create a project (Folder) Expandable and then create that same repository in bitbucket and then push the content to the repository that…
-
0
votes1
answer147
viewsQ: How to increment +1h between two dates using php?
I have the following code that receives from the user an initial date ($dtStart) and another final date ($dtEnd). The goal is to query every hour in mysql between these two dates. I need to control…
-
0
votes1
answer893
viewsQ: How to clone from a Bitbucket repository using bash code and passing the password as a parameter?
I have a bash code that creates a server instance in AWS. The last step of this process is to clone the project that is in the bitbucket.org. Usually what I do manually are these steps: cd…
-
0
votes1
answer537
viewsQ: How to open and close a browser window programmatically using bash commands in Ubuntu 16.04?
I have a bash code that, at the end of some installations, should automatically open a browser window with a URL (myapp.com) passed as parameter. A php configuration page is displayed, confirming…
-
0
votes1
answer102
viewsQ: How to avoid installing Apache when installing php7.1 on Ubuntu 16.04?
I have the following code that installs php7.1 on Ubuntu 16.04: sudo apt-get install -y software-properties-common sudo add-apt-repository -y ppa:ondrej/php sudo apt-get update sudo apt-get install…
-
16
votes2
answers301
viewsQ: What is serverless architecture?
Could someone briefly explain what a Serverless architecture is? After reading a few pages here, I was in doubt. Of Wikipedia, basically sums up what’s out there: [...] A cloud computing Execution…
-
0
votes1
answer966
viewsA: What are the steps to create a Docker image for Ubuntu 16:04, php 5.6 and apache (with Composer, Xdebug, phpunit, npm and REDIS)?
Although Docker’s ideology is to individualize to the maximum the processes running each of them in different containers, I will post here my solution with REDIS within a single container. Note…
-
0
votes1
answer36
viewsQ: I can’t override a Docker variable. How to resolve?
I have this next dockerfile: ... ENV REMOTE_HOST abcd RUN figlet SETTING__XDEBUG__php.ini RUN { \ echo '[xdebug]'; \ echo…
-
0
votes1
answer457
viewsQ: How to use Blade-Laravel in an MVC project that is not running with Laravel?
We have here in the company a large system in production that needs to be redone 100%. Among many discussions and uncertainties there is still no conclusion of the framework that will be used. At…
-
0
votes1
answer973
viewsQ: Host cannot find Docker’s ip. How to fix it?
The host is a MAC OS with Docker installed and a container with php and Xdebug configured. I try to start a debug session in Intellij but it is not working. My hypothesis is that since the host…
dockerasked zwitterion 2,876 -
0
votes1
answer50
viewsQ: How to query an AWS RDS service through the AWS API?
I have an AWS RDS service database and an API on AWS API GATEWAY services. One of the data request options when creating methods is to use other AWS services. Researching this post i saw that it is…
-
1
votes1
answer103
viewsQ: How to dynamically insert a DNS into /etc/hosts via a bash script?
I have a bash script runmydocker.sh whose goal is to retrieve the string sent by the user at the time he is calling this script and create a DNS on etc/hosts. Example: The user (developer) will call…
-
0
votes2
answers54
viewsQ: How to run a bash file "mytest.sh" on a MAC without using ". /" alias and globally?
I have a file mytest.sh which will be distributed among other users (all with mac). I wanted to know what has to be done so that they can run the script of this file, from anywhere ( globally )…
-
1
votes2
answers423
viewsQ: How do D-Ocker respond to a domain that does not exist in /etc/hosts?
In my hosts file I have only the following domains: 127.0.0.1 localhost 127.0.0.1 abc.com When I will rotate the image I use the following command: docker run -p 80:80 -v…
-
1
votes1
answer3749
viewsQ: How to expose more than one Docker container port?
I have a Docker container that has redis and Xdebug installed. A Redis client installed on the host needs to access this service through port 6379 and on the host intellij needs to access port 9000…
dockerasked zwitterion 2,876 -
3
votes2
answers4601
viewsQ: Where is php.ini being loaded from in this instance of Docker?
I’m running an instance that comes from this Dockerfile. Here’s some of my phpinfo: As we can see Configuration File (php.ini) Path is pointing to /usr/local/etc/php. This value was passed on line…
-
0
votes1
answer45
viewsQ: PHP $_POST is not being created when you submit the form
I have a form whose method is POST: <form action="/includes/process.php" method="post"> <input type="hidden" name="breakDown" value="1" /> <input type="hidden" name="string" value="2"…
-
2
votes1
answer199
viewsQ: How to make an Amazon EC2 instance listen to the 5000 port via HTTP?
An instance EC2 Ubuntu that has installed Nodejs with an app that responds on port 5000 with the Node command. I started the Nodejs node app.js through the terminal (ssh) and tried to access through…
-
0
votes1
answer99
viewsQ: How to create a Mysql schema after starting an instance in AWS-RDS?
I’m starting with the AWS Relational Database Service. I’ve already started a Mysql instance and now the next steps are: Run sql that creates schema and tables, Run sql that inserts the data. How…
-
1
votes1
answer1015
viewsQ: How to pass an array in HTML attributes and not to show single quotes?
Following this post I created the following html by passing arrays as an input element attribute: ... <input type="text" name="setValues[cardExpiration]" id="card_expiry" class="input-small"…
-
0
votes0
answers68
viewsQ: How to properly verify the existence of a user in a Restful API (Nodejs) by sending Login and Password in a GET verb?
Verifying a user’s existence through a Restful API would be a GET transaction given that it would only be a select. Briefly would be sending the Login and Password this way: const validator…