Posts by Maniero • 444,682 points
6,921 posts
-
9
votes2
answers717
viewsA: Receive variable value without passing parameter
What you want is called extension method. See the wikipedia article. And article in MSDN Magazine (is in VB.NET but is the same thing). He needs to follow some rules: You need to be in the same…
-
3
votes1
answer5855
viewsA: Pointer of struct inside a struct
More or less this is what you need to do: A[i].loc = malloc(sizeof(Local)); scanf("%[^\n]",A[i].loc->ender); //agora o loc aponta para algum lugar preparado p/ receber o ender printf("Digite a…
-
1
votes1
answer490
viewsA: Read the elements of a struct in another function
AP changed the question and put another example but the basis of what is done here serves for the same thing. You need to pass the object with this structure through function parameter. Read how…
-
2
votes3
answers1404
viewsA: Infinite loop when typing a character
I did another test and the original code I posted doesn’t work in any situation. I did another one which is more complicated but works. It picks up a string and tries to convert it to int. If it…
-
2
votes1
answer2518
viewsA: Create function that returns random numbers in C
Random function I imagine you just want to use a function like this. Creating one is not a very simple task. better use what is already ready. #include <time.h> #include <stdlib.h>…
-
5
votes2
answers112
viewsA: Check which processes are connected to the internet
It doesn’t seem very simple. I’ve also never tried to do this but I found some answers in the OS. It seems that the simplest way is to call an external process and run the Windows utility to inform…
-
3
votes1
answer1746
viewsA: How to align a string in a 42-character space
You need to do what you call it padding. This up to already exists on . NET but only left and right, you need it to do in both, so the ideal would be to create an extension method for this. using…
-
1
votes1
answer324
viewsA: How to pass a function pointer by parameter?
I couldn’t even compile. (func)argv[i] Doesn’t magically transform a string on a pointer to function. It is impossible to make this direct transformation. The best you can achieve is to assemble a…
-
31
votes2
answers668
viewsA: Why is a Fibonacci faster in Java than in C?
Real problem The algorithms are completely different. So the more you run it the worse. In C is calling fibo(num - 1) + fibo(num - 2) In Java is fibo(num - 1) + (num - 2) The first calls the same…
-
5
votes2
answers14165
viewsA: Dynamic allocation for struct
You can see this mistake right away: malloc(sizeof(struct info)); The correct is: malloc(sizeof(dados)); Do you want to allocate an element there? That’s what you’re doing after this change. If you…
-
42
votes2
answers20576
viewsA: What are the differences between Myisam and Innodb?
Default This is the default because it is the one that gives the most performance (but soon the next version is no longer, and it is curious because for most scenarios that people who least care and…
-
4
votes1
answer611
viewsA: Tracert or Traceroute in Java, without calling the OS
I also searched and on the first page appeared interesting results. I do not know if they solve what you want but seem to be what you need: Independent API for traceroute (apparently discontinued as…
-
2
votes4
answers2549
views -
2
votes1
answer405
viewsA: Compare two date attributes in the database with two Textbox
Consider using a date-specific component. Having said that, I will try to find a solution that seems to be just what you need: DateTime dataInicio; if (!DateTime.TryParse(textbox_inicio.Text, out…
-
2
votes1
answer62
viewsA: How to allow the user to select a directory/folder using a Filechooserdialog?
You probably would have to use the method set_action with the right filter option. Something like this: seuDialogo.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) Has an example here in C++.…
-
6
votes1
answer1312
viewsA: Definition of non-generic method?
The error is not in this passage; it is elsewhere. You must have defined an extension method within this class and you cannot define so because it is not static. As this excerpt makes it clear that…
-
35
votes4
answers53481
viewsA: How to decrypt MD5?
What is the MD5? MD5 is a technique to generate a code hash. It is a code that seeks to find a unique representation of an information (there are no guarantees that does not have collisions - same…
-
27
votes4
answers58476
viewsA: IF, ELSE IF, ELSE or IF IF IF. When to use, what’s the difference?
Semantics Programming languages often have different constructs to give different semantic effects. Rarely do you need a different construction if you don’t want this result. Simplicity You should…
-
2
votes1
answer1325
viewsA: Capturing user name logged into machine
One way is with the getProperty(): System.getProperty("user.name") You can take a lot of useful information with it about the JRE and the operating system. The other existing forms are not…
-
6
votes1
answer1474
viewsA: Scheduled tasks on the web
Essentially the same way you would in a task no web. It is the same as what you do on your computer. It can be the Windows task scheduler, the cron existing in Linux and similar distributions, or…
-
6
votes2
answers608
viewsA: Use of the Ienumerable
No. He’s the class builder EntFuncionarios(). And it is the entity that represents employees. It has connection with the class Funcionario, obvious. It is required for use with the standard of…
-
1
votes1
answer125
viewsA: "require" in higher directories
Before the require you must set the path package, tell in which files you should search for the module: package.path = package.path .. ";../config.lua" require "config" Note that the usage is…
-
3
votes1
answer73
viewsA: Using a function value
Delete the global variable. It probably didn’t work because it’s extremely difficult to manage global variables. See that answer. function deselectElement(evt){ if(selectedElement != 0){…
-
5
votes2
answers959
viewsA: How to compare the value of a Hashmap<key, value> with a variable?
First, you know why you chose the HashMap? Do you know that it has no set order? That you will not have the students in order of enrollment? This solves what you need? Your problem is that to scan…
-
9
votes2
answers1467
viewsA: Method to execute when destroying class instance
Disposable Pattern Yes, there is, it’s called Disposable Pattern. It is not exactly in the destruction of the instance because in C# this destruction is not deterministic. That is, only when the…
-
8
votes2
answers160
viewsA: How do these sites load your HTML?
This is not HTML, this is Javascript. This is object notation. It is only a data structure with relevant information that can be processed at any given time. This data presented is a serialized…
-
3
votes1
answer968
viewsA: How to capture file size from System.Drawing.Image?
From what I understand what you need is to know the size of any file. It makes no difference what is inside it. The result will be no different if you have a text, an image, a database structure, a…
-
3
votes1
answer272
viewsA: Web server that receives and sends parameters to C#, is it possible?
It is possible, of course. If it was not possible there were no web servers, right? You need to see if this is what you really want. Rarely is this necessary. But if you want to go ahead, I say it’s…
-
9
votes2
answers925
views -
5
votes2
answers209
viewsA: Processing time is affected by the size of variable names?
Compiled languages In compiled languages the name of variables is important only to the compiler. When the program finishes being compiled, these names no longer exist, they are only memory…
-
6
votes1
answer767
viewsA: Change of char variable content
The error that happens when using pointer notation is that you are not allocating memory, either in the heap with malloc() or, less commonly, in stack with alloca(). The strcpy() is just the way to…
-
57
votes2
answers3691
viewsA: What is DOM, Render Tree and Node?
GIFT Domain Object Model. In very simple words, DOM is a large hierarchical object with several elements forming a tree. In it you find all the elements existing in the model that it refers to. In…
-
6
votes1
answer91
viewsA: C file creation error
Do this: #include <stdio.h> void main() { FILE *file = fopen("/home/Documentos/teste.odt", "w"); fprintf(file, "alo\n"); fclose(file); } I put in the Github for future reference. You can’t get…
-
8
votes4
answers2204
viewsA: How to get page load percentage?
This is virtually impossible. There is nothing ready to do this. The most that is possible is you create a system that knows the size of each file that should be loaded and go controlling the load…
-
3
votes1
answer1175
viewsA: Import library in VS 2010
To canonical reference is here in the Microsoft documentation. Would this be: right click on the nodes References choosing Add Reference click on tab Browse Navigate through the options presented…
-
13
votes3
answers63728
viewsA: Add days to a date
Your problem is in the use of strtotime(). You need to say on top of that you want to add up 2 days. You were just adding 2 days to nothing. In addition you need to specify in which format you want…
-
12
votes2
answers2365
viewsA: Are JS native objects associative arrays?
TL;DR One can understand that they are but in reality it is not quite so. It was created to give this appearance although the implementation is not quite that. Strings too. It depends on whether you…
-
68
votes2
answers16758
views -
56
votes2
answers16758
views -
31
votes2
answers17231
viewsA: Can Visual Studio Community be used in commercial projects?
Yes, you can since you nay is developing within an undertaking under the following conditions: has more than 5 developers using this version (very rare projects have more than 5) or is in a large…
-
5
votes4
answers180
viewsA: Remove array positions that have the common name
It seemed to me that the intention is to detect any duplicity in the name before underlining (underscore) and not only the "number". And example does not match the description of the question. Then…
-
5
votes1
answer332
viewsA: Problems with dynamic allocation
Apparently his verificaCodigo() is in general on the right track. There are some problems in your code as a whole that I have seen passing the eye: I do not understand why the two parameters need to…
-
22
votes3
answers4284
viewsA: What is the probability of generating a Repeated Guid?
Although each generated GUID has no guarantee of being unique, the total number of unique keys (2128 or ~3.4 1038) is so great that the probability of the same number being generated twice is very…
-
1
votes3
answers158
viewsA: Capture only the second part of the string
It seems that simple, but it may be that the question is not well explained. Confirm me to try to adjust or remove the answer. Dim ItemsCopy As Integer = 0 Dim Caminho As String = ContarItems(I) Dim…
-
4
votes3
answers729
viewsA: Print vector data in a struct
There are two problems in your code: You need to increment the variable that controls the loop where ask for the data. You are storing the four dates in the same location and think it is not what…
-
2
votes1
answer176
views -
7
votes1
answer631
viewsA: C# Mobile Development Need Mac?
Microsoft has also opened . NET purchased Xamarin and prepared Visual Studio to meet the development on various platforms. Already in this version has even emulator for Android. And included the…
-
7
votes1
answer175
viewsA: How to run only one if without entering the other in PHP
The easiest way is to use a flag: $entrou = false; while ($arrayBancas = mysql_fetch_array($oBanca->retorno())){ if (date('Y-m-d', strtotime($arrayBancas['dataHora'])) ==…
-
2
votes2
answers179
viewsA: Object type for Time type data (Ex: 1 min 56 seconds) in Android/Java?
The most complete library to handle this type of information is the Jodatime. It is universally accepted by Java programmers as the solution when there are more complex time and date handling needs.…
-
3
votes3
answers4786
views