Posts by Zuul • 35,190 points
501 posts
-
4
votes1
answer119
viewsQ: dataTables - Add and preserve CSS class to the last column of each row
To add a CSS class to the last column of each row, I use the following method: var dataTablesOptions = { 'columnDefs': [ { targets: -1, className: 'text-center' } ], // ... };…
-
2
votes1
answer119
viewsA: dataTables - Add and preserve CSS class to the last column of each row
columnDefs is an option that allows you to set properties on startup of the dataTables plugin, but is not relived after updates to the table occur. For even after calling Ajax the CSS class or other…
-
7
votes2
answers2141
viewsA: Taking keys from an array
If what you want is the matrix key, you should make use of the following syntax of foreach: foreach (array_expression as $key => $value) Thus, for each iteration, the element key is assigned to…
-
6
votes2
answers1064
viewsA: Error using phpmailer class
In the package of PHPMailer, there are several classes, among which the: class.smtp.php used in the file class.phpmailer.php. Since you’re including the file class.phpmailer.php in your script, you…
-
6
votes1
answer49
viewsA: Presentation of the php query
One table is created using TR to open lines and TD to open cells. One TR multi-purpose TD is what you want: <?php while ($product=mysqli_fetch_object($result)) { ?> <tr>…
-
6
votes4
answers48238
viewsA: How to convert a String to Int in Javascript?
You can perform the conversion as follows: If the value is an integer: var x = parseInt("1000", 10); or Number("1000"); If the value contains or may contain decimal places: var x =…
-
40
votes1
answer8177
viewsA: What’s the difference of using PHP as a module of Apache, CGI, Fastcgi and command line?
Note: They are not "versions" or "manners"... they are modes of execution. I will try to highlight the main differences between them, advantages and disadvantages of each one. In summary a hint of…
-
5
votes1
answer101
viewsA: How to change the text smoothly?
How about a fadein / fadeOut to make the transition less aggressively: $(document).ready(function() { Janela = new BootstrapDialog.show({ message: 'Primeira mensagem<br><br><br>',…
-
4
votes1
answer681
viewsA: how to apply a mobile-only css class
Simply leave the work to the browser through a CSS Media Query: @media only screen and (max-width: 760px) { /* esconde o elemento de controlo caso em Mobile */ #el-controlo { display: none; } } On…
-
3
votes1
answer1531
viewsA: how to log off automatically after the session has expired?
A relatively simple method is to perform an x-Ajax call in x minutes to verify that the server-side session has expired. If it has expired, you direct the visitor to the desired URL.…
-
3
votes1
answer173
viewsA: Transactions by PHP Pagseguro date
Assuming Curl is installed and with the SSL protocols required by pay-off, the only mistake I find in your code is: return $output; If you do return, the following code is not executed! Delete that…
-
6
votes1
answer732
viewsA: Add and show tooltip
The Plugin Tooltips of Twitter Bootstrap can receive parameters, including trigger that we can define to manual and call the tooltip when we intend, thus staying with the same active until we…
-
8
votes3
answers1459
viewsA: How to get only the second class with Jquery?
Catch the second class The quickest I could think of is to use the method split(): $('input[name="Form1a1"]').attr('class').split(' ')[1]; Example: $(function() {…
-
10
votes5
answers3255
views -
5
votes2
answers489
viewsA: Making replace or append in a <p>?
Note: You are not using jQuery but working with pure and hard Javascript. You’re using the method document.querySelector() that returns only the first element found: Returns the first element Within…
-
3
votes1
answer157
viewsA: What is this __set_state that appears in var_export?
__set_state() is a function of the group of magic methods used by PHP in classes. Basically any function starting with __ is a magic function. This Static method is called for classes Exported by…
-
3
votes3
answers4229
viewsA: Check the running time of a Javascript function
To record the execution time, simply record the start and end within your target function. With Javascript you can make use of the method getTime() of the object Date(), which returns the numeric…
-
4
votes3
answers483
viewsA: redirecting to within site
NEVER Never log in automatically based on links that are received by email. There are an infinite number of scenarios that can make the email reach another person and/or the email be read by third…
-
3
votes1
answer662
viewsA: Comparison of Mysql hours
To find records between two dates in Mysql, you can use the function BETWEEN. If it’s a column like datetime: SELECT * FROM `minhaTabela` WHERE `campoDatetime` BETWEEN '2015-07-10 13:00:00' AND…
-
3
votes2
answers76
viewsA: Is it possible to use min, max and step in CSS?
As already mentioned, CSS does not serve to define values but to define formatting, the visual aspect of the element. You can however use Javascript for this purpose. Example with jQuery…
-
4
votes3
answers406
viewsA: Parse error: syntax error, Unexpected {
You already have the answer to your problem, but since no one has explained how the error should be read, here is my contribution so that in the future you can understand what PHP is saying: Parse…
-
4
votes2
answers4614
viewsA: Automatic update with Javascript
You are mixing Javascript with the jQuery Framework. The method .load() jQuery serves precisely for what you want, but in "Vanilla JS" things work in a different way. With jQuery: $( "#minhaId"…
-
7
votes2
answers115
viewsA: addClass() is adding class to <a href=""> instead of <img src="">
Your problem is that you are running the images as if they were side by side, but in reality the images are "children" of the elements <a/>, reason your variable $next points to the <a/>…
-
2
votes1
answer94
viewsA: Variable table
These kinds of scenarios tend to be complex when we’re developing something from scratch. The best is from a Plugin existing on the basis of Framework heavily used, so we have a base that already…
-
6
votes2
answers894
viewsA: Javascript does not work if it is placed in the head tag
Your Javascript code in the current form, is read before the elements are available in the DOM, reason it does not work giving a type error: Typeerror: calculate is null Ideally, when we talk about…
-
1
votes1
answer315
viewsA: Manipulate path from a form input sent to url
You can manipulate the action of your form at the time it is submitted: $('form').submit(function(e) { var $this = $(this), value = $this.find('input[name="q"]').val(), url = $this.attr('action');…
-
5
votes3
answers1750
viewsA: Traverse string with PHP
You can use regular expressions! To only handle the first image, you can make use of the function preg_match: $html = 'Muita cena aqui pelo meio e com tags<br><img alt="imagem 1"…
-
2
votes2
answers456
viewsA: jQuery inserts new rows into the form. How to populate them automatically?
You have id repeated in your code, jQuery will only work on the first one that finds. Should make use of classes to handle a scenario like yours: <input type="text" name="cpf[]" id="cpf"> must…
-
5
votes4
answers455
viewsA: Is it appropriate to create a`CSS Sprite` with disparate images?
CSS Sprite It’s not just a list of images combined in one file. Its main purpose is to reduce the number of requests to the server to make loading a page faster. No matter how many shots the…
-
4
votes3
answers4457
viewsA: Calling Java application via PHP
You can use the function exec() PHP to run your Java: File testar.java class testar { public static void main(String[] args) { System.out.println("Olá mundo!"); } } File testar.php echo exec('java…
-
6
votes3
answers9222
views -
4
votes1
answer371
viewsQ: Add current page to browser bookmarks
The code below is working, but the technique is old and probably outdated compared to current versions of browsers: function addFavorite( a, b ) { title = document.title; url = document.location;…
-
2
votes1
answer4307
viewsQ: Apply icon depending on the text value in the cell
Assuming as example the column E, the value of which Sim or the value Não, I am trying to create a conditional formatting that applies an arrow depending on the text present in the cell itself: Sim…
conditional-formattingasked Zuul 35,190 -
5
votes3
answers586
viewsQ: Find files containing string and rename
To locate files whose name contains a particular string, we can resort to find as follows: File example: 1429331804.H568641P9577.xxxx.example.com,S=17846:2, Command to locate by xxxx.example.com:…
-
2
votes3
answers377
viewsA: Firefox and IE cannot find source
Your rule of CSS at-rule, to @font-face, meets with incorrect statements, reason why it is not interpreted by some browsers. Correct formatting @font-face { font-family: 'Calibri'; src:…
-
3
votes0
answers85
viewsQ: Collect combined data from content with different Urls in Google Analytics
By collecting Google Analytics information for the local database, I end up consuming multiple requests for data relating to the same article on the web-site. This occurred given the evolution of…
-
2
votes2
answers1163
viewsA: Detect if the event was triggered by the user or via script
Vanilla Javascript We can observe the properties of the object event associated with it, particularly those that record the click coordinates. If the click was triggered programmatically, they will…
-
3
votes2
answers417
viewsA: How to keep the "scroll" at the bottom of the page?
To force your element with the ID qualquerCoisa, that is receiving content, always keeping the scroll in the end, you should call your function that takes the scroll down after and whenever you add…
javascriptanswered Zuul 35,190 -
0
votes1
answer97
viewsA: Flash->php->Mysql
When making a request to a remote server, Flash needs to first check the policy file cross-Domain to determine whether requests from your domain are allowed. If you have access to the remote server,…
-
2
votes2
answers485
viewsA: How to maintain indentation and line breaks when saving a text file via javascript
The line breaks are in the generated file, but that doesn’t mean that the program you use to read the file understands what is there. A file can be saved with three types of control characters…
javascriptanswered Zuul 35,190 -
3
votes2
answers1467
views -
22
votes4
answers2297
viewsA: Is it correct to use a table in the page layout?
Whoever told you in that case not to use a table should read about tableless because apparently you know nothing of the subject. Tableless Tableless web design (or tableless web layout) is a web…
-
1
votes2
answers898
viewsA: Format tabs from an HTML menu
Compared to your current code, what you need is to apply some CSS formatting to manipulate the look of the elements until you achieve what you want. Base preparation First, we use some CSS…
-
3
votes2
answers7541
viewsA: If input has only blanks, do nothing
One solution is to check two things: If the size of string is strictly equal to nothing making use of property .length: string.length === 0 If after removing blanks a string is empty, making use of…
-
2
votes1
answer278
viewsA: Is it possible to implement a "Recycle Bin" method in SAMBA?
To implement a "Trash bin" in SAMBA, we need at least one package, a dependency for the functionality in question: vfs_recycle - Samba VFS Recycle bin vfs_recycle intercepts deletion requests to…
-
1
votes1
answer148
viewsA: Change SVG animation
Two solutions, depending on whether you want to work directly on the text box or make use of a button to trigger the update. Anyway, to change the animation speed, you need to change the attribute…
javascriptanswered Zuul 35,190 -
6
votes3
answers1678
viewsA: How to run code just in the first click?
Leaving a solution in Vanilla Javascript to attach an event of click in each <li/> present in <ul/> specified where it only fires once. Example var ul =…
-
2
votes1
answer360
viewsA: Click event on an SVG
What you’re looking for is the method getBoundingClientRect() that will return you an object ClientRect with the distance in pixels to top, right, bottom and left. The method…
-
6
votes2
answers180
viewsQ: Bash, know what board you’re running on
How do I get the path to the directory in which the script in bash is located within the script? #!/bin/bash MINHADIR="caminho/para/onde/estou" # apanhar a diretoria onde estou atualmente…
-
24
votes2
answers24948
viewsA: What is the difference between Switch, Case and If, Else?
In short, the control structure switch is a if to operate on the same input variable or expression. There is not exactly a comparison between the two to ascertain their performance given the goal of…