Posts by novic • 35,673 points
1,265 posts
-
2
votes1
answer92
viewsA: Property coming as Undefined?
Enough people come up with the same doubt, in your case on props information does not have a local state so your code in the array of useEffect can be without any item, so that it is executed in the…
-
0
votes1
answer718
viewsA: useEffect not updating states in the first iteration
Needs to be put on useEffect one array without any item, ie, [], and this has the effect at the moment the component is created the method is invoked(componentDidMount() if class), example of code…
-
2
votes1
answer210
viewsA: Javascript Vanilla - Take select value Multiple and mount in json
The simple example with vanilla is to make a loop in the options of select and check which items are selected, example: var button = document.getElementById("get"); button.addEventListener("click",…
-
1
votes2
answers306
viewsA: Error exporting footer in Reactjs
In your code now available in the question it is easy to detect the problems, in the import, you have the keys, but, you are importing the file itself, then edit as follows: import Footer from…
-
4
votes2
answers180
viewsA: Incorrect value in vector when binary search
As I reported in the commentary, binary research has the principle of ascending ordering, and its array is not so ordered from the least to the highest value. Sort with Arrays.sort that the value…
-
1
votes1
answer183
viewsA: Vuex. Good practice when using Mutation
If you need to add only one item in this array, it is necessary to do as in the above mode overwriting everything? It depends on how your status update is being sent, if you are sending all the…
-
2
votes1
answer1381
viewsA: How to access properties of an object within another object in Reactjs
By checking your code I discovered that the array of pessoas with an empty object, observe: this.state = { pessoas: [ { // <-- aqui o problema } // <-- aqui o problema ] } but in the case as…
-
1
votes1
answer35
viewsA: isLoading on request is not working
Don’t use giving a delay use like this when the dom is updated by the new value in isLoading, executes the service routine that also gives a time and then when it finishes this request changes again…
-
2
votes1
answer33
viewsA: Clock that goes down too fast
Then use setInterval which can stop and then restart with clearInterval, that is, one creates the timer and the other to, example: const pomodoro = document.querySelector('#btn1'); const source =…
-
0
votes1
answer423
viewsA: How to run an event in Codebehind being called by jQuery?
To solve this question ask a <input type="hidden" /> same example below: <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> <input type="hidden"…
-
0
votes1
answer203
viewsA: Ternary relationship of entities in a relational scheme would be counter-normative, and how to do this mapping in Entity framework 6?
An example for this to work is to create an explicit intermediary entity and do the upgrade operations in this intermediary entity, example: Models: public partial class Employee { public Employee()…
-
0
votes1
answer41
viewsA: Problem in array ordering with numerical values in VUE?
To sort number the example below already clarifies your doubt: var points = [40, 100, 1, 5, 25, 10]; document.getElementById("demo").innerHTML = points; points.sort(function(a, b){return a-b});…
-
1
votes1
answer48
viewsA: Pass field for array sorting in VUE
Has 2 ways to access the property of an object that can be by point or by square brackets, in your case it must be by square brackets to make your code dynamic in access to certain property,…
-
0
votes3
answers333
viewsA: Return only the positive values of an array
But it’s not the right logic? Not its logic is wrong because at the moment it finds the balance of a certain position the code will return everything again and must save the value of the search in…
javascriptanswered novic 35,673 -
1
votes1
answer23
viewsA: I cannot use defaultProps in React
You are using wrong, remove the name of the property that will work, example: class Title extends React.Component { render() { return ( <div> <h1>Hello, {this.props.name }</h1>…
-
2
votes1
answer76
viewsA: Doubt about standard React class
My question is, why does React not create the default structure as below? Must be using the latest version of reactjs(Version: >=16.8) that presents the Hooks. The great motivation for this…
-
3
votes4
answers1891
viewsA: Sum of pairs typed interval
Is because you put the return before you finish the for, correction: function somaDosPares(x){ let soma = 0; for(let i = 2; i <= x; i += 2){ soma = soma + i; } return soma; }…
-
2
votes2
answers238
viewsA: How to compare only the date with Date objects?
Compare by method getTime() that returns the numeric value corresponding to the time of the specified date according to the universal time. Example: Class: class DateTimeCompare { getDate(): Date {…
-
1
votes1
answer2673
viewsA: React Hooks useEffect even with empty dependency runs more than once
You are using async and await to solve the promisse and then using the then and thereby generating duplicity in the request, but, solve so: function fetchWelcomeContent() {…
-
3
votes3
answers2679
viewsA: Apply mask to an HTML table column with Angular?
Create a PIPE via command CLI Angular: ng g pipe CPF after this command will be created a file with the name of cpf.pipe.ts that its value (value) with a regular expression can create the CPF mask…
-
0
votes1
answer860
viewsA: reactjs - Maximum update Depth exceeded
Good through your comments, you are recording data on localStorage and wanting at the same time that it is loaded in the state variable of the component and when that variable is updated also the…
-
1
votes1
answer54
viewsA: GROUP_CONCAT (CONCAT... in Laravel?
Basically with Query Builder: $dictionaries = DB::table('dictionaries') ->select(DB::raw('dictionaries.name, GROUP_CONCAT(CONCAT("{name:",dictionary_files.name,"file:",dictionary_files.path,"}"))…
-
3
votes1
answer95
viewsA: What is Simplechanges in Angular? Is it an Angular API?
Simplechanges is an Angular API? Is the interface representing the object of changes for all input properties I understood that in the example, Simplechanges is typing the changes parameter. (That’s…
-
0
votes1
answer653
viewsA: Displaying data with React JS
As you are at that moment of learning the name of the component does not refer to the component and what it represents, but, you need to change the state of the input text, then you need to program…
-
6
votes1
answer1155
viewsA: Problem running Migrations on Laravel
In the DB_HOST is the address configuration to get to the server and you put mysql is wrong, or is localhost(127.0.0.1) (which is the local machine) or a valid address, so where is your server…
-
0
votes1
answer218
viewsA: Formdata passing image plus object
Basically you have to create a form with the fields with their names and types and use it in a simple way fetch to send data with Formdata in your body (body) as in the example below: React Rook…
-
0
votes2
answers50
viewsA: How to return an array and only show the count number
I believe you’re learning to program with language php, because these functions are already depreciated and no one else uses, but, answering basically put a alias (AS) in his sql and how will one be…
-
0
votes1
answer37
viewsA: Why is nothing from my React app displayed?
In the export default you put the created Component that in the case is the App as follows: export default App; and in addition if you want something dynamic at the time of typing the numbers…
-
2
votes1
answer630
viewsA: How to get hasMany relationship data
In your code and in your question you have explicitly stated a relation 1:N (one for many), where the group has several topics and a topic is from a group. On the site there are several explanations…
-
1
votes1
answer80
views -
1
votes1
answer248
viewsA: onClick by Innerhtml React?
You are using React in the wrong way, and there does not have the expected result that is a simple assembly of a table, let’s go to an example to understand what should do: class Product extends…
-
4
votes3
answers325
viewsA: Is it possible to override a base class property?
Use the modifier new which has the primary purpose of hiding the member of the derived class, example: public class ClientePersonalizadoViewModel : ClienteViewModel {…
-
1
votes1
answer144
viewsA: Additional Fields in Pivot Model Laravel 6?
has how to return my 32 other fields without putting all fields in withPivot([col1,col2,...,col32]) in relationships? The answer the documentation has is NAY, that is to say, all extra (additional)…
-
1
votes1
answer46
viewsA: Insert returns TRUE, but does not insert
Your problem is in the html you did not set the name attribute, example: <input type="text" class="form-control" id="cpf" placeholder="000.000.000-00"> body the name? Solution: <input…
-
1
votes1
answer1284
viewsA: How to take a value from a select (Edit) Laravel
You need to compare the value that stores the selected client in the registration and compare with the values that are generating this SELECT and add attribute selected to position, example: @if…
-
0
votes2
answers69
viewsA: Separate Coordinate String in Array with separate Lat Long?
I had the idea the following way, break this text at the point ],[ where I can verify the division of these coordinates and array_map assemble the coordinates into a new array associative as…
-
0
votes1
answer19
viewsA: Mapping equivalence between Fluentnhibernate and Entityframeworkcore?
Of Nhibernate Map: References(x => x.Medico) .Class<Medico>() .Columns("id_medico") .Not.Update() .Not.Insert(); for Entity Framework Core builder.HasOne(x => x.Medico) .WithMany(c =>…
-
2
votes1
answer69
viewsA: (Mutators or Middlewares) What would be the ideal use when converting a string before inserting it into the database?
As I always like to have an idea about what each thing does I decided to make an example, the middleware who inherits from the class Transformsrequest has a global function that runs on the general…
-
3
votes2
answers113
viewsA: Mysql select data by period
The factor is that you record datetime and compares with date a solution is to use the function date() of the bank as follows: SELECT * FROM vendas WHERE date(feita_em) >= '2019-10-10' AND…
-
0
votes3
answers99
viewsA: Return method asks return that has already been given
The return by error showing need to exist at the end of the method, so change your code like this: public class Biblioteca { private ArrayList<Exemplar> exemplares; public boolean…
-
1
votes1
answer110
viewsA: Get a list of mapped data in Nhibernate
Yes, I ended up doing a test and it works perfectly, I think it’s doing something wrong, an example to illustrate: Class public class Credit { public virtual int Id { get; set; } public virtual…
-
0
votes1
answer98
viewsA: SELECT SQL Server VB NET error
Basically, if you’re doing it wrong, a simple example solution is like this: Implicit: Dim SQL As String Dim Dados As New DataTable SQL = "SELECT * From Diaria where data=@data and prefixo=@prefixo"…
-
0
votes2
answers595
viewsA: Select2 does not work in adminLte + Laravel 5.8
Basically just put the references .css and js, and with the example below: $(document).ready(function() { $('.select2-single').select2({ placeholder: 'Selecione os itens', width: '100%' }); });…
-
1
votes1
answer242
viewsA: Accessing data from an Angular array
I think you’re missing storage time: It can be done like this: localStorage.setItem('subscriptions(id)', result['subscriptions'][0]['id']); where in that case it is stored id of the return in…
-
0
votes2
answers64
viewsA: I can’t get the value of the column next to my input
I believe your doubt is simple and I’ve made a minimal example: function changeValue(e, value, obj) { document.getElementById(e).textContent = (value * obj.value); } <script…
-
1
votes2
answers57
viewsA: Populating dropdown with multilevel json
The field subcategoria is a array information, then, need to iterate on it basically, example: <select class="form-control"> foreach($data->Categorias as $c): // Categorias…
-
1
votes1
answer40
viewsA: Doubt - Query Sqlite
Look how good it is to model, if it were I would have built the table B and C in a single placing flag for V - Summertime and I - Winter. The way it is complicates how easy it is to show the two…
-
1
votes1
answer23
viewsA: Lumen: I need to display two dates in a single field
You need to format the output directly on SQL of the relationship with the Builder of Eloquent and in the SQL the date_format which opens a range of how to format output a date, example: $person =…
-
0
votes1
answer35
viewsA: Bring value Dropdownlist ASP.NET MV5
You have to take the amount by the event change of jquery as follows: function setMedicoValueDiv(value) { $("#medico-id-value").text(value); } $(document).ready(function() {…
-
2
votes1
answer114
viewsA: C# | How to select just a few subfolders?
Note: Your code can be refactored and enhanced, because you can for example create the list of Fileinfo directly by the class Directoryinfo If you want to specify only some directories to list your…