Posts by Oralista de Sistemas • 23,115 points
435 posts
-
3
votes1
answer687
viewsA: Open and close connection each time you run the looping
Performance will be negatively impacted if you open and close connections for each item in the loop. Then the shortest and fastest answer is that you should open the connection before the foreach,…
-
2
votes1
answer310
viewsA: Data link in SQL
The term "cornice" that your friend probably used refers to the use of bad practices, because maintaining bad code is the kind of thing that in Brazil we call "horn work" or "punishment to the…
sqlanswered Oralista de Sistemas 23,115 -
2
votes1
answer48
viewsA: Encrypting Function Script and Procedures in MSSQL
If you need something you handed the client to be secret, you’ve already lost this game of cat and mouse. In fact you were already defeated before the game even started. The very article mentioned…
-
2
votes3
answers70
viewsA: Prevent a value from being selected in the dropdown
Leave the option enabled for the user to select it, and wait for it to do so to display an alert saying it can’t... That’s ugly! All that’s left is for the alert to contain the words "pegadinha do…
-
4
votes3
answers861
viewsA: Simulate "ok" via command line
That’s not possible, and for good reason. Imagine if it were possible to simulate mouse clicks by the user. Just imagine, for a moment. Now imagine a malware that does this. Now imagine that so you…
-
4
votes1
answer551
viewsA: Is it better to change native Bootstrap classes or create subclasses and overwrite?
Look, I was scratching my finger to send the question to the review queue as "mostly based on opinions". But there’s one thing about good and bad practice that’s not opinionated, it’s fact.…
-
2
votes2
answers569
viewsA: Split a query
It is possible, through UNION. But it is not recommended - the performance will be worse. The recommendation is to simplify your CASE. You open a CASE complete as "otherwise" of each case. You can…
-
0
votes3
answers1886
viewsA: Check if a date is valid
You can get portions of the text from the field and turn into numbers: string textoBruto = this.TextBoxN.Text; int dia = Convert.ToInt32(textoBruto.Substring(0, 2), 10); // onde 10 significa base…
c#answered Oralista de Sistemas 23,115 -
3
votes1
answer110
viewsA: Is there a method to remove a substring from a string?
It doesn’t exist, but you can make one. Just add to the prototype type String that all strings, both existing and those still to be instantiated, will have. String.prototype.remover = function…
javascriptanswered Oralista de Sistemas 23,115 -
14
votes3
answers1557
viewsA: How to create a popup that keeps blinking on the screen?
The infograph below shows how much the use of this technique to draw attention is elegant, pleasurable, and recommended in papers writings on user experience and interface design: If you have…
-
1
votes2
answers80
viewsA: Load code according to device
You don’t need jQuery. With pure Javascript, you can access object screen of the global variable window and get screen resolution, i.e.: console.log('Minha resolução é ' + screen.width + 'x' +…
-
6
votes3
answers97
viewsA: How to write times on console entries without repeating too much code
Create your own method that receives text as input ;) public void EscreverNoConsole(string texto) { Console.WriteLine("[{0}]-{1}", data.ToString("HH:mm:ss:fff"), texto); } Hence, whenever you want…
-
1
votes2
answers66
viewsA: Permission system
I suggest switching operators AND and OR for && and ||, respectively. The reason is the priority in the execution of operators. This can be confusing in some languages, but in PHP this…
-
2
votes1
answer76
viewsA: Extract free text field dates
A good solution would be to use regular expressions. If I remember correctly they are natively supported in the latest versions of SQL Server, but you specified the 2008 version. In this version, to…
-
7
votes1
answer92
viewsQ: Cloning functions in a deep way
I would like to clone some objects in a deep way. I’ve seen this question: How to create a copy of an object in Javascript ...However, none of the answers offer a way to clone a function in a…
javascriptasked Oralista de Sistemas 23,115 -
5
votes2
answers422
viewsA: Calculating average time
In Javascript (and in most languages, in fact), dates and times are represented in memory as the number of milliseconds from an arbitrary date-time. You can see this number when using the function…
-
4
votes4
answers19183
viewsA: Is it possible to comment on a JSON file?
The specification does not allow, but if you have already sold your soul to the devil and someone is pointing a gun at your head, you can apply a gambiarra. To a parser that does not obtain JSON…
jsonanswered Oralista de Sistemas 23,115 -
12
votes4
answers27125
viewsQ: Multi-line selection in VS Code
Is there any way to make multi-line selection in VS Code, the way it is done in Sublime and other IDE’s? I tried the ALTSHIFT + arrow that works in Visual Studio, but instead of selecting multi-line…
visual-studio-codeasked Oralista de Sistemas 23,115 -
1
votes0
answers10
viewsQ: Compile files from multiple separate directories in a single output
For reasons beyond my control, I have my source code in separate and unrelated directories. Like this: diretorioPai foo serverSideJS clientSideJS bar serverSideJS clientSideJS I set up the…
browserifyasked Oralista de Sistemas 23,115 -
1
votes1
answer91
viewsA: Is it possible to edit an http Response?
You can use some class methods HttpResponse while it’s still on the server. Generally frameworks like pure ASP.NET and ASP.NET MVC give you an instance variable belonging to the page or controller…
c#answered Oralista de Sistemas 23,115 -
5
votes4
answers995
viewsA: User permission - Angularjs
Do not use angular to deny access to pages. The user can modify the Javascript loaded in the browser, even if it is obfuscated (i.e.: minified) and access the page anyway. The only secure way to…
-
7
votes1
answer656
viewsA: Why do packages start with the br.com prefix in Java?
Sun, the company that created the Java language and platform, created a naming convention to prevent name collisions. Suppose you have created a library to handle geolocation. Your program has a…
javaanswered Oralista de Sistemas 23,115 -
3
votes1
answer350
viewsA: I want to put "" in my JSON numbers
In a JSON object, if a value is in quotes, this is an indication that it is a string. Numbers themselves are not enclosed in quotes. So, if what you want is for your numbers to be even text and not…
-
13
votes2
answers2954
viewsA: What is a scalar variable?
The simplest answer is that this term, which is used not only with PHP but with most existing languages, comes from linear algebra. In linear algebra, we say that a value is scalar to denote a…
-
3
votes1
answer1202
viewsA: Send Image Base64 to e-mail
Other people’s inbox is sacred. Let me repeat again, now with emphasis. Other people’s inbox is sacred.. I guess I’m not clear enough. OTHER PEOPLE’S INBOX IS SACRED! If you host an image somewhere…
-
11
votes3
answers3392
viewsA: _ (underline) in consultation with LIKE
The underline has a meaning similar to the percentage sign in condition LIKE SQL. Both are wildcards. The difference is as follows: % looking for zero or more occurrences of any character; _ looking…
-
2
votes2
answers176
viewsA: Pop Up Discount
This is immoral, and if you were my son and I caught you trying to do this kind of thing on a website you’d be out of my will. Anyway... you mentioned in a comment in the other reply a certain site.…
popupanswered Oralista de Sistemas 23,115 -
1
votes2
answers1697
viewsA: Date range C#
I recommend replacing this excerpt: foreach (var item in ordens) { if (item.DataInicioOrdem == dataInicio && item.DataInicioOrdem == DataFim) { throw new InfoException("Ja existe solicitação…
-
1
votes1
answer47
viewsA: Auto-complete jquery error with image
The problem occurs in Javascript, on the line where you call the method JSON.parse. It occurs that the variable c that the function receives is already a valid JSON object, not a string. You should…
-
4
votes3
answers590
viewsA: How do I know if one string contains another?
The class String has an instance method called Contains that meets your need. The method takes a string, and indicates whether the given string is a substring of the instance in which it was called.…
c#answered Oralista de Sistemas 23,115 -
0
votes1
answer1178
viewsA: How to go through an array and tell how many objects of each exist in it?
If you want to pick up the words, you can use a regular expression. So: let texto; // preencha a variável acima da forma que achar melhor let palavras = texto.match(/\w+/g); Explanation: the regular…
-
3
votes1
answer748
viewsA: Catch IMEI via Javascript
No, it’s not possible. And that’s good, for various reasons, but mostly: It is possible to lock a mobile device remotely only with your IMEI. This is usually done in case of theft or theft. Now…
-
2
votes2
answers52
viewsA: Doubt regarding the https protocol
Each different browser has a list of the certificates it trusts. In general, all paid certificates are considered reliable by the major browsers. For free certificates, you will have variations. The…
-
3
votes5
answers8294
viewsA: Count characters while typing
You can get the size of a string through its field length. So if you already have the word and the price, i.e.: let palavra = "Betinho"; let precoUnitario = 10; So: let valorPalavra = precoUnitario…
-
1
votes1
answer446
viewsA: How to query via AJAX and store the data in a javascript variable?
By the way Javascript works, the page executes all the code that is in it in order. The method you define as callback successful ajax request, however, only executes when server return occurs -…
-
20
votes3
answers2456
viewsA: How do I know if I’m on an anonymous or normal Chrome page?
I don’t recommend doing this kind of checking. An HTTP request needs to contain, in a well summarized form, only the address to get, the way to get (i.e.: GET) and optionally parameters for the…
-
4
votes2
answers3157
viewsA: Start Windows Forms program in the background
If you take a quick look at the file Program.Cs of your project, you will probably see something like: static class Program { /// <summary> /// The main entry point for the application. ///…
-
3
votes1
answer610
viewsA: How does the Meet-in-the-Middle attack work?
The math behind the attack is more complex than what I’m going for here in the answer, but the principle on which it’s based is simple. Algorithms such as "Double DES" and Triple DES have multiple…
cryptographyanswered Oralista de Sistemas 23,115 -
5
votes1
answer1156
viewsA: Unable to create an instance of Activex control because the current thread is not in an STA
Windows applications have two ways to deal with threads: Single Thread Apartment and Multithread Apartment. Each model has an approach on how objects can be accessed. The differences between both…
-
-2
votes1
answer2416
viewsA: Freight calculation with WS post office via javascript
Instead of success, utilize jsonpCallback. And instead of passing a function, enter her name. Thus: $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", url:…
-
1
votes2
answers4211
viewsA: Passing parameter through URL
There is no way to pass information from a client machine to a server machine that is proof of past information changes. Deal with it. If you want to make life very difficult for a hacker, you can…
-
4
votes3
answers1242
viewsA: Update based on a select
I suggest using INNER JOIN: UPDATE pedidos a INNER JOIN produtos_pedidos b on b.id_pedido = a.id SET a.custo = b.valor The problem in the original command in the question seems to be the existence…
mysqlanswered Oralista de Sistemas 23,115 -
1
votes1
answer294
viewsA: want to do a phone validation more how do I validate the dash also if the user puts?
Phone traces can only be present in specific positions, right? /^([0-9]{5}(-| )?[0-9]{4})$/ This regex says the following: five numbers between zero and nine; an optional space or hyphen; four…
-
6
votes2
answers1021
viewsA: What is a decision problem?
A Programmer is right in his answer. I got curious and went for more material. I found this on Wikipedia: In computability theory and computational complexity theory a decision problem is a question…
-
1
votes1
answer34
viewsA: Request not working in firefox
A long time ago (I think more than a decade ago) the people of Internet Explorer decided that it would be a good idea to have a global variable called event, always filled with the data of the…
-
1
votes2
answers214
viewsA: jquery time Picker, create function for "min time"
I would do as follows. From the code you already have, and with the assumption that inputs have to id entree and exit: var entrada = $("#entrada"), saida = $("#saida"); var validarIntervalo =…
-
1
votes2
answers665
viewsA: Does one script start running only after another or at the same time?
Scripts will be executed in the order they are loaded. Javascript by default is synchronous. Note that this does not mean that all the logic of a script will be executed immediately when it is…
-
6
votes2
answers993
viewsA: Is there the equivalent of Andalso and Orelse in C#?
The behaviour of the logical operator to "and "logical in the C# (&&) is the same as the operator AndAlso you mentioned. Iofc for the operator "or "logical (||) and OrElse. Operators And and…
-
9
votes2
answers137
viewsA: Constants of non-priminal types
Not. Maniero put an answer that explains the technical reasons for this. I will put here the reasons why what the author of the code did is wrong. The relevant part of the code mentioned is this:…
-
3
votes1
answer312
viewsA: Page Printing
Not. You can only count how many times the user has clicked on your print button. If that’s enough: just as you increment the modal window counter, you can increment the print button click counter.…