Posts by rafaels88 • 576 points
20 posts
-
1
votes1
answer38
viewsA: Place an iterator in a table in a .pdf.erb file
Just use the method #each_with_index in place of #each to make the iteration. <tbody> <% @people[:people].each_with_index do |person, index| %> <tr> <td><%= index + 1…
-
1
votes4
answers396
viewsA: Select without id field (Ror)
Alessandro, this issue of yours is complicated and requires us to understand some things: 1) If you want to return an object without the attribute id, Rails won’t do it, and I’ll explain why: You…
-
1
votes1
answer349
viewsA: PHP script that for an operating system service
You can use the command exec, and execute a killall -9 [nome_do_processo] <?php exec("killall -9 mysql"); // mysql, por exemplo <?
-
2
votes1
answer3412
viewsA: How to change the order of the javascript array index
According to this reply, https://stackoverflow.com/questions/5306680/move-an-array-element-from-one-array-position-to-another, you can use this code: Array.prototype.move = function (old_index,…
-
1
votes1
answer753
viewsA: Can I have a single route file in Angularjs and have multiple modules?
Rod, the user must be falling into index.html when entering the site, right? Just call the file routes inside it, example: HTML <html> <head> <script…
-
2
votes3
answers4226
viewsA: How to select multiple results in one row
Even if you create an SQL for this, it will cost you a lot of processing, because you will have to break this string id_users in a list, and do a JOIN on top of it. What I suggest is that you…
-
1
votes1
answer1367
viewsA: How to create mysql.socket file
You have the command mysql on the command line? If yes, just start the service by doing: $ mysql.server start
-
3
votes2
answers213
viewsA: Error saving php mysql schedule
Brazil is in GMT-3, probably the system is configured to save in GMT+0. To fix this, you need to demonstrate the structure of your application to know who is responsible for saving this time. If you…
-
0
votes2
answers958
viewsA: Mask wp-admin/wp-login with . htaccess
Well, I don’t know what you want to do when the user accesses one of these Urls that you don’t accessible. If you want a 404, you can do so: RewriteRule ^(.*)/wp-login\.php$ /path-da-page-404.php…
-
0
votes2
answers2177
viewsA: How to change anchor links URL?
There’s no changing this symbol, because if you changed it would no longer be an anchor. What you can do is prevent the click event from spreading, preventing the browser from performing the default…
-
3
votes2
answers757
viewsQ: Angularjs Directive - Good practice
I know it is possible to create a Directive in Angularjs in the following ways: <div angular></div> <div class="angular"></div> <angular></angular> <!--…
-
8
votes1
answer1901
viewsA: How to execute a javascript function in the browser closure?
It is not possible to distinguish between the user clicking on the CLOSE of the browser, when it closes the tab or when it leaves your site through a link, but fortunately it is possible to detect…
-
3
votes3
answers318
viewsA: Is referring to an element via its id considered bad?
You already gave the answer: the maintenance of a code like this would be unfeasible. But there’s another point against it. According to the test below, you can see that getElementById runs about…
-
1
votes2
answers278
views -
1
votes3
answers266
viewsA: Pagination of Text
<style> .page {display: none} .visible {display: block} </style> <div class="page visible" id="page-1"><?php echo substr($row[texto], 0, 100);…
-
2
votes1
answer72
viewsA: Twitter API user_timeline request error
This same link in the official documentation, there is a right column with the following line: Authentication: Required Can you use another language to make these requests or do you need to do it…
-
1
votes2
answers3674
viewsA: How to create a 404 error screen
You must create a configuration for this. You can put this configuration on your web server (Apache, Nginx...), or put this configuration in the application itself: you will check if the user tried…
-
3
votes2
answers1356
viewsA: Identify repeating elements within a two-dimensional array
There are many ways to do this, but according to this benchmark, this is the most efficient solution: a = [[1,"José"],[2,"Pedro"],[3,"Maria"],[4,"Lauro"],[2,"Pedro"],…
-
0
votes2
answers1330
viewsA: How to insert a variable in the middle of the address I pass to Urllib2?
Use the method format(). id_user = 1 url = 'https://api.stackexchange.com/2.2/users/{0}?order=desc&sort=reputation&site=stackoverflow' request = urllib2.Request(url.format(id_user)) You can…
-
7
votes5
answers7447
viewsA: How to prevent spam in contact forms without using CAPTCHA?
Why not use Captcha? Well, there are several techniques to send spam, so we would have to treat all (which is impossible, since the techniques are recreated and invented every day). You can use a…