Posts by mgibsonbr • 80,631 points
861 posts
-
7
votes1
answer1368
viewsA: How to detect that the div was rolled to the end?
As there is no "scroll bottom" property, the way is to do some calculations using the property scrollTop of its element (how much it has rolled from the beginning), its property scrollHeight (the…
-
7
votes2
answers428
viewsA: How to open a Unicode file inside a zip?
If you know the correct file encoding, just use the function decode in the file contents (string if it is Python 2, bytes or bytearray if you are Python 3): with zfile.open(name, 'rU') as readFile:…
-
2
votes1
answer3916
views -
10
votes2
answers603
viewsQ: How to get the identity of an object in Javascript?
Several languages have a means of obtaining the "identity" of an object, i.e. an [integer] number that is unique to each object, such that different objects have different identities. Examples: Java…
javascriptasked mgibsonbr 80,631 -
1
votes2
answers531
viewsA: Association with scope in Ruby on Rails
What version of Ror are you using? According to that answer in the English OS, when the "read-only" feature was introduced (in version 1.12.10) the default behavior was to infer :readonly => true…
-
5
votes4
answers1546
viewsA: How can I optimize a recursive method for finding ancestors?
You will hardly find an efficient solution, as the number of candidates in this case grows exponentially with each generation (i.e. one person has 2 parents, 4 grandparents, 8 great-grandparents,…
-
46
votes4
answers12597
viewsA: What are the advantages of Lambda Expressions in Java 8?
Lambda expressions are a common feature in many languages, in particular those that follow the paradigm Functional Programming (the term itself comes from Calculus Lambda, mathematical foundation…
-
7
votes4
answers10238
viewsA: Problem using paragraphs in JSON file
The use of double bars (\\n, \\r etc) is usually only necessary when dealing with a string representing another string: var texto1 = "foo\nbar"; // foo // bar var texto2 = "'foo\nbar'"; // 'foo //…
-
17
votes7
answers8794
viewsA: How to Convert Mysql Database?
A major difficulty in working with databases is that changes come from two sides: data changes occurring in the production environment, and structure changes following the "normal" process…
-
10
votes6
answers20110
viewsA: How to center the content of an element vertically?
That article (in English) describe a variety of ways to achieve this goal. For your particular case (element with absolute position) I would recommend the method "stretch": Place your element in all…
-
6
votes1
answer115
viewsQ: Is it possible to send messages from one Webworker to another Webworker?
I have a page where I intend to use a set of Webworkers to perform tasks in the background. Each Webworker has a specific function, but potentially useful to others. It is simple to receive/send…