Posts by Rubico • 1,936 points
67 posts
-
1
votes1
answer141
viewsA: How to update Forms in Django
Nathan, when you load the data this way class AddPontoForm(forms.Form): tipos = [(0, 'Selecione'), (1, 'Entrada'), (2, 'Intervalo'), (3, 'Retorno'), (4, 'Saida'),] nomes_cad =…
-
1
votes2
answers719
viewsA: python: Attributeerror: 'int' Object has no attribute 'Count'
You reversed the Count method call. You are calling the Count method from the integer: n.count(number_sequence) But the method count belongs to list and counts how many times a certain value appears…
-
0
votes2
answers81
viewsA: Take a hardware variable and play in a software
Nathalia, I may be clouded, but I believe the mistake is in your for loop. for ( pressao=0; pressao>1024; pressao++) { //valorpress = analogRead(pressaoPin); //pressao=map(valorpress,0,50,0,40);…
-
1
votes1
answer744
viewsA: Using search and pagination field with Function Based View in Django
@Regis I believe that the filter has priority over paging, because first you should know what is the result of your filter and then page the results returned by it. Then the code would look like…
-
0
votes1
answer711
viewsA: Django - Unicodedecodeerror: 'ascii' codec can’t Decode byte 0xc3 in position 32: ordinal not in range(128)
According to this reply what is happening is. In the path of your project there is some character that Django cannot process. Example: /home/usuario/AndrÀ/projetos/ in this case Django will not be…
-
1
votes1
answer140
viewsA: Generate random class with Jquery
You don’t have to be a jQuery God for that :) To randomly set the color when the page is loaded just use this: var colors = ['red', 'green', 'blue', 'yellow'] var random_index =…
-
2
votes1
answer85
viewsA: Doubt while loop
Glaucio, you can perform your summation function both in a loop while how much in a loop for. def soma(lista): total = 0 for item in lista: total += item return total a = [1, 2, 3, 4] print soma(a)…
-
1
votes1
answer526
viewsA: Function return jQuery
Lipearu, if I understand correctly, you want to take the return of your jQuery function and use it in your PHP script. But this is not possible, in a very simple way what happens is: User makes a…
-
12
votes5
answers259
viewsQ: Login based on email domain
I’m thinking of a system where only users who have email with domain name empresa.com may register. After registration an email will be sent to validate the email. So far so good, I can easily…
-
0
votes2
answers42
viewsA: Recovering DOM objects ordered by a criterion
Dude, i didn’t understand what you meant by order of coordinates, but I did an example of how you can customize the ordering of an array. HTML <div data-gs-x="8" data-gs-y="0" data-gs-width="4"…
-
12
votes5
answers1956
viewsA: Difference between JSON and String data
Dude, I will abstain from comparisons between JSON and XML and keep the focus on what you asked. You put it like this: I want to know the best way to carry this data: Sending Ajax to the site and…
-
0
votes5
answers1479
viewsA: Input javascript text only
exactly how here what you want is to limit the characters that are typed. I adapted the code that was being used in the other answer to suit your problem: function bloqueioNumero (event){ var regex…
javascriptanswered Rubico 1,936 -
1
votes2
answers6574
viewsA: To enable and disable a text type input after a value selected in the combobox
Toothless, a simpler example of what you published would be: <select class="form-control" name="idTipoParticipante" id="idTipoParticipante"> <option value="0">Personagem</option>…
-
2
votes2
answers45
viewsA: Returning manager in template (Django)
Regis, i don’t know a way to do this you want without creating a new filter, or changing the context of your View. To create a new filter you can look at the django documentation, but well…
-
4
votes1
answer821
viewsA: How does Django create and verify tokens to reset password?
Excellent guy question! Come on, according to django documentation: There are 4 views for password reset: # - password_reset envia o email # - password_reset_done mostra uma mensagem de sucesso para…
-
1
votes2
answers535
views -
2
votes4
answers6154
viewsA: How to get session cookie via javascript?
Marcos, in accordance with wikipedia, to do what you want should be created a cookie Session, which is nothing more than a cookie with no expiration date. When you create the cookie with no…
-
0
votes2
answers764
viewsA: Script doesn’t work
I’ll list what I found in your file, which may be causing you problems. Your html is not completely formed. There is a closure of div extra before closing the form. Its function did not contain a…
javascriptanswered Rubico 1,936 -
1
votes1
answer50
viewsA: Ordering dictionary by obtaining values
Dude, what’s happening to my view is, when you call Counter(x) a dictionary is being created, using the values that were in your list as keys and the number of times that value appears in the list…
-
0
votes2
answers151
viewsA: Error in Django Module
@Theuzc, your meta actually is Meta. Try it there: class ProfessorForm(forms.ModelForm): class Meta: model = Professor…
-
0
votes1
answer52
viewsA: Conflict between 2 scripts
James, what is happening is: your function loadXMLDoc and buscarTempo are in the global scope and with the same name in both archives. So when the second script is loaded, it simply overwrites the…
-
0
votes4
answers926
viewsA: How to use css align for tables
I believe the problem is that your page has margin or padding that does not allow your table "paste" on the right, try the solution below and adapt to the rest of your code so that your whole page…
-
0
votes3
answers319
viewsA: How to disable console.log for a particular js file?
Programmatically, I don’t know a way. But using the replace all of any IDE is possible. Search for console.log and replace with //console.log
javascriptanswered Rubico 1,936 -
1
votes2
answers73
viewsA: I would like to know how to leave my page with this layout
Using pure HTML I managed to arrive with this code. I hope this is what you are looking for. Jsfiddle: https://jsfiddle.net/Lg55n17o/ HTML: <div id="div-left"> <div class="image"> Image…
-
9
votes1
answer388
viewsQ: Thread control to avoid lock
I’m starting a Crawler and his idea is to download all the content of a given website. It already has some "usable" features. What’s killing me is, I’m doing it multithreaded, but the threads in a…
-
3
votes3
answers896
viewsA: HREF pointing to a button
Maybe that’s what you’re looking for: <a href="javascript:$('#botao').click()">Link maneiro</a>
-
1
votes3
answers1666
viewsA: Rename gitignore.txt to . gitignore
You can open your file in the notepad and use save as. In the Save As window select tipo de arquivo as todos(*) and remove . txt from the extension. Or by the command line go to the folder of your…
-
1
votes1
answer44
viewsA: Show delete link only if there are no child categories
I think it would be something like: SELECT id, nome_categoria FROM categoria WHERE id NOT IN (SELECT DISTINCT id_pai FROM categoria);
-
2
votes2
answers614
viewsA: Enter data into a foreign key table
Pedro, this is happening because your Foreign key by default is set to NOT NULL. What you should do is change the Foreign key column to accept NULL. As I have no knowledge of your table, it would…
-
4
votes1
answer64
views -
3
votes1
answer386
viewsA: How to read an ID of a DIV, and put in a VAR?
I believe that would be it Roberval: var MinhaInfo = $('#memo-list-6 a').attr('id'); And just as a good practice tip, always try to use the standard of Omega for variables in any language you are…
-
0
votes3
answers566
viewsA: show all options of <select> without scroll bar
I’d use that if you’re sure you don’t have many options. When modifying the event onmousedown for this.size=this.options.length you make open the dropdown it always has the exact size of your number…
-
1
votes1
answer242
viewsA: How to know if a certain "class" is in use on my page?
Roberval, first your html is wrong, wouldn’t that be it: <div class"triagem"> conteudo a ser analizado</div> but yes this: <div class="triagem"> conteudo a ser…
-
3
votes3
answers531
viewsA: String.equals and Nullpointerexception method
When you do that System.out.println("teste".equals(texto)); you are calling the equals method in a literal string and comparing it to null and what is naturally false. When you this…
-
5
votes2
answers57
viewsA: Is it possible to change class of many Divs with a single js command?
Use this: $('[id^="checker-"]').removeClass('UmaVelhaClasse').addClass('UmaNovaClasse'); When you use the selector [id^="checker-"] you are searching for all elements that have the id that start…
-
6
votes9
answers2096
viewsA: How to assign a function with parameters to click without executing it?
Man, with just a few modifications I got the result I imagine you want. function mostraProdutosGrupo(g,elemento) { console.log('mostra'); //codigo que mostra os produtos elemento.unbind();…
-
0
votes2
answers175
viewsA: Line size of a drop box down when we click on the "down" button
According to that answer, you can increase the size when necessary and maintain the standard behavior when it is not necessary. <select name="select1"…
-
2
votes2
answers1064
viewsA: Java constructor with matrix
First let’s get to why you might be getting the NullPointerException: I believe there is some code missing from what you posted, otherwise the code would not even compile, but what might be causing…
-
0
votes1
answer47
viewsA: Git Permission denied for longer pathnames
I believe that the reason for the error is the bars on your path, as they are half bars and half bars against bars the error happens. Try to normalize the bars so that they are all the same.
-
0
votes1
answer200
viewsA: Bring value from a grouped record
After much pondering, this was the query I managed to get, I hope it helps you: SELECT p.produto, p.data, n.valor FROM notas n INNER JOIN (SELECT produto, MAX(data) as data FROM notas WHERE data…
-
2
votes2
answers6683
viewsA: How to order by the largest number of groupings, excluding those who have no more than one grouping?
I believe what you’re looking for is something like this: SELECT tipo, count(id) AS quantidade FROM imoveis WHERE cod = '$cliente' AND negociacao <> '0' GROUP BY tipo HAVING quantidade > 1…
-
2
votes3
answers4276
viewsA: Display menu when right-clicking?
Ivcs, I would use something similar to this code. And add an action to each of the buttons: var menu = document.querySelectorAll(".menu"); if (document.addEventListener) {…
-
6
votes1
answer6904
viewsA: pick up select text and send jquery form
opeta, I ran some tests here and I think I figured out the problem. If you notice, only your values of the kind String are not being sent. This is because you are using the +descricao instead of…
-
0
votes3
answers7717
viewsA: Open and Close div using the same Javascript button
The answer with toogle makes more sense than that work-arround I’ve come up with. Live Simplicity ;) I would use this device: $("#hamburger").click(function () {…
-
3
votes1
answer121
viewsA: Edit widgets Django
to get what you want, go to the model Professor and implement the method __str__ or __unicode__. Something like: class Professor(Model): #... def __str__(self): return self.nome #assumindo que nome…
-
2
votes1
answer1325
viewsA: Create Generic type in Arraylist to persist data
I believe that’s what you want: class Produto{ private Integer codigo; private String descricao; private Integer quantidade; public Produto(Integer codigo, String descricao, Integer quantidade){…
-
2
votes3
answers218
viewsA: htmlentities() does not work
Miguel, I searched here, and according to the w3schools the function htmlentities is used to just do the opposite of what you want. It is made so that a String is completely displayed by the…
-
0
votes3
answers958
viewsA: Query in two fields of a table
I would use: If you want to search the data of the provisions SELECT p.* FROM ocorrencia o INNER JOIN providencia p ON (o.cod_ocorrencia = p.cod_ocorrencia) WHERE o.cod_ocorrencia = 1; If you want…
-
2
votes1
answer45
viewsA: SQL to know the last edited record
From what I understand, you record the editing date in the uedita column. So if you sort by the uedita column in descending order. $sqlidcidade = "select id, titulo, tipo from imoveis where cod =…
-
1
votes2
answers620
viewsA: Enable TAB key for next field in Regexp
I got something that worked for me. $('#usuario').bind('keypress', function (event){ var regex = new RegExp("^[0-9a-zA-Z \b\0]+$"); var key = String.fromCharCode(!event.charCode ? event.which :…