Posts by Rodrigo Deodoro • 1,645 points
14 posts
-
0
votes1
answer168
viewsA: Reactjs - setState does not work with the first value in onClick
This is because updates of component state values do not happen immediately after the setState run - value only changes at next time render. You can check this using an Effect like:…
-
3
votes1
answer315
viewsA: Django 'bool' Object has no attribute '_Committed'
The problem seems to be that you have overwritten the method save() of Form without calling the save() original. Try trading for this code: def save(self, company): company = super(EditCompanyForm,…
-
4
votes4
answers262
viewsA: How to implement journaling in Python?
An easily visible problem in your implementation is that the way you check to see if the file journal.txt exists after reading is subject to race conditions, see How to check if a file exists using…
pythonanswered Rodrigo Deodoro 1,645 -
1
votes2
answers1009
viewsA: How to avoid blocking by number of accesses on Facebook Graph?
If your application is making more than 600 requests every 6 minutes (ie 1.66~ requests per second) there is probably something very wrong with the way you are structuring your application. Placing…
-
0
votes2
answers118
viewsA: Deploy with Capistrano - Comando su
You can put the user who deploys to the list of sudoers (via sudo visudo) so that he can do sudo without needing the root password to be typed, and to use sudo instead of su. Take care and limit the…
-
10
votes3
answers2323
viewsA: How to know if you are resize in width or height?
Save the height() and/or the width() of the object in a variable and compare in the callback with the previous value. Example working on Jsfiddle Change the width or height of the "result" window to…
-
9
votes6
answers32253
viewsA: What is the best way to create a PHP login system
When it comes to user authentication, "safe" and "simple" will hardly make sense. The way to do less work in this case, without sacrificing system security, is to use a framework that already…
-
0
votes4
answers309
viewsA: How to deal with a comet process?
The process group ID (PGID) does not change when it does Fork. You can kill (or send a SIGSTOP) by sending a signal to the process group -- do kill + plus PGID instead of PID.
-
74
votes3
answers74263
viewsA: What is the difference between the 'git pull' and 'git fetch' commands?
git fetch lowers the references (refs) with names or tags from one or more repositories (if you have another remote besides the origin configured), along with the objects needed to complete them.…
-
4
votes3
answers2416
viewsA: Use or not use bar at the end of a URL?
The idea that making a 301 redirect causes pagerank loss is a myth, and you have nothing to worry about. Any further answer will probably be a matter of personal opinion. As long as your urls serve…
-
16
votes3
answers15049
viewsA: How to check if a file exists using Python
You can do: import os.path os.path.isfile('nome do arquivo') But this approach is not considered the most pythonic. Following the principle that it is better to ask forgiveness than permission, it…
-
4
votes3
answers1254
viewsA: Effect on jQuery
Something like that? Example in Jsfiddle $(window).scroll(function () { /* checar a localização dos elementos */ $('.imagem').each(function (i) { var bottom_of_object = $(this).position().top +…
-
9
votes3
answers15165
viewsA: How to subtract two dates using Python?
Just instantiate the two dates as objects datetime.date and subtract them: In [1]: import datetime In [2]: data1 = datetime.date(day=22, month=11, year=2013) In [3]: data2 = datetime.date(day=25,…
-
13
votes3
answers15049
viewsQ: How to check if a file exists using Python
How to check if a file exists, in Python, without using a block try:?