Posts by vinibrsl • 19,711 points
378 posts
-
3
votes0
answers75
viewsQ: What is the difference of declaring these strings in Python?
Is there any difference between a string declared with single quotes ' a = 'Special cases aren\'t special enough to break the rules.' and one with double quotes " b = "Special cases aren't special…
-
6
votes2
answers245
viewsQ: How to fire multiple exceptions?
foreach (Foo el in arr) { // ... Validate(el); // ... } In the example code, when the foreach is executed, an exception can be triggered from the function Validate which will be treated on who…
-
17
votes4
answers1016
views -
4
votes1
answer107
viewsQ: Is there still reason to use var in Javascript?
ES6 introduced the Keywords let and const for variable declaration. There is still reason to use var? If yes, in which scenarios to use?
-
1
votes1
answer1213
viewsA: How to use Asp net core 2 in the visual studio 2015 community?
Visual Studio 2015 only supports up to . NET Core 1.1. Officially, the . NET Core 2.0 is only available in version 15.3 or higher of Visual Studio 2017. This is because the project file is different…
-
3
votes2
answers77
viewsQ: How to get the instance itself (this) in a callback?
class Cat { constructor(name, picture) { this.name = name; this.picture = picture; this.count = 0; // ... this.img.click(function () { this.count++; // não funciona como eu espero }); } } Watch the…
-
2
votes3
answers2812
viewsQ: How to convert a string to boolean?
In Javascript, when running Boolean('false') The value returned is true and the expected was false, since strings with any non-empty content when converted to boolean return true and the empty…
-
0
votes3
answers708
viewsA: Copy a file from the server to a local folder
You can use the nomenclature UNC on the roads. File.Copy(@"\\SVR\PARAM.SAC", @"C:\SACTRM\PARAM.SAC") Also be aware of read permissions in the source file and write to the destination path.…
-
9
votes2
answers216
viewsA: How to select only the characters I want from a font?
The icomoon.io allows you to select characters and generate a new font from them easily. Just import the Awesome Font by clicking on the library icon and searching for it, select the icons you will…
-
-1
votes1
answer76
viewsQ: How to choose between types of Nosql?
Nosql databases have different basic types: Column based Key-value database Graph-based Document based database What are the differences between these types and how to choose between them?…
-
3
votes3
answers1110
viewsQ: How to find "holes" in SQL Server tables?
I have a table with a column id (primary key, auto increment value 1). My application nay allows lines to be excluded, hence the expected query SELECT id FROM tbl ORDER BY id ASC that would be it:…
-
2
votes1
answer3501
viewsA: Which Java library returns the computer language?
Try to use the class java.lang.System: System.getProperty("user.country"); Or try to use the java.util.Locale: Locale currentLocale = Locale.getDefault(); currentLocale.getDisplayLanguage(); To…
-
0
votes3
answers63
viewsA: I cannot retrieve JSON in jQuery
You need to convert this JSON that was received as text to a Object. You can use the JSON.parse, same native Javascript, as follows: let obj = JSON.parse(dados); The manipulation you use the obj…
-
0
votes2
answers3054
viewsA: Manipulating file . sql
The *.sql file does not represent the database, it does not contain the records and is not a copy of it. This is a file of script, can contain database creation, queries, table creation, Inserts,…
-
0
votes4
answers1021
viewsA: Balloon that brings information about the page
Bootstrap has a few things regarding tooltips and popovers. You said you want the user to click to appear, see: <button type="button" class="btn btn-lg btn-danger" data-toggle="popover"…
-
1
votes2
answers117
viewsA: How to connect an Azure Storage Account to an ASP.NET Core project?
Unfortunately there is no way to connect an Azure Storage Account via Connected Services using any version and layout of ASP.NET Core (at least in Visual Studio 2017), however there is a manual way…
-
5
votes3
answers590
viewsA: Never use inline styles is never really?
On websites Leave styles inline does not enable you to code reuse, which is very important in software engineering. Repurposing code (well written) will make your development time faster and…
-
-1
votes2
answers117
viewsQ: How to connect an Azure Storage Account to an ASP.NET Core project?
I’m using VS2017 with ASP.NET Core 2.0 (Angular template) and I need to do basic Tables-based CRUD operations in Azure Storage. Is there any way to scaffold my environment?
-
2
votes1
answer171
viewsQ: How to organize namespaces?
I heard that namespaces should be organized by layer, in case using some Pattern design which makes it possible, as Projeto.Controller, Projeto.UI, Projeto.Model, however, if we look at the…
-
0
votes1
answer81
viewsA: How to assign a style to all objects at once in WPF
Global styles in WPF can be done as follows: <Style TargetType="{x:Type TextBox}"> ... </Style> That would apply to everyone who’s the type TextBox or inherited from TextBox. To leave…
-
3
votes1
answer192
viewsQ: Is it bad practice to do a lot of things inside a builder? Why?
Is carrying out heavy processing, such as queries to a database or consuming an API, within class constructors considered a bad practice? Why? public class Classe { private String dados; public…
-
1
votes3
answers2510
viewsA: When not to return Task in async methods?
In addition to the answers: Asynchronous methods that do not return Task or a Task<T> are dangerous by their "strange" control of exceptions in their execution. You have no way to monitor the…
-
3
votes2
answers289
viewsA: Why doesn’t Return work?
A method can either return values or not. Methods that return values can be called functions. And we have methods that return nothing (void). Let’s look at the following function, Multiplicar(int x,…
-
1
votes2
answers86
viewsA: Is there a sure way not to wait for a lawsuit?
I circled in the background creating a new thread. async Task DoFoo() { // ... new Thread(() => { GravarLog(); }).Start(); // ... } void GravarLog() { // operação síncrona }…
-
1
votes2
answers86
viewsQ: Is there a sure way not to wait for a lawsuit?
There is a safe way not to wait for a process on . NET? async Task DoFoo() { // ... GravarLog(); // ... } void GravarLog() { // ... } In the above code, my entire process will wait for the method to…
-
3
votes1
answer99
viewsQ: How to create an asynchronous method that is cancellable?
How to create an asynchronous method that is cancellable? In this context, the DoFoo() does things that cannot simply be stopped, like reading and writing files, and when canceling, I have to wait…
-
5
votes2
answers2000
viewsQ: What is the difference between async Task and void?
I use async Task with await when I need my code to wait for such a task to complete until it performs another process. In the case of methods void, without async-await, my code also does not "wait"…
-
3
votes0
answers39
viewsQ: What are structures for. NET?
What are structures for (struct) no . NET? What differs a class from a structure? In which cases would it be more feasible to use a structure than a class?
-
5
votes1
answer503
viewsQ: How to write an asynchronous method?
I have the following method: public void Contar() { int numero = 1; for (int i = 0; i < 100000; i++) { numero *= i } return numero } Supposing that the method Contar() take time to lock the UI of…
-
15
votes3
answers2510
viewsQ: When not to return Task in async methods?
Normally, in some time-consuming tasks, I use asynchronous methods: public async Task myLongRunningOperation(int i) { ... } However, in what situations I don’t necessarily need to return a Task?…
-
0
votes1
answer149
viewsQ: VB.NET, Visual Studio and Namespaces
How to make Visual Studio 2017 + VB.NET create new classes already with namespace, as it does in C#? I’ve tried creating and editing item templates using the parameter $itemfolder$, but it doesn’t…
-
4
votes1
answer98
viewsQ: puts e p in Ruby
What’s the difference between p and puts in Ruby? When I should choose to wear one or the other?
-
9
votes2
answers5167
viewsQ: What is "stdafx. h" and what is its importance?
When creating a C++ project in Visual Studio, it automatically brings a line into the main file: #include "stdafx.h" How I am at the beginning of the study of language, seeing some "hello world",…
-
26
votes3
answers3586
viewsQ: In programming, what is an object?
In programming, it is common to hear the term objeto, often defined in multiple vague definitions, if defined. What is, in fact, an object in programming (not limited to object-oriented…
-
7
votes1
answer10500
viewsQ: When to use lists and when to use tuples?
What’s the difference between the types list and tuple in Python and when to use each?
-
9
votes4
answers10562
viewsQ: Performatively calculate the divisors of a Python number
The code I’m using is: import time def divisores(num): for i in range(1, int(num/2+1)): if num % i == 0: yield i yield num inicio = time.time() d = divisores(47587950) [print(i) for i in d]…
-
81
votes4
answers4098
viewsQ: What is pythonic code?
In Python programming it is common to hear the term pythonic (or pythonic), see: Sopt: "Understanding the pythonic way of dealing with properties" Sopt: "Pass pythonic form parameters" Wikipedia:…
-
4
votes1
answer1187
viewsQ: What is marshalling and how does it work?
I’ve been working with a device that I sent to my software some information, but this information came in the type IntPtr, to read them, I had to use the class Marshal of . NET. What is marshalling…
-
3
votes1
answer8546
viewsQ: What is the difference between FTP, FTPS and SFTP protocols?
What is the difference between FTP, FTPS and SFTP protocols and what contexts should I use each one?
-
2
votes1
answer83
viewsA: Change Aero application color
There is no documented API. Microsoft created the toolbar colors in Windows Aero to be changed by user and not by the application. However, there is the API DwmSetColorizationParameters,…
-
1
votes1
answer83
viewsQ: Change Aero application color
How to change the application color . NET/Forms in the Windows Aero taskbar?…
-
11
votes2
answers435
viewsQ: What characterizes a database?
What makes a data collection to be called a database? For example, if I have a file pessoas.txt as follows: Vinicius João Maria José And I write, read and update the data there, it is considered a…
-
18
votes3
answers1013
viewsQ: What is blockchain and how does it work?
What is blockchain and how it works? In which contexts, outside cryptocurrencies, it can be implemented and why would it be feasible to implement it in these contexts?
-
3
votes1
answer104
viewsQ: Always prefer xrange above range?
The range creates a list in memory of the number of elements defined by the programmer. The xrange has more performance, I do not know if in all cases, since it does not end up generating a list. I…
-
15
votes2
answers2209
viewsQ: What is typing style?
On Wikipedia, on the page about C# says about the "typing style" of the language: static and dynamic, strong, safe and insecure, nominative, partially inferent What is typing style? What do the…
-
3
votes2
answers662
viewsA: Convert HTML as image
Htmlrenderer It is a C#library. I recommend it because it does not need anything else besides the DLL itself, without other dependencies, if you want to save in image. Example (withdrawn from here,…
-
0
votes1
answer422
viewsQ: When is/was Absolutelayout used?
I know with this layout it is possible to define manually the positions x and y of the components inserted in layout. In which hypothesis is/was recommended the use of AbsoluteLayout, since it works…
android-layoutasked vinibrsl 19,711 -
8
votes4
answers8945
viewsQ: What’s the importance of indenting the code?
It is common to hear that it is important to keep the code indented, which is not a difficult task with the help of an IDE. Excluding languages that require indentation, such as Python, why is it…
indentationasked vinibrsl 19,711 -
1
votes2
answers1215
viewsQ: How to pass arguments by value in Python?
def somentenumeros(entrada): try: int(entrada) return True except: return False while True: cpf = input('Digite seu CPF ou digite os nove primeiros digitos ') if somentenumeros(cpf) == False or…
-
7
votes1
answer17403
viewsQ: What is the best way to concatenate strings in Python?
I know I can concatenate strings with +=, +, join() and append(). They all give me the same result when I concatenate two strings. What is the best way to concatenate Python strings? What is the…