Posts by mutlei • 2,978 points
103 posts
-
1
votes1
answer1487
viewsA: Reuse function in 2 different controllers
The use of a service or factory are the best choices as you can incorporate them into the controller easily. The skeleton of a service is simple: //Criando o service angular.module('services', [])…
-
2
votes1
answer149
viewsA: How to cancel an Handler?
You can use the following code within the run(): while(true) { if(garagem.isChecked() != luzgaragem) { garagem.setChecked(luzgaragem); wait(); //Quando quiser que ele volte a executar, basta…
-
6
votes2
answers243
viewsA: How to make the program recognize ' x ' as multiplication?
No. The multiplication operator in Java is *. However, you can do this for the end user. For example, he can even type 5 x 5 as a multiplication, hence the program takes the string and replaces the…
-
0
votes5
answers17869
viewsA: How to align the Left fields of an Html table?
You can create a class CSS, as follows: .alinhamento { text-align: left; } And then add this class to the elements td, manually via HTML or via Asp.NET-MVC (which I am not aware of and do not know…
-
2
votes3
answers1030
viewsA: Search Mongodb Array
You use the/query function db.<nomeDB>.find() to make this consultation. Assuming the BD name is "test", the command db.test.find() would return all records. But you want to filter the…
-
2
votes2
answers599
views -
5
votes2
answers433
viewsA: What is the difference between the union of an array via soma operator and the array_merge function?
In the array_merge, the same keys are changed; with the operator +, they stay intact. In the example of documentation, the array_merge of an empty array and another with 1 => "data" returns an…
-
6
votes2
answers1824
viewsA: Is there a difference between strtr and str_replace?
Of PHP manual: str_replace checks a string subject by the presence of a string search and replaces this string with replace. strtr checks in a string str by the presence of a string from and…
-
4
votes1
answer251
viewsA: Return multiple attributes using XPATH
In the XML example, it would be //utilizador/cesto | //utilizador/cestohist to return any of the two attributes. Explaining: Each of the //utilizador/cesto and //utilizador/cestohist return only one…
-
0
votes2
answers15045
viewsA: count how many days a date range has in another date range
At first, you have three cases to consider: The beginning of periodo2, which I will call p2, is before or equal to the beginning of the periodo1, called from now on as p1. In this case, the answer…
-
4
votes1
answer1370
viewsA: Create a website with JAVA programming?
There are many alternatives to do this. But overall, the idea consists of: HTML page having a form for the user to enter the necessary information; Once with the information, a server receives this…
-
1
votes4
answers1398
viewsA: Tool to generate Xpath
Has a add-on for Firefox that queries XPath on a page, called XPath Checker. Add-on page…
-
5
votes1
answer143
viewsA: Traits don’t take property superscripts?
This is not a mistake, it’s a warning. A trait can insert properties in a class. If a class has a property identical to that of the trait, you get the warn Strict Standards, otherwise you receive a…
-
3
votes1
answer65
viewsA: Why can traits have methods called directly when they are static?
After a read on this website, I understood the following: Members (fields and/or methods) from a trait has a higher priority than those coming from a super class, but smaller than those of the…
-
5
votes2
answers3760
viewsA: Calculation of the multiple of 10 greater than or equal to a value
To find the nearest 10 multiples, you can make use of the following pseudo-code: int multiplo; if(quociente % 10 != 0) { int quociente = soma / 10; multiplo = (quociente+1)*10; } else { multiplo =…
-
3
votes1
answer202
viewsA: How does Bitap’s algorithm work?
I extracted the code contained in this answer of this article, and the analysis of the code is my own. Below is the code in C to follow the reasoning of the analysis. Note: In this code the values…
-
1
votes1
answer315
viewsA: Failed to perform a request with Angular.js $http is not defined
You did not set the service as a controller dependency $http. The controller definition should look like this: sbMenuTop.controller('sbMenuTopSupport', ['$scope', '$http', function ($scope, $http) {…
-
1
votes1
answer345
viewsA: Force Javascript to cancel field registration with required (HTML 5)?
When you do the evt.stopImmediatePropagation() you prevent the event that was shot from continuing to run, that is, you prevent the return to the previous page. Reverse the order of commands, thus:…
-
0
votes3
answers354
viewsA: Return the last entry of different Postgresql objects
If you’re just looking for the data, you can use the following query... SELECT DISTINCT evt.carro, evt.lat, evt.long, evt.data, evt.hora, etc... FROM Evento evt, Carro car WHERE evt.carro =…
-
0
votes4
answers12782
viewsA: Validation of CNPJ with Angularjs
According to the reply @bfavaretto quoted in the comments, here is an adaptation: I am considering the code already inside a controller. And Angularjs can execute commands jQuery usually because it…
-
1
votes2
answers1381
viewsA: What are subdomains and how do you identify subdomains in Ddds?
Why make this distinction between three types of subdomains and what each represents? The distinction between subdomains means the division of scopes of parts of the domain. The "core" subdomain is…
-
4
votes3
answers3350
viewsA: Add event to multiple elements without being inside a for loop
You can use the native Javascript function getElementsByClassName, for example: for(var elem in document.getElementsByClassName('BUTTON')) { elem.click = function () { //seu codigo aqui }; } The…
-
1
votes2
answers8126
viewsA: What is the service layer in DDD?
Making logic out of domain types allows the application of a design pattern known as MVC (MOdel-View-Controller) where the model is responsible for the implementation data, the view is the graphical…
-
5
votes2
answers4565
viewsA: What are DDD aggregates and how to identify them?
From what I could understand of the concept, the agregado is very similar to POO composition. Let’s suppose a car, which has engine, doors and wheels. In that, we have the aggregate car, with the…
-
5
votes4
answers551
viewsA: When are branches useful in Git?
Usually you use a second (third, fourth and so on) branch to develop something without interfering with the development of branch main, and so the development of the second branch ends, um merge is…
-
16
votes4
answers92747
viewsA: Convert String to whole in Java
Do something like this: Scanner s = new Scanner(System.in); String str = s.nextLine(); /* Vai pegar tudo até a primeira quebra de linha. Garanta que o número é válido! */ try { int i =…
-
1
votes4
answers1981
viewsA: Go to the first option after clicking the button
You can use the methods attr and removeAttr. That way: $(".bt").click = function () { $(".op1").attr("selected", "selected"); $(".op2").removeAttr("selected"); $(".op3").removeAttr("selected"); };…
-
1
votes1
answer158
viewsA: Preparedstatement Not Initialize(stm = >"stm" is not a known variable in the Current context.<)
SQL = "SELECT COUNT(*) AS TOTAL FROM TBCLIENTE WHERE TBCLIENTE.CODIGO = ?)"; The ) really should be at the end of the query? I think this is the problem.
-
2
votes1
answer127
viewsA: How does Javascript’s async attributo work?
I believe what should matter with the attribute async is the use of DOM manipulation by Javascript, which may end up creating more problems if the elements are not loaded when the script needs them.…
-
33
votes4
answers37758
viewsA: What is the difference between "&&" and "||" and "and" and "or" in PHP? What to use?
The difference between them is in the order of precedence of each one. Order of precedence? But what?! For example, take the mathematical expression 3+4*2. What is the result of the expression? 14…
-
4
votes1
answer65
viewsA: Reference not found for object property
In function run, you are traversing to a position that the set of points has no record of. for(var j = 0; j <= dots.length; j++){ <- errado for(var j = 0; j < dots.length; j++){ <-…
-
3
votes2
answers1093
viewsA: How to assemble logic to read 2 files, compare them and extract values not found
He’s only walking once because the Scanner of the wrong cities has reached the end of the file. You have to restart it. Do something like that on the first while: <Segundo While>…
-
5
votes4
answers1799
views -
1
votes2
answers72
viewsA: Contain or John, huh?
The error message says that the column Phone.phone is unknown. On the line FROM, this table is not cited.
-
8
votes1
answer329
viewsA: Polymorphism in Java
Instance 1 accepts any object that is of the Car class or a child class of the Car class, so it accepts objects Carro, Fusca and a Ferrari extending the class Carro. And according to @Jorge B.’s…
-
0
votes2
answers1029
viewsA: Run plugin after ng-view is loaded
You will need to attach a controller to the page and it will execute the script when the view loads completely, that way: $angular.module('app', ['ngRoute']) .config(function ($routeProvider) {…
-
1
votes1
answer894
viewsA: Write to a 2x16 LCD display with the MCU 8051 IDE on-line c
Error means you don’t have a memory where the text will be written, so you can’t write any text. It may be because the initialization function is not executed before the others. EDIT So I’m guessing…
-
1
votes1
answer2876
viewsA: Problem installing Bower in windows
Apparently, the error is that you are trying to install programs as a normal user. In the case of Windows, you have to run the command prompt as an administrator to carry out that operation. EDIT…
-
1
votes2
answers3435
viewsA: How to hide iframe when entering the site
Assign the element the CSS below: <seletor desejado> { visibility: hidden; //Uma opção, esse mantém o espaço do video na página display: none; //Outra opção, esse deixa a página como se o…
-
1
votes2
answers227
viewsA: How to replace Regexp in editable div using Javascript?
I think we’re missing an assignment on that line: campo.replace(docrg, "outrapalavra")); Thus remaining: var aux = campo.replace(docrg, "outrapalavra"); Or it may also be the additional parenthesis…
-
3
votes2
answers442
viewsA: How to add "android-support-v13.jar" to my project?
You have to reference the imported library on project.properties. In a Helloworld, he’d be like this: target=android-21 android.library.reference.1=../appcompat_v7 In your case, I’d leave her that…
-
2
votes1
answer735
viewsA: Json org.json.Jsonexception error: Unterminated Object at Character
Your second link is not closed as a string. "nome": "Chegou a Hora", "icone": "https://lh4.ggpht.com/IQ4km0WoDCIB-6ESZLzSYGYOae5X-ZDUKAdmB3D4_i7KF8HhVuWu65cpcxUOTDNH8tI=w300-rw", "link":…
-
3
votes2
answers137
viewsA: Error in my C Program
In the loop while you are checking the nValoresLidos, but the scanf does not assign the value to nValoresLidos and yes to outroInt. Do so: scanf("%d", &outroInt); nValoresLidos = outroInt;…
-
5
votes2
answers1654
viewsA: What’s the difference between top and margin-top in css?
Every element in HTML is always a box. This box has 4 area values: The first, innermost, is that of the element itself. In the case of an image, it is the image itself. The second is the call…
-
0
votes4
answers1081
viewsA: how to filter an ngRepeat loop according to the value of one of the contents of an array
As @Pedro Luz responded, the idea is right, going into the use of Angular filters, but they are used differently. For example, I want to change the way a date is displayed? I use the following…
-
4
votes1
answer354
viewsA: Angularjs and SEO
If you are using views and routing in Angularjs, each routed page must have a controller. This way, you can use the following template to run something at the time the view is loaded completely:…
-
3
votes4
answers1489
viewsA: Cleaning the Buffer after getchar
You can use the following line, along with the includes of the code: #DEFINE flush "while ( getchar() != '\n' );" With the code going like this: #include <stdio.h> #DEFINE flush "while (…
-
3
votes1
answer181
views -
0
votes1
answer181
views -
0
votes2
answers4028
viewsA: Class.getResource() can only recover files in internal folders to which the class is located?
I managed to solve here, follow the code: package util.server.consultas; import java.io.File; import java.io.FileReader; import org.restlet.Response; import org.restlet.data.MediaType; import…