Posts by alan • 1,908 points
95 posts
- 
		0 votes3 answers81 viewsA: Array readingFor your code to work, just replace: var len = person.length; For: var len = Object.keys(person).length; javascriptanswered alan 1,908
- 
		1 votes3 answers364 viewsQ: How to overwrite a root HTACCESS in a subfolder with another HTACCESSI have a file HTACCESS at the root of my project. However, I have a subfolder that also has a file HTACCESS. But I’m not sure how to make this code override part of the HTACCESS root. HTACCESS root:… 
- 
		2 votes1 answer32 viewsA: Input cache when updating pageYes! You can use localStorage <!DOCTYPE html> <html> <head> <title>Teste</title> <script… 
- 
		1 votes1 answer30 viewsQ: Redeem value of objectI own an object like this: SimpleXMLElement Object ( [0] => 1bf7080ac1c04e4e9de924c0a7d9444d ) But I can not only redeem the value of it. I have tried the following ways: print_r($obj{0});… 
- 
		0 votes0 answers80 viewsQ: Add Next and Previous buttons embedded in HTML5 Video PlayerI’m looking for a way to do something that Youtube has in their app, however, in an HTML5 video player using only HTML, CSS and Javascript/Typescript. Look at: I already have all the code and logic… 
- 
		0 votes1 answer55 viewsA: how to use the LPAD function with COUNT?After searching a little, discover that this may be a bug generated by Drive. Thus, the problem that was occurring to me, will not necessarily happen on other computers. To fix this, and have the… 
- 
		0 votes1 answer55 viewsQ: how to use the LPAD function with COUNT?For example only: I am trying to select where a zero will be added to the left if the number is less than 10. Examples: SELECT COUNT(1); Returns => 1 SELECT LPAD(1, 2, 0); Returns => 01 SELECT… 
- 
		0 votes1 answer204 viewsQ: Create background-image directiveI have an image directive, where if an image does not load I display a default image. Directive: import { Directive, Input, HostBinding } from '@angular/core'; @Directive({ selector: 'img[default]',… 
- 
		2 votes1 answer1154 viewsA: Angular validate password field with FormgroupSome time ago I discovered the problem and forgot to post the answer. The mistake was in: onRegisterForm.get('senha').hasError('minLength') Where minLength should be in minuscule minlength In this… 
- 
		1 votes1 answer235 viewsA: Value in input element is not displayed - (although value is being loaded correctly ) - JqueryJust completing my comment. If you want to see this attribute in the Console (This is not necessary). You can do it: $('#txt_titulo').attr('value', objeto_menu.titulo); But the most common is to use… 
- 
		0 votes0 answers277 viewsQ: Inject service in the page’s press.moduleI’m working with Ionic 3 and I’m using some of your native services, like logging in with facebook. Everything works perfectly, my problem is in something I’m trying to do to organize my code more.… 
- 
		3 votes2 answers1525 viewsQ: Restful DELETE methodWithin the Rest architecture we have the verbs POST, GET PUT and DELETE. Among the various examples and tutorials I studied. The use of the verbDELETE is always exemplified with DELETE /addresses/1,… 
- 
		2 votes0 answers131 viewsQ: PHP Methods StaticPHP allows me to have methods static. Whose advantage is to have them accessible without the need to instantiate the class Documentation. However, in the case of methods static, I can use them both… 
- 
		1 votes1 answer53 viewsQ: Differences between ways to reference a namespaceI’d like to understand why in some code examples, people import classes as follows: use \Firebase\JWT\JWT; and not just: use Firebase\JWT\JWT; Is there any difference in starting with a "\"? In my… 
- 
		0 votes2 answers2906 viewsA: How to add a class to an HTML element via Javascript. In my case, I need to add a class to the H1 element belowEdited Just replace "your-class" with the name of your class. See the example below: var div = document.createElement("div"); var h1 = document.createElement("h1"); var p =… 
- 
		1 votes1 answer97 viewsA: How to receive the value of <select> in PHP when selecting an optionI don’t know if you really need to do this with pure javascript. But with jQuery it’s much easier. See an example below: Javascript / jQuery and HTML: $('#idCourse').on('change', function() {… 
- 
		0 votes1 answer162 views
- 
		0 votes0 answers228 viewsQ: Correct way to pass headers to the Httpheaders ObjectI’m trying to figure out how to pass headers the correct way to instantiate an object HttpHeaders in the Angular 5. I have the following code: postApi(body: any, route: string) { return new… 
- 
		0 votes1 answer1154 viewsQ: Angular validate password field with FormgroupI have the following code: TS code: ... onRegisterForm: FormGroup; ngOnInit() { this.onRegisterForm = this._fb.group({ nome: ['', Validators.compose([ Validators.required ])], email: ['',… 
- 
		0 votes2 answers179 viewsA: Add code Analytics in Wordpress blogFinally I found it. Thanks to your help. Thanks to everyone who tried to help with tips in the comments :D Before I was always accessing Appearance -> Editor, selecting the current theme and… 
- 
		0 votes2 answers179 viewsQ: Add code Analytics in Wordpress blogI’m trying to change the code Analytics of a Wordpress blog. However, I don’t have much knowledge and I’m having trouble figuring out how the code was added. From what I research, I managed to… 
- 
		0 votes1 answer39 viewsQ: boquear directories and files with . htaccessI don’t know much about .htaccess and I came across a project where it blocked some images that I climbed into an img folder of the project. RewriteRule ^(css|js|img)/(.*)$ statics/$1/$2 [L] But… 
- 
		0 votes1 answer2169 viewsQ: Best way to register two foreign keys in a tableI have 3 tables, being them: personal, pesso_juridical and addressee. Both the tebela pessoa_fisica, as for tebela pessoa_juridica use the table endereco. I would like to add two foreign keys in the… 
- 
		2 votes1 answer60 viewsQ: Best way to filter (validate) rescued $_SESSION dataI am creating a register and I have a session $_SESSION['usuario']['cpf']; I am validating the data I receive by POST and GET with the function filter_input PHP. However, the documentation says:… 
- 
		0 votes1 answer31 viewsA: Rename part of the parameter names of a precedentUnfortunately I ended up discovering that this is not possible: This statement can be used to change the characteristics of a stored procedure. More than one change can be specified in an ALTER… 
- 
		0 votes1 answer31 viewsQ: Rename part of the parameter names of a precedentI have some procedures where parameter names start with: "p_". It is possible to change in a unique way and via code all the names of all the procedures that start with this abbreviation by: "abc_"… 
- 
		2 votes2 answers4790 viewsQ: How to go up and configure a project with Laravel on the serverI’m starting with Laravel 5.3 and learning to explore all of its resources. But I have a question. What would this project of mine look like on the server (in production). Today my projects are… 
- 
		0 votes3 answers2287 viewsA: Remove created image-div spacingAnother solution I found was to add a display: block; in the image! .box-img { width: 100%; max-width: 200px; background-color: red; // tentando remover padding padding: 0 !important; } .box-img… 
- 
		0 votes3 answers2287 viewsQ: Remove created image-div spacingWould you like to understand why a spacing is created between the image and the div? How is it possible to see when adding the red background. And how to correct without using position or margin and… 
- 
		0 votes1 answer2482 viewsQ: How to fix charset="UTF-8" in application nodejs within the socket.ioI have a chat app and I’m working with nodejs and socket.io. But I’m having trouble with name coding. The following name: Guilherme Loução is coming as: Guilherme Louã§. I have already saved the… 
- 
		1 votes3 answers2817 viewsA: view var Javascript in div htmlTry it like this: <section class="content"> <span></span> <span></span> <script type="text/javascript" src="../js/purl.js"></script> <img… 
- 
		2 votes1 answer147 viewsA: Margin conflict in cssEdited! To fix this. Remove the float: left of the classes .horizontal-menu and .horizontal-menu li and add display: display: inline-block; in these two classes. See below: body { margin: 0;… 
- 
		0 votes2 answers140 viewsA: Two fields of a table associated with One field of another tableYou are using INNER JOIN so select will only return the results if the conditions shown are true. You said the records have the following values: Table teams: id = 1, name = Barcelona and photo =… 
- 
		0 votes1 answer86 viewsQ: How to calculate the speed of a user’s internet connection?I am trying to calculate the connection speed in MB of a user who access my site. But I couldn’t find much on the Internet other than ready-made programs and websites that already do that. The only… 
- 
		0 votes1 answer158 viewsQ: How the PHP include function works behind the scenesLet’s say I have two pages, one call teste.php and the other teste2.php. On the page teste.php I have the following code: ... $usuario = new Usuario(); $usuarios = $usuario->getUsuarios(); ...… 
- 
		1 votes1 answer297 viewsQ: PHP Object InjectionOn the website of OWASP It explains this kind of flaw that makes code injection possible. But one part was not clear to me and if anyone who understands can clarify me. The excerpt says the… 
- 
		1 votes1 answer42 viewsA: (Select query) How to make it more dynamic?I do this way using PDO: /** @var PDO */ private static $connect = null; /** * Conecta com o banco de dados com o pattern singleton * Retorna um objeto PDO! */ private static function Conectar(){… 
- 
		1 votes1 answer398 viewsQ: PHP Stored Security XSS and SQL InjectionIs there any security breach or possibility of attacks on the code box below? public static function prepareQuery($query, $params){ $preparedQuery = self::getConn()->prepare($query); foreach… 
- 
		1 votes1 answer331 viewsQ: PHP Security - Avoid SQL InjectionIt’s wrong or unsafe to use: if ($_SERVER['REQUEST_METHOD'] === 'POST') { foreach ($_POST as $key => $value) $$key = $value; ... } Let’s say I have this code, but use a Procedure call with… 
- 
		2 votes1 answer63 viewsQ: Best way to apply the concept of Object OrientationI own a class Usuario class Usuario{ } Let’s say that this user needs to access some different Web Services for resources and information. I then thought about creating a class called WebService and… 
- 
		3 votes2 answers1106 viewsQ: Block direct access to a URL via webconfigI have an old system in classic ASP and need to do some implementations. I have a file web.config for this application and would like to know if it is possible to block direct access to a video URL.… 
- 
		2 votes2 answers3864 viewsA: How to remove video download optionI found a solution: https://jsfiddle.net/u1wqb4kz/ // Remove botão de download de vídeos video::-internal-media-controls-download-button { display:none; } video::-webkit-media-controls-enclosure {… 
- 
		2 votes2 answers3864 viewsQ: How to remove video download optionI would like to remove the video download options (I know this will not prevent downloading it through other means. But the idea is just to make it harder for more lay users). I have the following… 
- 
		1 votes1 answer259 viewsQ: Nusoap return $HTTP_RAW_POST_DATA emptyI’m trying to create a Webservice using the nusooap. However my return is always empty. Online is created the webservice and I can see the methods and xml (WSDL). But when trying to access via… 
- 
		0 votes0 answers124 viewsQ: How to set time_zone using PDOI have a connection using PDO what arrow the SET NAMES UTF8: $options = [ PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8" ]; But I’d like to add the SET time_zone='America/Sao_Paulo'.But in… 
- 
		1 votes1 answer52 viewsQ: Retrieve Browser Information in Procedure MysqlYou can pick up browser information on a PROCEDURE via Mysql code? No need to pick up via back-end code and pass as parameter. That is, Mysql has some function that returns information from the… 
- 
		1 votes1 answer40 viewsQ: Should I use prepare in ProceduresBelow I have an excerpt of code adapted to illustrate this question: <?php $params = [ ':codUser' => $_SESSION['data-user']['codigo'], ':codCarrinho' => $codCarrinho, ':codPremio' =>… 
- 
		2 votes0 answers490 viewsQ: Best way to add product to shopping cartI have a method that adds product to cart/Session. But I think I’m using a lot of code for this and would like to do it in a better or more simplified way. Any hint? public function… 
- 
		0 votes1 answer1513 viewsQ: How to identify the child element clicked through the event click on the parent elementI have the following code: <div class="tipo-cadastro"> <div class="box-logista active">Logista</div> <div class="box-distribuidor">Distribuidor</div> </div> and… 
- 
		6 votes1 answer1391 viewsQ: Connection with Webservice SOAP WSDL with XML returnI have the following code that works perfectly. The return of the webservice is a XML, but the return I’m getting is a string. What should I do to receive the XML as return and not a string? $client…