Posts by Jéf Bueno • 67,331 points
1,254 posts
-
12
votes5
answers1461
viewsA: Is it possible to code the size of the object in memory?
Directly is not possible. And I would still say that the . NET does not provide any mechanism in which it is possible to obtain this information precisely. A good idea, even if subject to failures,…
-
4
votes1
answer374
viewsA: Browse Sites By Clicking Previous and Next Buttons
Well, here’s a possibility, using only basic things. Create a array within the scope of the class (of form in the case), in this array will be saved all sites in your "list" of sites. And create,…
-
1
votes2
answers155
viewsA: validate <form> with Javascript
The key that closes the function ValidateContactForm is in the wrong place. This if (ISBN.value == "") is lost in the code, it should be inside the function that makes the validation. See working (I…
-
7
votes3
answers2438
viewsA: Doubt in Calculation of %
Rule of three. It’s more a mathematical question than C problem#. var percentual = (valorVendido * 100) / valorMinino;
-
3
votes1
answer256
viewsA: Insert the value of an attribute into a textbox
It’s a little simpler and more intuitive in C#. Instead of using methods get and set just assign and retrieve the values of these properties (attributes). Who cares about get's and set's is the…
-
3
votes2
answers16529
viewsA: Cannot set Property 'innerHTML' of null
Well, the error can’t be more descriptive than that. You just need to know how to look for the problem. See the error: Cannot set Property 'innerHTML' of null Which part of the code tries to set the…
-
8
votes2
answers7167
viewsA: Error trying to delete with INNER JOIN in MYSQL
You need to specify from which table you want to delete the record. In the example, I added an alias to the table tb_users and specified that I wanted to remove the record from this table. DELETE…
-
2
votes1
answer62
viewsA: Nav-Burger Collapse onclick
Just add one eventListener and swap the class of the element validating whether the menu is open (then it is closing and must be changed to fa-close) or not (is opening and must change to fa-bars).…
-
7
votes2
answers113
viewsA: Use of@in variables
In Javascript, this means nothing, not even a valid variable identifier (like $ or _). In the Coffeescript, the @ is the same thing as this. Only syntactic sugar. In Typescript, the @ inherited from…
-
6
votes3
answers4491
viewsA: How to check if the program is already running in C#
Use the class Mutex. Processes can have equal names and this can get in the way. Especially in a context where there is no complete control of the destination station. using System.Threading; class…
-
5
votes2
answers4105
viewsA: .addeventlistener() is not a function
document.querySelectorAll returns a list of elements and not an element as such. Soon, loginBtn is a array and cannot add a eventListener in a array. If you want to add the same eventListener for…
-
2
votes1
answer84
viewsA: Problem picking up file key . resx
I don’t know why this doesn’t work, but you can try it in the standard way Resources.globalization.ResourceManager.GetString("mail_from")
-
2
votes1
answer1865
viewsA: Store user logged in variable . bat
Use the global variable %username%.
-
8
votes1
answer515
viewsQ: What is COM (Component Object Model)?
I was reading this question1 here on the site and I have sometimes come across the term "objects WITH". A brief survey showed me that WITH that is to say Component Object Model, but I couldn’t…
-
1
votes3
answers106
viewsA: Filter per parameter or all
Just check if there is a value in the variable that stores the filter and work on a boolean expression. Example If he goes nullable and null represent the absence of parameter (i.e., return all…
-
3
votes1
answer91
viewsA: Error with Arraylist data display
This exit is correct. The second parameter of JOptionPane.showMessageDialog will be converted to string and this is the standard implementation of .toString() in class Object (all classes inherit…
-
3
votes1
answer601
viewsA: How can I set my Controller values for an Ionic / Angularjs form?
As the directive already exists ng-model pointing to $scope.usuario.cep, you only need to assign a value to $scope.usuario.cep and let the two-way data Binding do your magic.…
-
5
votes3
answers146
viewsA: Performance "Where in foreach vs if"
There is not much mystery. Without knowing the details of how the language works is just measuring and making an average to have a base of which is faster. In my trials, with three million records,…
-
1
votes1
answer157
viewsA: How can I add paragraphs to a TEXTAREA TAG?
Basically only need to validate when typed Tab and add a tab (\t). $(document).delegate('#textarea', 'keydown', function(e) { var keyCode = e.keyCode || e.which; if (keyCode == 9) {…
-
1
votes1
answer2649
viewsA: How to calculate 2 n and (2 n)+1 in java?
It’s simple, just do the power calculation and then add 1. As there are more details below. The code calculates all the powers of 2 and the powers of 2 added with 1. Scanner input = new…
-
2
votes2
answers212
viewsA: Assign Tuple return in two variables
Has. Just create a tuple to receive the return (string retorno1, string retorno2) = SearchTerra(artista, musica); Or else var tupla = SearchTerra(artista, musica); // Acessando tupla.item1;…
-
1
votes2
answers15349
viewsA: Factorial algorithm in Portugol Studio
The first thing you need to keep in mind is that the loop (para) needs to be reversed. This is because it will become easier to concatenate the multiplications into one string (type cadeia). For…
-
1
votes2
answers328
viewsA: Filling out a form’s textbox with information from a datagridview
There are several ways to do this. I almost always opt for the idea of sending the data via constructor to the new form, this makes it easy to put values in the controls right after they are created…
-
2
votes2
answers13835
viewsA: Algorithm to calculate the sum of the numbers typed in portugol
Only the sum of the last number typed is being made. soma = soma+numero needs to be inside the block enquanto, this way whenever the user enters a number, this number will be summed with the…
-
3
votes2
answers895
views -
5
votes1
answer13243
viewsA: Uncaught Syntaxerror: Unexpected Identifier
Foul the comma before the error, in both cases. success:function(data){ alert("Registro exluído com sucesso!"); $("#"+id).hide(); }, error:function(data){ //linha 14 alert("Erro!"); }…
-
3
votes2
answers690
viewsA: Return xml to preview browser Asp.net mvc
Really save XML just to show in the browser is not a good idea. It is possible to simply return Content passing as first parameter to string XML. public ActionResult GetXml(int entradaId) { var…
-
4
votes4
answers150
viewsA: How to use unsafe code on a Web Site
If the application is an ASP.NET website Add the tag compilers in the web.config file (within configuration -> system.codedom) <configuration> <!-- outras tags -->…
-
2
votes1
answer7020
viewsA: How do I solve a potentiation problem in an alternative way?
The exit is completely correct. Take the example import math res = math.pow(2, 8) # Saída: 256.0 len(str(res)) # Saída: 5 This is because when converting the variable res (who’s kind float) for…
-
3
votes2
answers153
viewsA: Print the minimum number on the list?
I think the best way is to ignore what not a number. This is because if the smaller number has floating point the other proposed solution will ignore it. In Python3 this is very easy import numbers…
python-3.xanswered Jéf Bueno 67,331 -
4
votes1
answer268
viewsA: Move image to HTML via Viewbag
Yes, several. What I find most interesting is to convert this array byte in a string in Base64. var byteArray = GerarByteArray(); string strBase64 = Convert.ToBase64String(byteArray); var imgSrc =…
-
4
votes1
answer265
viewsA: Exit Standard Event on ESC key
Yes, there are several ways to do this. My tip for you is to create a simple form with all the default behaviors for the system’s Forms and whenever you create a new form, make this new one inherit…
-
2
votes2
answers557
viewsA: Add hyperlink to Messagebox c#
There are two options: Create a form new to simulate a MessageBox In this case, it is only necessary to create a form normal, add a label for be the link and add the event to click in it. Ex.:…
-
1
votes1
answer424
viewsA: Return Controller Image and Render to an HTML Tag Using Javascript/Jquery
My tip is that you return one string Base64 instead of trying to handle the byte array in the client-side. Convert a array bytes for a Base64 string is very easy var byteArray = new…
-
6
votes2
answers2086
viewsA: How to capture all exceptions in Python?
It’s the same thing. Just use one try-except. try: aluma_coisa() except Exception as e: fazer_algo(e)…
-
2
votes1
answer138
viewsA: Error calling form screen
Is there an exception happening and you’re not seeing. The method InitializeComponents() needs to be called before any interaction with the screen components, because it is this method that creates…
-
6
votes2
answers35
viewsA: Notsupportedexception error when setting value to a Datasource
The problem is written in the error, the return of its expression is a query and not concrete data. Call .ToList() to materialize the data gridFornecedor.DataSource = modelOff.fornecedors .Where(p…
-
8
votes2
answers1163
views -
3
votes1
answer508
viewsA: Picking up a specific file in an FTP directory
It is necessary to make a request to FTP using the method ListDirectoryDetails, the return of this request will be the name of all files (and directories) separated by a line break. After that just…
-
5
votes4
answers9040
viewsA: How to return 2 or more values at once in a method?
Tuples are a good idea. Even more so with this change that comes in C# 7, this will become much more fluid and easy to read. There is still the option to use a parameter out, if it is necessary to…
-
16
votes4
answers11601
viewsA: Set constant in Python
In Python (in versions smaller than 3.8) this is not possible. Just create a variable and do not change its value. PI = 3.1415 This second option would not have the same effect as a constant, since…
-
3
votes1
answer365
viewsA: Create matrix (line header) in Datagridview
That really is a line header (Row header) and it is perfectly possible to add values to it. All you have to do is use the property HeaderCell of the line. private void…
-
4
votes1
answer250
viewsA: C# Postgree Connection Error - Locaweb
You need to have the application Trustlevel as FullTrust to execute the NpgsqlException. Locaweb does not allow applications using FullTrust. Solution: change the preview or accommodation.…
-
5
votes1
answer7602
viewsA: How to Know which version of Ionic is being used in my project
You can run the command ionic info in the project folder The way out will be something like: C:\User\ProjetoIonic> ionic info Cordova CLI: X.X.X Ionic Version: X.X.X Ionic CLI Version: X.X.X…
-
6
votes1
answer998
viewsA: Exception class creation and implementation
Well, first (I believe) its implementation of the class VectorSizeException is wrong. Syntactically it’s perfect, but semantically it doesn’t make much sense. Exceptions should be thrown, in this…
-
7
votes1
answer246
viewsQ: How do I stop watching the changes in a particular file?
The scenario is as follows. I work on a project that contains a JSON file with database configuration. Something like: { "db_config": { "conn_string":…
-
0
votes1
answer76
viewsA: Doubt with algorithm and vector
Well, it’s easy, let’s go in pieces. Dismembering the for i = 1, A[0] = 1. This instruction initializes i as 0 and the first position of A as 1. After that is only one is normal. The condition, i…
-
1
votes2
answers120
viewsA: C# MVC how statements work
It’s always by request. This doesn’t just apply to ASP.NET MVC, this is how a web application works. Basically, no server-side state is maintained. That’s why you use strategies like cookies to…
-
10
votes1
answer142
viewsA: What is the difference between the new JOIN operator and the previous ones?
What is the difference of that operator? None. JOIN is exactly the same thing as INNER JOIN. It’s just syntax sugar. In itself documentation of Inner Join of Oracle, it is possible to see that the…
-
5
votes1
answer4466
viewsA: Ignoring files by . gitignore
If the file/folder already exists in the repository, it is not enough to just put it in the gitignore, you also need to remove it from the repository. In other words, you need to warn GIT to stop…