Posts by Lucio Rubens • 3,384 points
113 posts
-
0
votes1
answer63
viewsQ: Remote file upload with Javascript
It is possible to make a request POST sending a file as parameter? For example the website of Tinypic contains a field of the type file, and I want to send a direct image of my application to…
-
0
votes2
answers1108
viewsA: Grab the element ID when dragging and dropping
Replace the event stop for receive, see all properties here. The object ui returned from the event contains the following properties: item: current drag element. sender: source element. And to…
jquery-uianswered Lucio Rubens 3,384 -
1
votes2
answers1435
viewsA: How to count the number of lines within a div that does not have a "line limiter"?
In addition to the width, set the line-height of the element via css: div { max-width: 60px; line-height: 14px; } And with javascript just divide the height of the element by the line height: var…
-
3
votes1
answer490
viewsA: View routes in Codeigniter
This type of structure is known as HMVC (Hierarchical Model-View-Controller). It is necessary to use the Modular Extension to the Codeigniter. Tutorial here.…
-
3
votes2
answers313
viewsA: Access variable based elements
You can search the object by name: for (int i = 0; i < 3; i++) { XRLabel label = (XRLabel)this.Controls[string.Concat("xrLabel", i.ToString())]; label.text = "teste"; }…
c#answered Lucio Rubens 3,384 -
3
votes3
answers4174
viewsA: Recover larger and shorter hours conditioned on dates
First concatenate the date and time columns to transform the string into date: to_date(data_inicio || ' ' || hora_inicio,'dd-mm-yy hh24mi')) After that just take the smallest and longest date:…
-
2
votes2
answers1547
viewsA: Problems using Dropzone.js in a form
Set the item in the Dropzone settings previewTemplate: Dropzone.options.myDropzone = { previewTemplate: document.querySelector('.dropzone-previews').innerHTML, // .... }…
-
4
votes1
answer737
viewsA: How do I filter Google Maps results for a specific region?
You must use the option componentRestrictions and set the filter to the field administrativeArea, documentation here. Then your code would look like this: geocoder.geocode({ 'address': endereco,…
-
1
votes1
answer639
viewsA: How to turn select option into option with images?
Another option is to use ul and li instead of select and option to create the evaluation list. To display icons use label with a background and to mark the options use checkbox 'hidden': .star {…
-
1
votes1
answer69
viewsA: Clear Forms Navigation Android
You can use the attribute autocomplete of Html5, which can be defined for the whole form, or only for a specific element. <form action="/login" method="post" autocomplete="off"> Login:…
-
3
votes1
answer491
viewsA: phpMyAdmin with slow Xdebug on Windows 8.1 with Xampp
According to this answer in Soen, you need to disable remote debugger auto-boot: xdebug.remote_autostart = 0…
-
2
votes1
answer87
viewsA: Detect an image exchange
You need to register the event with the load after the page has been fully loaded: $(window).load(function() { $('.image').on('load', function() { alert('Imagem alterada'); }); }); See working on…
-
1
votes4
answers191
viewsA: Doubt with CSS selector
Use the selector switch :last-Child .linhasFotos a:last-child { margin-right: 0; }
-
2
votes1
answer75
viewsA: Why is this code on an infinite loop?
Because the variable value digita shall not be amended by entering loop. Request a new data entry after the switch: switch(digita) { // ... } digita = in.nextInt();…
javaanswered Lucio Rubens 3,384 -
0
votes2
answers171
viewsA: Change menu class
You did not specify the selector for the element id, see the documentation here: $("#li1").removeClass("active"); $("#li2").addClass("active");…
jqueryanswered Lucio Rubens 3,384 -
0
votes2
answers3087
viewsA: Accent problem, running at Windows Prompt
The problem is in the prompt Windows. According to the extract of this answer in the Soen: Unicode characters will only be displayed if the current source of console contain the character. Use a…
-
1
votes2
answers4496
viewsA: Consultations between tables with Eloquent - Laravel 5
No need to check for each person.. to add up the entire amount of all jobs: $total = App\Custo::sum('montante'); To sum up the amount per job: $trabalhoTotal =…
-
3
votes2
answers47
viewsA: Always equal table check
The function mysqli_num_rows returns the number of query records, not the select field. You need to check whether the outworking of the consultation is equal to 0: $status = mysqli_query($connecta,…
phpanswered Lucio Rubens 3,384 -
2
votes1
answer63
viewsQ: Trigger events remotely
What is the best way to trigger/receive an event remotely on C#? Example: When clicking a button on the PC1, perform certain task on the other PC’s that have the app. I thought of 3 solutions:…
-
1
votes2
answers89
viewsA: How to erase a word at once?
Use the replace: texto.replace("seno","")
-
12
votes3
answers419
viewsQ: Assign type to parameters
It is possible to assign types for the parameters in functions in PHP? Example: public function random(int $length) { // ... }
-
1
votes2
answers165
viewsA: How to make the user system banned
Change your query to: mysql_query("SELECT id,username FROM tb_users WHERE username = '$username' and password = '$password' and banned <> 'Banido';");
phpanswered Lucio Rubens 3,384 -
3
votes2
answers14029
viewsA: Mysql - Create temporary table according to dynamic SELECT
See the documentation of CREATE TABLE, can be created through a consultation: CREATE TEMPORARY TABLE tabela_temporaria SELECT idCentroCusto, 'Dez/14', 'Jan/15', 'Fev/15', 'Mar/15', totalAnual;…
-
2
votes3
answers163
viewsA: SELECT filtering the first results
Use the following subconsulta: SELECT * FROM noticias n WHERE id NOT IN ( SELECT * FROM ( SELECT id FROM noticias WHERE destacar = 'Sim' ORDER BY id LIMIT 4 ) p); Example working on SQL Fiddle.…
-
6
votes3
answers106
viewsA: Avoid the last occurrence of a character concatenated in a loop
Use the function implode: $categorias = array("Categoria 1","Categoria 2", "Categoria 3"); $lista = implode(" - ", $categorias); Updating: For objects I used the array_map returns only the property…
phpanswered Lucio Rubens 3,384 -
2
votes1
answer143
viewsA: Change part of all two-column records through a reference
Use the command UPDATE to update your table, and the function REPLACE to replace the values: UPDATE nome_tabela SET params = REPLACE(params, 'www.meussite.com.br', 'www.meunovosite.com.br'), layers…
sqlanswered Lucio Rubens 3,384 -
1
votes1
answer50
viewsA: Mysql - Reading data in a string
You must separate the items in the clause IN, thus: IN('1','2','3'); Or: SELECT codigo FROM ccusto WHERE ',1,2,3,' LIKE CONCAT('%,',codigo,',%'); See example working on ideone…
-
1
votes1
answer73
viewsA: How does the loops and variables in Jekyll work?
The loop syntax is correct, adjust the if for: {% if post.category == "Eventos" %}
-
4
votes3
answers10914
viewsA: How to remove the first element from a list in python?
Use the method pop, documentation here: lista = sys.argv lista.pop(0)
-
0
votes2
answers851
viewsA: Unite results of various procedures in a single table
Use temporary or variable table: CREATE TABLE #resultado (item VARCHAR(50), quantidade INT) -- DECLARE @resultado TABLE (item VARCHAR(50), quantidade INT) INSERT #resultado -- INSERT @resultado exec…
sql-serveranswered Lucio Rubens 3,384 -
2
votes2
answers485
viewsA: Extract only extensions specific to a ZIP
Use the library Extractor, that extracts the compressed files and returns an object Finder package Symfony\Component, documentation here. See the example for your situation: $temporaryDirectory =…
-
0
votes2
answers132
viewsA: Condition (WHERE) with IF
LEFT JOIN solves your problem: SELECT p.* FROM posts p LEFT JOIN posts_promovidos pp ON p.id = pp.id AND pp.status = 'N'
mysqlanswered Lucio Rubens 3,384 -
3
votes1
answer84
viewsA: Problem with LEFT Joins joins and one condition
Filter per user needs to be in both: LEFT JOIN favoritos as f ON p.id = f.to AND f.from = 74 LEFT JOIN leu as leu ON p.id = l.to AND l.`from` = 74
-
3
votes3
answers353
viewsA: How can I split this INSERT into steps?
As stated in other answers, it is possible through the OFFSET: $inicio = 0; $limite = 10000; $total = 70000; $sql = "INSERT INTO imagens3 (ID, IMOVEL, CODIGO, IMAGEM_G, IMAGEM_P) " . "SELECT t1.ID,…
-
0
votes3
answers736
viewsA: Multiple UPDATE from a dynamic field
Whereas the return of your $_POST['check_imprime'] is already an array: $ocs_imp = $_POST['check_imprime']; $sql = ""; foreach ($ocs_imp as $id => $val) { $sql .= "UPDATE .. WHERE id = {$val};";…
-
1
votes1
answer163
viewsA: How to do this SELECT (SQL Server 2008)?
Utilize INNER JOIN with any table of numbers: CREATE TABLE NUMEROS (n INT); INSERT INTO NUMEROS VALUES (1),(2),(3),(4),(5),(6); SELECT 'Adulto ' + CAST(NUMEROS.n AS VARCHAR) AS PESSOA ,…
-
1
votes5
answers25936
viewsA: How to pass a list of values to a Stored Procedure?
Use a VARCHAR as type of variable @Ids, the use will be practically the same: CREATE PROCEDURE pr_lista_produtos ( @Ids VARCHAR(500) ) AS DECLARE @query VARCHAR(1000) SELECT @query = 'SELECT nome…
-
2
votes1
answer1551
viewsA: Get self variables from another class and custom event
You are repeating the same thing for multiple classes, take a look at the beginning DRY — Don’t Repeat Yourself, a question has already been answered here at Sopt Magics First I created a class…
-
1
votes2
answers1472
viewsA: Only get words from A-z and numbers 0-9
Using the following regular expression: [^\w] And make the substitution using preg_replace: $texto = 'Ex#em$!plo uti@!lizando r3gex'; echo preg_replace('/[^\w]/', '', $texto); Ideone…
-
1
votes2
answers1063
viewsQ: Left John returning more records
I have a main table with about 5,000 records, and I need to search for information in another table with 7,000 records. But my query is returning +6,000: SELECT principal.id, info.nome,…
-
5
votes4
answers249
viewsA: Most common words among Rows
First you need to separate the delimiter for lines, can be done through function or a solution found in the Soen. SELECT dados.id, SUBSTRING_INDEX(SUBSTRING_INDEX(dados.descricao, ' ',…
-
3
votes1
answer667
viewsQ: Hours calculation
I need to calculate the exact time that a given record has to be analyzed. Each registration has a intermission where it can be analysed and, a maximum value in hours, referring to deadline for…
-
2
votes3
answers14141
viewsA: Fix first row table
Yes, just use the position:fixed and, set a fixed width for cells. And you used the repetition in php to define the colors of each line. It can also be done through css3 with the selector nth-child…
-
1
votes1
answer113
viewsA: How to make the cursor be in Text at the beginning of the program?
Utilize Entry.focus() from tkinter import * root = Tk() text = Text(root) entry = Entry(root) entry.pack() entry.focus() root.mainloop()
-
2
votes3
answers1579
viewsA: Select the two highest values of a tuple
It is possible with the use of functions GREATEST andLEAST. View documentation here. SELECT dados.id, max1.valor as maior_v1, max2.valor as maior_v2 FROM dados INNER JOIN ( SELECT id, GREATEST(v1,…
-
2
votes2
answers11183
viewsA: How to put an Submit input inside the input text?
The button is not inside the input: .box { border:1px solid #444; width:300px; } .box input { display:inline-block; outline:0; border:0; padding: 5px; } .box .button { background: #aaa; color: #fff;…
-
0
votes2
answers559
viewsA: How to remove and add a class in a SINGLE event?
No javascript required, just use CSS with the selector hover and the effect transition of CSS3. .box { position: relative; overflow: hidden; width: 300px; height: 100px; border: 1px solid black; }…
-
3
votes2
answers76
viewsA: Given the given String below, how do I define this division?
Use the function explode. View documentation here. $string = "Dados do Usuário: JOAQUIM DE OIVEIRA, NASCIDO EM 2010, FORMADO EM: DIREITO, HOBBIE: FUTEBOL"; $array = explode(":", $string, 2); //…
-
3
votes1
answer129
viewsA: How to reset form after Ubmit?
Utilize document.getElementById to find the form: <form id="formulario" onsubmit="document.getElementById('formulario').reset();return false"> <input type="text" name="email" value="">…
-
1
votes2
answers166
viewsA: Routing Codeigniter
The best way to a dynamic routing is by using the database and, make the file routes read the table. This link demonstrates how it can be done in Codeigniter.…