Posts by Vitor Vezani • 491 points
24 posts
-
0
votes2
answers936
viewsA: java login screen and Mysql database
The problem is that you are not using JDBC correctly. You should use executeQuery instead of executeUpdate to perform Selects. ResultSet rs = alterar.executeQuery(query); Here is a more detailed…
-
2
votes1
answer351
viewsA: Insert dynamic filter into an Angularjs Expression
I decided to create a custom filter, surely there must be another way of doing it, but I leave here the solution used: app.filter('CpfCnpj', ['$filter', function($filter) { return function(CpfCnpj)…
angularjsanswered Vitor Vezani 491 -
3
votes1
answer351
viewsQ: Insert dynamic filter into an Angularjs Expression
I am trying to insert a dynamic filter according to a field of an object in the ng-grid. I tried so many ways and I couldn’t: $scope.gridOptions.columnDefs = [ { displayName: 'entity.tipoPessoa',…
angularjsasked Vitor Vezani 491 -
2
votes4
answers2028
viewsA: Identifying common snippets in two PHP strings
You can use the function strpos.For more details click here if (strpos($primeira, $segunda) !== false) echo 'true';…
-
1
votes1
answer52
viewsA: Partial does not render with enter using Ajax
In get_recommendations.js.erb was missing escape_javacript: $("#content-recommendation").html("<%= escape_javascript(render 'content_recommendation', itens: @itens_recomendados ) %>") You have…
-
0
votes1
answer52
viewsQ: Partial does not render with enter using Ajax
I have an ajax that fires when the page loads: /assets/javascript/itens.js: if ($('#content-recommendation').length) { xhr = $.ajax({ url:'/get_recommendations/' + gon.item_id + '.js', type:"get"…
-
1
votes1
answer3262
viewsQ: Take the value of the input closest to a button
Given the code below, how do I get to button.like or button.dislike, in the value of input#avaliacao_item_id (2) by jQuery? <td> <button type="button" class="btn btn-primary btn-md…
-
1
votes2
answers241
viewsQ: Active Record Rails 4
If I have a model Evaluation and I do avaliacaoes = Avaliacao.all and then avaliacoes.where("score = ?", 3). In the first command Rails searches all the ratings, what happens in the second command?…
-
0
votes1
answer66
viewsQ: Redis in Rails 4
I have an Item template. Can you store Item.all(Item::Activerecord_relation) in Redis? I tried to do so: $redis = Redis::Namespace.new("suggestme", :redis => Redis.new) $redis.set("itens",…
-
1
votes1
answer196
viewsQ: Algorithm takes 5sec but the page takes 1.5m to load
After calling a process via ajax if ($('#content-recommendation').length) { $.ajax({ url:'/get_content_recommendation/' + gon.item_id + '.js', type:"get" }); } I do this in…
-
3
votes2
answers500
viewsQ: Organize jQuery Ruby On Rails
I have an app in Rails 4 and after scaffolding it generates a *.js.coffee for each model, as I am not using coffeescript renamed to *.js and am trying to use jQuery. The problem is that I need to…
-
1
votes2
answers220
viewsQ: Nomethoderror: Undefined method `similaridade_com' for #<Class:0x007ff55873cad0> - Ror
I’m trying to create an attribute of the class that will be an array of similarities between users. Is there something wrong with this construction? There’s a better way to do it? class Usuario <…
-
2
votes2
answers123
viewsA: Performance Improvement - Ruby on Rails
I had the idea of trying to do directly in the bank to simplify the process and modified the function to: def likes query = "SELECT itm.id FROM avaliacoes av INNER JOIN itens itm ON av.item_id =…
-
1
votes2
answers123
viewsQ: Performance Improvement - Ruby on Rails
I have 3 tables: [users] 1 ------------- n [valuations] n -------- 1 [items] Where evaluation can be positive(evaluation: true) or negative(assessment: false), i need a method that returns all the…
-
4
votes2
answers1339
viewsQ: Hide and Show all li decendentes of a ul - Jquery
I have the following lists: <h4>Procedures</h4> <ul> <li">Foo</li> <li">Foobar</li> <li">FooBarBazz</li> </ul>…
-
0
votes1
answer131
viewsQ: syntax error, Unexpected ',', expecting ')' - Rails 4
The Rails interpreter is sending me this message in the following line of code: ... <li> <%= form_tag("search", { method: "get", class: "navbar-form navbar-right", role: "search" }) do…
-
1
votes2
answers403
viewsQ: Asynchronous Process in Ruby on Rails
I have a process that makes a match between the items[books, movies, music and games] of a particular user on Facebook with the items registered in my database. The problem is that the whole process…
-
0
votes1
answer235
viewsQ: link_to action and id
I want to do an action to change the password and I have the following link_to to redirect to html.erb with the correct user <%= link_to 'Mudar Senha', "edit_password_form/" + @usuario.id.to_s…
-
1
votes1
answer605
viewsQ: Relationship has_and_belongs_to_many Rails 4
I have a model of Item has_and_belongs_to_many :generous and a model Gender has_and_belongs_to_many :items, with this I also have a generous item relationship table(id_item, genero_id). I’m trying…
-
3
votes1
answer491
viewsQ: What is the difference between Controller and Helper methods?
Architectural and conceptual doubt: I own a model Item who possessed attributes nome_ptbr and nome_en. I did the following method: def display_nome nome_ptbr || nome_en end Where should I put these…
-
1
votes2
answers270
viewsQ: Order by on a Count in another table
I wanted to sort a table of items by counting the positive evaluations(another table) for that item. This query will be executed in the controler: item action: index Item: id nome Avaliacao id…
-
4
votes2
answers266
viewsQ: Updating Header with Jquery after page reload
I have a partial in Rails to load my header in all pages.. _header.html.erb: <ul class="nav navbar-nav"> <li><%= link_to "Home", root_path %></li> <li><%= link_to…
-
2
votes2
answers121
viewsQ: Ruby and Ruby on Rails version - Openshift
I tried to upload an application made in Ruby 2 and Ror 4 in Openshift and could not. Is an application made in Ruby 2 compatible with Ruby 1.9? What versions are supported by Openshift? Follow the…
-
2
votes1
answer914
viewsQ: Button with a value - Ruby on Rails
I have 2 buttons and each one will have to send a template value and will also be the submit button 1 and button 2 - depending on the button I click it will send the value to the @rating.type field.…