Posts by Pablo Almeida • 5,060 points
155 posts
-
1
votes1
answer140
viewsA: "Error: Identifier expected" when trying to compile a project with res/raw videos
The problem is that the names of your files start with number. How the Android SDK uses file names to create corresponding variables in the file R.java, if you use a name other than a valid Java…
androidanswered Pablo Almeida 5,060 -
5
votes2
answers818
viewsA: How to avoid restarting the screen elements when turning the phone?
The problem When you change the orientation of the device, Android destroys and recreates the Activity. What’s going on is that you’re probably starting your stopwatch on onCreate. Like the onCreate…
androidanswered Pablo Almeida 5,060 -
3
votes1
answer209
viewsA: How to interpret binary content, . dat?
There is no way without knowing which encoding was used to generate this file. .dat is usually used to say that this is a binary file in a format that only the program that created it understands.…
-
6
votes1
answer73
viewsA: Split by the | character does not return all expected elements
According to the documentation of split, just pass a negative integer as the second parameter of the call to receive as many results as possible (which, at bottom, is what you want). So it would…
javaanswered Pablo Almeida 5,060 -
4
votes3
answers213
viewsA: Why don’t I need to pass parameters to that function?
The solution would be like this: document.getElementsByClassName("informacao")[0].addEventListener("mouseover", function() { troca(banner2) }); troca(banner2) is a function call. addEventListener…
-
6
votes2
answers9159
viewsA: Read multiple numbers on the same line with raw_input
You can use the raw_input() (in Python 2) or input() (in Python 3) and separate the data through split. I mean, it would look like this: entrada = raw_input("Digite três números") # lendo os números…
pythonanswered Pablo Almeida 5,060 -
7
votes2
answers2039
viewsA: What is a hook method?
These methods hook cited are used in the Template pattern. Just as the excerpt you quoted mentions, there is an abstract class A that delegates parts of its functionality to abstract methods. A…
-
7
votes1
answer1729
viewsQ: What are the modules?
Whenever I read about Java 9, I see assertions that the big change in the next version of Java will be native module support through Jigsaw Project. Then comes the criticism of adopting a new…
-
0
votes1
answer420
viewsA: Remove video context menu from Vimeo
It is not possible. Or rather, it is not possible to do this in another browser other than your own. Any solution we could give you would depend on you being able to run code in other people’s…
-
1
votes2
answers374
viewsA: Click on Notification Desktop and go to the same window without refreshing the page
According to this question in Soen, just use window.focus() where you are using window.open. This brings the focus to the window that generated the notification. I mean, do notification.onclick =…
-
1
votes3
answers454
viewsA: Why was the parameterized class attribute <T> not instantiated?
It’s simply separation of responsibilities. Design decision, only. " Injecting" dependencies in this way is useful to facilitate testing, among other things. If the class were not parameterized, the…
-
0
votes1
answer40
viewsA: Failed to create Web Worker from local file in Chrome
Currently, there is a disagreement between the browsers between what is considered a violation of the same origin policy for the Workers. Chrome and Opera don’t allow local addresses even running…
-
0
votes1
answer202
viewsA: What is the lifetime of a variable in the method, class and module?
The variable will exist as long as there is a reference to it. When the reference counter reaches 0, the variable is deleted. This is independent of where the reference resides - whether inside or…
-
2
votes3
answers3002
viewsA: How do I try to make a site compatible with major browsers?
A good start to making sure your sites are compatible with the browsers you’re working with (but not with everyone, as this is virtually impossible, especially when it comes to old browsers and…
-
11
votes3
answers1989
viewsA: How do I know if the first digit of a string is a number?
Take the first digit and try to convert it. If it fails, it does not start with number. Something like this: public boolean primeiroDigitoEhUmNumero(String entrada) { String primeiroDigito =…
-
4
votes1
answer3024
viewsA: How do I use the if and Else functions?
For starters, it’s good to know that if and else are not functions. They are what we call conditional selection structures. The example you showed is correct (except for the indentation and the…
-
0
votes2
answers797
viewsA: Avoid opening more than one of the same Jinternalframe
Keep one of your JInternalFrame as a class field containing this event and check if it contains something before creating a frame copy. Something like that: public class MeuJDesktop extends JDesktop…
-
2
votes1
answer112
viewsA: "Unfortunately, *my app* has stopped" in the data pass to Activity
It seems to me a problem with some of these accesses to index 1, as in String autor1 = intent.getStringExtra("etAutor1"); String[] a1= autor1.split(" "); String a1pronto =…
-
1
votes3
answers96
viewsA: Android how to remove "Photos" option from the options selector and leave only "Camera" and "Gallery" options
You can’t do this. Who defines what appears there is Android, based on the type of Intent that you passed and in which applications are listening to this type of action. Who should decide whether…
-
2
votes1
answer430
viewsA: Commando gcc on Android Terminal Emulator
It needs to be through the terminal and needs to be GCC? There are alternatives to compile C programs on Android both online and offline. A quick Google search showed me this:…
-
1
votes1
answer4982
viewsA: How to call the bootstrap module on the html page in a Node project?
Bootstrap is a library to be used on the client, regardless of whether you are using Node or not. The included standard template on the official website illustrates well: <!DOCTYPE html>…
-
1
votes6
answers8595
viewsA: javascript loop with Sleep
I’ll explain how to do with setTimeout by explaining why Rodrigo’s method made the i be worth 10 every time. setTimeout It’s an asynchronous call. This means that by the time the first setTimeout…
javascriptanswered Pablo Almeida 5,060 -
3
votes1
answer70
viewsA: Detect copied text
You’re looking for the method addPrimaryClipChangedListener of ClipboardManager. It takes as parameter one ClipboardManager.OnPrimaryClipChangedListener. Assuming you’re familiar with Listeners, the…
androidanswered Pablo Almeida 5,060 -
5
votes2
answers279
viewsA: Error including library using Linux
conio.h and io.h are libraries commonly found in compilers for Windows. They are not part of ISO C. Therefore, it is natural that other platforms do not include it. Unless you have great reasons,…
-
1
votes1
answer3723
viewsQ: How to see on the desktop the mobile version of this site that is not responsive?
I need access to the mobile version of the articles of a certain website on the desktop, for the development of an extension. An example page. The site is not responsive, does not use a specific…
-
2
votes2
answers1859
viewsA: Is there a maximum size limit for an HTML page?
There is no limit in the HTML pattern to the maximum size it can have. It would make no sense to limit what a browser can endure until, because if the browser could cross that limit, you can be sure…
-
0
votes1
answer139
viewsA: Doubts about pointer pointers and function returns
The first line is modifying root->right and not root. The proof of this is that if you display on the screen the address of root before and after this operation, there will be no change. The…
-
2
votes2
answers74
viewsA: I wonder if every time I create an object in java it initializes a Thread
Your code is probably not complete because your class Objeto has no method start(). If what’s missing is the extends Thread, then, yes, by putting this, two threads will be created (one in each call…
javaanswered Pablo Almeida 5,060 -
2
votes1
answer94
viewsA: Pointer cannot be reset to NULL within function
When you do root = NULL, you are modifying the value of the local variable root. If you want a function to receive a pointer as a parameter and modify it, you need a pointer to a pointer. The…
-
0
votes4
answers277
viewsA: How do the objects created following Singleton work?
In his example, Object would be the object you want to make a Singleton. Simply replace (since you have defined your object) and if you only use Singleton, you will always have only one copy of the…
-
2
votes2
answers797
viewsA: Implementation of Jmenubar in a Jframe
You must call the method setVisible() just after finishing all the screen changes. So, your main stays: public static void main(String[] args) { // TODO code application logic here Tela…
-
2
votes1
answer980
viewsA: Android save user profile image
Neither of the two ways will cause processing problems. You are working with data reading. This is orders of magnitude slower than anything the processor might be doing. Processor is the least of…
-
8
votes3
answers959
viewsA: Why does calling System.gc not guarantee running the Garbage Collector?
Because that’s how the language was designed. This can be seen in the official documentation: https://docs.oracle.com/javase/7/docs/api/java/System.html#gc%28%29 Now of course it raises the…
-
2
votes1
answer1990
viewsA: Priority queue implementation using vector
As you are queuing on a vector-based basis, you need to rearrange the vector after a removal. This is the price to pay for using a static structure, but it can be a great price if the application…
-
2
votes2
answers77
viewsA: Application is returning Nullpointerexception error although the object is set
CadastroProcesso is an Activity. You are playing with one of her variables through another Activity. This is extremely not recommended on Android. The same goes for static Activities members. In…
-
3
votes1
answer187
viewsA: Rename an element in a Jlist
You need to implement toString() in your class Ocorrencia. This method should return a readable version of your object’s data such as String. How did you not do it, the JList used the standard…
-
0
votes3
answers156
viewsA: Regular expression to reorder string
I believe this expression captures what you want. Just set up the capture groups to extract the data you want. ([1-9][0-9]*,)*[1-9][0-9]*\|[a-z]*(,[a-z]+)* An important detail is that there is no…
-
2
votes2
answers606
viewsA: Determine specific size for console in C
The command gnome-terminal --geometry=20x20 -e ./meuprograma opens a 20x20 Gnome terminal window (measured in characters) already running the program meuprograma located in the current directory.…
-
3
votes6
answers1100
viewsA: Same number of characters in password after md5
It’s not possible in a practical way. And, if it’s possible for you, it’s possible for external attackers. If you saw someone doing it, that person is not taking security seriously. By the way,…
-
1
votes1
answer102
viewsA: the result obtained does not correspond to the actual result
I couldn’t find a complete solution, but I found the cause of the problem. Since I don’t understand its application, I don’t know what is intentional and what is not, but what happens is that, in…
canswered Pablo Almeida 5,060 -
5
votes3
answers490
viewsA: How is a Framework developed?
Depends on what you want to do. A framework, unlike a library, is a kind of environment that calls or uses your code. This means that it is a program (or a set of programs) that uses your program as…
-
2
votes2
answers1491
viewsA: Store some elements of an array in another array
Its resulting vector has the wrong size. If it has to receive only even numbers, it cannot be the same size as the original vector. If you do this, you will have to fill the resulting vector with…
-
0
votes3
answers167
viewsA: How to delete node in linked list?
The algorithm goes something like this: "Be it NoAtual the first node in the list. While NoAtual is not null: If the value saved by NoAtual is different from the value I want to remove, NoAtual…
c#answered Pablo Almeida 5,060 -
7
votes3
answers2891
viewsA: What is the need to maintain a`name` attribute in a`HTML`tag?
The attribute name is suitable for forms, to identify components on the server. The attribute id is suitable for client-side computations. The attribute name may also occur repeatedly with the same…
htmlanswered Pablo Almeida 5,060 -
1
votes2
answers12821
viewsA: What it means *(int *)
Expressions should be read as follows:: 1) The value of ptrArray, I’m treating like a pointer to int, receives intN (which is a int) 1) The value of ptrArray, I’m treating like a pointer to float,…
canswered Pablo Almeida 5,060 -
3
votes2
answers695
viewsA: Web scraping with pure Javascript
There is nothing to stop you from downloading an XML and analyzing its content. The only problem doing this in a browser would be the same origin policy, that would prevent you from accessing…
-
1
votes2
answers1697
viewsA: Ackerman function - Python
This is a recursive function. You must create a function ackerman which takes two parameters: m and n. Inside it, you will place a sequence of type if... If... Lse testing all three cases. In…
-
2
votes1
answer259
viewsA: Update. csv file when edited in Java
You created a method that reads the file and turns it into a contact list. When you remove something from that list, you are only removing it from the list. This is simply expected. Now you need to…
-
0
votes1
answer228
viewsA: Pass struct matrix as argument
The second error you received is because you need to pass a constant size within the brackets in the parameter statement. " side" does not serve as it is also a parameter. Even if it was, side is…
c++answered Pablo Almeida 5,060 -
7
votes4
answers12732
viewsA: Multiple return in C/C++
What you’re wearing without realizing it’s the dark Comma Operator. This operator evaluates the expression on the left, discards its value, evaluates the one on the right, and returns its value. For…