Posts by fotanus • 1,421 points
15 posts
- 
		12 votes2 answers1331 viewsA: Ruby - What’s the difference if you use two dots or quotes in a string?Short version: Use :simbolos for code control "strings", and "strings" to what will appear on the user screen. The first thing to say is that you should not confuse strings with symbols. When you… 
- 
		-2 votes1 answer146 viewsQ: When to use `for x in y`and when to use `each`In my other question I figured out the difference between for x in y and the method each. Now, I ask, when should I use each of them? Could give some examples of cases where one should use one and… 
- 
		27 votes3 answers27173 viewsQ: How do I do an entire division?Using ruby, the division of two integers is an integer division, that is, the result is an integer number. For example: 3/2 => 1 If I want the result to be a decimal number, I can use a floating… javascriptasked fotanus 1,421
- 
		27 votes4 answers9017 viewsQ: How to declare a constant in Javascript?How can I declare a constant in Javascript? I am looking for the equivalent (at least semantically) of const int NUMERO_MAGICO=3; in C. javascriptasked fotanus 1,421
- 
		12 votes2 answers5931 viewsQ: git merge or rebaseWhen I program using git, I always use merge from my branch in master to add new code, but some graphic tools like smartgit rebase instead of merge. I must use the command rebase or merge to add my… 
- 
		14 votes4 answers17336 viewsQ: How do I copy commits from one branch to another?I’m using the following workflow with git: I set a task I create a branch for her from the master Implement the task I pull on the master I merge my branch into master I push the master However, I… 
- 
		10 votes1 answer165 viewsQ: What is the difference between `for x in y` and `Enumerable#each`?We can iterate an array/list in ruby in two ways: Using the syntax for x in y: > for x in [1,2,3] do > puts x > end 1 2 3 => [1, 2, 3] Using the method .each > [1,2,3].each do |x|… 
- 
		1 votes3 answers3165 viewsA: Function to increment value within the divThere’s nothing wrong. Your code works. You can check in the jsfiddle Answer the question after edited There are some syntax and logic errors. I think you want to that. I advise you to stop thinking… javascriptanswered fotanus 1,421
- 
		1 votes1 answer138 viewsA: Do not use hidden_field fields in nested formsSo, formally responding to, Change <%= form_for(@responsible, :url => (@responsible.new_record? ? enterprise_responsibles_path(@responsible.enterprise) :… 
- 
		2 votes4 answers15127 viewsA: Uncaught Syntaxerror: Unexpected end of inputYou can use the javacriptlint for that reason. Just copy and paste the code there and it shows you syntax errors. The site is a tool lint. Unfortunately there isn’t a wiki page for lint tools in… javascriptanswered fotanus 1,421
- 
		4 votes3 answers1327 viewsA: Place information in field fields of a URL and send to the server with a program languageUsing Java you can use the framework Selenium. After writing a script, it opens the browser and "has a life of its own". At first, Selenium is a framework for testing web graphical user interface,… 
- 
		4 votes2 answers3111 viewsA: How to check the database update from a browser?The model adopted by web servers before HTML 5 are one-way requests, which in practice means that the server can never send a request to the client, only the other way around. The server can only… 
- 
		0 votes3 answers131 viewsA: Problems with belongs_to when using Ajax in Rails 4Most likely your object has an ID of a product that has already been deleted. I guess the following doesn’t work either: <td><%= Product.find(i.product_id) %> </td>… 
- 
		1 votes1 answer86 viewsA: How to test a Singleton class in Ruby?Better show with an example: # Obs.: Não foi testado describe MySingletonClass do subject { MySingletonClass.instance } describe '#to_s' do it 'works' do expect(subject.to_s).to be eq(subject.to_s)… 
- 
		10 votes3 answers10991 viewsA: How to escape quotes in Postgresql?To escape quotes, you can duplicate them. Example: f_criaproduto('meu produto é ''televisao'' da melhor qualidade') To avoid the problem of having too many quotes to exhaust, you can use the dollars…