Posts by Lucas Lima • 6,714 points
107 posts
-
5
votes1
answer2785
viewsA: How to run Assembly inline in a code with variables in C?
Basic Notation The basic scheme of use of asm or __asm__ or _asm or __asm in C C++ is as follows (using GCC as reference): asm [volatile] ( "SEU CODIGO\n\t" "EM\n\t" "ASSEMBLY" : OperadoresDeSaída […
-
25
votes1
answer68862
viewsA: How to generate a . apk file in Android Studio?
It depends on which apk you refer to. Every time you compile your project in Android Studio and run it you’re generating an apk. The difference is in the build configuration. When you only compile…
-
1
votes1
answer428
viewsA: Toast is not being shown
You forgot to register the event in Drawview. Try calling in the Drawview constructor: this.setOnTouchListener(this); Reference…
-
1
votes1
answer92
viewsA: Dimension of a display - Android Canvas
Not much of a pattern. Android can be used in tablets, smarthphones, watches, Tvs and etc. Each manufacturer adapts the system to the appliance according to the needs and proposals of the same. What…
-
2
votes2
answers465
viewsA: What criteria do I use when choosing which Apis to download?
This depends on which audience your app targets and the level of compatibility you want. You can download the latest summer, but if you want your app to be compatible with older versions of Android,…
-
1
votes1
answer124
viewsA: View notification every day
Do the following in MyActivity, using AlarmManager.setRepeating(...): Calendar cal = Calendar.getInstance(); Intent intent = new Intent(this, AlarmReceiverActivity.class); PendingIntent…
androidanswered Lucas Lima 6,714 -
1
votes2
answers2699
viewsA: Revert a string and add method to native objects in Python
You can invert the string by converting it to list, for example: str = "The String" list = str.split() # list é ['The', 'String'] list.reverse() # list agora é ['String', 'The'] Or, if you want to…
-
3
votes3
answers10342
viewsA: What are Unions? Why use them within structs?
Vinícius Gobbo and hugomg have already given explanations about what is and the difference of a struct. However, I would like to add an example of. union Valor { uint32_t dword; struct { uint16_t…
-
2
votes2
answers197
viewsA: Createprocess running EXE
The signature of Createprocess is: BOOL WINAPI CreateProcess( _In_opt_ LPCTSTR lpApplicationName, _Inout_opt_ LPTSTR lpCommandLine, _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, _In_opt_…
-
5
votes2
answers5045
viewsA: How to check in C if the file is empty?
You can check which file size and then check if it is empty. int get_size(const char* file_name) { FILE *file = fopen(file_name, "r"); if(file == NULL) return 0; fseek(file, 0, SEEK_END); int size =…
-
3
votes2
answers5841
viewsA: Style quote: "(Author, Date)" to "Author (Date)"
You can use: \citeonline{ID_DO_AUTHOR}. This generates: Fulano (2014) And it is also useful for situations like: Segundo \citeonline{ID_DO_AUTHOR} o sistema ... If this is the case, you can also…
latexanswered Lucas Lima 6,714 -
1
votes1
answer418
viewsA: How to minimize the reduction of compatibiliade due to the use of permissions?
One of the reasons for this problem is that your app requires GPS (ACCESS_FINE_LOCATION), to have access to location accurately. That is, if a device does not have GPS, it is deleted from the…
-
1
votes2
answers1327
viewsA: Qmake - Independent executable
As dlls are great because you should be using the debug ones, which are bigger even. The release ones are much smaller. To use static linkage in Qt you must have a commercial license. Otherwise, you…
-
14
votes3
answers6039
viewsA: What’s the difference between DLL and lib?
Both have the same purpose: they are libraries that allow you to reuse a certain code. One is static (*.lib, *.a) and the other dynamic (*.dll or *.so). You already know that. But the differences…
-
1
votes3
answers3750
viewsA: consuming JSON
William’s answer solves his problem. But, a suggestion: you could use the Volley to facilitate this part. Would something like this: // lista de requisições RequestQueue queue =…
-
5
votes3
answers1181
viewsA: Passing vector to functions
The other answers already solve your problem, but I would like to collaborate. In Lua there is no difference between "V", 'V' and [[V]], how do you read here. All treated as strings. But in C single…
-
9
votes3
answers10053
viewsA: Why is it not good practice to use namespace "Std" in C++?
A less "aggressive" way of using the using namespace is to do within a scope. This way you have the same ease, having more control over the namespace. For example, you can use the using namespace…
-
3
votes1
answer211
viewsA: How to detect the mouse, in Lua?
A solution to detect mouse movements with Lua and in terminal mode would be to use the wxLua, that is usually already integrated in some implementations. Basically, you call it: pt =…
luaanswered Lucas Lima 6,714 -
2
votes1
answer732
viewsA: Get font name in . bat
A solution, but which does not involve only batch is to use a program to extract the source name directly from the file. This can be done with several languages (C, Python and etc). I don’t know if…
-
2
votes3
answers729
viewsA: Print vector data in a struct
When you print out the dates, you’re doing: printf("%d/%d/%d\n", data_aniversario.dia, data_aniversario.mes, data_aniversario.ano); And should be data_aniversario[0].dia, ranging from 0 to 3 to…
-
2
votes2
answers156
viewsQ: Use separate threads or programs?
I’m developing an application that involves three (maybe more) processes that run simultaneously: an HTTP server, a logger and another that will run the main code. A priori, a simple solution to do…
-
1
votes1
answer322
viewsA: Error in readImage using Imagick()
Try with the complete directory for the image: $image->readImage($_SERVER['DOCUMENT_ROOT'] . '/dir_da_imagem/myfile.pdf'); $imagick->writeImages($_SERVER['DOCUMENT_ROOT'] .…
phpanswered Lucas Lima 6,714 -
1
votes1
answer64
viewsA: How to verify that a URL has been successful in QML?
The problem was actually an implementation error of the Android version of Qt (which was that I was using). When the function Qt.openUrlExternally(url) was called, in the native part of the code the…
-
69
votes3
answers4929
viewsQ: What is the point of using double negation in Javascript?
Recently, while studying some Javascript codes, I came across the following code: return !!navigator.userAgent.match(/iPad/i); I know that: !true == false !false == true And consequently: !!true ==…
javascriptasked Lucas Lima 6,714 -
3
votes1
answer306
viewsA: What is the difference and advantages of SDL and Unity3d
They are very different things. Unity is a complete engine. It gives you just about everything you need to make a 2D or 3D game. The SDL is a low-level library for audio, Keyboard, mouse and…
-
0
votes2
answers32709
viewsA: "Windows. h" library, what can I do?
Adding the DBX8 response, such as the windows.h is specific to Windows, you should take special care when developing codes that you want to reuse on other systems. For example, when you do include:…
-
1
votes1
answer64
viewsQ: How to verify that a URL has been successful in QML?
In QML, I can run an external URL using: Qt.openUrlExternally(url); With this, I can, for example, open the Facebook app in a certain profile: var test =…
-
7
votes1
answer633
viewsA: Tools for mobile development
Qt Framework As I have more experience with this and I can’t talk about others without having tested, I can suggest the framework Qt 5.2+. It caters well to some of the cases you mentioned, but not…
-
13
votes6
answers10591
viewsA: Differences between Parse() vs Tryparse()
The difference, basically, is that Parse makes an exception, while TryParse nay. As regards the performance, TryParse is faster than Parse because it does not use try/catch. But depending on how…
-
15
votes6
answers8712
viewsA: How and when to use Finally after a Try?
You must use finally to finalize/release resources you may have used in a try, even if an exception is made, the code in the finally will be executed. The operation is basically this: try { // seu…
-
0
votes1
answer625
viewsA: Center a Plot on top of an image in Matlab
You can move the location where the image will be drawn by setting XData and YData in imshow. To center, you define that the image position (by default is [0.0]) is [-width/2, -height/2]. Example %…
-
2
votes3
answers665
viewsA: Register with C File
In addition to the check that @pmg presented, I would recommend doing a check of the data read, to make sure that they are what you expect and make sure that the Registro exists. For example, if you…
-
1
votes1
answer434
viewsA: Mount an RGB matrix that is equivalent to a Grayscale with an altered color
Since you didn’t inform the original matrix, I’ll assume this: % matriz original: matrix_cinza = rand(64, 64); And visualizing: % imagem original % Sendo: cat(3, VERMELHO, VERDE, AZUL) % Mas, como é…
matlabanswered Lucas Lima 6,714 -
4
votes1
answer857
viewsA: How to make a window transparent using Qt?
You can do this by activating the flag Qt::FramelessWindowHint in Janela leading. Janela::Janela() : QMainWindow(NULL, Qt::FramelessWindowHint) And then activate the attribute…
-
1
votes1
answer1110
viewsA: How does Webservice SOAP/Rest work with JAX-WS?
About Base64 coding: it is necessary because it is a way to ensure that the user’s login and password content does not change during client-server transfers. It consists of 64 characters (A-Z, a-z,…
-
9
votes4
answers917
viewsA: How to check for value in a PHP array?
You can use the isset to check if the variable has been set. Thus, you will only show the information that the nome be informed: include ("conexao.php"); if(isset($_POST["nome"])) { $nome =…
phpanswered Lucas Lima 6,714 -
3
votes2
answers1674
viewsA: Retrieve XML report data in PHP
To access the value in XML you must call the tag name and access the value using foo["value"]. For example, for: <city id="3469115" name="Armazém"> Stays: $xml->city["name"]; To read the…
-
0
votes2
answers304
viewsA: how to terminate program in windows from Matlab?
I don’t know if there’s any more automatic way to solve this, but I think that solves your problem. First, you should find out what is the name of the process that is running in your code (I believe…
-
1
votes3
answers258
viewsA: Accessing an SFML pixel
Another solution is the following: Check the size of the original image before converting. sf::Uint32 sz = img.getSize().x * img.getSize().y; Create a structure to store pixels in RGB. May be a…
-
6
votes3
answers1021
viewsA: How to add object properties in Javascript?
To aggregate the values you can use the following function: function somarRegioes(vendas) { totais = {}; obs = Object.keys(vendas).map(function (key1) { var obs_vendas = vendas[key1];…
javascriptanswered Lucas Lima 6,714 -
4
votes2
answers1301
viewsA: How to open a C++ image using SFML?
The SFML alone offers no way to ask the user to select an image. But, you can use an Image Selection Dialog from a Toolkit such as Qt, wxWidgets or using the API of your program’s own target system.…
-
1
votes1
answer130
viewsA: Input bugging for no reason
The problem is in the excerpts you allocate a new string thus: new char[std::strlen(first_name)]; Should be: new char[std::strlen(first_name) + 1]; Without the + 1 you are not considering the null…
-
4
votes3
answers11852
viewsA: How to separate a String according to a separator in C#?
If the goal is to interpret the numbers in the string as integers, you can do the following: To: string valores = "1#2#3#4#"; int[] numeros; Separates the string and creates an array to store the…
-
4
votes2
answers99
viewsA: How to get the code from a Unicode General Category?
I don’t know any function that returns the value as String as you want.And, based on several projects I’ve researched on github, the solution found usually involves a mapping that, as you said…
-
1
votes2
answers110
viewsA: Sorting does not work
Error is on startup i, where is pos+1 it’s just pos. template <typename T> void selection_sort(T* begin, T* end, unsigned pos = 0u) { if(begin != end) { for(int i = pos; i < (end - begin) +…
-
1
votes3
answers2326
viewsA: CSS Transition top
I think that solves: .hand .card { position: absolute; transition-duration: 0.3s; -webkit-transition-duration: 0.3s; transform: translate(0,0em); -webkit-transform: translate(0,0em); -o-transform:…
cssanswered Lucas Lima 6,714 -
7
votes2
answers2674
viewsA: Receive indefinite amount of parameters in C#
You can do this using the keyword params.With it you define a parameter that uses several arguments or none. For example: private static int Somar(params int[] values) { int sum = 0; for (int i = 0;…
-
7
votes6
answers12772
viewsA: How to locate a value in an array with a specific structure
I’m not experienced in php but I think this might help. Assuming the input array is what you passed named as $valores: $valores = array( 0 => array( "id" =>"5744", "fk" =>"7", "nome"…
-
1
votes1
answer107
viewsA: Align Popup to Center
You must define the dimensions of the tag Popup in order to centralize it. For example: <Popup x:Name="popup" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="456" Height="70">…
-
0
votes2
answers153
viewsA: reset problem in C code
In addition to the problem presented by @pmg, you are also not initiating variables PP and LP, which caused the program to run at unknown values for these variables. Ironically, these values must…
canswered Lucas Lima 6,714