Posts by Francisco • 7,472 points
260 posts
-
0
votes1
answer58
viewsA: I need help a file. Moon
You can create a function that uses regex to identify each 3 digits and insert a dot between them to help you with this, it would look something like this: local function addSeparators(number) --…
-
5
votes2
answers76
viewsA: Why does Lua’s "print" print print extra spaces in the arguments?
The Moon print function adds a tab between each argument, the code describing this is available on github: https://github.com/lua/lua/blob/681297187ec45268e872b26753c441586c12bdd8/lbaselib.c#L31 To…
-
1
votes1
answer74
viewsA: Written to command line via Lua, command line reading via C#
Your moon code is not passing the variables X and Y for your C#application, note that you are sending a string, and in it, the characters themselves, not the value contained in the variables. To…
-
1
votes1
answer62
viewsA: How to replace a special character in moon?
Lua uses the isalpha of C to make expression matching Pattern %a, by definition it will only accept characters between 'to' and 'z' and 'To' and 'Z', soon won’t take the 'ã' as one. In your case a…
-
1
votes1
answer56
viewsA: Use what the user type (io.read) as a function argument in Lua
To access a property dynamically, you must use brackets: function perfil(monstro) print(monstros[monstro].nomeM) print(monstros[monstro].racaM) print(monstros[monstro].generoM)…
-
0
votes2
answers393
viewsQ: How to create a volume of a single file on Docker?
I want to synchronize a file that is inside my container with my host. I thought of simply creating a volume for the file, getting that way: version: '3.7' services: deathrun: image:…
-
3
votes2
answers1273
viewsA: What is the difference between "in pairs" and "in ipairs" in Lua?
The ipairs returns an iterator of ordered key-value pairs. It only iterates from numeric keys, needing to be necessarily sequential, starting from 1 and having no hole between the keys. This is why…
-
4
votes1
answer57
viewsA: What is this :Object = ""?
As the question is solely about the :object in the code, I will not explain about the tag Object or something like that. The two points(:) before the attribute is a directive of Vue.js to say that…
-
1
votes2
answers38
viewsA: How to create Object constant in javascript
You can use a proxy to observe modifications to the object, and if there is an error: function createConstant(obj) { return new Proxy(obj, { set() { throw new Error("You cannot change the object.");…
-
1
votes1
answer849
viewsQ: How to create an object dynamically from an interface?
I have the following interface: interface IInterface { Method1: (param1: any) => any; Method2: (param2: string[]) => any; } I wish that from it I could create objects dynamically that…
typescriptasked Francisco 7,472 -
2
votes1
answer500
viewsA: How to pass a URL in the Parameter of an API
The route generated by your code will be: /http/URL={paramêtro} Pass the parameter https://google.pt does not work because it is not possible to pass parameters with / route, if you want to do this,…
-
1
votes1
answer95
viewsA: Names and data types Lua
What is the maximum size of a name? Lua does not have a maximum size for variable names. Internally, basically names are just strings. Has the type Enumeration? Today it still does not support…
-
1
votes2
answers50
viewsA: Table position
You can make the foreach return also the key(in your case will be the index) of the current element: foreach ($fetch as $key => $rs) After that just use: <td style='padding:10px'…
-
0
votes1
answer39
viewsA: Javascript- Syntax of classes
Creating methods within the constructor is almost never a good option. A great utility of this notation is the ease of creating private variables, since the methods created in there will have their…
-
1
votes3
answers340
viewsA: Change CSS property when doing :Hover over another menu link
The problem is the selector from where you are using the :hover, put it straight on the Nav-link and it will work normal: .nav-item { padding: 5px; } .nav-link:hover { background: #000; color: #fff;…
-
6
votes1
answer745
viewsQ: What is the usefulness of the exclamation (non null assertion Operator) in Typescript?
I recently discovered that in Typescript we can use the operator of non null assertion simply putting a ! where you want to check. When I saw it, I thought it was like in C#, that we have the ?,…
-
2
votes3
answers298
viewsA: Function . play() in jQuery
First your selector is filled incorrectly, the selector $('aud1') take DOM element with Aud1 tag, not id. If you want to take the id, use $('#aud1'). Even if filling it out correctly, it wouldn’t…
-
1
votes1
answer340
viewsA: How to detect if an element is under another element? (HTML, via javascript)
You can use the function getBoundingClientRect, it basically returns both the position of the element and its size. With this information only do the checking of the other elements. One way to do…
-
3
votes1
answer811
viewsA: Send error message to user (ASP.NET MVC)
You don’t necessarily need an Exception to run the customErrors, you can simply return the Status Code you want: catch (ApplicationException e) when (e is NotFoundException) { return NotFound(); }…
-
5
votes2
answers900
viewsA: Error while trying to add session to startup
This is because you cannot "configure" the session without first adding it to the services. To fix it, add it to the method ConfigureServices in this way: services.AddSession(); See more on official…
-
5
votes1
answer189
viewsA: Mysql returning all integers as string in PHP
When making the conversion to JSON with the json_encode, you can pass the parameter JSON_NUMERIC_CHECK, it is available from the version 5.3.3, it basically checks whether that value can be…
-
1
votes1
answer102
viewsA: How to hide a menu by clicking on another in JS?
Trying to follow a little the architecture of bootstrap + jQuery, I could do as follows: var headerItems = document.getElementsByClassName("header-item"); for (var headerItem of headerItems) {…
-
4
votes3
answers650
viewsA: How to pull Header over the top of a DIV?
First of all, there is no position: center, you can see all possible position values here. What is causing the margin between the beginning of the div and the tag header is the h1, which lies within…
-
4
votes1
answer36
viewsA: This parameter outside of expected inside an anonymous function
This is because when a function is not a property of an object, it is invoked with the parameter this linked to the global object. There are many ways to escape from this, you could use bind, call,…
-
2
votes1
answer40
viewsA: Cannot Rename a null token Parameter name: token
How do you even check on the method Rename, the value of the token passed is null. This is because JSON does not have the field streetNumber or ZipCode. I believe you want to access the field…
-
0
votes1
answer37
viewsA: Regular expression to get the third part of a paragraph in HTML
Taking from the base what you had already done, I formulated this regex: ((<p(.*?)>)([[:space:]]+?|.*?|[[:space:]]+?)(<\/p>)\s?){3} The only changes I made was to add everything in a…
-
3
votes1
answer58
viewsA: Replace words in a text that must be formed of letters and numbers
This regex works well here: ([0-9]()|[A-Za-z]())+\2\3 Basically what this regex does is create 2 capture groups, one of numbers([0-9]) and one with uppercase and minuscule letters([a-zA-Z]), and…
-
1
votes1
answer316
viewsA: Error trying to access an object property in an React component
According to the question shown, the code seems to work normally when tested in a sandbox. This may be due to timing problems, where the Component render TimeCasa is being called before the state…
-
2
votes3
answers82
viewsA: Receive result from an ajax as return
I recommend using the Adrian, for using the newer ES7 API with async/await. But you can also do it by creating a Promise ES6 style, see how it would look: funcao1 = function () { return new…
-
1
votes1
answer184
views -
1
votes1
answer145
viewsA: Countdown does not stop at Zero
Its function somarUmSegundo() doesn’t make much sense. Try this way: somarUmSegundo() { if (this.state.contadorSegundo == 0) { if (this.state.contadorMinuto > 0) { this.setState(antigo => ({…
-
0
votes1
answer214
viewsA: Chrome.tabs.executeScript does not work in the background
The problem is that if you have a default_popup defined in its manifest file, the event browserAction.onClicked is never called. The simplest solution would be to take the default_popup. Another…
-
3
votes2
answers301
viewsA: When should I use a string object and a literal string?
When you declare strings as in your example: var palavra = 'Palavra'; var palavra = String('Palavra'); There is no difference, the 2 forms are declaring primitive strings. I believe the article you…
-
3
votes3
answers48
viewsA: Object for a javascript array
Another way is using the map, see how it would look: let sel = { "1": { "id_turma": 485, "codigo_turma": "1112A - 41", "ano_ciclo": 14 }, "2": { "id_turma": 486, "codigo_turma": "1112B - 27",…
javascriptanswered Francisco 7,472 -
7
votes1
answer65
viewsA: Is Streamreader reading a line that doesn’t exist?
What is happening is that you are trying to do all the operations on the line to then check if it is null, which doesn’t make much sense. That should work: string line; while ((line = sr.ReadLine())…
-
2
votes2
answers929
viewsA: How to use async/await in void return methods?
A method that returns void can also be asynchronous, hence you can also use the await within it. To make it asynchronous, include the prefix async in your header, see an example: private async void…
-
1
votes2
answers177
views -
-1
votes2
answers177
views -
2
votes1
answer152
viewsA: How to directly compare strings treated with Regex in C# directly
You can compare 2 regex yes, maybe the problem is that your second Replace is with the r minuscule. If you just want to check if it exists, use the .Any instead of .Where: // método de consulta…
-
2
votes2
answers61
viewsA: How to display the values of two-class fields in a Datagridview?
As your Institution class has only one property, perhaps the appropriate would be to place it within course. But it depends on how you want to use it later. Other solutions would be to override the…
-
2
votes2
answers131
viewsA: Can anyone tell me what is causing this error
As @Leite said, the problem is that you are trying to record a duplicate data in a Row unique. You can get around this by checking if there is value before: $conexao = new PDO($banco,$user,$senha);…
-
1
votes2
answers301
viewsA: Bring the records from one table according to the Where from another
One way to do it is to count how many status of the guy is different from 0 and filter only those who have 0, see: SELECT F.nome, M.status FROM matricula M JOIN fisica F ON F.codigo = M.fisica WHERE…
-
1
votes2
answers214
viewsA: Knowing when my list is coming with values in sequence
You can use the SequenceEqual next to the OrderBy. Supposing your list calls lista, see how it would look: lista.SequenceEqual(lista.OrderBy(x => x)) This line will return a Boolean saying…
-
6
votes2
answers11109
viewsA: How to remove duplicate values from an object array easily?
A simple way to remove duplicates is like this: let values = [ { "value":"ETH", "label":"ETH" }, { "value":"LTC", "label":"LTC" }, { "value":"ETH", "label":"ETH" } ] values = values.filter(function…
javascriptanswered Francisco 7,472 -
3
votes2
answers11109
viewsQ: How to remove duplicate values from an object array easily?
I have the following array: [ { "value":"ETH", "label":"ETH" }, { "value":"LTC", "label":"LTC" }, { "value":"ETH", "label":"ETH" } ] As you can see, there are duplicate values. What is the best way…
javascriptasked Francisco 7,472 -
2
votes3
answers364
viewsA: Manipulating values through Hidden input
The code has several errors, see: You are checking the variable $_POST["calcularbtn"], would not be $_SESSION["historico"]? if (isset($_SESSION["historico"])) You are overwriting the value of the…
-
2
votes2
answers123
viewsA: How to make logic enable text field at a time when filled
With Jquery you can do this way (follow the comments): $($("input").on("change input paste", function(){ //Event handle para quando o usuario escrever algo if ($(this).val()){ //Checa se tem valor…
-
1
votes2
answers490
viewsA: Two jquery masks in a field
This code works, extracts from the documentation: var options = { onKeyPress: function(cpf, e, field, options) { //Quando uma tecla for pressionada var masks = ['000.000.000-000',…
-
2
votes1
answer1550
viewsA: Display logged-in user on C#
To read values, you can use the ExecuteReader, see how it would look(follow the comments): var conn = new SqlConnection(conexao); var comando = new SqlCommand("SELECT * FROM funcionarios WHERE…
-
2
votes1
answer857
viewsA: Does not contain a Definition for 'Include' and the best Extension method Overload 'Queryableextensions.Include(Iqueryable, string)
Try to use the Asqueryable: var list = _tbCardapio.Cardapio.AsQueryable().Include("Categoria").ToList(); He converts a IEnumerable for a IQueryable. In the same way as the ToList does, but in…