Posts by Maniero • 444,682 points
6,921 posts
-
10
votes1
answer871
viewsA: Change class template in Visual Studio
Look for this file, it’s him you want to change: C:\Program Files (x86)\Microsoft Visual Studio\12.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs I think it would look something like…
-
6
votes3
answers1361
viewsA: Validate different date formats
There are several ways to solve this depending on your need. One of them is this: echo date('Y-m-d', strtotime(str_replace('/', '-', '31/10/2014'))); Behold working in the ideone. And in the repl…
-
6
votes3
answers2984
viewsA: How to name a unit test when using TDD?
There’s taste for everything, I’ve never seen a universally accepted standard. In that reply I put nomenclature standards well accepted because it was basically established by the company that…
-
2
votes3
answers937
viewsA: Operators, order, relevance, how it is read and priority
Each operator is different from the other. It would make no sense to have operators doing the same thing. In this case we are talking about relational operators that result in boolean values, i.e.,…
-
16
votes2
answers2992
viewsA: Decimal places of the float
With the float there’s nothing to do. I’ve essentially answered in that reply (has several links to other information, I recommend reading all, especially those that are in English, if you can).…
-
9
votes4
answers4670
viewsA: Select string at random
Just use the method shuffle() available for use in collections. This method is made to sort randomly elements of a collection. public static void main(String[] args) { List<String> letras =…
-
5
votes2
answers1016
views -
23
votes4
answers5242
viewsA: What is the priority of HTML? "id" or "class"?
HTML In HTML you can always have both and none shall take precedence over the other. It doesn’t matter what they are. The two information are different with different functions, so they coexist and…
-
37
votes3
answers24523
views -
48
votes3
answers24523
views -
4
votes4
answers584
viewsA: How to verify the efficiency of these 2 functions in C++?
How to calculate efficiency I don’t know but I can test it: #include <stdio.h> #include <time.h> #include <cstdint> #ifdef WIN32 #include <Windows.h> #else #include…
-
4
votes2
answers1246
viewsA: Count number of records in a database
If you look at documentation will see that the return of the method exec is of the boolean type, ie it will return 0 (false) whether the operation failed or 1 (true) if the operation was successful.…
-
5
votes1
answer196
views -
3
votes1
answer250
viewsA: Permission denied accessing file
The file is open. You cannot remove open files. You need to close it first. This error indicates that you do not have permission precisely because of this. Your code is quite confused, it is very…
-
1
votes3
answers936
viewsA: HTML Helpers in ASP.NET MVC 4
The idea here was to give a general idea about lambda that which was used in that parameter. Read the other answers for more complete information about the entire feature, especially Miguel…
-
4
votes2
answers455
viewsA: List of Exception PHP errors
Exceptions were created just to not need a list. It is to be unstructured and even decentralized. You know what exceptions can happen by studying the specific API documentation you are using. There…
-
2
votes2
answers756
viewsA: Possible SHA256 return 128bytes after signing?
The SHA-256 is 256 bits and not 256 bytes. I’m trying to understand how it got so big. 256 bits are 32 bytes. There is even a need for 64 bytes, or more precisely 64 characters, after all each byte…
-
4
votes3
answers369
viewsA: Stringbuffer.equals and String.equals difference in Java
StringBuffer uses the implementation that comes from Object as the other answers demonstrate. But the comparison is not of a string and yes of a reference to a string. As a whole Object does so by…
-
4
votes2
answers548
viewsA: How to generate error in logerror.txt file?
The syntax error is easy to solve. The try has not else, he has catch. Try: try { //faz o que precisa aqui } catch (PDOException $e){ echo'Sistema indisponível'; LogErros($e); } I put in the Github…
-
5
votes1
answer426
viewsA: Concatenate string with int in printf
Yes it is possible: printf("\n| %.*s | %8s | %8s |", MAX, "Nome", "Salario", "Idade"); The secret is the .*. It is a parameter for the string formatting. Note that as is the first parameter the MAX…
-
7
votes1
answer270
views -
2
votes1
answer127
viewsA: Error while adding strings to an array
I believe you want to do this (probably the y needs to be initialized with 0, but I don’t know, you might be wanting to do something else that I didn’t realize): public void geraLista() {…
-
2
votes2
answers2748
viewsA: Passing parameter null to a method
I understand that you are talking to do this for primitive types. All Java classes accept nulls as in C#. In Java only primitive types do not accept null, as is usually the case with ValueTypes of…
-
6
votes4
answers3475
views -
4
votes1
answer327
viewsA: Access URL without receiving the reply
Maybe I can’t find the WebClient but seems to find WebRequest, just ask for the HEAD not the data. You cannot use the GET, this returns all content. I believe it is the best that can be done. For…
-
11
votes3
answers31819
viewsA: Random number range in C
The function rand() generates pseudo-random numbers between 0 and (possibly) 32767 (depending on implementation may have greater amplitude). 1001 + ( rand() % 4000 ) //os parenteses estão aí só para…
-
3
votes2
answers3962
viewsA: Taking System Time in C
See if it solves what you want with the code I found in the OS. #include <stdio.h> #include <sys\timeb.h> int main() { struct timeb start, end; int diff; int i = 0; ftime(&start);…
-
12
votes2
answers151
viewsA: switch does not show the expected result
The case does not work the way you expect. It is not a substitute for the if. See the documentation of him. The case accepts only one value, it only tests the equality of that value. More or less…
-
3
votes1
answer2717
viewsA: Check File Creation Date and Delete
I found some answers that might help you. Steve Danner’s response in the OS: using System.IO; string[] files = Directory.GetFiles(dirName); foreach (string file in files) { FileInfo fi = new…
-
1
votes1
answer75
views -
7
votes2
answers2276
viewsA: Methods without parameters and with parameters
You are correct in all your initial assumptions. To return an integer you do not need parameters. The return works separately. You can have parameter but it has no direct relation to the return. The…
-
5
votes1
answer216
viewsA: Yield does not return data
See the documentation of yield return. He doesn’t do what seems to be what you expect of him. The part of return is important. When it arrives on this line, it finishes the execution of the method.…
-
4
votes1
answer504
viewsA: Can the type of an operating system be microkernel + monolithic?
Yes, it is possible. Of course the details of what you can reconcile depends on the specific architecture. It has a entry on this in Wikipedia. As well demonstrates the article there are…
operating-systemanswered Maniero 444,682 -
8
votes1
answer125
viewsA: Loop with array + string
I will put two solutions for you. The first is based on answer I have already provided you. Pay close attention to the comment of lhf, the creator of language. function table.map_length(t) local c =…
-
1
votes2
answers160
viewsA: What is the difference between open and opendir calls on UNIX?
In thesis could but you would have to filter what is directory or not, could err or not pay attention to all the details. A opendir treats a directory in a more specific way. It is essentially a…
-
13
votes3
answers5859
viewsA: Develop for multiple platforms using C# and Xamarin Studio
Yes, absolutely free. But you need a license from some Microsoft IDE, probably a Visual Studio, even Community. Essentially it is possible to use the same code for all three platforms, but it…
-
6
votes2
answers190
viewsA: Delete repeated values
A more traditional approach to verify duplicity as I had already done in another answer on C. a = {{a=1, b=2}, {a=2, b=3}, {a=1, b=2}, {a=3, b=2}, {a=1, b=2}} for i = #a, 2, -1 do for j = i - 1, 1,…
-
13
votes4
answers11103
viewsA: How to get the last days of the month in PHP
See the existing formatting parameters in the function date(). The t is what determines the last day of the month. echo date("Y-m-t", strtotime("2014-10-29")) . "\n"; echo date("Y-m-t") . "\n";…
-
2
votes2
answers343
views -
5
votes3
answers13033
viewsA: Split to separate part of a string considers first separator
From what I understand it is guaranteed that the first character is "_", so just treat the exception of the first part. You can do this: using static System.Console; public class Test { public…
-
2
votes1
answer159
viewsA: Is it possible to detect the key pressed in Lua?
Directly, in a ready way, as far as I know, no. It is possible to do this in C and expose to Lua access. In fact there are some libraries that have already done this. Example Ntlua. I found this…
-
33
votes4
answers3125
viewsA: Precise math division
There are several posts about it here on the website (this for example). You can’t do this in any number language with binary floating point which is the case of float and double. You need to…
-
3
votes2
answers591
viewsA: Nested class in Java
You can’t instantiate in the direct way you did. A reference to the parent class is required so first you need to create an instance of it and in this instance access the inner class. Look at this…
-
3
votes1
answer48
viewsA: Select notes to be printed
Which part is printing what you want? Currently prints the grade of all students, right? cout << "Mat.: " << v[i].matricula << endl; cout << "Nome: " << v[i].nome…
-
1
votes1
answer981
viewsA: glassfish boot error in eclipse - asadmin path not found, bootstrap and without Domain
The AP solved the question: The problem. The solution. Check the folder where Glassfish is configured in Eclipse. Preferences > Server > Runtime Environments…
-
2
votes1
answer254
viewsA: SVM Stats from MATLAB gives test error
The AP managed to response in the OS: This should be solvable keeping my generic solution to this problem in mind. 1) Run dbstop code if error It will now stop at the line you provided: outclass=…
-
12
votes2
answers2282
viewsA: How to do binary search in a txt file?
I’ll describe what you need to do, if I can, later I’ll try to write some code. But I already say that you can not do it more precisely because your lines have no fixed size. So you have to do more…
-
5
votes1
answer976
viewsA: How to move files read by Streamreader in C#?
There are several errors there. First I think you should read it in a simpler way. But I will follow your line. Never use GC.Collect unless you know very well what you are doing and have mastery of…
-
4
votes2
answers12692
viewsA: Find out if item is in array
Essentially you don’t have much to do, you have to check item by item. Depending on what you want there are other data structures that can minimize the search time. On the other hand, maybe what you…
-
8
votes1
answer1902
viewsA: Is it possible to get a specific line of txt/csv file using an address?
You can save this data that you picked up on the line along with the position of the file where this line starts to be able to access this part of the file directly at a later time. Read a specific…