Posts by Maniero • 444,682 points
6,921 posts
-
4
votes2
answers2271
viewsA: Take printscreen on Android by API
I found this code on this response in the OS: //nome e local onde será gravado String mPath = Environment.getExternalStorageDirectory().toString() + "/" + ACCUWX.IMAGE_APPEND; //cria a imagem Bitmap…
-
1
votes2
answers91
views -
15
votes1
answer10002
viewsA: Differences between Natural Join and Inner Join
The NATURAL JOIN He’s just a facilitator. It is not faster or does nothing better, it only allows a shorter syntax if the junction is simple, your example illustrates this well. Both do exactly the…
-
1
votes1
answer2508
viewsA: How to compile and run C program using Sublime Text on Ubuntu 12.04?
Yes, it is possible to configure the build of it. I imagine you already know the documentation. What you probably lack is how to create a configuration file on Linux. It probably works: { "linux": {…
-
4
votes1
answer190
viewsA: Read table in Lua through C++
I found it in the user list of Lua this code: #include <stdio.h> extern "C" { #include "lua/lua.h" #include "lua/lualib.h" #include "lua/lauxlib.h" } // In Lua 5.0 reference manual is a table…
-
3
votes1
answer752
viewsA: What is the correct way to declare a javascript Function?
There is a difference between them and so it is not possible to say that there is a correct form. Each one has a purpose. The preference should be for the first form, it can be considered the…
-
5
votes1
answer222
viewsA: How to generate a random number within a range?
As the function allows to determine the maximum, just need to make a minimum offset. arc4random_uniform(max - min) + min I put in the Github for future reference. In his example:…
-
7
votes2
answers129
viewsA: Boxing is copying the data
Boxing creates a new instance of a type by reference. Boxing does not change the immutability of the type of data being stored. On the contrary, it guarantees. If you have a type for mutable value,…
-
16
votes1
answer1791
viewsA: How to apply Dexes to improve the performance of the queries?
Index clustered I don’t know if you understand the term clustered index, I imagine you’re thinking of indexes spread by machines on nodes of cluster, that’s not it. This is a term used to indicate…
-
9
votes4
answers2315
viewsA: How to format a value in Javascript?
Although there are other ways I think the best is to go in the simplest and insert the formatting characters in the appropriate locations. function formatar_valor(strvalor) { return…
-
6
votes3
answers1828
viewsA: Format Strings to RG
I cannot see a better solution than this. I thought to use ToString() or string.Format() but I didn’t find an easy solution (maybe you have: using static System.Console; public class Program {…
-
4
votes1
answer1533
viewsA: Compiler error or code error?
It is extremely rare for you to encounter an error in the compiler. Never consider this until you have a very strong reason. How many times have you found a real compiler error. In dozens of…
-
7
votes1
answer1863
viewsA: Encrypt Web.config
The ideal is not to depend on this information, it would be better to have the authentication done by other more secure mechanisms, such as the Integrated Security. Having said that, let us go to…
-
19
votes2
answers2001
viewsA: Does Delphi own a garbage collector?
Doesn’t exist in the most accepted sense of Garbage Collector, although I can question this concept. Delphi is a manual memory management language with some library facilities, similar to what is…
-
9
votes1
answer660
viewsA: Difference between Library and Helper
I never saw the term library (or library) be applied in the specific context of the MVC, even a specific technology using MVC. I’ve seen the term used in generic contexts, which obviously includes…
-
4
votes1
answer191
viewsA: Lua array/table for Javascript
There is the function concat() who does this: tabela_y = {0, 1, 2} print(table.concat(tabela_y, ",")) Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.…
-
2
votes1
answer4125
viewsA: Calculate distance between two points in C++ using struct
I did not understand which problem is being solved and after several attempts I did not get better information. Then I will solve the problems that are clearly demonstrated in the question.…
-
3
votes2
answers2673
viewsA: How big is a memory address?
It’s a little confusing. You need to learn and use the right terms to know what you’re talking about. On a computer running on 32-bit architecture it will have a 32-bit address. Note that 64-bit…
-
2
votes3
answers913
viewsA: Multiple of 10 closest to a sum
You don’t need to use the if In this case, you can solve it with pure mathematics. You need to make sure it goes to the next ten, so we’re 9 to the number found. We divide by 10 to lose unity and…
-
7
votes2
answers116
viewsA: How to make readable the code that uses String properties?
From what I understand I think the method getname() produces the result you expect: String sessionHash = new File(dirPath).getName(); Or to look exactly the same: String sessionHash = "/" + new…
-
4
votes1
answer4464
viewsA: Remove item from simply chained list
I made a basic code. I didn’t analyze all your code and I didn’t do extensive tests. There may be situations that don’t work. As I would have made several different decisions I preferred to try to…
-
7
votes4
answers14217
viewsA: How to create/maintain "global variable" in java? To log in
Yes, keep global state is not very recommended but I wouldn’t say it’s a terrible practice. In almost everything you will find a reason to use. First you need to see if you have any way to eliminate…
-
4
votes2
answers198
viewsA: Can I access a variable (not array) in PHP using index 0 as if it were an array?
Only arrays have index, so it is only possible to access values through variables that are somehow, arrays. Scalar variables cannot be accessed by indexes. Just remembering that there are two types…
-
2
votes1
answer549
views -
4
votes1
answer858
viewsA: How to work with environment variables?
I think what you want is the method getenv(). He is responsible for reading the environment variables and takes care of the specifics of the operating systems. I removed this code from official…
-
2
votes2
answers160
viewsA: Best high availability path for my need
SQL Server has some solution that helps me with this? It’s not easy to say. These things need in-depth study and no one on the internet can tell you properly something that really helps you. As far…
-
2
votes1
answer1552
viewsA: How to connect to an existing Sqlite database using PDO?
According to the example available at documentation the file must be accessed by its absolute address, so the name needs to be normalized to have the full path. class Database extends PDO { public…
-
10
votes1
answer430
viewsA: How do you find the term X in the Fibonacci sequence?
I was going to answer "calculating each term as far as you want". I was already thinking about making a recursive and a repetitive solution. But then I came up with the idea of looking for a better…
-
5
votes1
answer145
viewsA: Insert into database recording in half
The cut is happening when you find an accent. So the problem is the incompatibility between the coding of the data being sent by the page and the coding waiting in the database column. Assuming that…
-
4
votes4
answers199
viewsA: Problem accessing array element
You weren’t sweeping the whole string and I was still not restarting the count of the limit characters of each word. I would do so: #include <stdio.h> #include <ctype.h> #include…
-
24
votes1
answer3096
viewsA: How to place authorship using MIT license
I already point out that I am not a lawyer. If you have major concerns, consult one. The risk is yours to trust random people informing you about laws and licenses. If you are just using don’t have…
-
12
votes2
answers214
viewsA: What happens if I don’t specify the { }?
Why the problem exists in PHP As C has become an extremely popular language, and to succeed, others seek to copy its syntax, as is the case with PHP. The problem This is the so-called dangling Else.…
-
6
votes6
answers8412
viewsA: Function that enumerates letters of the alphabet
You need to build a table with your alphabet. You can put the letters you want from any alphabet in the order you want. Then just do what you call lookup in this table. function converte(letras) {…
-
8
votes3
answers2955
viewsA: Function that returns function in Javascript
Actually this code runs in this order: Flame hello(3,3) Within hello executes b+1 resulting in 4 Flame hi(3, 4), the values of a and b+1 Within hi multiplies and returns a and b (result 12) Back to…
-
13
votes3
answers10600
viewsA: Generate random data within a range
Make use of what is already ready (Random) and be happy. It works better and takes less work: import java.util.*; class Main { public static void main (String[] args) {…
-
5
votes1
answer415
viewsA: How to get 4 last numbers from a variable?
You can use the module operator to get the rest of the division of 10 (our numerical base) raised to 4 (the digits you want to pick up), ie 10000. import java.util.Calendar; class Program { public…
-
9
votes6
answers96354
viewsA: How to make an "Alert" in PHP?
The alert is not a good solution to show some message to the user in the browser but I will reply what you asked: mail($email,$assunto,$mens,$headers); echo "<script…
-
15
votes4
answers1580
viewsA: Is this a common practice in object orientation?
Solution to the problem First I’ll give you the simple solution to your problem of initializing a large amount of properties: var pessoa = new PessoaJuridica { NomeFantasia = "abc", RazaoSocial =…
-
11
votes5
answers2736
viewsA: Test whether all characters of the first string also appear in the second
There’s nothing ready but(see below) it is not difficult to create a function that does this. If I understood what you want, it would be this: #include <stdio.h> int contem(char s1[], char…
-
2
votes1
answer758
viewsA: Freeze Windows clock
I may not have understood what you want, but from what I understand, it’s not possible. No programming language with any library has the capacity to make such a profound change in the operating…
-
8
votes2
answers1303
viewsA: Picking up content within a string
A simple way to do this is to locate the position of the two parentheses and take the inner part, like this: using static System.Console; public class Program { public static void Main() { var texto…
-
9
votes2
answers1267
viewsA: Size of an Arraylist
The initial capacity is 10 elements, if not specified in its creation. And when it reaches its maximum it is transparently reallocated (internal implementation) with twice the current capacity if…
-
2
votes2
answers4494
viewsA: Scroll through a list of characters
To separate the blocks. After separating the blocks you apply the separation of the individual fields as shown in your another question. using System; using static System.Console; using…
-
8
votes1
answer8805
viewsA: Separate string by number of characters
The method you are looking for is the Substring(): using static System.Convert; using static System.Console; public class Program { public static void Main() { var exemplo = "13032015joao"; var dia…
-
6
votes3
answers8025
viewsA: Difference between decimal and Numeric
For Mysql they are synonymous. The SQL standard defines that there is a difference between them but Mysql has simplified this and only the behavior of NUMERIC has been implemented. So it’s a matter…
-
25
votes2
answers4023
viewsA: Can it be considered a bad modeling practice to store all people (customers, employees, suppliers) in the same table?
Introducing On the contrary. The idea of separating the activities of the entities that have business relationship with the organization is old and was used because no one had thought about it…
-
3
votes2
answers80
viewsA: How to ensure that the instantiation of a class is done only through "using"?
It is recommended to do so whenever a class implements the interface IDisposable. Unfortunately the compiler and even Visual Studio do not help to guarantee this. I even understand that the compiler…
-
3
votes3
answers4129
viewsA: Directory problems
It depends on where you want to get the current directory you should do it: using System.Console; using System.IO; using System.Reflection; public class Program { public static void Main() {…
-
7
votes1
answer408
viewsA: Var inside the FOR when starting at 0(zero) Count should be Count-1?
Yes, you’re right, it’s basic math. If you have 10 elements, and you start counting from 0 to 9: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The Count tells you how many elements you have in the list. Then you…
-
5
votes1
answer1541
viewsA: Send array by GET
I can assemble the logic to access the table that I imagine comes from your page but this depends on which library you are using to receive the data. I will simulate the data received from the page…