Posts by vinibrsl • 19,711 points
378 posts
-
4
votes1
answer102
viewsA: Click event does not work in custom control
The click event is not triggered when you click on the child elements. The UserControl.Click is triggered only by clicking on UserControl and not in the Label that counters it. In his UserControl…
-
2
votes2
answers219
viewsA: Limit result to random
You can use a random ordering, so you will have your first result also random. Mysql SELECT column FROM table ORDER BY RAND() LIMIT 1 Mysql Reference Manual: Mathematical Functions (RAND())…
-
7
votes4
answers236
viewsA: Comparison syntax referring to the same variable
Why is it so? This type of conditional structure is based on boolean algebra. Yes or no. True or false. One or zero. It works like this in BASIC (1964), C (1972), Java (1995) and other languages you…
-
12
votes2
answers971
viewsA: Are there static methods in Python?
Use the decorator @staticmethod: class Classe(object): @staticmethod def funcao(arg1, arg2): pass that code produces: class Classe(): def funcao(arg1, arg2): pass funcao = staticmethod(funcao) can…
-
3
votes2
answers334
viewsQ: Is "inheritance" table a bad practice in this case?
In my database I need to store employees, customers and suppliers. Since all these share data in common, but not all the data, I decided to create a table pessoas with the columns in common: id //…
-
4
votes1
answer161
viewsQ: What are other pass applications?
In the documentation the statement pass is defined pass is a null operation. When executed, nothing happens. Useful as a placeholder when syntactically a statement is required, but no code needs to…
-
3
votes2
answers400
viewsA: How do I know if the screen is in "Extend" mode?
I don’t know anything about . NET to use Windows "Extend". Maybe you can do it with Windows API. Under Windows 7, Windows 8 and 10 you can use the system Displayswitch.exe with the argument /extend.…
-
14
votes1
answer488
viewsQ: Why is the application entry point a static method?
A declared static method means that it belongs to the type rather than the object instance. In a C#console application, the entry point is static: static void Main(string[] args) { ... } This is not…
language-independentasked vinibrsl 19,711 -
5
votes1
answer1392
viewsA: Python indentation error
See lines 41 and 42: if btc_prices >= eth_prices: #To do buy and sell prices! Here you have a conditional block and does nothing within it. It is empty. Only one commenting within. I don’t know…
-
7
votes2
answers2203
viewsA: Is a View faster than a regular Query?
Views are commonly used to improve security, prevent repetition of SQL code and semantics. In most cases there will be no improvement in performance, except if you are talking about a Indexed View.…
-
4
votes1
answer1716
viewsQ: How to create a single index based on two columns?
I have a table with these columns: ip nome email I want you to ip and the email are a single pair. The same ip may contain several records and a single email may also. But the same ip and even email…
-
8
votes5
answers972
viewsA: How to get the name of the day of the week on the first day of the month?
You can use the FORMAT too. See: DECLARE @Data DATETIME = '2017-12-01 00:00:00' SELECT FORMAT(@Data, 'dddd') AS dia_semana The return: dia_semana ------------- Friday The format dddd is related to…
-
1
votes2
answers395
viewsA: Treating JSON in C#
You can use the class JsonConvert of Newtonsoft.JSON. The installation can be done directly by Visual Studio as a Nuget package. Just run the following in Package Manager: Install-Package…
-
1
votes1
answer907
viewsA: Send email to create commitment in Google Calendar
To create an event that can be recreated across multiple calendars like Google and Apple Calendar, you can use iCalendar files (*. ics). There is the iCal.NET, an open source . NET library for file…
-
1
votes1
answer1225
viewsA: How to insert text into an existing PDF?
You can modify the document using the property DirectContent of PdfWriter. Thus modifies the content using ShowTextAligned of PdfContentByte. Source string oldFile = "oldFile.pdf"; string newFile =…
-
7
votes3
answers1011
viewsA: How to compare strings differentiating case from case?
You are comparing the password as follows: x.Senha.Equals(senha, StringComparison.Ordinal) According to the documentation the StringComparison.Ordinal makes the case-sensitive comparison, ie…
-
5
votes1
answer100
viewsA: How to return a list of each chapter?
List<List<String>> capitulos = new List<List<String>>(); StreamReader arquivo = new StreamReader("meuarquivo.txt", System.Text.Encoding.Default); while((linha =…
-
2
votes2
answers1084
viewsA: Pass SQL value to a VB.Net variable?
The method you are using to effectively execute the SQL statements is the ExecuteNonQuery(). Get noticed in the documentation, it says that this method does not return any lines. It is used to do…
-
4
votes1
answer444
viewsA: How to project an image on the big screen?
A projector is just another video output. You can press Win + P to switch between connected video devices. I don’t know if it works on Windows 7 or lower. Have a form with what you want to show. An…
-
18
votes3
answers640
viewsA: How should an error page (404) behave?
Perhaps unfortunately, the mistake is classic. The Wikipedia so defines him: the HTTP response indicating that the client has communicated with the server, but the server cannot find what was…
-
9
votes2
answers237
viewsA: Is it correct to adopt a design specification for an entire project?
Follow guidelines is not a rule. Are, as the word says, guidelines. Who is your target audience? Why would you follow the design standards of iOS to make an Android app? Little robot users are used…
-
1
votes1
answer72
viewsA: How to Binding an element that was inherited from a User Control?
You can use the RelativeSource to access the Usercontrol context. <TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Foo}" /> From…
-
1
votes1
answer152
viewsA: Image Majority Algorithm Analysis
Divide the vector into two parts n/2 --> A and A2 find n1 which is the majority element( image) of A find N2 which is the majority element (image) of A2 check whether the n1 or N2 count is larger…
-
7
votes1
answer1004
viewsQ: How to simulate load in a database?
I have an SQL Server database that recently had performance problems in production by the large amount of simultaneous users added to some implementation and architecture problems. After taking some…
-
8
votes3
answers230
viewsQ: Why are methods that operate pointers insecure in . NET?
Reading a bit of the . NET source code I realized that some methods have a peculiar modifier, the unsafe. [System.Security.SecuritySafeCritical] // auto-generated…
-
6
votes4
answers351
viewsA: What is gamification in the context of software?
Gamification gamification (of game), is the promotion of public engagement in a certain product or service through alternative ways. Stackexchange communities, Stackoverflow in Portuguese is one of…
-
3
votes1
answer123
viewsQ: How to present the untreated exceptions?
Every application fails, it’s a fact. In a Windows desktop application, when an untreated exception bursts, the following explodes on the user’s screen by closing the program: Is not a blue screen,…
-
17
votes2
answers383
viewsQ: Is gamification the same as competition?
Gamification is thus defined: is the strategy of interaction between people and companies based on offering incentives that stimulate public engagement with brands in a playful manner. Source In…
-
4
votes2
answers624
viewsQ: When using optional parameters above overloading and vice versa?
An optional parameter in C# is declared as follows (see parameter y): public void DoFoo(String x, String y = "") { ... } In many cases, this Feature can be replaced by Overload signature of the…
-
10
votes1
answer2621
viewsQ: Why use Class.forName when connecting to the database?
For database connection, in addition to the inclusion of the JDBC driver, most articles and examples use the static method Class.forName(String). See the example with Mysql:…
-
8
votes3
answers2216
viewsA: How to reverse an integer?
Analyzing the code There are some errors in your implementation. I made the corrections and will comment below. Console.Write("Informe um número inteiro para ser invertido: "); string numeroDigitado…
-
6
votes2
answers98
viewsA: Eclipse creating getter with prefix is
Boolean, logical attributes have improved getter semantics when automatically generated by the IDE. Maybe with a name attribute status is not the best case. Think about getter of property…
-
4
votes5
answers1530
viewsA: Do programs written in C# depend on the . NET Framework to run?
I don’t know anything that doesn’t require a dependency to run. Only if this dependency is compiled together with the application. If you intend to deliver your application to Windows environments,…
-
5
votes1
answer219
viewsA: How to evaluate which command to use between truncate/delete
It is always good to use the official or most reliable documentation possible. The TRUNCATE removes all rows from a table. It does not generate single line deletion logs. This is a faster way, since…
-
0
votes1
answer147
viewsA: Problem entering data with methods. Java/Mysql
comando has never been initialized and you try to use comando.execute(sqlInsert); Hence the error occurs, because comando is null. Before calling addDespesa, remember to initialize your object…
-
12
votes4
answers316
viewsQ: Is it bad practice to make this comparison?
To compare two values with a single one, I can do as in the example: if(foo == "abc" || foo == "54") { ... } But as I need to add more conditions, it starts to get complicated: if(foo == "abc" ||…
-
1
votes1
answer33
viewsA: Problem in select
The alias has to be unique. On the last lines make the following change: select P.tipo_prescricao, P2.tipo_prescricao from tbl_juntaprescricao as J inner join tbl_prescricao as P on J.prescricao =…
-
2
votes1
answer96
viewsA: Catching HTML 5 validation errors
One option is to use the attribute oninvalid: <input type="text" oninvalid="handle();" required> In your Javascript set the function function handle() { // ... } View documentation of…
-
6
votes1
answer793
viewsQ: What is the use of Task.Yield?
The documentation of this method says: Method Task.Yield() - adapted from English Creates a task suitable which returns asynchronously to the current context when awaited. I read the his source code…
-
0
votes1
answer78
viewsA: Process.Start does not load executable dependencies
Let’s think of your application as meuapp.exe and the process to be carried out subprocesso.exe. meuapp.exe is located in C:\vinicius\meuapp.exe and subprocesso.exe is in C:\foo\subprocesso.exe.…
-
2
votes2
answers1623
viewsQ: Checking whether a string is empty in Javascript. Idiomatic or readable?
I understand that it is often best to value the readability and clarity of the code by programming explicit. This does not only stop the Javascript, also the C#, Python and perhaps the rest of the…
-
3
votes3
answers542
viewsA: What files for an MEAN project should I send to Github?
First, have the Git installed and configured on your machine. As you mentioned, your project has many packages. When using a package manager it is not necessary to send the packages to the…
-
2
votes1
answer122
viewsQ: Treatment of exceptions of different types
try { await DoFooAsync(); } catch (Exception e) { if(e is TaskCancelledException || e is UnauthorizedAccessException) { // ... } throw; } The block catch from the above section checks the type of…
-
3
votes1
answer4025
viewsQ: What is the difference between the types of Binding in Angular?
In Angular (not Angularjs) there are some ways to Binding Component properties to View. <img src="{{ boundProperty }}"> <img bind-src="boundProperty"> <img [src]="boundProperty">…
-
0
votes2
answers1863
viewsA: How to decrease compilation time?
I started using Visual Studio 2017. The build time dropped from 8 minutes to 4 minutes on average. Solved for me. The visual part is still the most time consuming in the compilation. The test I had…
-
3
votes1
answer8172
viewsA: Icons do not appear - Font Awesome
In your style sheet you are using the universal selector, *, and subscribing to the font-family for Open Sans. The problem is that Font Awesome is a font. You can choose to withdraw the line…
-
2
votes1
answer3547
viewsQ: What does vendor mean?
A folder with a name vendor is commonly used in web projects. See some examples: rklet, ytd. What is the purpose and importance of this folder? Why does it have that name?…
-
4
votes3
answers2941
viewsA: What is a View on Android?
As says the documentation, to View is the most basic class for building visual components from simple to complex. In a nutshell, the View is a rectangle that responds to user interactions. The…
-
1
votes3
answers85
viewsA: Searching and opening files by name
You can use the Directory.GetFiles passing the parameter searchPattern. The parameter searchPattern is a string that supports wildcards * (zero or more characters in position) and ? (zero or one…
-
16
votes2
answers1206
viewsQ: Should placeholders contain examples or descriptions?
I am building an application and in my forms the placeholders fields are empty because I haven’t decided which criteria to use to fill them. On many websites and apps it is common to find two types…