Posts by Maniero • 444,682 points
6,921 posts
-
3
votes3
answers42472
viewsA: Error Segmentation fault (core dumped)
The other answers already showed that the code has some problems. I will put as the code can be changed to work. It’s not the only way to do it, just one of them: #include<stdio.h>…
-
33
votes1
answer7393
viewsA: Why does Java consume so much memory?
The task manager is not a reliable tool to check how much memory an application is consuming. There are some factors for the large Java consumption: Java is a platform, not just a simple native…
-
8
votes1
answer3098
viewsA: How to customize Auto_increment numbering in Mysql?
You’ll have to do three things: Create a table to store the number of the last contract. Create a trigger to ensure that each insert uses the sequential number Create a function that calculates the…
-
2
votes2
answers335
viewsA: Inheritance and manipulation of a superclass’s methods
You shouldn’t use inheritance like this. In fact it is inheritance is something bad and should only be used as a last resort, when it proves more beneficial than the difficulties that its…
-
2
votes2
answers457
views -
4
votes1
answer247
viewsA: How to remove an extension from Visual Studio 2010?
From the pictures you have the Devexpress Coderush installed. You need to disable it or uninstall it in order not to appear the three points. If it is the Express version you need to do the Menu…
-
3
votes1
answer1246
viewsA: In Postgresql, which field to use for percentage?
If you don’t have decimals you can use the integer or smallint, otherwise the decimal is a good choice. Only won’t use real or something like that. I think you already know this guy has problems…
-
6
votes2
answers599
views -
7
votes3
answers2878
viewsA: What is the best way to verify the existence of a record in the database via application?
As far as I know this form is good and there is nothing that brings significant improvement. Just this: SELECT COUNT(id) FROM tabela WHERE coluna = valor I put in the Github for future reference.…
-
10
votes2
answers1824
viewsA: Is there a difference between strtr and str_replace?
Essentially they do the same thing, but with different results in certain situations and with different speed commitments. strtr is a little faster for simple operations and str_replace is better…
-
6
votes2
answers208
viewsA: I cannot get return of floats through expressions
The problem is that you are using Python 2.7. I do not recommend using it, prefer to use version 3.0 on. First because you are following a tutorial using this version, second because there are no…
-
3
votes2
answers2443
viewsA: What do I need to program in C#?
As you may have already noticed this language is the C# (in English). It depends on a platform called .NET (in English) There’s a good chance it’s already installed on your computer. That is, to…
-
15
votes7
answers1682
viewsA: Make the class builder private?
A private constructor is useful in cases where you want to prevent the class from being instantiated or want to allow it to be instantiated only within itself. This is useful for static classes or…
-
19
votes2
answers9060
viewsA: Best practice for logging the system
The best practice is not to reinvent the wheel. It is to use a tool of log that has been well thought out and tested by professionals who dedicate themselves to this. And use these ready-made tools…
-
10
votes5
answers631
viewsA: If Else with functions
If you want to call the function, of course it works, but the syntax wouldn’t be this, it would be like this: if (a > 1) { Save(); } else { NoSave(); } But if you want to define functions…
-
21
votes2
answers1634
viewsQ: What is ASP.NET vNext? What is the correct name?
Okay, I know that ASP.NET vNext is the new version of ASP.NET being released by Microsoft in 2015 and that brings big changes changing the way of working various things. This vNext name was used as…
-
6
votes3
answers2379
viewsA: How to see how much memory occupies such a variable in C++? And how to use the define?
The #define should not be used in C++ (actually not even in modern C), use a constant with the keyword const. Anyway I showed an example of #define. I made an example in the C++ patterns showing the…
-
2
votes2
answers94
views -
7
votes2
answers120
viewsA: Why do certain services still depend on the Java plugin?
The main thing is that these plugins how Java provides almost unrestricted access to your computer. This is great "advantage" of having an application running Java in the browser. At least that was…
-
6
votes1
answer1769
viewsA: How to insert UUID automatically into a Mysql Database?
Since autoincrement needs static constant data and UUID would have to be generated dynamically, I think the only way is to create a trigger, something like that: CREATE TRIGGER…
-
1
votes1
answer618
viewsA: Calculate rest with 2 Biginteger numbers
Just use the method of mod() class BigInteger. import java.util.*; import java.lang.*; import java.io.*; import java.math.*; class Ideone { public static void main (String[] args) throws…
-
3
votes1
answer634
viewsA: How to convert latitude/longitude to Double in C#
The conversion seems to be working ok. If you show it in a specific format you need to specify this format: using static System.Console; using System.Globalization; public class Program { public…
-
4
votes2
answers681
viewsA: "Merge" elements of a single vector
It has one form only to print and another that really calculates correctly and prints: #include <stdio.h> int main(void) { int v[4] = {0x0A, 0xBB, 0x4B, 0x18}; for (int i = 0; i < 4; i++)…
-
21
votes3
answers1556
viewsA: SQL in the code or in the database?
Take a test with both of them and come to the conclusion on your own in the conditions of what you will use. The code has less influence than the database only you have access to. And keep in mind…
-
4
votes1
answer965
viewsA: Is it possible to work with a local "community" repository in Git?
Somehow the access will be remote. Even if remote does not leave the building where you are. Even if access is done via SSH, for example, it will be remote. So strictly local gets complicated. But I…
-
9
votes2
answers2303
viewsA: Prevent an application from being closed by the user through the task manager
Generally that is not possible, especially by a code in your application. The application itself has no control over this. The most that is possible is not giving privilege to close (TERMINATE) the…
-
6
votes3
answers972
viewsA: Why are there so many ways to check if a value is NULL? How to standardize?
There are no several ways. Or there are if you consider that any code is possible to write in several ways. The second form is exactly equivalent to the first form, mainly in performance. It is…
-
11
votes4
answers2074
viewsA: How to get the format in hours when it exceeds 24?
I don’t recommend it, but you can do a little snitching: function dtLength($sec) { $t=new DateTime("@".$sec); $r=new DateTime("@0"); $i=$t->diff($r);…
-
20
votes1
answer1008
viewsA: When to increment the version using Semantic Versioning?
We don’t know. Deep down, until someone presents me with a reliable study that shows otherwise, this is more or less arbitrary. You must be referring to the concept described in website "officer" on…
-
5
votes2
answers174
viewsA: How in ASP.NET 5 is this property defined?
What you’re looking for is in the code of ConfigureHostingEnvironment.cs: using System; using Microsoft.Framework.ConfigurationModel; namespace Microsoft.AspNet.Hosting { internal class…
-
7
votes2
answers19790
viewsA: Delete all tables from a database at once
You’d have to create a script to do all the work. The simplest way to do this is to give a TRUNCATE in each of the tables. But this will not work well if you have certain constraints in the table.…
-
3
votes3
answers780
viewsA: Select data and display
There’s no simpler form than that. Yes, it creates a variable when it enters the while and reuses this variable every time it goes through while assigning a new value obtained from the database. The…
-
6
votes3
answers1826
viewsA: How to calculate PI with "n" decimal places in Javascript?
Surely you would have to create an algorithm of your own and it’s not so simple. I found that code. As there is no explicit license I do not know if I can bring here. Another code which may be used…
-
4
votes2
answers912
viewsA: How to free memory from an internal malloc to a function that returns a pointer?
The basic rule is don’t do this. But if you do the path is the one you presented, there’s not much to invent. That is, if you will not follow an organization rule that everyone establishes as the…
-
12
votes2
answers511
views -
3
votes2
answers188
viewsA: Problems running Java class
You need to instantiate the class Cliente in the variable clientes before using it. But I improve this code a little more, so: package newpackage; import java.util.ArrayList; import…
-
18
votes3
answers7424
viewsA: What are the main differences between VB.NET and C#?
Its final conclusion is the best explanation for VB.NET to exist. I’m not gonna find anything easy, but there’s some information spread around that says this is it. Unlike some languages that are…
-
4
votes3
answers8700
viewsA: Typeerror: not all Arguments converted During string formatting (Python 3.4)
First there is a previous error complicating the operation. Programming languages usually use American numerical notation so the separation of decimals is done with a dot and not a comma as it is in…
-
8
votes1
answer130
viewsA: How do I save read-only data? Should I use Sqlite in this case?
It has several forms that can be used and in this case virtually any solution is feasible. You have not given more details or requirements, it is not easy to answer this mainly without incurring…
-
5
votes2
answers1271
viewsA: Does the memory consumption of a variable increase each time it is used?
It’s not easy to measure In PHP memory consumption is not so easy to track. It is not simple to monitor consumption. You didn’t report how you did it but probably used some "naive" method that…
-
19
votes2
answers618
viewsA: How can we not allow indexing by search engines?
Just put a file called robots.txt (has good documentation in this website) in the folder you do not want to be indexed. Some searchers interpret what is written inside to learn more how to follow…
-
11
votes2
answers18486
viewsA: What is the Role attribute for?
It is used more for accessibility - ARIA (Accessible Rich Internet Applications) - it provides context to the element. But it can also be used to create more complex situations, facilitate some…
-
10
votes5
answers1721
viewsA: Is it possible to change the type of the variable in Java?
It is not possible and there is no reason to do this. In theory it would be possible to create a type, or use object, to store any type but rarely this makes sense. Anyway the data type will be more…
-
15
votes1
answer1277
viewsA: What is "Runtime Environment" really?
The CLR is the Runtime Environment. O R is just Runtime. It is the infrastructure responsible for implementing the programme. In a way we can say that every program needs a system of Runtime. Some…
-
13
votes3
answers2397
viewsA: Why does "Return false;" in a click event cancel the link opening?
It is not a matter of prevailing. What happens when you click on link is that it is fired in event. This event only calls a code that must execute what the programmer wants. In case the event is…
-
7
votes1
answer112
viewsA: Recommendations for comments on an interface and its contracts
Following good practices by following is bad practice. You should do what’s right for your application. You should think about why you should do something. Because a specific practice should be used…
-
12
votes4
answers452
viewsA: & Together with PHP operators and functions
This is the reference operator. It is not very common in PHP. It causes side effects and not everyone is aware of the implication of this. Although the functioning is very similar to that of the…
-
13
votes2
answers17517
viewsA: Real difference between point operator (.) and arrow operator (->) in C?
The real difference is that the first is a reference to the limb, you’re simply saying that you should take the limb die and the second is a dereference of the pointer contained in the limb, you’re…
-
4
votes1
answer257
viewsA: Calculate x in x seconds
Just add a third parameter to the for indicated the jumps that must be given. Thus: function str2time(hora) return tonumber(string.sub(hora, 1, 2)) * 3600 + tonumber(string.sub(hora, 4, 5)) * 60 +…
-
11
votes3
answers11142
viewsA: Difference between Console.Read(); and Console.Readline();
The first reads one character of buffer and the second reads a line, that is, all characters until it finds an end of line indicator. For reading only one character Read() returns an integer…