Posts by Rodrigo Santiago • 1,822 points
61 posts
-
1
votes0
answers52
viewsQ: Are multiple JDBC connections "thread-safe"?
I am creating a very simple java and postgresql project of clients and contacts between clients. Exists the table clientes with id and name, and the table contatos with id1 and id2 which refer to…
-
0
votes1
answer30
viewsQ: Is it valid to convert an array to a class/struct?
Although I have tested I’m not sure if it will always work : class Val { public: int data[4]; }; int main() { int data[4]; Val* v = reinterpret_cast<Val *>(data); }…
c++asked Rodrigo Santiago 1,822 -
1
votes1
answer69
viewsQ: Is there a difference between "new" and "reinterpret_cast" for a memory buffer?
I wonder if there is any difference in the final product of these two codes : //------ Declaração curta class ClasseA { public: int valor; Classe() { iniciar(); } ClasseA * iniciar() { valor = 10;…
-
1
votes2
answers61
viewsA: Is it possible to add extra classes to a dll?
In the latest updates Mingw connects to the standard c++ library dynamically by default. In this case the generated dll is also dynamically dependent on this library, it seems that the dll is trying…
-
1
votes2
answers61
viewsQ: Is it possible to add extra classes to a dll?
The compiler can even compile perfectly , but for some reason when I run the app.exe gives me an error, follows my code: main.cpp #include <iostream> #include "cpp.h" int main() { ClassA * a =…
-
2
votes1
answer42
viewsQ: Is it possible to include dynamic libraries in a static?
The final goal is very complicated, I will try to explain as much as possible : There is the file libA.so and the file libB.so , both are required to use my own library code libC, which I would like…
-
-1
votes1
answer286
viewsQ: Is it possible to compile C/C++ from Windows/Linux for Macos?
In a hypothetical environment where I don’t have the system or how to emulate, would it be possible to compile an application in c++? (properly compatible) I’ve already found some cross-compilers…
-
1
votes1
answer26
viewsQ: How do I calculate to convert a Codepoint to UTF-16?
I have a 32-bit integer representing a Unicode character and would like to convert this single character into its representation utf-16, that is, one or more 16-bit integers.
unicodeasked Rodrigo Santiago 1,822 -
9
votes3
answers977
viewsQ: How to know the size of an object in memory?
I’m not after a method/operator sizeof because I already understand that JAVA doesn’t have it, but I need some way to measure at least on average how much memory an object spends, even if it is…
-
1
votes1
answer425
viewsQ: How to calculate the year from the number of days?
Without using any library, and ignoring little scientific facts about the rotation of the earth. The function receives the number of days and must determine how many years have passed judging the…
-
2
votes1
answer56
viewsQ: How to create a "defnine" with undetermined arguments?
I’ve seen somewhere for some time that this was possible, and now I need to implement this to make it easier to read the code. Is the following : void A::adicionarTodos () { lista.adicionar(A1::id);…
c++asked Rodrigo Santiago 1,822 -
0
votes1
answer145
viewsQ: Why doesn’t Clang recognize the basic header (iostream)?
Command line : clang++ "C:\caminho\completo\helloworld.cpp" -o "C:\caminho\completo\helloworld.exe" Code : #include <iostream> using namespace std; int main(){ cout << "Ola Mundo"…
c++asked Rodrigo Santiago 1,822 -
5
votes3
answers171
viewsQ: Is it safe to create an object pointer in the stack indirectly?
My class has a method that returns a pointer to itself, and at some point I use the following : void classequalquer::metodo() { ClasseA * ponteiro = ClasseA().getThis(); //usa o ponteiro nesse…
-
2
votes1
answer52
viewsQ: What happens after Wait synchronization?
Look at these two codes in separate threads Thread A synchronized(objeto) { while(condicao) objeto.wait(); //operações } Thread B synchronized(objeto) { condicao = false; objeto.notify();…
-
3
votes1
answer59
viewsQ: How to select double contacts from a table
I have 2 tables : Users [id, name, etc ...] Friends [id, idUsuario, idAmigoI] In the Friends table, idUsuario corresponds to the id of the user who has the contact and idAmigo the id of the user who…
-
0
votes1
answer30
viewsQ: How to remove the class name from the executable without losing dynamic_cast?
My goal is to just remove the class name from the executable, but still continue with the ability to use dynamic_cast. The problem is that if the RTTI is removed, and thus the class names, there is…
-
4
votes1
answer66
viewsQ: Specialize only one template class method
I own 2 basic class types, Classea and Classeb. Classea has a method that generates an integer, and Classeb has a method that generates a Classea. I would like in the method of a Classec, if the…
-
1
votes0
answers21
viewsQ: Is it possible to export a jar and documentation together?
I am using the Intellj IDE and exporting a project to a file jar using Artifacts. However, when I use this jar in other projects the methods javadoc style comments do not appear. Is there any way to…
intellij-ideaasked Rodrigo Santiago 1,822 -
0
votes1
answer78
viewsA: In what language can I make a form?
I would recommend using Javafx and Scenebuilder, and to do any effect you can use CSS ( javafx uses a proper css ). I have a link on how to use it in Netbeans, it’s in English but it has lots of…
javaanswered Rodrigo Santiago 1,822 -
1
votes1
answer246
viewsQ: Animate circular form Activity
I would like to make a transition effect by calling an Activity. When the image, in this case a circular, is pressed Activity grows from a circle with the same radius of the image until it fills the…
-
0
votes0
answers48
viewsQ: Blob For bitmap returns null only on Android 4.2.2
It’s simple, if I use this line of code on android 5.0 , 6.0 it works correctly, and converts the blob into bitmap. However, testing here on a lower device (android 4.2.2 ) it always returns null;…
-
0
votes1
answer390
viewsA: Help with Libgdx
You must implement a Inputprocessor, and define it as a receiver of events : Gdx.input.setInputProcessor(instanciaInputProcessor); This interface has all kinds of input events, in the case of touch,…
-
1
votes0
answers58
viewsQ: How to link to SDL2 statically
With a simple sdl project, it just shows an empty window. I’m using the following Cmake (in Clion) : cmake_minimum_required(VERSION 3.3) project(AprendendoCpp) set(CMAKE_CXX_FLAGS…
-
3
votes1
answer732
viewsA: Help with Javafx form
Well, you need to leave an empty pane (can be Hbox, Vbox, Pane etc) in the area you are going to add. Then use the following code : paneVazio.getChildren().setAll(…
-
2
votes1
answer170
viewsQ: Regex, valid if there are specific words in any order
For me it is always better to exemplify the cases of regex. Look at this: Palavra1- Valid Word2- Valid Palavra1 Word2- Valid Word2 Palavra1- Valid Palavra1 Palavra1- Invalidity Word2 Word2-…
regexasked Rodrigo Santiago 1,822 -
0
votes1
answer260
viewsQ: How to use sdl in Clion
I’m fairly new in c++ , and don’t know how to use sdl in Clion. I’ve tried several ways, it’s like this currently: Cmakelists: project(cppsdl) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11…
-
0
votes2
answers5472
viewsQ: How to create an android app using c++ only in Android Studio?
Just for learning purposes, is it possible to create an app using only c++(without JNI)? And if possible, what are the steps, have some example 'Helloword' somewhere? From what I know some things in…
-
0
votes2
answers896
viewsQ: Software to create documentation without using source code
I’m developing an API, very big, and I want to create the documentation, but most of the programs I found just take the documentation from the comments of the code-source, what I really want to do…
-
2
votes1
answer320
viewsQ: Use a layout folder for more than one size
I have a Tablet(7") and a smatphone(5"). My layout folders are: layout > Has almost all layouts layout-large > One of the screens(Screen A) will behave differently to wide layout-normal-land…
-
0
votes0
answers58
viewsQ: Smallest JRE(jvm) possible
I am creating a Java application and need to put the JRE together, and some wrapper, or even an installer. Is there any program that does this, with the SMALLEST jre possible already included?…
javaasked Rodrigo Santiago 1,822 -
0
votes1
answer67
viewsQ: Does closing Datainputstream always close Inputstream?
I need to temporarily use one Datainputstream with an inputStream of a socket. I need to use close-up on Datainputstream? And if I use I’d be closing the socket inputStream too ?…
-
0
votes0
answers85
viewsQ: Error rotating screen with open fragment
I am using the simple model of Fragment. There is one that is the List, and another Viewer . Fragmentactivity : if(pFragVisualizar==null){ pFragVisualizar = new FragVisualizar();…
-
0
votes1
answer44
viewsQ: Is there any way to disable a view without leaving it gray?
I would like to standardize the views, some screens to view and edit and others just to view. In view mode I leave the views disabled. I’m trying to keep the appearance similar, using the following…
androidasked Rodrigo Santiago 1,822 -
2
votes2
answers397
viewsA: Rename large mass of files
First you can split (divide) the spaces, then go in each part by changing the first letter, and finally send the extension to lowercase, here is a complete code : String ext = "";…
javaanswered Rodrigo Santiago 1,822 -
1
votes1
answer36
viewsQ: Deleting a Watcher’s subfolder ends the loop
My code is this:: try { watcher = FileSystems.getDefault().newWatchService(); registerAll(path); } catch (IOException e) { return; } while (true){ WatchKey key; try { key = watcher.take(); } catch…
javaasked Rodrigo Santiago 1,822 -
1
votes1
answer26
viewsQ: Low performance when converting Blob to Bitmap
I’m using the following code : BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 4; bitmap = BitmapFactory.decodeStream(blob.getBinaryStream(), null, options); The…
androidasked Rodrigo Santiago 1,822 -
0
votes1
answer56
viewsQ: Is it possible to cancel a JDBC connection?
I’m using the following code in a Thread: try { Class.forName("org.postgresql.Driver"); DriverManager.setLoginTimeout(60); conexao = DriverManager.getConnection(url,usuario,senha); }catch(Exception…
-
0
votes2
answers200
viewsA: How to take the camera counter rotation on Unity 5
You must , first access the Camera. It has innumerable forms, judging that you already know how to do it ,you can do the following : transform.rotation =…
unity3danswered Rodrigo Santiago 1,822 -
1
votes1
answer84
viewsQ: How to make a regex that accepts one line but not two?
I get lost doing any complex regex. I use the following code in java: Pattern pattern = Pattern.compile("tentativas de regex aki"); Matcher matcher = pattern.matcher(conteudo); while(matcher.find())…
-
1
votes1
answer90
viewsQ: Underline custom javafx
It is possible to leave a text (or any text Node) with custom underline. Like microsoft word when there is an error word. Using the CSS
javafxasked Rodrigo Santiago 1,822 -
0
votes1
answer39
viewsQ: Load and set bitmap asincrona
It is possible to load a Bitmap image asynchronously, but set it to an imageview before finishing? Thus : imageView.setImageBitmap(bitmap); new Thread( ()->{ //carregar bitmap }).start();…
-
6
votes3
answers5185
viewsA: How do I know in JAVA that the Resultset result is empty?
You can use next . Is usually used : white(resultSet.next()){ //Percorrer o resultado da sql } What happens is that if there are no results the first next will return false. And you can enjoy doing…
javaanswered Rodrigo Santiago 1,822 -
1
votes1
answer84
viewsQ: How to create a Double Toolbar?
I googled, but I never found a way to make a double Toolbar(material design) like the image: https://chris.banes.me/content/images/2014/11/layout-structure-toolbars-toolbars-04_large_xhdpi.png…
-
1
votes3
answers1282
viewsA: Take screen size in xml
The only way to do this is to change the width at runtime. Since xml does not support mathematical operations. In onCreate : DisplayMetrics dm = new DisplayMetrics();…
androidanswered Rodrigo Santiago 1,822 -
1
votes3
answers1282
viewsQ: Take screen size in xml
I would like Layout to have the size of the screen horizontal. But when the screen turned, it would still be the same size. I’ve made a little sketch of how I intend it to look: The current xml is…
androidasked Rodrigo Santiago 1,822 -
1
votes4
answers7150
viewsA: In inheritance with private attributes, does not the daughter class take its attributes from the mother class?
When a variable or method is marked as private. Only the class you implemented directly will have access. Nor can child classes access private fields. If you want it, use it protected. It is private…
-
3
votes4
answers334
viewsA: Advantages of Inner Class
It’s just structural! In the compilation process, each Inner Class is done separately and has even a little more attention than the Garbagecollector(I cannot guarantee that it will perform better).…
-
0
votes1
answer57
viewsQ: Problem running manually compressed jar
I was studying how to compile java straight through javac and everything else. Then I joined all the files into a zip and renamed it . jar . It didn’t work at first due to lack of Manifest - didn’t…
javaasked Rodrigo Santiago 1,822 -
4
votes1
answer52
viewsQ: Is it necessary to repeat dependencies (JAR)?
I have an "A project" that uses a java library . JAR , which is inside the dependencies. I exported this project to . JAR to use in "project B". This project B also needs to use the same library. I…
javaasked Rodrigo Santiago 1,822 -
1
votes2
answers127
viewsQ: Can I use tools.jar in the Classpath of my Java project?
I’d like to know if there’s a problem, since he’s part of the JDK, or even if it’s necessary.