See what the Stackoverflow community is most excited about today.
Date: 2017-12-01
-
What is the purpose of the single underscore “_” variable in Python?
tags: python, variables, naming-conventions, underscores, metasyntactic-variable
371 votes, 3 answers and 145478 views
\r\n What is the meaning of _ after for in this code?\n\nif tbh.bag:\n n = 0\n for _ in tbh.bag.atom_set():\n n += 1\r\n
-
How do I delete (unset) an exported environment variable?
tags: linux, environment-variables, unset
967 votes, 3 answers and 547486 views
\r\n Before installing gnuplot I set the environment variable GNUPLOT_DRIVER_DIR = /home/gnuplot/build/src.\n\nDuring the installation something went wrong; now I want to remove the GNUPLOT_DRIVER_DIR ...\r\n
-
Difference between “expose” and “publish” in docker
tags: docker
266 votes, 5 answers and 94604 views
\r\n I'm experimenting with Dockerfiles, and I think I understand most of the logic. However, I don't see the difference between "exposing" and "publishing" a port in this context.\n\nAll the tutorials I ...\r\n
-
How can Python iterate over dictionaries with 'for' loops using only the dict keys?
tags: python, python-2.7, dictionary, key, iteration
1657 votes, 12 answers and 2233477 views
\r\n I am a bit puzzled by the following code:\n\nd = {'x': 1, 'y': 2, 'z': 3} \nfor key in d:\n print key, 'corresponds to', d[key]\r\nWhat I don't understand is the key portion. How does Python recognize ...\r\n
-
differentiate null=True, blank=True in django
tags: python, django, django-models
506 votes, 7 answers and 118943 views
\r\n When we add a database field in django we generally write models.CharField(max_length=100, null=True, blank=True). The same is done with ForeignKey, DecimalField etc. What is the basic difference in ...\r\n
-
How to iterate over rows in a DataFrame in Pandas?
tags: python, pandas, rows, dataframe
472 votes, 10 answers and 496191 views
\r\n I have a DataFrames from pandas:\n\nimport pandas as pd\ninp = [{'c1':10, 'c2':100}, {'c1':11,'c2':110}, {'c1':12,'c2':120}]\ndf = pd.DataFrame(inp)\nprint df\r\nOutput:\n\n c1 c2\n0 10 100\n1 11 110\n2 ...\r\n
-
animating addClass/removeClass with jQuery
tags: javascript, jquery, css, jquery-ui, jquery-animate
183 votes, 6 answers and 240724 views
\r\n I am using jQuery and jQuery-ui and want to animate various attributes on various objects. \n\nFor the sake of explaining the issue here I've simplified it to one div that changes from blue to red when ...\r\n
-
Difference between .on('click') vs .click()
tags: jquery, click
396 votes, 8 answers and 237225 views
\r\n Is there any difference between the following code?\n\n$('#whatever').on('click', function() {\n /* your code here /\n});\r\nand \n\n$('#whatever').click(function() {\n / your code here */\n});\r\n
-
Rollback to an old Git commit in a public repo
tags: git, git-checkout, git-revert
505 votes, 8 answers and 523575 views
\r\n How can I go about rolling back to a specific commit in git?\n\nThe best answer someone could give me was to use git revert X times until I reach the desired commit. \n\nSo let's say I want to revert ...\r\n
-
Why must wait() always be in synchronized block
tags: java, multithreading, concurrency, wait
194 votes, 8 answers and 97439 views
\r\n We all know that in order to invoke Object.wait(), this call must be placed in synchronized block, otherwise an IllegalMonitorStateException is thrown. But what's the reason for making this ...\r\n