Posts by mateusalxd • 2,768 points
68 posts
-
1
votes3
answers351
viewsA: How to access the key, by value, in python dictionary?
You can do the same that answer (mentioned in the commentary): print(max(people, key=people.get)) or if you prefer, go straight through the keys of the dictionary and compare their values: names =…
-
0
votes1
answer53
viewsA: Python - print blank cells in excel
In your code, you have a for for the lines, only one was missing for for the columns: import openpyxl, smtplib, sys #Abre a planilha e obtém o status do último pagamento. wb =…
-
1
votes2
answers53
viewsA: Browse and collect data from dictionaries within a list
Another approach would be to use reduce: import functools dados = [{'sexo': 'M', 'idade': 44}, {'sexo': 'F', 'idade': 33}, {'sexo': 'M', 'idade': 55}] def reduzir(anterior, atual):…
-
0
votes1
answer240
viewsA: Include or sum key/value type elements in a javascript array
There’s more than one way to do this, I’ll show you one using a little functional paradigm. // simulei essa variável como o resultado que vem do banco const retornoBanco: any[] = [{ item: 10 }, {…
-
0
votes1
answer48
viewsA: Result Hierarchy prioritization in a view (Largest Record and Order specifies within the largest record)
Without the table structures and the data, it is more complicated to give an answer including your tables and columns, so I will present two approaches to do what you need but more generally. From…
sql-serveranswered mateusalxd 2,768 -
2
votes1
answer724
viewsA: Replace space with new powershell line
As stated in this comment, single quotes take text literally, to do what you want, use double quotes: set id=1 powershell "(gc %id%_01.txt) -replace '[a-zA-Z]','' -replace ' ',"""`r`n""" | Out-File…
-
2
votes1
answer54
viewsA: How to extract strings from 4 different files, and insert into a single line of an HTML document
From what I can understand, there is a corresponding line in each text file, so you can make a for of 1 until n, where n represents the total of lines to be covered in each file, something like:…
-
2
votes3
answers168
viewsA: Compare python 'E' letter
In your code, what’s happening is that you’re just making transformations on new_user and not in the current_users, a way to solve this would be by normalizing the two lists and then comparing, for…
-
1
votes1
answer36
viewsA: Incorrect grouping of lines
One of the ways to solve this would be to count how many records you have dt_fim in the corresponding month and meeting the other criteria of WHERE, after arriving at this value, you check if there…
-
2
votes2
answers112
viewsA: How to select 2 records in an SQL Table in a given sequence?
From what I could understand, when it rains, the columns related to rain receive the value 1, when it doesn’t rain, they get the value 0. Depending on your version of SQL Server, I believe you can…
-
3
votes1
answer1394
viewsA: Remove and replace vowels in any sentence, C
I analyzed your code, unfortunately I could not understand it and fix it, but I noticed the following: for(c = 0; c <= fraseOriginalLen; c++) - if you have 6 positions in the vector, you go from…
canswered mateusalxd 2,768 -
0
votes2
answers150
viewsA: Inner Join Database
To be able to do what you need, you can use the function RANK in this way: WITH resumo AS (SELECT A.Nome NomeAluno, D.Nome NomeDisciplina, MAX(N.Nota) MaiorNota, RANK() OVER (PARTITION BY D.Nome…
-
3
votes2
answers1194
viewsA: Fill a Datatable from a list of a complex type
The same way you used Reflection to recover generic type properties, you can also use Reflection to recover the value of the property for an instance of that type, it would look like this: protected…
c#answered mateusalxd 2,768 -
2
votes1
answer59
viewsA: How to select double contacts from a table
To make it easier to understand, I created the two tables with the columns informed: CREATE TABLE Usuarios ( id integer, nome varchar(20) ); CREATE TABLE Amigos ( id integer, idUsuario integer,…
-
3
votes1
answer99
viewsA: Doubt about using LEFT JOIN in mysql
In this case, you will return all student table records, even if they are not in the test table, but since you are filtering data from the test table, you should also consider the null value,…
-
2
votes1
answer7098
viewsQ: How to go to an anchor on a page with little content?
I’m creating a page using Bootstrap and would like to put some anchors in specific locations, it turns out that as the page has little content, the element that represents the anchor does not go to…
-
3
votes1
answer332
viewsQ: How to format values with custom string formats?
I am developing a graphic and would like to put the values of the Y axis as the image below: I have verified that it is possible to do this through custom string formats in that way…
-
1
votes1
answer1645
viewsQ: How to add items dynamically in a Listview that is inside a Fragment?
I’m developing a layout in an Android app that will be used in Tablets, basically the layout main possesses a Toolbar, one Drawerlayout, one Framelayout and a Fragment, as is below: <?xml…
androidasked mateusalxd 2,768 -
3
votes1
answer430
viewsA: Datagridview windows Forms
You can use the property Selectedrows of your Datagridview and take the cell referring to Id, something like that: In C# int id = 0; foreach (DataGridViewRow linha in dataGridView.SelectedRows) { //…
-
1
votes3
answers2241
viewsA: How to create nonexistent columns in a Datatable?
If your columns do select and the records of table tb_situation are always fixed, you can do right in your select, that way: -- considerando que o id_situacao -- 1 = 'APROVADO' -- 2 = 'REPROVADO'…
-
1
votes1
answer136
viewsA: Displaying null results for mysql related tables
You can use OUTER APPLY (with SQL Server) or a sub-query on Join (I think in other banks), something like that: Using OUTER APPLY: select p.*, oau.* from PERMISSAO p outer apply(select u.* from…
-
1
votes1
answer416
viewsA: Change of Users
There’s probably more than one way to do this, I’ll give you a basic example and you change it according to your needs. Login Form: using System; using System.Windows.Forms; namespace…
c#answered mateusalxd 2,768 -
1
votes2
answers264
viewsA: Enable Keypress in Panel C#?
If I understand correctly, your problem is in foreach (Object item in Controls). When you only use the Controls, you are picking up the collection of controls from your form, such as the Textbox is…
-
3
votes2
answers934
viewsQ: Is it possible to use Actionbar on Android natively?
I’m doing some test applications and I ended up coming across something that has caused me many doubts, the Android support libraries. I tried to develop an application that uses Actionbar natively…
androidasked mateusalxd 2,768 -
2
votes3
answers12716
viewsA: SQL Grouping by name, date and quantity by month
You can use the internal function MONTH, which returns which month of the given parameter, which must be a team, date, smalldatetime, datetime, datetime2 or datetimeoffset, as stated in the function…
-
0
votes3
answers2429
viewsA: Calling event from within code
If you intend to use only the property SelectedValue of RadioButtonList, you can create a method that takes a parameter of type String, something like that: protected void MeuMetodo(String…
c#answered mateusalxd 2,768 -
1
votes2
answers1804
viewsA: Running program in the background
In accordance with commenting, you can use the library Jnativehook, follows demo code that is on the library’s own page. import org.jnativehook.GlobalScreen; import…
javaanswered mateusalxd 2,768 -
4
votes1
answer1320
viewsQ: Composite primary key or primary key plus single index?
I am developing a report in my system to control the productivity of teams, the table of teams has the following information: (tblequipe) | id (pk) | nome | meta | | 1 | EQ01 | 5 | | 2 | EQ02 | 7 |…
sql-serverasked mateusalxd 2,768 -
1
votes1
answer296
viewsA: How to use Autofit in C#?
You can use the method AutoFit in that way: public void exportarExcel(InformacaoDB info, string nomeArquivo) { [...] xlWorkSheet.get_Range("A:D").EntireColumn.AutoFit(); [...] } Something that I…
-
10
votes2
answers352
viewsA: What does the operator = mean in C#?
Only by completing the @Maniero response, how are you making one foreach about a String, means that you are traversing character by character from chave and performing a XOR between the variable…
-
0
votes1
answer866
viewsA: How to validate a date on a Datagridviewtextboxcolumn?
As @Jota suggested in the comments, I used the event CellValidating together with KeyPress, was like this: private void dataGridView_EditingControlShowing(object sender,…
-
0
votes1
answer866
viewsQ: How to validate a date on a Datagridviewtextboxcolumn?
I’m creating a form where the user will input data through a DataGridView, one of the columns of this DataGridView is the type DataGridViewTextBoxColumn and it will receive a date, I would like to…
-
20
votes5
answers1879
viewsQ: What is the difference between an explicit cast and the operator as?
Whenever I convert an object to a specific type, I use a cast explicit, for example: private void textBox1_Leave(object sender, EventArgs e) { TextBox textBoxTemp = (TextBox)sender;…
-
2
votes3
answers1895
viewsA: Dynamic Query in a List
I made a little adaptation of How to: Use Expression Trees to Build Dynamic Queries (C# and Visual Basic. To make it easier to understand, I’ll create the class Cliente. public class Cliente {…
-
2
votes1
answer1354
viewsA: Text break in Windows Reporting (RDLC) column
In accordance with that question in Soen, change the property KeepTogether from your Textbox to true, to keep on the same page, or to false, to break to another page.…
-
2
votes2
answers501
viewsA: Error canceling file import in Excel
The method Application.Getopenfilename returns a value of type Variant, which can be a file, a file array or the boolean value false if the operation is canceled, then you can do a check before…
-
17
votes1
answer2508
viewsQ: How to develop two versions of the same application, one free and the other paid?
I’m starting the development of an application for Android using Android Studio, I intend to make it available in two versions, one paid, with more features, and one free, more basic. I thought…
-
2
votes1
answer795
viewsA: Is it possible to rename a folder with files inside using VBA (Outlook)?
Yes, it is possible, the problem is that you are doing the following: 1 - Opening the file 2 - Reading the file 3 - Grabbing the folder reference temp 4 - Changing the folder name 5 - Closing the…
vbaanswered mateusalxd 2,768 -
4
votes2
answers639
viewsA: How to get all paths of a Jtree?
Only by complementing the @Renan response, you can also scan the JTree in that way: private void outroMetodo() { List<Object[]> niveis = new ArrayList<>(); DefaultMutableTreeNode raiz =…
-
2
votes2
answers2851
viewsA: Enable/Disable Button according to Checkbox value in a Datagridview
You can do this using the event CellValueChanged that way: private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { // se a célula alterada for a célula de interesse…
-
5
votes1
answer1368
viewsA: Customize calendar C#
Using the MonthCalendar native, the most you can do is check if the date selected is a Saturday or a Sunday, something like that: private void monthCalendar_DateChanged(object sender,…
-
1
votes1
answer282
viewsA: Give preference to greater equality, mysql
Note: depending on the amount of records and the size of the column, probably the performance with the query won’t be good. One way to show the smallest difference is by considering the number of…
-
5
votes5
answers25936
viewsQ: How to pass a list of values to a Stored Procedure?
I’m creating a stored Procedure in SQL Server 2008 R2 and would like to pass a list of values per parameter, for example: Table produto ---------------- | id | nome | | 1 | maçã | | 2 | pera | | 3 |…
-
1
votes2
answers931
viewsA: Select returns nothing at all
If you want to use the DataSet, you can do it this way: public DataTable Select(bool all = true, string campos = null) { if (all && campos == null) _sql.Append("SELECT * FROM "); else…
-
2
votes1
answer242
viewsA: can not find Symbol class Builder
I looked into it, found that PlusClient is no longer approved (deprecated), if you still want to use it, use an earlier version of the API, like this: dependencies { compile fileTree(include:…
-
1
votes3
answers1571
viewsA: Textview is getting behind other objects
When you work with RelativeLayout you should take into account the relative position of the elements around you, for example: the left of (android:layout_toLeftOf), below (android:layout_below),…
-
4
votes3
answers2598
viewsQ: How to know which component is in focus?
I am making a form (Windows Forms) in C# and I would like to know how to get the component that is focused. In my form there is a SplitterPanel and within it, in the Panel2, has a TabControl with…
-
1
votes1
answer3804
viewsA: How to change a cell based on the value of another cell?
You can use the function Format as follows: Dim numeroQualquer As Integer Dim numeroFormatado As String numeroQualquer = 8 numeroFormatado = Format(numeroQualquer, "00") The value of the variable…
vbaanswered mateusalxd 2,768 -
22
votes1
answer5620
viewsA: How to make an expandable Listview?
As mentioned in the comments, you can use Expandablelistview, I’ll give you a simple example and you can change/modify as needed. In the example I will simulate a mini shopping list, where the…
androidanswered mateusalxd 2,768 -
2
votes1
answer573
viewsA: Tabs on Android
The problem in question is related to the lack of a label for the tab, as has been said here, to solve it do the following: TabHost.TabSpec spec1=tabHost.newTabSpec("IF"); spec1.setContent(R.id.IF);…