Posts by carlosrafaelgn • 4,769 points
70 posts
- 
		3 votes2 answers335 viewsA: Split a String dynamically based on screen sizeWell, in general lines, you can do the following (the process below should be repeated every time the string changes, or the width or height of the change, or the font size changes): Paint paint =… 
- 
		3 votes1 answer570 viewsA: Filtering data from acceleration and magnetic sensors on AndroidAfter much search I was able to choose the top 3 links that enlightened me in this issue: Using Android gyroscope Instead of accelerometer Indoor Positioning System based on Gyroscope and… 
- 
		2 votes1 answer426 viewsA: Android Mediaplayer class alert: Should have Subtitle controller already setWell, after a lot of trying and searching, the best solution I’ve found is to ignore the message completely, as you say that response from the OS (a free translation/summary): Some Google developer… 
- 
		4 votes1 answer391 viewsQ: Android SDK Build-tools 22.0.1 inventing folders inside res in generated APKI’m using the Android Studio 1.2.1.1, with the Gradle 2.2.1, and this is an excerpt (the relevant part) of my resource folder structure: res |- layout |- layout-v21 |- values |- values-v11 |-… 
- 
		4 votes1 answer570 viewsQ: Filtering data from acceleration and magnetic sensors on AndroidI have a player open source for Android some time ago. Months ago I created an audio viewer (the type of ones with bars and colors) where the user could interact, simulating an augmented reality… 
- 
		22 votes2 answers574 viewsQ: Is it possible to have month 13 on a date in Java?I was looking at the class documentation Formatter java 7, this link from Oracle itself, when I noticed myself with the following example below: What intrigued me was the example given for the month… 
- 
		15 votes1 answer318 viewsQ: How do Proguard remove a class method?I’m not getting Proguard 4.10 to make a method static turn inline. I can only do that with instance methods. For example, this little bit: public final class Calc { private int x = 0; public int… 
- 
		2 votes1 answer608 viewsQ: Difference between glFlush and glFinishWhat is the practical difference between glFlush and glFinish commands in the context of Opengl ES 2.0? I have read the documentation of the two functions glFlush and glFinish, and I haven’t been… openglasked carlosrafaelgn 4,769
- 
		6 votes4 answers1224 viewsA: How to exchange data between a mobile(android) and another device through Bluetooth communication?If you want a big, functional example, you can look at this my application on Github, Serialbtcontrol. To Activitymain starts the Activitydevicelist in line 159, to list existing/pairable Bluetooth… 
- 
		4 votes2 answers1991 viewsA: Changing the Culture of the SystemThe fact is that the technique of changing the Thread.CurrentThread.CurrentCulture and the Thread.CurrentThread.CurrentUICulture does not work for the control DateTimePicker and for control… 
- 
		9 votes2 answers5295 viewsQ: Reduce the size of an APK fileIt is possible to reduce the size of an APK file by changing the way it is compressed? It is known that an APK file is just a ZIP file, signed and aligned. However, I performed some tests, and if… 
- 
		7 votes2 answers5295 viewsA: Reduce the size of an APK fileYes, it is possible to reduce the size of an APK file by just changing its compression. It is possible to use any ZIP utility such as Winzip, Winrar, or 7-Zip. I used 7-Zip. To execute these… 
- 
		5 votes2 answers17274 viewsA: Click on a button via pure javascriptTo simulate a click on an element, just use the method click() of the same. var botoes = document.getElementsByTagName("button"); for (var i = 0; i < botoes.length; i++) { if (botoes[i].className… javascriptanswered carlosrafaelgn 4,769
- 
		5 votes1 answer1863 viewsQ: Difference between using the main element versus a div with role="main"?Thinking in terms of accessibility, described by WAI-ARIA, you need to define the element with the main content of the page with role="main", in order to improve the accessibility of the page for… 
- 
		2 votes1 answer89 viewsA: ARM atomic operations without Visual StudioAfter a lot of research, I found a material made available by Google (impossible to reproduce here, because it is huge) called Symmetric Multi-processor Primer for Android. In several parts of… 
- 
		8 votes2 answers12489 viewsA: Should I always use Dispose?You must use the Dispose to free resources before the Garbage Collector passes to clear the reference to your object. This should be done, because there are scenarios where Garbage Collector can… 
- 
		3 votes1 answer89 viewsQ: ARM atomic operations without Visual StudioWhen programming in C/C++ on the x86 and x86-64 (AMD64) architecture and using the Microsoft compiler that comes with Visual Studio, there are two intrinsic functions to perform atomic operations,… 
- 
		35 votes3 answers2309 viewsA: Is it right to prefer composition to inheritance?I know I can enter the sphere of opinion, but still, very curious the placement prefer composition rather than inheritance During my master’s classes, I heard the exact opposite. Including, among… 
- 
		1 votes1 answer578 viewsA: Expired web page when I return to the page by the browser button. Previous page c/ postbackReally, when returning to a page that was generated through information sent via POST, the browser can say that the page has expired, or say that it will submit the information again, which may not… 
- 
		2 votes2 answers396 viewsA: How to optimize the color palette of a Gif?As explained in the comments: The image consists of a white background and some texts/signatures/lines It is not harmful to use grayscale for the output image So I created a function that transforms… 
- 
		5 votes2 answers272 viewsA: How to create a box with two separate textsA small example of how to achieve this using CSS only. There are a multitude of other ways to achieve the same result. HTML: <div class="FUNDO"> <span class="CIMA">Título do… 
- 
		1 votes1 answer301 viewsA: Subroutines in the vb6It is possible to do this by creating a Timer in his Form, as shown in the figure below: Then just adjust the properties Interval and Enabled of Timer created, to be able to create a repetitive… visual-basic-6answered carlosrafaelgn 4,769
- 
		2 votes1 answer114 viewsA: Asynctask canceled during execution does not call any of the post-InBackground() methodsThe big problem here is that the method onCancelled, as well as the method onPostExecute, are executed in the Thread responsible for dealing with the UI, as the documentation. That way, when you do:… 
- 
		4 votes1 answer1975 viewsA: Create dynamic menu in VB6Unfortunately VB6 does not allow to do this using only the VB. Should be used an external component or the Windows API. I created a small example of how to do this using Windows Apis. For the… 
- 
		3 votes2 answers93 viewsA: How to use Window.Clientbouds inside a class in XNAThere is a lack of information for a complete analysis of the situation, but from what it was possible to understand the question, the method Update shown belongs to the class Player1. In turn, this… 
- 
		4 votes1 answer203 viewsA: javascript, sum of LabelThe error is on the line sum += parseint(inputs[i]. value); The element label does not have the attribute value, the way you’re hoping. For that, you need to take the text of label, that by DOM, is… javascriptanswered carlosrafaelgn 4,769
- 
		3 votes1 answer426 viewsQ: Android Mediaplayer class alert: Should have Subtitle controller already setAfter I upgraded to Android Kitkat (4.4), a class object MediaPlayer Android generates the following alert on Logcat: Should have Subtitle controller already set As explained in that question of the… 
- 
		3 votes1 answer439 viewsA: Jframe Paint method does not show the drawings on the screenThe problem is that you are creating a new object by doing: Graphics2d g2d = (Graphics2d)g.create(); That is why your drawing does not appear on the screen (it is occurring in this other Graphics2D… 
- 
		8 votes1 answer7213 viewsA: Libraries for communication between Arduino and AndroidThere are two sides to analyze in this situation: the Arduino side and the Android side. Arduino On the Arduino side, you have several options, but the most common are: Use the class Serial, to send… 
- 
		7 votes3 answers7464 viewsA: Round numbers in C# to decimal 0 or 5To make this type of rounding, assuming its value is in a variable float calling for x, the following can be done: x = (float)((int)((x + 0.4f) * 2.0f)) * 0.5f; If it is double: x =… 
- 
		1 votes1 answer3622 viewsA: Html5 audio player customizationCustomizing the player is impossible. However, you can do different: make it invisible, and create your own custom controls by sending the commands directly to the player, via Javascript. For… 
- 
		8 votes6 answers10591 viewsA: Differences between Parse() vs Tryparse()I’ve read all the answers, but none specifically talks about their performance. There is an answer back in the OS with a time comparison table. There is also a post on the MSDN blog talking about… 
- 
		5 votes1 answer582 viewsA: Google Images Chrome and IEThe problem is the size of the original image: http://4.bp.blogspot.com/-ip63yAFK9WE/Tftadqnv41i/Aaaaafs/nr7HyirMdPE/S320/homehost_ok.png When IE has to reduce much an image, arise these artifices,… 
- 
		2 votes2 answers2180 viewsA: Generating a pseudo-random number based on an inputI just found a way to generate this kind of pseudo-random number, created by the creator of the Perlin Noise, Ken Perlin. He left one of his own Talks available online here. Throughout the… 
- 
		3 votes2 answers438 viewsA: How to improve code workflow without using synchronous ajax?You can use a global counter and a Guard condition to synchronize the execution of its asynchronous actions. More or less as it is done in a State machine. In your code, this would look like this… 
- 
		3 votes2 answers529 viewsA: I rotate in my browser Webservice and gives me a strange messageThis is the default message shown when trying to access a Webservice in the browser, without having the metadata enabled. A Webservice, by default, is not made to be viewed directly in a browser,… 
- 
		2 votes1 answer947 viewsA: Setting an image as a background in JAVA MESupposing your wish is to place an image as the background of JogoDaVelhaUI, you can do the following: Add the background image to the folder res, for example, fundo.png Load image asynchronously,… 
- 
		3 votes2 answers2180 viewsQ: Generating a pseudo-random number based on an inputI need to generate a random number based on another input number, so that for the same input number, the function should always generate the same output number. For example, meuRand(4) would always… 
- 
		8 votes2 answers4464 viewsA: Getting the full path of a client file in ASP.NETFrom the server it is not possible to take the path of a file submitted by the client, due to security restrictions. The most you will get is the file name, its size, extension and MIME. For… 
- 
		2 votes2 answers2764 viewsA: IF condition inside _Layout.cshtml in MVCAssuming you want to write, through Razor, a Javascript code to be interpreted on the client side, you can use the tag <text>: <script type="text/javascript"> //código JavaScript @if… 
- 
		2 votes2 answers1196 viewsA: How to make an Animate up to the mouse position and after starting to follow the mouse?This code performs a smooth movement of div until the cursor, every time the cursor enters the menu area, and the cursor is "far" from the div. Since the div reaches the cursor, it follows it… 
- 
		29 votes3 answers1858 viewsA: How to know the right measure of comments?I finished my master’s this year, and one of my two advisors, a deep connoisseur of Patterns design, UML and OO preached that over-commenting the code could be an indication of something as serious… 
- 
		2 votes1 answer207 viewsA: socket failed: EACCES (Permission denied)There are some details in your code. On the manifest, the line <permission android:name="android.permission.INTERNET"/> Should be <uses-permission android:name="android.permission.INTERNET"… 
- 
		1 votes1 answer537 viewsA: Ajax request in C# update authenticationTwo years ago I made AJAX requests without using tools or API’s support. The target resource for AJAX requests was "Generic Handlers" (with ASHX extension). After a long time just making this kind… 
- 
		1 votes3 answers258 viewsA: Accessing an SFML pixelA pixel really is the smallest point of an image, but what the library returns, through the pointer const sf::Uint8* pixels are the R, G, B and A components of the pixels (according to the… 
- 
		2 votes1 answer838 viewsA: Send request for pairingI have this code here, which I use in my applications. It should give a light on how to connect. This code uses a treatment try-catch, that some may not like, but it is to be able to treat the case… androidanswered carlosrafaelgn 4,769
- 
		8 votes2 answers234 viewsA: How to handle frameworks and ready-made technologies?I’ve always wondered the same thing throughout my life (I’ve been through Clipper, VB, Assembly, C, C++, Java, C#, HTML and Javascript). In the past I developed everything by hand, for several… 
- 
		2 votes2 answers160 viewsA: Nullpointerexception when creating a View on AndroidIn line 40 of the code posted btnCalc.setOnClickListener (new View.Onclicklistener() You are using btnCalc, but it was not assigned before. Before using btnCalc lacks something like btnCalc =… 
- 
		3 votes2 answers680 viewsA: How to create the fade effect on a link that uses Sprite?In my experience and by that other answer here, it is not possible to do fade of opacity between two background-image using only CSS3. What you would have to do would be to create two overlapping… 
- 
		38 votes3 answers19104 viewsA: Understanding threads in C#Using threads in C#, is semantically similar to using threads in Java, C or C++, what changes is the form (syntax) with which threads are created/used in different languages. Answering the question…