Posts by Fábio Batista • 286 points
5 posts
-
0
votes5
answers29639
viewsA: How to convert an int number to string in python?
There is a mathematical way to invert a number, which works for any number of digits: import math def inverte(n): digitos = int(math.ceil(math.log10(n))) return sum(n / 10**p % 10 *…
-
3
votes2
answers50
viewsA: How to sort array based on an object array
The best thing is "divide and conquer". Let’s go in parts. First, create a function that counts the amount of "compatible tags" in a box: function matches(box, tags) { return box.tags.filter(tag…
javascriptanswered Fábio Batista 286 -
6
votes4
answers6604
viewsA: How to extract a file extension in Javascript?
I like the regular expression approach: function getExtension(path) { var r = /\.([^./]+)$/.exec(path); return r && r[1] || ''; } The regular expression will look for a "dot", followed by…
-
5
votes8
answers45427
viewsA: How to disable the scroll of a web page?
You cannot disable the scroll, but you can "pin" an element to the document so that the scroll will have no effect. Something as simple as: div.fixed { position: fixed; top: 0; left: 0; } In your…
-
3
votes1
answer1278
viewsA: How to fill a Listbox using multi thread in VB . NET?
Changes to the interface can only be made by the thread running the interface itself. The easiest way to ensure this happens is to place the following code at the beginning of your method: Public…