Posts by lazyFox • 3,227 points
103 posts
-
1
votes1
answer62
viewsQ: Assign string value with pre-defined size inside the pointer
You need help with dynamic memory, I can’t understand why I can’t access nome of ptr in the method adicionarSocio? How can I change this field? I have to do malloc of the name before assigning even…
-
1
votes1
answer236
viewsQ: Traverse an array using malloc
In the course of some questions here in the SO I saw this example and I was left with doubts. #include<stdio.h> #include<stdlib.h> #include<conio.h> void main() { clrscr(); int…
-
1
votes1
answer194
viewsA: Interim records in foreach
You can add everything in an array and use the suffle function to mix the contents. Example: <?php $registos = array("noticia1","noticia2", "noticia3"); $anuncios = array("anuncio1", "anuncio2",…
-
0
votes1
answer37
viewsA: Is it possible to display the data of a table separately?
You can split the string by comma, so use the function explode: <?php $retorno_bd = "link.com/1, link.com/2, link.com/3, link.com/4"; // converte a string em um array // utiliza a "," para fazer…
-
1
votes1
answer298
viewsA: Unity Store System
There are several ways to preserve data, here are some suggestions: Playerprefs class int valor = 1; // para gravar PlayerPrefs.SetInt("valor_exemplo", valor); // para obter o valor valor =…
-
0
votes1
answer160
viewsQ: Access variable via exec
I was trying to create a "shell" to be able to communicate with a python program during its execution, so far I have the following (this code is just an example): import sys, pygame from threading…
-
3
votes1
answer2169
viewsA: PYTHON - How to know if there is an object on the screen from a reference?
I did something similar for days with the library pyautogui, following example: import pyautogui icon_pos = pyautogui.locateOnScreen('cadeado_aberto.png') if icon_pos: print(icon_pos) print("Existe…
-
0
votes2
answers708
viewsA: How to manipulate DIV with Angularjs
You can add an ng-model to each button and as the value of each button makes content appear and disappear. See this example taken w3schools: <!DOCTYPE html> <html> <script…
-
1
votes2
answers7124
viewsA: How to get the directory from the location where a . py file is running?
You can get the current directory from the script using: import os print(os.path.dirname(os.path.realpath(__file__))) Reference to the stack overflow…
-
2
votes2
answers1885
viewsA: Adding Buttons in the upper right corner of the div
If you are using bootstrap you can use the class pull-right as Mr @hugocsl mentioned. Following example: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"…
-
3
votes5
answers391
viewsA: Concatenation in C
You got the strcat that allows you to concatenate two strings or the sprintf to format the string with the variables you want. srtcat example [as a complement, tip from Jefferson Quesado] char…
-
3
votes2
answers868
viewsQ: What is Port Knocking?
I understand it’s about sending a sequence of requests to a server to unlock a port. It would then be possible through a browser to activate the port for ssh, for example: Access servidor.com:80…
-
2
votes1
answer108
viewsA: Addcomponent() with parameters in Unity3d?
You must add the component to the object you want and then call a method/function to assign/define the values of that new component. Example: // a class fulano deverá ter uma funcao init…
-
-1
votes3
answers120
viewsA: Convert String to Date and remove 1 day from String
If you ensure that the variable will always come in xx/xx/xxxx format you can simply use explode followed by implode. $data_final = explode("/","26/11/2017"); var_dump($data_final);…
-
4
votes4
answers19332
viewsA: Compare current date with javascript
That comparison is correct because new Date() returns Tue Jul 04 2017 16:53:25 GMT+0100 (Hora de Verão de GMT) and new Date('07/04/2017') returns Tue Jul 04 2017 00:00:00 GMT+0100 (Hora de Verão de…
-
5
votes2
answers605
viewsA: Why do I need './' to run Unix commands?
First of all this ./ is placed behind the name of your executable to ensure that you are running it within the current directory. Second, it is a security method to prevent the execution of any…
-
1
votes1
answer40
viewsA: Angular Bind with Canvas
I solved my problem by adding $scope.$digest() whenever I need to update the variables.
-
1
votes1
answer40
viewsQ: Angular Bind with Canvas
Good morning I would like to know if it is possible to bind and/or force angular bind with canvas. My problem is this: I am using canvas to give a graphical representation to my client and for UI I…
-
0
votes1
answer82
viewsA: Angular assign data from a POST request
I discovered the mistake :) Is in the assignment to the variable this, I’ve misjudged your range. Just add inside the controller var controller = this; And then assign the answer to this variable…
-
0
votes1
answer82
viewsQ: Angular assign data from a POST request
Good people I have the following code app.controller('lista', function($http){ $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; //this.feriados = <?php echo…
-
0
votes1
answer48
viewsA: Changes to the error log
To achieve this goal you can make use of the function set_error_handler in conjunction with the function debug_backtrace I did some research and found a solution in neighboring stackoverflow,…
-
2
votes2
answers1262
viewsA: How to run mysql database using shell script if the base name has "-"
You can easily include the hyphen in the command using the severe accent, as follows:: mysql -h"$DBHOST" -u"$DBUSER" -p"$DBPASS" -e "create database `modelo-submodelo`;"…
-
0
votes1
answer86
viewsA: Add program to windows shell
I was adding the "Program" - "exe location" variable to the windows environment variables. Instead I added the path of the program folder to the PATH variable and it works at 100% That is, to solve…
-
0
votes1
answer86
viewsQ: Add program to windows shell
I need to add a program to the windows shell to call it more comfortably. In the linux environment I usually create a soft link between the program and the program installation folder, follow an…
-
3
votes1
answer244
viewsA: Do not compile, error: use of Deleted Function
You have to pass the window by reference. bool LimitaMovimento(sf::RenderWindow& window,sf::Sprite img){ if(img.getPosition().x >= window.getPosition().x){ return false; }else{ return true; }…
-
3
votes1
answer226
viewsQ: Update and increment column by sorting (UPDATE and ORDER BY)
I have the following table ID | NOME | ANO | REGISTO ---------------------------------- 0 A 2015 4 1 B 2017 6 2 C 2014 15 3 D 2017 2 4 E 2013 55 5 F 2017 1 6 G 2017 6 7 H 2017 8 And by doing the…
-
3
votes1
answer68
viewsA: DNS change used by a domain
Propagating The spread of nameservers can take up to 24 hours and depends on several factors. Among them is your ISP and the TTL (time to live or lifetime) defined in the record. Requisitions During…
-
8
votes1
answer635
viewsQ: Is there a difference between a compiler and an interpreter?
What’s the big difference between a compiler and an interpreter? In languages like C, Java is used a compiler, for example in Javascript an interpreter is used, but I was confronted with the term…
-
33
votes6
answers24229
viewsA: What is the difference between padding and margin in CSS?
Roughly the big difference is: Margin / Margin - Spacing out of content. Padding / Padding - Spacing within content limits. HTML element styles are structured within a box called "The Box Model".…
-
1
votes5
answers325
viewsA: Php View Columns
You can use the functions strlen and explode to help you. The strlen function returns the size of a string Already function explodes create an array dividing the string (2nd parameter) based on the…
-
0
votes2
answers1046
viewsA: How to Save Date, Time, Minute, and Second in C# WINFORMS and SQL SERVER?
To receive the current date / time you can do: DateTime d1 = DateTime.Now; And to remove a day just put -1 in the function Adddays d1 = d1.AddDays(-1);…
-
3
votes1
answer763
viewsA: How to create a Gif with Canvas content
canvas does not allow such operation natively, you will need an external library to be able to create a GIF. Try jsgif Example of use (extracted from github): var encoder = new GIFEncoder();…
-
1
votes3
answers2105
viewsA: How do I get an object back to its initial position in Unity?
I would create a variable with the initial position between the camera and the object you want to move and then to return to the original position would: var posicao_inicial = new Vector3(3,3,3);…
-
2
votes3
answers156
viewsA: How to select users with the STATUS field =1 in the user table?
A solution would be to select all users with the value 1 in the column STATUS and count them. $con=mysqli_connect("localhost","utilizador","password","base_dados"); if (mysqli_connect_errno()) {…
-
1
votes2
answers534
viewsA: How to send a php variable in a javascript function parameter?
Just print the variable using the function echo href="javascript:calcular(<?php echo $valor1; ?>)"
javascriptanswered lazyFox 3,227 -
7
votes1
answer245
views -
0
votes1
answer325
viewsQ: Count number of occurrences in a for in loop {Bash}
I have the following script #!/bin/bash for file in *.jpg; do convert $file -resize 1920x1080! -blur 0x8 alterado$file; echo "A Processar o ficheiro $file" done I want to do an echo with Processor…
-
3
votes2
answers1590
viewsA: How to make a progress bar?
You can use jQuery’s ready method. Create a div with a "Loader" after the body and then hide as soon as the page has been fully loaded. $( document ).ready(function() { $('#divLoader').hide(); });…
-
28
votes12
answers28737
viewsA: What are the ways to iterate an array in PHP (without foreach)?
Being also a beginner, I became interested in the question and found an interesting article about it. Here’s a solution according to the article. $array = array( 'stack' => 'Overflow',…
-
0
votes3
answers580
viewsA: How to keep a web project in sync with a remote server?
As @chambelix said there are many solutions, the one I’m using right now is Sublime Text 2 + SFTP Allows several interesting options: Local Synchronization > Server Server Synchronization >…
-
2
votes2
answers1623
viewsQ: Concatenate number sum to a string
I want to concatenate a sum of a number to a string in Javascript and had to resort to an auxiliary variable. What I did first (incorrect example): for (var i; i < x; i++) h = "texto" + x+1 +…
-
1
votes1
answer330
viewsQ: CSS Media Queries (several statements followed)
Hello, I want to know if it is possible to get a cleaner and more compact solution of the following CSS. @media screen and (min-width: 630px) { .tab ul.login{ right: 29%; } } @media screen and…
-
0
votes2
answers55
viewsA: tooltip always present
Taken from jquery website var tooltips = $( "[title]" ).tooltip({ position: { my: "left top", at: "right+5 top-5" } }); tooltips.tooltip( "open" ); jQuery tooltip Forms…
-
2
votes1
answer828
viewsA: Counter variable PHP
mysql_select_db($bd, $coneccao); $query = "SELECT lugar FROM atletas"; $result = mysql_query($query, $coneccao) or die(mysql_error()); $row = mysql_fetch_assoc($result); $lugar = row['lugar'];…
-
1
votes3
answers1746
viewsA: How to list a json object to generate a txt file and download that file via ajax request?
1 Taking an example from json_decode <?php // neste caso $json seria "response" $json = '{"foo-bar": 12345}'; $obj = json_decode($json); print $obj->{'foo-bar'}; // 12345 ?>…
-
1
votes2
answers553
viewsA: Java script menu opens and closes other Ivs
Store the last open in a global variable and close it whenever you open a new one, if there is no "last one", you do not close it. var ultimo; $(function(){ $(".btn-toggle").click(function(e){ if…
javascriptanswered lazyFox 3,227 -
6
votes2
answers11472
viewsA: Just grab a div from another page via jQuery
You can use Jquery load $("#cabecalho").load("loja.php #teste"); jQuery Load
-
4
votes1
answer308
viewsA: Video playback problem using HTML5 native tag
Try to convert the video to mp4 but this time using H.264 codec Video H.264 Audio AAC HTML5 Video Encoding
-
4
votes1
answer202
viewsA: Script to mute my site (game)
If the audio comes from the tag audio <audio id="musica" autoplay="autoplay"> <source src="musica.mp3" type="audio/mpeg" /> </audio> document.getElementById('musica').muted = true;…
-
3
votes1
answer105
viewsA: How to make the gun disappear in the same key that makes it appear in UNITY
You can simply assign a bool variable to its negation and use it to hide and show the weapon. var muda = true; //atribui o valor contrário ao actual, se for true passa para false e vice-versa muda =…