Posts by Rafael Silva • 944 points
60 posts
-
-1
votes1
answer960
viewsQ: Run sequelize migrate on a Docker container
Hello! I have my development environment set up in Docker. package json.: { "name": "teste_sequelize", "version": "1.0.0", "description": "teste do sequelize", "main": "app.js", "scripts": {…
-
3
votes1
answer41
viewsQ: How to define the possible values of a string in an iterface from an object?
I have that class Item: class Item { nome: string; idade: number; } And that interface ConfItem: interface ConfItem<TypeItem> { titulo: string; } How do I make for the title in ConfItem…
-
0
votes0
answers81
viewsQ: Not treating a catch is bad practice?
In my system I have the store, which is responsible for maintaining the status and also sending http requests to the server. An example of this is this method here: async novoLancamento( valor:…
-
1
votes1
answer30
viewsQ: How to capture an exception of a function that is within a Try catch?
I have this asynchronous method: async printForNetwork( device ) { try { const options = {encoding: "860"}; const printer = new Printer(device, options); device.open( err => { if (err) return…
javascriptasked Rafael Silva 944 -
0
votes1
answer31
viewsQ: Promisse daughter is not getting into the father’s catch
I have this generic method that recovers something from the server: async criate(url: string, object: Object): Promise<any> { try { return response = await this.api().post( url, object ); }…
-
1
votes2
answers289
viewsQ: Create a new object with the type received by parameter
I have the following generic class: class Generic<T> { } How do I create an object with received type? Something like this: class Generic<T> { item: T = new T(); // isso é um exemplo,…
-
0
votes0
answers32
viewsQ: Count only on unrepeated data
Consider the following fictitious tables: Venda = id_venda, data, id_carrinho Carinho = id_carrinho ItemCarrinho = id_item, id_carrinho, id_produto Suppose there is 1 registration for sale, 1…
mysqlasked Rafael Silva 944 -
1
votes1
answer232
viewsQ: Problem with Mysql Pool conections
I have this class I use to create the connection: class DbConnection { constructor() { this._con = undefined; this._pool = undefined; } _createPool( database , user, password ) { this._pool =…
-
0
votes2
answers1371
viewsQ: How to receive express headers sent by Xios in React.js
My front sends requests with Axios to Node express API this way: class ServiceRequest { constructor() { this.api = axios.create({ baseURL: URL_BASE, timeout: 1000, headers: { 'Content-Type':…
-
1
votes3
answers254
viewsQ: How to concatenate a varchar into a Mysql function?
I have this hypothetical function: BEGIN DECLARE dado VARCHAR(150); SET dado = 'teste'; END; How do I concatenate the variable dado, as an example: SET dado += ' teste2'; I tried this but it doesn’t…
mysqlasked Rafael Silva 944 -
4
votes2
answers602
viewsQ: Return Zero in Function Mysql if query is NULL
I have this function: BEGIN RETURN( SELECT valor_desconto AS desconto FROM ItemCardapio WHERE id_produto = idProduto AND id_cardapio = idCardapio ); END How do I return 0 if the consultation is…
mysqlasked Rafael Silva 944 -
2
votes2
answers3529
viewsQ: How to make the text adapt to the size of the div?
I have a div that has the dimensions widht and height 100% of the screen size. Inside, I have a text encapsulated in p. How do I define the font-size so that it gets the same ratio on different…
-
0
votes0
answers56
viewsQ: Return Json with the attributes of a class without "_" in the initials
have this following class javascript: class Usuario { constructor() { this._nome = ''; this._idade = ''; } get nome() { return this._nome; } set nome( value ) { this._nome = value; } get idade() {…
javascriptasked Rafael Silva 944 -
0
votes2
answers38
viewsQ: Default of HTTP request
I am developing a restfull API. I have this route: /senha In the POST I saved the password; In the PUT i update the password; In the DELETE i delete the password; In the GET I call the password;…
-
1
votes0
answers91
viewsQ: How to use socket.io within a control that is injected by the consign?
I have my file server.js: const express = require( 'express' ); const expressValidator = require( 'express-validator' ); const expressSession = require( 'express-session' ); const consign = require(…
-
1
votes0
answers61
viewsQ: What do these two "<<" mean?
I have that code: Math.floor((this.currentTime/1000/60)<<0); I don’t understand what these two are for <<.
javascriptasked Rafael Silva 944 -
2
votes0
answers32
viewsQ: How to go through data from an htm file?
I need to go through the data of a .htm that’s zipped up in that zip file. But I have no idea how to do it in an automated way. I have no idea how to do it. Can anyone tell me which tool or…
-
0
votes1
answer34
viewsQ: Retrieve date between two dates
I need to make a for between two dates, entering each day of that period. const firstDate = new Date(_visita.data); const secondDate = new Date(_visita.dataSaida);…
javascriptasked Rafael Silva 944 -
0
votes1
answer178
viewsQ: Run function managed by Redux
My app React Native is managed by Redux. I need to perform the function _verificaLogin() coming by connect automatically when my app is rendering. The way I did it’s not working, I think the props…
-
-3
votes1
answer356
viewsQ: Scroll between two dates
I have two dates in milliseconds. I need to recover every day of that period to make an insert in the database. I thought I’d do one for each day of that period, but I have no idea how to do it!…
-
0
votes1
answer22
viewsQ: Donwgrade from API 23 to 21
I have an app already posted on Google play that was designed on API 23. But now a little problem has arisen, as it has some customers who use Android 5.0. My app is simple and uses no more advanced…
androidasked Rafael Silva 944 -
0
votes1
answer383
viewsQ: Convert an Object to Arraylist<Visitor>
I have a method that returns values from firebase. When received, I create a new ArrayList<Visitante> and the saved in a Object. ArrayList<Visitante> visitantes = new…
-
0
votes1
answer75
viewsQ: Several filters in a regex
I need to validate a field input which may have the following formats: `D-1` ou `D-10` ou `D-1_1` ou `D-10_1` ou `D-1A` ou `D-10A` Letters and numbers may vary, but they will always have one of…
-
0
votes1
answer157
viewsQ: How to allow one device to be logged in at a time
I have an app that when installed and logged in by firebase, the user will not be able to use your account on another device. In case, if you need to change the device the user will have to ask for…
-
0
votes1
answer65
viewsQ: Update ng-repeat when receiving Firebase values
Hello! I’m learning to use Angularjs now, but I’m already an experienced programmer on Android. I correctly receive data from firebase, but the ng-repeat does not update when the array is changed.…
-
10
votes5
answers7541
viewsQ: Is programming for iOS on a virtual machine feasible?
I am Android developer, but now I will start developing also for IOS. Is it functional to program for iOS on a virtual machine? Or do I have to buy a Mac anyway?
-
0
votes1
answer37
viewsQ: Can’t find file directory
I have a method that is part of a class to capture the client’s signature. But he’s giving trouble when it comes to opening the FileOutputStream, appears "No such file or directory" follow the…
-
0
votes2
answers53
viewsQ: Programming in pairs remotely
My partner and I are quite fond of pairing from time to time, usually when we have some complex function. But we live in different cities and sometimes it gets hard to get together to program. We…
-
0
votes0
answers32
viewsQ: Find out if the user has printed the app screen
I would like to know how Snapchat does to know if the user gave a screen print.
androidasked Rafael Silva 944 -
0
votes1
answer254
viewsQ: PHP PDO does not insert value
I don’t really understand PHP, but I’m trying to create a PDO connection. Connection works fine, but does not insert values... follows the code: config define("DB_HOST", "localhost");…
-
2
votes1
answer772
viewsQ: Items repeating in a Recyclerview
I have a fragment v4 which is managed by a SectionsPagerAdapter. In the fragment have a RecyclerView who has a Adapter personalized that receives a ArrayList which contains exactly 96 objects,…
-
6
votes4
answers2358
viewsQ: Return day of week from date in dd/mm/yyy format
I have this function that brings me the day of the week: public static String getWeek(String date){ //ex 07/03/2017 String dayWeek = "---"; GregorianCalendar gc = new GregorianCalendar(); try {…
-
0
votes1
answer311
viewsQ: Fragment Transaction - Error commit already called
I have this method that checks the Fragment inflate in my view: private void startFragment(int code) { switch (code) { case 1: fragmentTransaction.replace(R.id.fragment, MesAnterior.newInstance(0));…
-
3
votes1
answer100
viewsQ: Simple login Firebase
I already have a main login with Firebase auth. But I need to implement another login within that system, because the client can add other administrators. The login will be simple even, just check…
-
3
votes2
answers1280
viewsQ: Recyclerview Error: No layout manager Attached
I couldn’t find the mistake. my Activity: private AdapterPacientes adapterPacientes; private static MVP.Presenter presenter; @Override protected void onCreate(Bundle savedInstanceState) {…
-
1
votes2
answers556
viewsQ: Persistence and reading of Firebase data
would like to have a data structure in the Firebase database Realtime similar to this: { "codigo": "01", "Data": "1234567890", "usuario": "{codigo : 01, nome : Rafael}" } have the class: class…
-
0
votes1
answer119
viewsQ: Best way to access Activity components - MVP
I am using the MVP standard in my Android project. In my mainactivity I have the following components: private Paciente paciente; private EditText nome, cpf, cpfTutor, telefone; private CheckBox…
-
1
votes0
answers926
viewsQ: Firebase database or API Rest PHP Mysql. Which is the best choice and which Google recommends
I graduated college at the end of the year. I did Systems Analysis and Development, and there I had programming class for mobile devices, more specifically for Android. In class the teacher taught…
-
1
votes3
answers4806
viewsQ: Split the database to multiple clients or create one for each?
I am developing an app for business management. It will consume data from a Mysql database through a Web Server. My question is: What strategy to follow to store each customer’s data? Save all data…
-
1
votes1
answer54
viewsQ: Does not enter the if
have a function but the same is not entering the if... /** * funcao que trocas os valores por "?" * @param type $condicao : ex "codigo = 1, AND, nome = 2, OR, secao = 1" ou "codigo = 1, AND, nome =…
phpasked Rafael Silva 944 -
2
votes3
answers296
viewsA: How do prepare dynamic and generic with mysqli?
Well, it seems kind of strange to answer your own question, but it’s just that everyone who responded helped me to put together this script and come up with a result that I found satisfactory. Below…
-
0
votes1
answer67
viewsQ: restrict htaccess access
i have the following folder structure: I would like any external direct access done in helper and useful directory files to be forwarded to the index.html file that is at the root of the site. That…
-
4
votes3
answers296
viewsQ: How do prepare dynamic and generic with mysqli?
I have a mobile application that sends me the following parameters $tabela = $_POST[“tabela”]; // ex: “pessoa” $atributos = $_POST[“atributos”]; // ex: “codigo, nome, cpf” $valores =…
-
3
votes2
answers1212
viewsQ: Manipulating an Object class
I have the following very complex situation (at least for me). I have a class Person (The data are fictitious for better understanding, but the idea is the same) like this: public class Pessoa {…
-
1
votes2
answers1547
viewsQ: Insert data from an array into a mysql database
I get a json from an android application. This json is a java class that has been converted with Gson from java to a string. After the php web server receives this json I convert it to an array. I…
-
-1
votes2
answers413
viewsA: How can I put a button to make it visible?
I think that solves. Button bt1 = findViewById(R.id.bt1); Button bt2 = findViewById(R.id.bt2); bt1.setOnclickListerner(new ... { bt2.setVisibility("gone"); }); It’s only the base, you have to fix…
-
1
votes1
answer398
viewsA: Popular a Spinner with Sqlite data
First you have to save the data in a list // Criei um array de string, mas no caso pode usar um objeto sem problemas String[] nome=new String[]{"pedro","joao"}; Then you create an Arrayadapter…
androidanswered Rafael Silva 944 -
2
votes2
answers633
viewsA: Toast is not displayed
First: The run method does not accept modifications to the interface from it.. Second: use Asynctask.
-
0
votes1
answer131
viewsQ: Finish all daughter threads of an Activity
In my Activity I instill some controls that search server data asynchronously. The control instance is as follows: new controle().executar(new InterfaceRetorno(){...}); But what happens is this, if…
-
1
votes2
answers602
viewsQ: Delete Sharedpreferences created dynamically
In order not to keep redoing requests that have already been brought from the server I persist them using Sharedpreferences... Only they are created dynamically in my app. example: // essa key é…