Posts by lsalamon • 874 points
50 posts
-
0
votes1
answer151
viewsA: Dynamic matrix in C#
Use Tuple: Tuple<int, int, int, int> tuple = new Tuple<int, int, int, int>( 1, 2, 3, 4); List<Tuple<int, int, int, int>> matriz = new List<Tuple<int, int, int,…
-
0
votes1
answer35
viewsA: Segmentation failure using realloc function
Looking at the code, it seems that a return is missing in the intersection routine. Try placing a return command at the end of the routine: return p;
-
0
votes3
answers2036
viewsA: Error of Segmentation fault (dumped core)
Use the last generated core dump to do the analysis: gdb programa core_dump Use the commands below to extract useful information for analysis: bt bt full info threads thread apply all bt thread…
-
0
votes1
answer111
viewsA: Pick Line Index clicked with the right button, remove the option to select in datagridview
You must set: dgvLocation.Fullrowselect = true; //No evento que voce subscreveu irá usar algo assim: if (SuaDataGridView.SelectedRows.Count > 0) { Int32 id =…
-
5
votes3
answers681
viewsA: What makes cache invalidation a difficult solution?
My point is that the difficulty is related to the cache model that is used. If it is a distributed cache, it tends to be harder to invalidate and synchronize with the other nodes. Another difficulty…
-
2
votes1
answer128
viewsA: Problem with graph c#
Code profile is the path I suggest. Use the Clrprofile which will allow you to collect the execution trace and thereby allow you to see where exactly the bottlenecks occur. My second suggestion. Log…
-
-1
votes1
answer192
viewsA: How to use map / create keys to store c/c++ cycles?
I suggest using unordered_map, which has a constant search cost O(1), as long as you can compose a unique search key for each search. For example, if your key is a string: typedef…
-
3
votes4
answers621
viewsA: Create Windows Service Auto-Updatable
There is no simple way to make a process. Net update itself. It would be something like committing hara-kiri and continuing to live to rebuild yourself. The upgrading process would have to be…
-
1
votes1
answer195
viewsA: Is it possible to store files in an executable?
What Voce is trying to do is called "EXE Packer". There are many ways to do this. See this tool: Inject your code to a Portable Executable file These are in C#: friedkiwi/netcrypt Vitevic Assembly…
-
1
votes1
answer74
viewsA: Getopenfilename() used with user personification
Services do not have interactive desktop access by default. I believe it should be created with a specific attribute to be allowed. Try searching for SERVICE_INTERACTIVE_PROCESS. This help should…
-
0
votes1
answer52
viewsA: How do I pass String.Concat "/" [""; "usr"; "local"; "bin"] to c?
This is a solution without many validations: #include <string> #include <vector> #include <numeric> using namespace std; class String { public: string concat ( const string val) {…
-
2
votes3
answers3624
viewsA: When to use asynchronous or synchronous method?
In my opinion, the use of asynchronous media brings complexity that in most cases can be avoided, using synchronous methods. Each case should be evaluated, and it will depend a lot on the developer…
-
1
votes1
answer94
viewsA: Accessing a pointer pointer ( c )
You should always take into account the value of the operators' precedence, as they have direct effect on what you want to get from the data being manipulated. Parentheses takes precedence over the…
-
1
votes2
answers252
viewsA: Error comparing two C strings
According to his explanation, Cvoce must analyze the logic of its code to function according to the operating rules of each API. In the case of strcmp we have the following operating rule: int…
-
0
votes2
answers135
viewsA: How to capture information from a 64-bit process that is running?
If your application is written in managed code, it can be compiled to "Any CPU", so it will behave according to the running operating system. You will get process information running in 32 and 64…
-
0
votes1
answer55
viewsA: Is there a replacement for _outp, removed in Visual C++ 2015?
I believe your only alternative is to migrate code using supported Apis: Serial Communications
-
0
votes2
answers161
viewsA: C++ program communication with a C#
What you need is to realize Interop between applications. If you have the module signature in C/C++, you can use this tool which makes mounting of types interfacing automatically: Pinvoke Interop…
-
0
votes2
answers363
viewsA: How to return letters between points using a regular expression?
I’m no expert on regular expressions, but I believe the expression would look like this: [a-z]
-
4
votes1
answer101
viewsA: Make a Textbox read a binary number. C#
The text that is placed in your Textbox can be converted this way: int val = Convert.ToInt32(textBox.Text, 2); This class Convert is used for conversion into several numerical bases. In the link…
-
0
votes1
answer2375
viewsA: Doubt - Visual Studio Export/Import Project
When the import does not do everything alone it may mean that the project descriptors files are not exactly as the interpreter would expect or even are not in the correct paths in the case of…
-
-2
votes5
answers3375
viewsA: Console Application without showing console window
You must perform the task on an account other than the one the user is logged in to. So nothing will appear.
-
0
votes1
answer141
viewsA: Problem with Iterator Map C++
You have not implemented a correct stop rule in the two while Ops. Try to include a rule that uses iterator’s, as these are the most important to be tested, since if they are not pointing to a valid…
-
0
votes2
answers1202
viewsA: Instantiate dll created in C# . net for VB6
VB6 calling components. Net is not recommended. Remember that VB6 support no longer exists. But if necessary, you should export your interface with the proper commands for this. See in this link…
-
1
votes2
answers743
viewsA: Communicating a Windows Service project with a Windows Form project
My advice is: Use UDP socket Whenever it is possible to choose asynchronous methods for information exchange, so you ensure that there will be no lockouts or increase code complexity. Here you have…
-
-1
votes2
answers520
viewsA: Problems with if and conditions
If you include these two lines before the 'main' statement, your code will compile without errors: #define or || #define and &&
-
1
votes3
answers389
viewsA: How to find a string in a Crystal Reports file in windows
Forget the built-in search tools from Windows. It’s an area where Microsoft has to improve a lot yet. I recommend using the free tool Agent Ransack It allows simple searching by names or by content.…
-
0
votes3
answers1517
viewsA: What to do when I get a bad_alloc error?
If you are going to miss heap memory, you should prepare your application to require more heap space when starting. It’s an action to mitigate the possibility of memory loss. But the best…
-
1
votes1
answer1582
viewsA: Work with C interruptions by compiling for pc
If when you write PC means Windows, your problems just started. Joke, actually they will become more complex, because the Windows operating system abstracts the hardware of the applications. This is…
-
1
votes1
answer1009
viewsA: How to make an x64 application connect to a 32bit ODBC driver?
For access to a database any application must use a customer, OS or database provider. So if your application runs in 64 bits the client must be 64 bits too. The solution is to install the 64-bit…
-
3
votes3
answers958
viewsA: Using Visual Studio and C++ how to prevent the debug screen from closing automatically?
You must insert a "break point" into the code, so the debugger will stop and you can view the information from the execution context. Use the shortcut keys to execute step-by-step code. If your IDE…
-
0
votes1
answer122
viewsA: Error passing an object array in C++
The information you have passed is not clarifying the cause of your mistake. The code snippet below compiles and executes correctly online. struct Node { char c; int i; }; int…
-
1
votes1
answer347
viewsA: Thread hanging
Without concrete evidence of the state in which it finds itself it is very difficult to locate the problem. So my recommendation is to activate an operation trace. Log relevant information from the…
-
3
votes2
answers3308
viewsA: Project C in Visual Studio
Just create an empty Win32 project and add a font with extension "C". You can also force the compiler to only accept ANSI code as shown below : Configuration Properties->Advanced->Compile As :…
-
2
votes2
answers466
viewsA: Multi Banks / Cache / Client Layer
I can suggest something related to cache, which in my view makes all the difference when it comes to meeting high volumes of competing transactions/accesses. This is the framework Appfabric, that…
-
0
votes2
answers1036
viewsA: Dictionary in C always returns "word not found"
Just change the code line of : if (compararpalavras(procurarpalavras, lingua[x].palavra)) To if (compararpalavras( lingua[x].palavra, palavra))…
-
0
votes2
answers1834
viewsA: Updating object value of a Form by a thread
You should not use a normal thread to make changes to the Form. In this use Backgroundworker Class . In this link there is an example.…
-
0
votes4
answers1330
viewsA: How to load a C library into C#?
Some tips that might help. To mount the module Interop signature written in C/C++ you can use this tool: Pinvoke Interop Assistant You paste the routine signature you want to call, via managed code,…
-
0
votes4
answers661
viewsA: How do I execute a method at the end of each method in my class C#
Use the construction Try/Finaly. The code in the Finaly construction will run always, even if an exception occurs in your class, so you should provide the treatment that should be given properly.…
-
7
votes5
answers17889
viewsA: Why choose C instead of C++ or C++ instead of C?
I understand that there are two main factors affecting choice: 1) the libraries to be used in the project, and; 2) Mastery of language; Libraries are a determining factor. Many projects use…
-
0
votes3
answers19104
viewsA: Understanding threads in C#
A Task in C#, in its simplest form, being it synchronous is nothing more than a piece of code that runs in parallel with the main stream, ie a thread. Your main process or Taks controller, can be…
-
1
votes2
answers2694
viewsA: Consuming C#(dll) functions in a C/C++ project
To prevent changes to your DLL written in C# from having an effect on your C++ program, preventing it from working properly, try to fix the global identifier of your module using the instructions in…
-
3
votes4
answers1095
viewsA: Why can’t I release memory?
For starters, the fact of executing delete[] A; does not have any effect on pointer A, specifically, only affects the memory that the system has allocated and that has in the Port A the address that…
-
2
votes2
answers1042
viewsA: Collect information from system resources
I am adept at the least effort, so I try to use what is already ready and available. Library for collections: Performance Counter Helper Tools : Perfview - Perfview is a performance-analysis tool…
-
3
votes3
answers546
viewsA: Run program inside Try/Catch
To prevent all code from being inside a Try/catch you must improve your tests to detect faults. Everything must be validated using good programming techniques. Therefore data entries should be…
-
1
votes2
answers2690
viewsA: incompatible types when assigning to type 'int *[]' from type 'int'
With this construction : int *V_VALORES_GERADOS[TAM]; you are saying that V_VALORES_GERADOS is an array of pointers for integers. Your routine returns a pointer to integer array. See the changes I…
-
2
votes7
answers14277
viewsA: What can C++ do that C# can’t?
Depends on the task. If you are critical in performance C/C++ is recommended. For example, I developed an application that runs as a service, collecting process performance counters. It does exactly…
-
1
votes2
answers163
viewsA: Array of bitmaps firing Outofmemory even having sufficient memory
You did not inform the version of the Framework in use, but version 4.5 has an attribute that allows you to extend the limitation of 2GB. gcAllowVeryLargeObjects - On 64-bit Platforms, Enables…
-
0
votes3
answers5189
viewsA: How to convert a string to const char *?
The qualifier const only indicates that the variable cannot be changed. So the code below means that the data pointed by the file pointer is not changeable: void Processa(const char * file) { .... }…
-
0
votes5
answers453
viewsA: Is it legal to delete this in a member function?
I do not believe it is good practice, because depending on the implementation can occur serious problems. Check more details on [ 16.14 ] It is legal, and moral, a member function to command delete…
-
8
votes3
answers19154
viewsA: How to take the path of the open executable in C#
Use : String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString(); To create a sub folder you can do so: class Program { static void Main(string[] args) { string path =…