Posts by MagicHat • 12,262 points
358 posts
-
3
votes2
answers84
viewsA: How to pick a number in the middle of a string
You can use the function split for that purpose. This function will split the string into an array, given a certain separator. var url = 'https://pokeapi.co/api/v2/ability/35/'; var pathArray =…
-
0
votes2
answers42
viewsA: I cannot run a script from an external page
This type of error occurs because the script is executed before the complete loading of the DOM. There are some ways to prevent this error. I use: window.onload = function() { ... Code } Has other…
-
0
votes4
answers140
viewsA: Exercise: Quick replacement
Note that when returning textoNovo the script finishes its execution by returning the new variable value textoNovo, however it does nothing with this value, does not print on the console. This way…
-
5
votes1
answer68
viewsA: Cut word after comma
Use Count, to count the array elements, and then you can loop to your liking <?php $str = "valor1,valor2,valor3"; $corta = explode(",", $str); for($i=0 ; $i < count($corta); $i++) { echo…
-
4
votes2
answers115
viewsA: Concept of blocking directories in robots.txt
In the context of Webcrawler, the tracker is a program that sends requests to domains in order to verify, index and organize the resources available for future access in an optimized way. One of the…
-
1
votes2
answers108
viewsA: How to perform Submit in a form with input text and two inputs file?
Friend by default the form property enctype has the value application/x-www-form-urlencoded. To send files you need to specify enctype=multipart/form-data. <form id="main-contact-form"…
-
0
votes1
answer1164
viewsA: What is the appropriate use of display: table?
The layout model table, is suitable for tabular data structure display, "because they have an internal structure complex, with various different roles that their children and descendants can fill".…
-
4
votes4
answers231
viewsA: How many times should I use the Strong element to highlight a word as important?
This is a controversial and opinion-based theme. You can’t accurately state how many times you can or can’t use this feature. The fact is that it has its usefulness, and in the present day search…
-
3
votes3
answers61
viewsA: Automatic filling product name
Makes CSS. Gambiarra by gambiarra, do with style .p1::after{content:"gambiarra";} Não há a necessidade de fazer essa <span class="p1"></span>, porque <span class="p1"></span>…
-
0
votes1
answer67
viewsA: Is it correct to repeat the itemprop attribute?
It is not forbidden, being correct will depend on the purpose you want to reach when using this attribute. As stated : The global itemprop attribute is used to add properties to an item. Every HTML…
-
0
votes1
answer33
viewsA: Copy Form before Post to Html
Use document.getElementById("lista").value <textarea id="lista" onblur="alert(document.getElementById('lista').value)"> </textarea>…
-
0
votes2
answers47
viewsQ: Insert filesystem image name in mysql
I use Debian, and I need to capture the image names of a folder and insert the names (as string) into a mysql table. ss:~/folder_img$ 859034809583_img.jpg 458389547389_img.jpg ... This problem has…
-
0
votes2
answers613
viewsA: Calling a function after validating a form in Bootstrap
When attaching the event handler to the form element, the scope of the event handler is the form and not the window. Since the input elements within a form are attached as properties to the form…
-
3
votes1
answer77
viewsQ: Delete specific ids in querySelectorAll
I want to take the amount of elements coming from an array: document.querySelectorAll('select,input,textarea'); alert(Object.keys(arr).length);//19 Inside the array I have 4 elements to exclude,…
-
1
votes1
answer671
viewsQ: Why $_SESSION is not accessible on another page
On my site I have a profile page, when the user logs in he is redirected to the page perfil.php, this login is performed on the page entrar.php. So on the page enter I have: enter php. <?php…
-
0
votes1
answer82
viewsQ: Remove a mysql column configuration
I have a mysql column that has a key worthwhile MUL, how to remove this setting from the command line? My table has the following scheme:…
-
0
votes0
answers25
viewsQ: Export Mysql database settings
I recently exported a database mysql in format .sql, however some settings are not present, such as the configuration for FULLTEXT index. What is the correct procedure to export these configuration…
-
0
votes2
answers1219
viewsA: Execute function when arriving in Div
That one reply of Soen serves you: $(window).scroll(function() { if($(window).scrollTop() + $(window).height() > $(document).height() - 100) { alert("near bottom!"); } }); -100 is the value for…
-
1
votes1
answer73
viewsA: Creation of validation with Pattern
Good in your case is due to c of his Pattern be tiny and what you want to validate is C capital. For this you need a capture group containing the letter c insensitive case followed by exact 6…
-
4
votes1
answer198
viewsA: How do sessions work at HTTP level?
As explained in the answers cited ¹ ², the HTTP is stateless: is a communication protocol that considers each request as an independent transaction that is not related to any previous request, so…
-
1
votes0
answers33
viewsQ: Exactly what it takes to publish to Google plus with your Apis
My question is about the Google + Domains API: From this reply is said: "Currently, there is no public API to publish on Google+". So, look for other questions and answers, I see the possibility of…
-
2
votes1
answer242
viewsQ: Simulate a click, how to share a link to Google+ without clicking
My challenge is to share my site to Google+ without clicks. I have a google account [email protected], I created a profile on G+. The idea is through localhost create a script where when accessed it will…
-
1
votes1
answer9213
views -
2
votes1
answer131
viewsA: Is it possible to apply style to an XML structure?
Yes you can indicate the style through : <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="style.css"?> Or else: <?xml-stylesheet href="#style"…
-
4
votes2
answers1240
viewsA: Is there a way to auto-increment the id in Mongo?
Yes, following the example of documentation(create-an-auto-incrementing-field), it would be something like that: 1 - Enter the starting value for the field in the meter collection:…
-
4
votes1
answer50
viewsA: Search for similarity in Mongo
Can use regex: cursos.find({nome: /^Eric/})
-
1
votes2
answers979
viewsA: Picking text from an input text
To receive the shipment via POST, you use the variable $_POST["name_do_input"] <form method="POST"> <input id="comentario" type="text" name="comentario" id="comentario"> <input…
-
0
votes1
answer50
viewsQ: How to iterate to get all results of xpath->evaluate
In general to iterate elements xpath I use a loop as follows: <?php $dom = new DOMDocument; $dom->loadHTML('<div class="xGh">Test1</div><div…
-
2
votes1
answer67
viewsQ: Is it possible to get the value of the background-image attribute through xpath?
I have the following structure: <div class="xGh" style="background-image: url('name_file.jpg');"></div> Where I need to capture: name_file.jpg I tried to use the solution presented in…
-
1
votes1
answer63
viewsA: How is a website published and hosted on the internet?
A web server is roughly a machine with an operating system, a web server software (in the case of php or Apache), a database server software and an application software, the site, with its…
-
2
votes2
answers3074
viewsA: How to calculate numbers in a given range?
Wrong answer, fixed below in the edit Using the tips in the comment, you can do something like this: for c in range(3, 500, 3): soma = c + c print(soma) See on Ideone Edit Well noted by @Anderson…
-
1
votes2
answers834
views -
0
votes2
answers834
views -
9
votes5
answers2375
viewsA: Should I show generic error messages like, wrong password or user, or specific messages?
In relation to the best practices of UX, other answers already sufficiently address the subject. In contrast to answers that claim segurança as a reason: Not, this does not protect the data. As…
-
3
votes2
answers4145
viewsQ: Script not authenticated
Time and again I come across an icon in the browser bar, stating that the page is trying to load scripts from an authenticated source. Why does this happen?
-
3
votes2
answers496
viewsA: What is the technical difference between SSL and EV SSL certificates?
Source Extended Validation (EV) is the highest class of SSL Certificate available. Although it uses the same powerful encryption as other Ssls, to have it takes a full check of the applicant’s…
-
2
votes2
answers81
viewsQ: Fix incorrect module return
Mathematically speaking why it happens and how to fix the following "error" in python: >>>10.53 % 1 0.5299999999999994 I’d like to understand how the python works to obtain this value, why…
-
2
votes1
answer467
viewsA: How to add social media buttons
You can control the destination of the click through the attribute href anchor: <a href="https://pt-br.facebook.com/"…
-
13
votes3
answers1488
viewsA: Using Lower() in a list of lists in Python
I used the example of that answer where it is used comprehensilist on : lista = [['DE','DO','OU'],['AE','YHH','OO'],['OW','LA','FOR']] [print([w.lower() for w in line]) for line in lista] See on…
-
4
votes3
answers2842
viewsA: Swap the image on smaller screens
Solution CSS One option is to use your image as your background css(I don’t know if it’s possible in your project): .class{ background: url('../Imagens/saiba-mais-1.png') no-repeat;}…
-
1
votes1
answer37
viewsA: Generate button in DIV?
That’s basically it, playing the while within the div: connect_query.php <?php $host = ""; $bd = ""; $usr = ""; $psw = ""; $conn = new mysqli($host, $usr, $psw, $bd); if($conn->connect_error)…
-
17
votes4
answers351
viewsQ: What is gamification in the context of software?
I recently saw some comments about gamificação and would like to understand what it is and how it works in the context of software. How this relates to programming itself?
-
2
votes1
answer421
viewsA: Anchor type link inside an iframe
When you use the #(hash) in the href he refers to a id, this put: alter : <a name="ancora"></a> for <a id="ancora"></a>…
-
0
votes2
answers37
viewsA: Put my email to receive the contact messages
Only with html the solution would be: <form name='contact-form' action="mailto:[email protected]""> Or using some programming language, if applicable edit your question by adding the…
-
3
votes2
answers60
viewsA: How to find a caraceter in the string and cut string to it and after it
You can use this combination of preg_split and pathinfo. <?php $str = '3803452.jpg'; $chars = preg_split('/_/', $str, PREG_SPLIT_OFFSET_CAPTURE); if(count($chars) < 2) { $ext = pathinfo($str);…
-
1
votes3
answers12022
viewsA: Read 10 whole numbers and get the biggest one among them
Initially it is necessary to assemble a função : def maxNum_input(): #declara a função list_num = [] #declara a lista que vai receber os números i = 0 # um contador(há outras formas de fazer) while…
-
0
votes2
answers6501
viewsA: Fatal error: Function name must be a string
Function name must be the string "Translating the function name must be a string" The variable $_POST is an array then as mentioned in the comments, must change the parentheses by square brackets,…
-
8
votes2
answers21372
viewsQ: What is a database database?
For some time I have been following issues involving the term procedure in database, then doubts: What is procedure? Where to use it, what’s the point? If possible examples of use clear the mind of…
-
0
votes3
answers3621
viewsA: How to readjust the image to the size of the div
You can put to the element img, occupy 100% of height and length. #conteudo{ width:600px; height:600px; float:left; background-color:#ff1; display: initial; margin: auto; z-index: 6; overflow:…
-
5
votes2
answers2146
viewsQ: What is the difference between mysql-server and mysql-client?
It is said that using the command apt-get install mariadb-server would also install the mariadb-cliente. I understand that the server can be said to be where the data persist, however I lack an…