Posts by KaduAmaral • 11,472 points
313 posts
-
1
votes2
answers625
viewsA: Read an XML in another domain
It is possible as long as the domain owner allows the request: PHP: // Permite apenas alguns domínios header('Access-Control-Allow-Origin: http://mysite1.com'); header('Access-Control-Allow-Origin:…
-
1
votes2
answers125
viewsA: Sort two-dimensional array by date index (timestamp)
You can use the function usort and create a role for the rule: Numeric Value: usort($array, function ($a, $b){ return $a['date'] - $b['date']; }); String: usort($array, function ($a, $b){…
-
8
votes2
answers7532
viewsA: NFC-e (consumer invoice) integration API with PHP
The Farm does not provide any tutorial or anything else based on language, only provides information on the addresses of webservice on the page URL Webservice. Documentation and XML Schemas can be…
-
0
votes3
answers3151
viewsA: How to read a Json file
The JSON notation is quite similar to that of an object in Javascript, except for a few differences: Javascript object: [ { "bloco":"bloco1", // Uso de aspas duplas 'titulo': "titulo1", // aspas…
-
3
votes3
answers3214
viewsA: JS - How to add a style within a new class?
Yes, using the css as you yourself have mentioned: $('.classe').css('propriedade', 'valor') Example: function RefreshClass(){ $('.classe').css('text-decoration', 'underline'); } RefreshClass();…
-
3
votes3
answers766
viewsA: "Smart" columns in Mysql
In SQL there is the "joker" which is the * which means all or in Portuguese, all. That is, if you do the consultation: SELECT * FROM filtros You’re saying: Select everything from the table filtros.…
-
6
votes2
answers4723
viewsA: Anchor to another page with scroll to the content
Scroll on the same page just put the element ID in the href: <a href="#id-do-elemento">Go</a> To perform on another page the engine is even, just add the ID at the end of the URL: <a…
-
12
votes3
answers423
viewsQ: How to choose a digital certificate? What to take into account?
I’m working in a virtual store, and I need to know which is the best certificate Custo x Benefício, need to indicate a certificate to the client, but this is the first time I work with a.…
-
2
votes5
answers5072
viewsA: jQuery, duplicate click event
You can create a function that loads the scripts and check whether the script has already been loaded: $(document).on('click', '.load', function(event){ event.preventDefault(); var script =…
-
3
votes2
answers340
viewsA: How to save a function’s parameters to a variable?
You can access the object arguments of function: var args; // Variável no escopo global para salvar os parâmetros function MinhaFuncao(x, y, z, w, k, j){ args = arguments; // Salva os parâmetros…
javascriptanswered KaduAmaral 11,472 -
0
votes2
answers1901
viewsA: PHP Logout with Cookies and Sesssions
Put the refresh page after the return of AJAX: function deslogar(){ $.post('/', { sair:'sair' }, function(data){ if (window.location.origin == undefined) window.location.origin = '//' +…
-
1
votes2
answers124
viewsA: Login system (error when banned)
I gave myself the freedom to make some improvements to your script, here are some of them: Treat errors instead of deleting them: $username = (empty($_POST['username']) ? NULL : $_POST['username']);…
-
2
votes3
answers1152
viewsA: How to make an object array have only unique values?
I’m sure the @Runo response is better, but as I already did I’ll post it anyway, for didactics. You could create a function: function ClearArray($arr, $KeepKey = FALSE){ if (!is_array($arr)) return…
-
0
votes1
answer163
viewsA: Horizontal Menu - CSS
I did not understand correctly why (I also did not look), but need to float the menus "parents": .menu > ul > li { float:left; /* <- Adicione essa propriedade */ list-style: none;…
-
1
votes3
answers371
viewsA: error while creating table with Foreign key mysql
The problem is in the syntax of the second FK, has a comma between the FK and the Reference: FOREIGN KEY fk_id_noticia(`id_noticia`) REFERENCES tbnews(`id`), FOREIGN KEY…
-
1
votes1
answer53
viewsA: Page components messing up when redeeming the page
This happens because you are using position:absolute; this property is not very responsive. Try to build your layout using position:relative; and let the position:absolute; only for cases really…
-
2
votes2
answers2102
viewsA: Dynamically change the text color based on a background color
You can determine the distance of colors to apply a different brightness according to the tolerance: function isNeighborColor(color1, color2, tolerance) { // Função tirada da resposta: //…
-
1
votes2
answers856
viewsA: Centralize Nav with Materializecss
From what I saw in documentation, created some classes: @media screen and (min-width: 769px){ .nav-wrapper ul.center { display: block; width: auto; } .nav-wrapper > ul.center li { float: none;…
-
2
votes1
answer856
viewsA: Jquery video final event
This is because you are creating the element dynamically, in which case it is necessary use the event observer on jQuery and add the function event after creating the element:…
-
2
votes1
answer211
viewsA: Insert file set into 2 different tables
Brief explanation about multi-upload To work with uploading multiple files you need to enter the name of the input in the format of array: <input type="file" name="upload[]"> Note that the…
-
7
votes4
answers847
viewsA: How to generate indented code?
A very good way to print HTML is by using strings in format Heredoc, which has the advantage of not needing to escape the quotes, example: echo <<<EOT <div> <table> <tr>…
-
16
votes1
answer3443
viewsA: User-friendly URL using HTACCESS
Resolution Remove the ? before the m and use variable $1: RewriteRule ^film/([a-z0-9\-]+)/?$ index.php?p=filmes_v&m=$1 [NC] The htaccess will be as follows: <IfModule mod_rewrite.c>…
-
12
votes1
answer2987
viewsQ: Can I sell a product by-product under the Apache License 2.0?
I’m working on a project with Opencart (as freelancer) and need to use a certain extension, but the extension is outdated (compared to Opencart) and licensed under Apache 2.0. So I was thinking of…
licenseasked KaduAmaral 11,472 -
3
votes1
answer57
viewsA: Pseudo Class in CSS Does Not Apply Rule
This happens because you are also hiding the parent elements of the image, you have to create a rule for each to not hide them: body > :not(#content), body > #content > :not(.main), body…
cssanswered KaduAmaral 11,472 -
1
votes1
answer183
viewsA: Search for posts on Facebook by Hashtag in JSON format
Facebook does not provide resources to search for posts by tag, the only type of reading posts found in the documentation, is based on ID: /* make the API call */ FB.api( "/{post-id}", function…
-
17
votes1
answer12287
viewsA: Concurrent Programming x Parallel x Distributed
The main differences between these types of programs are their forms of execution. To concurrent programming is the most common, where the program runs sequentially competing for the availability of…
-
4
votes2
answers1253
viewsA: Layout with diagonal div and responsive
You can also work with the method rotate of property transform and "undo" the transformation (remake it in the opposite direction) into a child element: body{ margin:0 0 -250px; padding:0 0 -250px;…
-
4
votes3
answers181
viewsA: Why in Javascript, 7 (a number) is not an instance of Number?
Simply because he "is not" a object instance. Objection instances are declared using the keyword new. The reported problem also occurs for the following situations: "string" instanceof String; //…
javascriptanswered KaduAmaral 11,472 -
0
votes4
answers168
viewsA: How to redirect url with htaccess out of the domain?
You don’t need to use any language server-side for this, just add the protocol http or https before: <a href="http://www.google.com" target="_blank"> SSL authentication error often occurs by…
-
3
votes1
answer1067
viewsQ: Drag and Drop HTML components with jQuery
I am developing a project, for my academic course and I have the following code: // Esse é um json que vem do banco de dados var Componentes = {"input": {"Label": "Textbox","Tag": "input",…
-
0
votes1
answer35
viewsA: Undefined $class_name in autoloader using spl_autoloader_register() with WAMP?
Here’s a autoload that I use: function search_lib($lib, $file, $ds = '/'){ // Verifica se o diretório informado é válido if (is_dir($lib)){ // Verifica se o arquivo já existe neste primeiro…
-
1
votes1
answer292
viewsA: Tabulation via Jquery
You can try to select the next field and set the focus. Generic example: $(document).on('keyup', 'input[type=text]:enabled:not([readonly])', function(event){ if ( this.value.length ==…
-
0
votes2
answers910
viewsA: How to select an element in a jQuery selection
Complementing the answer, on how to navigate between the elements: Suffice: Grab the previous object: $el.prevObject $el.end() (as mentioned by @bfavaretto) Grab the selected object index:…
jqueryanswered KaduAmaral 11,472 -
2
votes2
answers910
viewsQ: How to select an element in a jQuery selection
For example, I have the following code: var $els = $('elementos'); // cerca de 8 elementos selecionados So from this group of elements, I want an element that has the class active. I tried something…
jqueryasked KaduAmaral 11,472 -
2
votes1
answer138
viewsA: Next Back content on page
You can do something like this: $(document).on('click', '.go', function(event){ event.preventDefault(); var dir = parseInt($(this).data('go')); var $active = $('.rodadas .rodada.active');…
-
1
votes1
answer1878
viewsA: Modal window with PHP database request
You’re riding your tag a oddly. Try something like: <a href="#" type="button" class="btn btn-danger" data-toggle="modal-image" data-target="#imgModal"…
jqueryanswered KaduAmaral 11,472 -
23
votes2
answers1094
viewsA: What does content:" f0ed" mean?
The estate content in CSS is to add some content, for example: div::after{ display:block; content:"Hello World"; } <div></div> It is important to note that the property content only…
cssanswered KaduAmaral 11,472 -
5
votes2
answers9672
viewsA: Play alert sound after database query (PHP + MYSQL)
Your javascript function probably wasn’t working (I believe) because you were "playing" the sound before the element audio be created. For example: <?php //seleciona o numero de linhas da tabela…
-
1
votes1
answer871
viewsA: Take time to access a page and write to the BD
First (and obviously) you need a table to store this information: Tabela - ID - Session - Page - User - DateStart - DateEnd Create a function to send the data to the server: <script> function…
-
2
votes2
answers184
viewsA: View formatless HTML tags from Twitter Bootstrap
What you need to do is a context, or wrapper as it is commonly used in CSS. The context or wrapper is a (parent) element that will involve several elements with specific rules or not. Example: p…
-
1
votes2
answers606
viewsA: Select category and subcategory within the same table
I don’t see a query that can solve the problem well, so I suggest doing it in PHP. <?php $sql = "SELECT * FROM modulos WHERE idMoludoBase = 0"; // Execute sua query $modulos = Array(); while…
-
2
votes2
answers489
viewsA: Making replace or append in a <p>?
With jQuery you can use the method prepend (to add at the beginning of(s) element(s)) or append (to add at the end): // var é para variável ser local, não criando uma variável global tendo a…
-
2
votes3
answers109
viewsA: In PHP, is NULL a constant or a keyword?
Only by complementing the reply from @Ricardo: Keywords Some represent things that look like functions, some seem constant but actually are not really: they are language constructors. Examples of…
-
2
votes2
answers1472
viewsA: how to know if the date is of the date type yyyy-mm-dd, dd/mm/yyyy etc?
You can use regular expressions: <?php function DateFormat($date){ if (preg_match("/\d{4}-\d{2}-\d{2}/", $date)) return 'YYYY-MM-DD'; elseif (preg_match("/\d{2}\/\d{2}\/\d{4}/", $date)) return…
phpanswered KaduAmaral 11,472 -
1
votes1
answer144
viewsA: Is there a way to create a jquery slide that takes up 100% of the screen?
Yes, just set the width and height of the widgets to the width and height of the window: $('#slider').width( $(window).width() ) .height( $(window).height() ); Note: If the window is not maximized,…
-
3
votes2
answers96
viewsA: Buttons made with images
The effect does not use any CSS3 or HTML5 features, but I will show you how the effect works. a{ background-image: url(http://levelupgames.uol.com.br/elsword/era-dos-herois/img/menu-vertical.png);…
-
4
votes1
answer524
viewsA: Count selected checkbox
The problem is that you are selecting all the checkbox from the page, and may give conflict with other checkbox groups. Use a class or attribute to group them: <input type="checkbox"…
-
4
votes2
answers124
viewsA: Problem with access limit by refresh JAVASCRIPT account
Each HTTP request is a new request to the server. It is only possible to "simulate" sessions thanks to the server-side languages that support this, as is the case with PHP. But this is only a…
-
1
votes3
answers743
viewsA: Confirmation for deletion
You can use a plugin like Bootbox just implement it into your code. The call can be made like this $(document).on('click', '.confirma-delete', function(event){ // Evento padrão do click…
-
1
votes3
answers743
viewsA: Confirmation for deletion
Create two empty fields in your modal: <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <input type="hidden" data-name="mdClientCode">…